{t("manualBadge")}
+ )} {error &&{error}
} {nutrition && ( diff --git a/apps/web/components/recipe/recipe-form.tsx b/apps/web/components/recipe/recipe-form.tsx index ca36fee..dc76bcd 100644 --- a/apps/web/components/recipe/recipe-form.tsx +++ b/apps/web/components/recipe/recipe-form.tsx @@ -78,9 +78,28 @@ type RecipeFormProps = { photos?: PhotoEntry[]; isBatchCook?: boolean; dishes?: DishRow[]; + nutrition?: { + calories: number; + proteinG: number; + carbsG: number; + fatG: number; + fiberG: number; + sodiumMg: number; + } | null; }; }; +type NutritionValues = { + calories: string; + proteinG: string; + carbsG: string; + fatG: string; + fiberG: string; + sodiumMg: string; +}; + +const EMPTY_NUTRITION: NutritionValues = { calories: "", proteinG: "", carbsG: "", fatG: "", fiberG: "", sodiumMg: "" }; + function newIngredient(): IngredientRow { return { id: crypto.randomUUID(), rawName: "", quantity: "", unit: "", note: "" }; } @@ -98,6 +117,7 @@ export function RecipeForm({ recipeId, defaultValues }: RecipeFormProps) { const t = useTranslations("recipeForm"); const t_recipe = useTranslations("recipe"); const t_common = useTranslations("common"); + const t_nutrition = useTranslations("nutritionPanel"); const isEdit = !!recipeId; const id = recipeId ?? crypto.randomUUID(); @@ -113,6 +133,19 @@ export function RecipeForm({ recipeId, defaultValues }: RecipeFormProps) { const [tagInput, setTagInput] = useState(""); const tagInputRef = useRef{t("nutritionToggleHelp")}
+ {addNutrition && ( +