feat: add batch-cooking sessions (single "mega recipe" with dish sections)

New AI-generated batch-cooking flow: pick N dinners/lunches + servings,
get one unified recipe covering a full prep session — merged shopping
list, steps tagged per-dish (a step can advance several dishes at once,
e.g. a shared oven bake), and per-dish storage (fridge/freezer) + exact
day-of reheat/finishing instructions.

Schema: recipes.isBatchCook, recipeSteps.appliesTo (dish names), new
recipeBatchDishes table. Batch recipes are excluded from the normal
/recipes list and live under their own /batch-cooking section.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Arnaud
2026-07-12 01:23:37 +02:00
parent 68f0f490b9
commit 78d0599ffc
16 changed files with 5343 additions and 22 deletions
@@ -0,0 +1,53 @@
"use client";
import { useTranslations } from "next-intl";
type Step = {
id: string;
instruction: string;
appliesTo: string[];
};
function sectionLabel(appliesTo: string[], prepLabel: string): string {
return appliesTo.length === 0 ? prepLabel : appliesTo.join(" + ");
}
export function BatchCookSteps({ steps }: { steps: Step[] }) {
const t = useTranslations("recipe");
const prepLabel = t("batchCookPrep");
const groups: Array<{ label: string; steps: Step[] }> = [];
for (const step of steps) {
const label = sectionLabel(step.appliesTo, prepLabel);
const last = groups[groups.length - 1];
if (last && last.label === label) last.steps.push(step);
else groups.push({ label, steps: [step] });
}
let stepNumber = 0;
return (
<div className="space-y-8">
{groups.map((group, gi) => (
<div key={gi} className="space-y-4">
<h3 className="text-sm font-semibold uppercase tracking-wide text-muted-foreground">
{group.label}
</h3>
<ol className="space-y-6">
{group.steps.map((step) => {
stepNumber += 1;
return (
<li key={step.id} className="flex gap-4">
<div className="flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground text-sm font-bold">
{stepNumber}
</div>
<p className="flex-1 leading-relaxed pt-1">{step.instruction}</p>
</li>
);
})}
</ol>
</div>
))}
</div>
);
}