import { useT } from "@agent-native/core/client/i18n"; import type { Meal } from "@shared/types"; import { IconTrash, IconPencil, IconToolsKitchen2, IconLoader2, } from "@tabler/icons-react"; import { Button } from "@/components/ui/button"; interface MealCardProps { meal: Meal; onDelete: (id: number) => void; onEdit: (meal: Meal) => void; isDeleting?: boolean; isPending?: boolean; } export function MealCard({ meal, onDelete, onEdit, isDeleting, isPending, }: MealCardProps) { const t = useT(); return (

{meal.name}

{meal.calories} kcal {((meal.protein ?? 0) > 0 || (meal.carbs ?? 0) > 0 || (meal.fat ?? 0) > 0) && ( {(meal.protein ?? 0) > 0 && `${meal.protein}p`} {(meal.protein ?? 0) > 0 && ((meal.carbs ?? 0) > 0 || (meal.fat ?? 0) > 0) && " · "} {(meal.carbs ?? 0) > 0 && `${meal.carbs}c`} {(meal.carbs ?? 0) > 0 && (meal.fat ?? 0) > 0 && " · "} {(meal.fat ?? 0) > 0 && `${meal.fat}f`} )}
{isPending ? (
) : ( <> )}
); }