"use client"; import { useTranslations } from "next-intl"; import { Minus, Plus } from "lucide-react"; import { Button } from "@/components/ui/button"; import { Label } from "@/components/ui/label"; import { Input } from "@/components/ui/input"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"; function Counter({ value, onChange, max = 6, disabled, }: { value: number; onChange: (v: number) => void; max?: number; disabled?: boolean; }) { return (
{value}
); } export type BatchCookFieldsState = { dinners: number; lunches: number; servings: number; difficulty: "" | "easy" | "medium" | "hard"; dietaryPrefs: string; }; export function BatchCookFields({ state, onChange, disabled, }: { state: BatchCookFieldsState; onChange: (state: BatchCookFieldsState) => void; disabled?: boolean; }) { const t = useTranslations("batchCooking"); const tCommon = useTranslations("common"); const tRecipe = useTranslations("recipe"); return (
onChange({ ...state, dinners: v })} disabled={disabled} />
onChange({ ...state, lunches: v })} disabled={disabled} />
onChange({ ...state, servings: v })} max={12} disabled={disabled} />
onChange({ ...state, dietaryPrefs: e.target.value })} placeholder={t("dietaryPrefsPlaceholder")} disabled={disabled} />
); }