feat(weekplan): MIKRO WEEK-2 dagliga måltidsslots (vardag middag, helg lunch+middag)

This commit is contained in:
Sven (AAMOS AI)
2026-08-17 19:17:27 +07:00
parent 9777c2ff1b
commit 97b5baa367
3 changed files with 10 additions and 2 deletions
+6 -1
View File
@@ -79,6 +79,11 @@ export default function PlanScreen() {
}, []);
const mondayKey = toKey(monday);
const weekDays = useMemo(() => Array.from({ length: 7 }, (_, i) => addDays(monday, i)), [monday]);
// Vardag: middag. Helg (lör/sön): lunch + middag. Realistisk förifylld default.
const mealSlots = useMemo(
() => weekDays.map((d) => (d.getDay() === 0 || d.getDay() === 6 ? ["lunch", "dinner"] : ["dinner"])),
[weekDays],
);
const query = useQuery({
queryKey: ["week-plan", mondayKey],
@@ -125,7 +130,7 @@ export default function PlanScreen() {
mutationFn: () =>
api("/v1/week-plans/generate", {
method: "POST",
body: { weekStartDate: mondayKey, mealTypes: ["lunch", "dinner"] },
body: { weekStartDate: mondayKey, mealTypes: ["lunch", "dinner"], mealSlots },
}),
onSuccess: () => setGenerating(true),
onError: onMutationError,