Compare commits

...
1 Commits
Author SHA1 Message Date
kai 0692914666 Cooking mode with timers and wake lock, ratings and thank-yous (26.11.13) (#14)
release / which version (push) Successful in 1s
release / olares chart · sanity (push) Successful in 4s
release / app (push) Successful in 1m0s
release / tag and release (push) Successful in 3s
2026-11-07 05:06:07 +00:00
23 changed files with 932 additions and 14 deletions

No files matched your search

+14
View File
@@ -250,6 +250,20 @@ Vorlagen ersetzt. `tests/seed.test.ts` prüft die Dateien. Ein Haushalt
- Der Rundgang misst Überlauf gegen die Gerätebreite: Ein mobiles Layout-Viewport
wächst mit überstehendem Inhalt mit (`innerWidth` sah den Fehler nicht).
## Kochen und Bewerten (Arbeitspaket 8)
- Kochmodus `/kochen/[slot]` (`components/cooking/cooking-mode.tsx`): Mise en place
als Checkliste in der Portionszahl des Slots, dann Schritte groß, mit Timer (aus
`dish_steps.timer_seconds`, sonst aus dem Text: `lib/timer.ts`, „30 Minuten
köcheln“). Timer laufen beim Blättern weiter, gerechnet gegen die Uhr. Screen Wake
Lock, Wischen, Pfeiltasten; im Querformat zwei Spalten. Kinder lesen mit, „Fertig“
drücken nur Erwachsene.
- `lib/cooking.ts`: Fertig setzt `cooked_at` (und den Koch, falls offen); ist der
letzte Slot gekocht, ist die Runde `done`. Bewerten (Daumen + ein Satz, ersetzt die
eigene Bewertung) und Dankeschön (einmal je Person, nie an sich selbst) auf „Heute“
für Gekochtes der letzten drei Tage; der Koch sieht Dankeschöns, Daumen und Sätze.
- Bewertungen fließen über `dish_popularity` in den nächsten Vorschlag.
## Kinderkonten (Arbeitspaket 5b)
- **Gerät + PIN** (Kai 6.11.2026), nicht Haushaltscode + PIN: Lunch ist öffentlich
+2 -2
View File
@@ -21,7 +21,7 @@ metadata:
title: What's cooking?
description: The family decides together what's for dinner — and the shopping list writes itself. Runs entirely on your own box.
icon: https://git.aimighty.olares.de/aimighty/bilder/raw/branch/main/lunch/icon.png
version: 26.11.12
version: 26.11.13
categories:
- Applications
@@ -61,7 +61,7 @@ permission:
appData: true
spec:
versionName: '26.11.12'
versionName: '26.11.13'
featuredImage: https://git.aimighty.olares.de/aimighty/bilder/raw/branch/main/lunch/icon.png
promoteImage:
+39
View File
@@ -0,0 +1,39 @@
import { notFound, redirect } from "next/navigation";
import { getLocale, getTranslations } from "next-intl/server";
import { CookingMode } from "@/components/cooking/cooking-mode";
import { requireSession } from "@/lib/auth/session";
import { cookingSlot } from "@/lib/cooking";
import { withHousehold } from "@/lib/db";
export const dynamic = "force-dynamic";
// Kochmodus. Kinder dürfen mitlesen (Konzept, „Kindermodus“), abschließen nur Erwachsene.
export default async function CookingPage({ params }: { params: Promise<{ id: string }> }) {
const { id } = await params;
if (!/^[0-9a-f-]{36}$/.test(id)) notFound();
const session = await requireSession();
if (session.role === "guest") redirect("/");
const t = await getTranslations("cooking");
const slot = await withHousehold(session.householdId, async (c) => cookingSlot(c, id, await getLocale()));
if (!slot) notFound();
return (
<main className="mx-auto flex max-w-md flex-col gap-4 px-4 py-6 landscape:max-w-4xl">
<header className="flex flex-col gap-1">
<p className="eyebrow">{slot.cookName ? t("eyebrowCook", { name: slot.cookName }) : t("eyebrow")}</p>
<h1 className="text-4xl leading-tight">{slot.dish.title}</h1>
</header>
{slot.cookedAt ? (
<p className="rounded-2xl border border-border p-4">{t("alreadyCooked")}</p>
) : (
<CookingMode
slotId={slot.id}
title={slot.dish.title}
portions={slot.portions}
ingredients={slot.dish.ingredients}
steps={slot.dish.steps}
canFinish={session.role === "admin" || session.role === "member"}
/>
)}
</main>
);
}
+23 -1
View File
@@ -1,4 +1,6 @@
import { CookingPot, Crown } from "lucide-react";
import { ChefHat, CookingPot, Crown, Heart } from "lucide-react";
import { RateCard } from "@/components/cooking/rate-card";
import { pendingRatings, thanksForCook } from "@/lib/cooking";
import Link from "next/link";
import { getLocale, getTranslations } from "next-intl/server";
import { DishPhoto } from "@/components/dishes/dish-tile";
@@ -21,6 +23,10 @@ export default async function TodayPage() {
const t = await getTranslations("today");
const locale = await getLocale();
const date = new Intl.DateTimeFormat(locale, { weekday: "long", day: "numeric", month: "long" }).format(new Date());
const after = await withHousehold(session.householdId, async (c) => ({
toRate: await pendingRatings(c, session.memberId),
thanks: await thanksForCook(c, session.memberId),
}));
const data = await withHousehold(session.householdId, async (c) => {
const round = await currentRound(c);
if (round && round.status !== "open") return { round, slots: await planSlots(c, round.id) };
@@ -43,6 +49,18 @@ export default async function TodayPage() {
<h1 className="text-4xl leading-tight">{t("greeting", { name: session.displayName })}</h1>
</header>
{after.toRate.map((r) => (
<RateCard key={r.slotId} item={r} />
))}
{after.thanks.map((th) => (
<p key={th.slotId} role="status" className="flex items-start gap-2 rounded-2xl border border-border p-4">
<Heart aria-hidden className="mt-0.5 size-5 shrink-0 text-accent" />
<span>
{t("thanks", { title: th.title, kudos: th.kudos, up: th.up })}
{th.comments.length ? <span className="block text-sm text-muted-foreground">„{th.comments.join("“, „")}“</span> : null}
</span>
</p>
))}
{"slots" in data && data.slots ? (
<PlanToday slots={data.slots} adult={adult} />
) : "budget" in data && data.budget ? (
@@ -135,6 +153,10 @@ async function PlanToday({ slots, adult }: { slots: Awaited<ReturnType<typeof pl
<p className="text-muted-foreground">
{[t("portions", { n: next.portions }), next.cookName ? t("cook", { name: next.cookName }) : null].filter(Boolean).join(" · ")}
</p>
<Link href={`/kochen/${next.id}`} className={cn(buttonVariants({ size: "lg" }), "mt-2")}>
<ChefHat aria-hidden />
{adult ? t("startCooking") : t("readAlong")}
</Link>
</div>
</article>
) : (
+20
View File
@@ -0,0 +1,20 @@
import { guardWrite, isResponse } from "@/lib/auth/guard";
import { fail, json } from "@/lib/auth/http";
import { markCooked } from "@/lib/cooking";
import { withHousehold } from "@/lib/db";
import { notifyShopping } from "@/lib/shopping";
export const dynamic = "force-dynamic";
// „Fertig“ im Kochmodus: Slot gekocht, Bewertung kann beginnen.
export async function POST(request: Request, { params }: { params: Promise<{ id: string }> }) {
const session = await guardWrite(request);
if (isResponse(session)) return session;
const { id } = await params;
if (!/^[0-9a-f-]{36}$/.test(id)) return fail("invalid", 400);
return withHousehold(session.householdId, async (c) => {
if (!(await markCooked(c, id, session.memberId))) return fail("notFound", 404);
await notifyShopping(c, session.householdId); // die Liste braucht das Gekochte nicht mehr
return json({ ok: true });
});
}
+22
View File
@@ -0,0 +1,22 @@
import { guardWrite, isResponse } from "@/lib/auth/guard";
import { fail, json } from "@/lib/auth/http";
import { RatingRefused, thank } from "@/lib/cooking";
import { withHousehold } from "@/lib/db";
import { WISHERS } from "@/lib/wishes";
export const dynamic = "force-dynamic";
// Dankeschön an den Koch (Konzept, „Gamification“): einmal je Person und Essen.
export async function POST(request: Request, { params }: { params: Promise<{ id: string }> }) {
const session = await guardWrite(request, [...WISHERS]);
if (isResponse(session)) return session;
const { id } = await params;
if (!/^[0-9a-f-]{36}$/.test(id)) return fail("invalid", 400);
try {
await withHousehold(session.householdId, (c) => thank(c, session.householdId, id, session.memberId));
return json({ ok: true });
} catch (error) {
if (error instanceof RatingRefused) return fail(error.message, 409);
throw error;
}
}
+24
View File
@@ -0,0 +1,24 @@
import { z } from "zod";
import { guardWrite, isResponse } from "@/lib/auth/guard";
import { fail, json, readJson } from "@/lib/auth/http";
import { rate, RatingRefused } from "@/lib/cooking";
import { withHousehold } from "@/lib/db";
import { WISHERS } from "@/lib/wishes";
export const dynamic = "force-dynamic";
// Daumen hoch oder runter, optional ein Satz — jede Person am Tisch, auch Kinder.
export async function POST(request: Request, { params }: { params: Promise<{ id: string }> }) {
const session = await guardWrite(request, [...WISHERS]);
if (isResponse(session)) return session;
const { id } = await params;
const body = z.object({ thumbsUp: z.boolean(), comment: z.string().max(280).nullable().optional() }).safeParse(await readJson(request));
if (!/^[0-9a-f-]{36}$/.test(id) || !body.success) return fail("invalid", 400);
try {
await withHousehold(session.householdId, (c) => rate(c, session.householdId, id, session.memberId, body.data.thumbsUp, body.data.comment ?? null));
return json({ ok: true });
} catch (error) {
if (error instanceof RatingRefused) return fail(error.message, 409);
throw error;
}
}
+269
View File
@@ -0,0 +1,269 @@
"use client";
import { Check, ChevronLeft, ChevronRight, Pause, Play, Sun, Timer as TimerIcon } from "lucide-react";
import { useRouter } from "next/navigation";
import { useLocale, useTranslations } from "next-intl";
import { useEffect, useRef, useState } from "react";
import { Button } from "@/components/ui/button";
import { ErrorNotice } from "@/components/ui/notice";
import { timerFromText } from "@/lib/timer";
import { formatQuantity, type BaseUnit } from "@/lib/units";
import { cn } from "@/lib/utils";
type Ingredient = { ingredientId: string; name: string; qtyPerPortion: number; unit: BaseUnit; note: string | null };
type Step = { text: string; timerSeconds: number | null };
type Running = { step: number; endsAt: number | null; left: number; done: boolean };
const mmss = (s: number) => `${Math.floor(s / 60)}:${String(Math.max(0, Math.round(s % 60))).padStart(2, "0")}`;
function beep() {
try {
const ctx = new AudioContext();
for (const [i, f] of [880, 660, 880].entries()) {
const o = ctx.createOscillator();
const g = ctx.createGain();
o.frequency.value = f;
o.connect(g).connect(ctx.destination);
g.gain.setValueAtTime(0.2, ctx.currentTime + i * 0.35);
o.start(ctx.currentTime + i * 0.35);
o.stop(ctx.currentTime + i * 0.35 + 0.25);
}
} catch {}
}
// Kochmodus (Konzept, „Kochen“): erst Mise en place als Checkliste in der
// Portionszahl des Slots, dann Schritt für Schritt in großer Schrift mit Timer.
// Das Display bleibt an (Screen Wake Lock); Wischen, Tippen oder Pfeiltasten
// blättern. „Fertig“ schließt den Slot ab und führt zur Bewertung auf „Heute“.
export function CookingMode({
slotId,
title,
portions,
ingredients,
steps,
canFinish,
}: {
slotId: string;
title: string;
portions: number;
ingredients: Ingredient[];
steps: Step[];
canFinish: boolean;
}) {
const t = useTranslations("cooking");
const locale = useLocale();
const router = useRouter();
const [index, setIndex] = useState(-1); // -1 = Mise en place
const [have, setHave] = useState<Set<string>>(new Set());
const [timers, setTimers] = useState<Running[]>([]);
const [awake, setAwake] = useState(false);
const [alarm, setAlarm] = useState<string | null>(null);
const [error, setError] = useState(false);
const [busy, setBusy] = useState(false);
const touch = useRef<number | null>(null);
// Display an lassen, solange der Kochmodus offen ist.
useEffect(() => {
let lock: WakeLockSentinel | null = null;
const request = async () => {
try {
lock = (await navigator.wakeLock?.request("screen")) ?? null;
setAwake(!!lock);
} catch {
setAwake(false);
}
};
void request();
const again = () => document.visibilityState === "visible" && void request();
document.addEventListener("visibilitychange", again);
return () => {
document.removeEventListener("visibilitychange", again);
void lock?.release().catch(() => undefined);
};
}, []);
// Timer laufen weiter, auch beim Blättern; gerechnet wird gegen die Uhr, nicht gegen Intervalle.
useEffect(() => {
const tick = setInterval(() => {
setTimers((list) =>
list.map((r) => {
if (r.done || r.endsAt === null) return r;
const left = (r.endsAt - Date.now()) / 1000;
if (left > 0) return { ...r, left };
if ("vibrate" in navigator) navigator.vibrate?.([300, 150, 300]);
beep();
setAlarm(t("alarm", { n: r.step + 1 }));
return { ...r, left: 0, done: true, endsAt: null };
}),
);
}, 500);
return () => clearInterval(tick);
}, [t]);
const go = (by: number) => setIndex((i) => Math.min(steps.length - 1, Math.max(-1, i + by)));
useEffect(() => {
const key = (e: KeyboardEvent) => {
if ((e.target as HTMLElement)?.closest("input, textarea, select")) return;
if (e.key === "ArrowRight") go(1);
if (e.key === "ArrowLeft") go(-1);
};
window.addEventListener("keydown", key);
return () => window.removeEventListener("keydown", key);
});
function toggleTimer(step: number, seconds: number) {
setAlarm(null);
setTimers((list) => {
const r = list.find((x) => x.step === step);
if (!r || r.done) return [...list.filter((x) => x.step !== step), { step, endsAt: Date.now() + seconds * 1000, left: seconds, done: false }];
if (r.endsAt === null) return list.map((x) => (x.step === step ? { ...x, endsAt: Date.now() + x.left * 1000 } : x)); // weiter
return list.map((x) => (x.step === step ? { ...x, endsAt: null } : x)); // Pause
});
}
async function finish() {
setBusy(true);
const res = await fetch(`/api/slots/${slotId}/cooked`, { method: "POST" }).catch(() => null);
setBusy(false);
if (res?.ok) {
router.push("/");
router.refresh();
} else setError(true);
}
const amount = (i: Ingredient) => {
const f = formatQuantity(i.qtyPerPortion * portions, i.unit, locale);
return `${f.amount}${f.unit ? ` ${f.unit}` : ""}`;
};
const raw = index >= 0 ? steps[index] : null;
// Kein hinterlegter Timer? Dann die Zeit aus dem Text („30 Minuten köcheln“).
const step = raw ? { ...raw, timerSeconds: raw.timerSeconds ?? timerFromText(raw.text) } : null;
const running = timers.filter((r) => !r.done || r.left === 0);
return (
<div
className="flex flex-col gap-5"
onTouchStart={(e) => (touch.current = e.touches[0]?.clientX ?? null)}
onTouchEnd={(e) => {
const start = touch.current;
const end = e.changedTouches[0]?.clientX;
touch.current = null;
if (start === null || end === undefined || Math.abs(end - start) < 60) return;
go(end < start ? 1 : -1);
}}
>
<p className="flex items-center gap-2 text-sm text-muted-foreground">
{awake ? (
<>
<Sun aria-hidden className="size-4" />
{t("awake")}
</>
) : null}
</p>
<p role="alert" aria-live="assertive" className={cn(alarm ? "rounded-xl border border-accent bg-accent/10 px-4 py-3 font-semibold" : "sr-only")}>
{alarm}
</p>
{running.length ? (
<ul className="flex flex-wrap gap-2" aria-label={t("timers")}>
{running.map((r) => (
<li key={r.step}>
<Button type="button" variant="outline" onClick={() => setIndex(r.step)}>
<TimerIcon aria-hidden />
{t("timerChip", { n: r.step + 1, time: mmss(r.left) })}
</Button>
</li>
))}
</ul>
) : null}
<div className="landscape:grid landscape:grid-cols-[2fr_3fr] landscape:gap-8 flex flex-col gap-5">
<section aria-labelledby="mise-title" className={cn("flex flex-col gap-2", index >= 0 && "hidden landscape:flex")}>
<h2 id="mise-title" className="eyebrow">
{t("mise", { n: portions })}
</h2>
<ul className="flex flex-col">
{ingredients.map((i) => {
const checked = have.has(i.ingredientId);
return (
<li key={i.ingredientId} className="border-b border-border">
<label className="flex min-h-14 cursor-pointer items-center gap-3 py-2">
<input
type="checkbox"
className="peer sr-only"
checked={checked}
onChange={() =>
setHave((s) => {
const n = new Set(s);
if (n.has(i.ingredientId)) n.delete(i.ingredientId);
else n.add(i.ingredientId);
return n;
})
}
/>
<span aria-hidden className={cn("flex size-7 shrink-0 items-center justify-center rounded-lg border-2 peer-focus-visible:ring-2 peer-focus-visible:ring-ring", checked ? "border-accent bg-accent text-background" : "border-border")}>
{checked ? <Check className="size-5" /> : null}
</span>
<span className={cn("text-lg", checked && "text-muted-foreground line-through")}>
<span className="font-semibold tabular-nums">{amount(i)}</span> {i.name}
{i.note ? <span className="text-muted-foreground">, {i.note}</span> : null}
</span>
</label>
</li>
);
})}
</ul>
</section>
{step ? (
<section aria-labelledby="step-title" className="flex flex-col gap-5">
<h2 id="step-title" className="eyebrow">
{t("step", { n: index + 1, of: steps.length })}
</h2>
<p className="text-3xl leading-snug">{step.text}</p>
{step.timerSeconds ? (
<TimerButton
running={timers.find((r) => r.step === index)}
seconds={step.timerSeconds}
onToggle={() => toggleTimer(index, step.timerSeconds!)}
/>
) : null}
</section>
) : null}
</div>
{error ? <ErrorNotice>{t("error")}</ErrorNotice> : null}
<div className="sticky bottom-[calc(4rem+env(safe-area-inset-bottom))] z-10 flex gap-2 bg-background py-2">
<Button type="button" variant="outline" size="lg" disabled={index < 0} onClick={() => go(-1)} aria-label={t("back")}>
<ChevronLeft aria-hidden />
</Button>
{index < steps.length - 1 ? (
<Button type="button" size="lg" className="flex-1" onClick={() => go(1)}>
{index < 0 ? t("start") : t("next")}
<ChevronRight aria-hidden />
</Button>
) : canFinish ? (
<Button type="button" size="lg" className="h-auto min-h-11 min-w-0 flex-1 whitespace-normal py-3 text-center" disabled={busy} onClick={finish}>
{t("done", { title })}
</Button>
) : null}
</div>
</div>
);
}
function TimerButton({ running, seconds, onToggle }: { running: Running | undefined; seconds: number; onToggle: () => void }) {
const t = useTranslations("cooking");
const active = running && !running.done && running.endsAt !== null;
const paused = running && !running.done && running.endsAt === null;
const left = running && !running.done ? running.left : seconds;
return (
<Button type="button" variant={active ? "default" : "outline"} size="lg" className="h-16 self-start px-6 text-2xl tabular-nums" onClick={onToggle}>
{active ? <Pause aria-hidden /> : <Play aria-hidden />}
<span>{mmss(left)}</span>
<span className="sr-only">{active ? t("pause") : paused ? t("resume") : t("startTimer")}</span>
</Button>
);
}
+82
View File
@@ -0,0 +1,82 @@
"use client";
import { Heart, ThumbsDown, ThumbsUp } from "lucide-react";
import { useRouter } from "next/navigation";
import { useTranslations } from "next-intl";
import { useState } from "react";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { cn } from "@/lib/utils";
type ToRate = { slotId: string; title: string; cookName: string | null; isCook: boolean; thanked: boolean };
// Bewerten (Konzept, „Bewerten“): Daumen hoch oder runter, optional ein Satz,
// und ein Dankeschön an den Koch. Fünf Sekunden, am Tisch.
export function RateCard({ item }: { item: ToRate }) {
const t = useTranslations("rating");
const router = useRouter();
const [thumb, setThumb] = useState<boolean | null>(null);
const [comment, setComment] = useState("");
const [thanked, setThanked] = useState(item.thanked);
const [busy, setBusy] = useState(false);
async function post(url: string, body?: object) {
setBusy(true);
const res = await fetch(url, { method: "POST", headers: { "content-type": "application/json" }, body: body ? JSON.stringify(body) : undefined }).catch(() => null);
setBusy(false);
return !!res?.ok;
}
return (
<article className="flex flex-col gap-3 rounded-2xl bg-muted p-5" aria-labelledby={`rate-${item.slotId}`}>
<p className="eyebrow">{t("eyebrow")}</p>
<h2 id={`rate-${item.slotId}`} className="text-2xl leading-snug">
{t("question", { title: item.title })}
</h2>
<div className="flex gap-3" role="group" aria-label={t("thumbs")}>
{[true, false].map((up) => (
<Button
key={String(up)}
type="button"
variant="outline"
aria-pressed={thumb === up}
className={cn("h-16 flex-1 text-lg", thumb === up && "border-accent bg-accent text-background")}
disabled={busy}
onClick={() => setThumb(up)}
>
{up ? <ThumbsUp aria-hidden className="size-6" /> : <ThumbsDown aria-hidden className="size-6" />}
{up ? t("up") : t("down")}
</Button>
))}
</div>
{thumb !== null ? (
<form
className="flex flex-col gap-3"
onSubmit={async (e) => {
e.preventDefault();
if (await post(`/api/slots/${item.slotId}/rating`, { thumbsUp: thumb, comment: comment || null })) router.refresh();
}}
>
<Input aria-label={t("comment")} placeholder={t("commentPlaceholder")} maxLength={280} value={comment} onChange={(e) => setComment(e.target.value)} />
<Button type="submit" size="lg" disabled={busy}>
{t("send")}
</Button>
</form>
) : null}
{!item.isCook && item.cookName ? (
<Button
type="button"
variant="ghost"
disabled={busy || thanked}
aria-pressed={thanked}
onClick={async () => {
if (await post(`/api/slots/${item.slotId}/kudos`)) setThanked(true);
}}
>
<Heart aria-hidden className={cn(thanked && "fill-current text-accent")} />
{thanked ? t("thanked", { name: item.cookName }) : t("thank", { name: item.cookName })}
</Button>
) : null}
</article>
);
}
+1
View File
@@ -59,6 +59,7 @@ Das Repo erbt sie, weil es in der Organisation liegt.
7. **Einkaufsliste:** `lib/aggregate.ts` mit Tests, Gangsortierung, Echtzeit (SSE), Offline-Warteschlange.
**Erledigt** in 26.11.12 (mit Vorrats-Check, Packungen, Hauptladen, Freitext).
8. **Kochmodus** mit Wake Lock und Timer, Bewertung, Dankeschön.
**Erledigt** in 26.11.13 (Timer auch aus dem Schritttext, Runde endet mit dem letzten gekochten Slot).
9. **PWA-Feinschliff:** Manifest, Icons, Installationshinweis, Playwright für Wünschen, Planen, Einkaufen.
Danach: Lunch in `aimighty/plattform` `werkzeug/apps.json` eintragen (nicht
+53
View File
@@ -0,0 +1,53 @@
import { expect, test } from "@playwright/test";
// Kochmodus und Bewertung am iPhone (Paket 8). Läuft nach „einkauf“ mit Kais
// Sitzung; als Nächstes steht Spaghetti Bolognese an (Kai kocht).
test.describe.configure({ mode: "serial" });
test("cooking mode: mise en place, steps by key, timer from the step text, done", async ({ page }) => {
await page.clock.install();
await page.goto("/");
await expect(page.getByRole("heading", { level: 2 }).first()).toHaveText("Spaghetti Bolognese");
await page.getByRole("link", { name: "Kochen" }).click();
await expect(page.getByRole("heading", { level: 1 })).toHaveText("Spaghetti Bolognese");
await expect(page.getByText(/Alles bereit\? · \d+ Portionen/)).toBeVisible();
const first = page.getByRole("checkbox").first();
await first.check({ force: true });
await expect(first).toBeChecked();
await page.getByRole("button", { name: "Los geht's" }).click();
await expect(page.getByText("Schritt 1 von 6")).toBeVisible();
await page.keyboard.press("ArrowRight");
await expect(page.getByText("Schritt 2 von 6")).toBeVisible();
// „… 5 Minuten mitbraten“: Timer aus dem Text.
await page.getByRole("button", { name: /5:00/ }).click();
await page.clock.fastForward("02:00");
await expect(page.getByRole("button", { name: /Timer anhalten/ })).toContainText(/3:0\d|2:5\d/);
await page.keyboard.press("ArrowRight"); // der Timer läuft beim Blättern weiter
await expect(page.getByRole("list", { name: "Laufende Timer" })).toContainText("Schritt 2");
await page.clock.fastForward("03:05");
await expect(page.locator("main [role=alert]")).toHaveText("Timer für Schritt 2 ist abgelaufen!");
for (let i = 0; i < 3; i++) await page.getByRole("button", { name: "Weiter" }).click();
await expect(page.getByText("Schritt 6 von 6")).toBeVisible();
// Ein langer Titel im Fertig-Knopf darf die Seite nicht verbreitern.
const width = page.viewportSize()!.width;
expect(await page.evaluate(() => Math.max(document.documentElement.scrollWidth, window.innerWidth))).toBeLessThanOrEqual(width);
await page.getByRole("button", { name: "Spaghetti Bolognese ist fertig" }).click();
await expect(page).toHaveURL(/\/$/);
});
test("after cooking everyone rates; the cook sees the thumbs", async ({ page }) => {
await page.goto("/");
const card = page.getByRole("article", { name: "Wie war Spaghetti Bolognese?" });
await expect(card).toBeVisible();
await expect(card.getByRole("button", { name: /Danke an/ })).toHaveCount(0); // Kai hat selbst gekocht
await card.getByRole("button", { name: "Lecker" }).click();
await card.getByRole("textbox", { name: "Ein Satz dazu (optional)" }).fill("mehr Soße");
await card.getByRole("button", { name: "Abschicken" }).click();
await expect(card).toHaveCount(0);
await expect(page.getByRole("status").filter({ hasText: "Spaghetti Bolognese" })).toContainText("1 Daumen hoch");
await expect(page.getByText("„mehr Soße“")).toBeVisible();
await expect(page.getByText("Als Nächstes")).toBeVisible();
await expect(page.getByRole("heading", { level: 2 }).filter({ hasText: "Spaghetti Bolognese" })).toHaveCount(0);
});
+108
View File
@@ -0,0 +1,108 @@
import "server-only";
import type { PoolClient } from "pg";
import { getDish, type DishDetail } from "./dishes";
// Kochen und danach (Konzept, „Kochen“ und „Bewerten“): ein Slot wird gekocht,
// jede Person gibt Daumen hoch oder runter und optional ein Dankeschön an den
// Koch. Bewertungen fließen über dish_popularity in den nächsten Vorschlag.
export type CookingSlot = {
id: string;
portions: number;
cookMemberId: string | null;
cookName: string | null;
cookedAt: string | null;
dish: DishDetail;
};
export async function cookingSlot(client: PoolClient, slotId: string, locale: string): Promise<CookingSlot | null> {
const row = (
await client.query(
`select s.id, s.portions, s.cook_member_id as "cookMemberId", m.display_name as "cookName", s.cooked_at::text as "cookedAt", s.dish_id
from slots s left join members m on m.id = s.cook_member_id where s.id = $1 and s.dish_id is not null`,
[slotId],
)
).rows[0];
if (!row) return null;
const dish = await getDish(client, row.dish_id, locale);
if (!dish) return null;
const { dish_id: _, ...slot } = row;
return { ...slot, dish };
}
/** „Fertig“: Slot ist gekocht; wer kocht, steht fest; ist alles gekocht, endet die Runde. */
export async function markCooked(client: PoolClient, slotId: string, memberId: string): Promise<boolean> {
const { rows } = await client.query(
`update slots set cooked_at = now(), cook_member_id = coalesce(cook_member_id, $2)
where id = $1 and cooked_at is null and dish_id is not null returning round_id`,
[slotId, memberId],
);
if (!rows[0]) return false;
await client.query(
`update rounds set status = 'done' where id = $1 and status <> 'done'
and not exists (select 1 from slots where round_id = $1 and dish_id is not null and cooked_at is null)`,
[rows[0].round_id],
);
return true;
}
export class RatingRefused extends Error {}
async function cookedSlot(client: PoolClient, slotId: string) {
return (await client.query("select cook_member_id from slots where id = $1 and cooked_at is not null", [slotId])).rows[0] as
| { cook_member_id: string | null }
| undefined;
}
export async function rate(client: PoolClient, householdId: string, slotId: string, memberId: string, thumbsUp: boolean, comment: string | null) {
if (!(await cookedSlot(client, slotId))) throw new RatingRefused("notCooked");
await client.query(
`insert into ratings (household_id, slot_id, member_id, thumbs_up, comment) values ($1, $2, $3, $4, $5)
on conflict (slot_id, member_id) do update set thumbs_up = excluded.thumbs_up, comment = excluded.comment`,
[householdId, slotId, memberId, thumbsUp, comment?.trim() || null],
);
}
export async function thank(client: PoolClient, householdId: string, slotId: string, memberId: string) {
const slot = await cookedSlot(client, slotId);
if (!slot) throw new RatingRefused("notCooked");
if (slot.cook_member_id === memberId) throw new RatingRefused("ownDish");
await client.query(
"insert into kudos (household_id, slot_id, from_member_id) values ($1, $2, $3) on conflict do nothing",
[householdId, slotId, memberId],
);
}
export type ToRate = { slotId: string; title: string; cookName: string | null; isCook: boolean; thanked: boolean };
/** Gekochtes der letzten drei Tage, das ich noch nicht bewertet habe. */
export async function pendingRatings(client: PoolClient, memberId: string): Promise<ToRate[]> {
const { rows } = await client.query(
`select s.id as "slotId", d.title, m.display_name as "cookName", s.cook_member_id = $1 as "isCook",
exists (select 1 from kudos k where k.slot_id = s.id and k.from_member_id = $1) as thanked
from slots s join dishes d on d.id = s.dish_id left join members m on m.id = s.cook_member_id
where s.cooked_at > now() - interval '3 days'
and not exists (select 1 from ratings r where r.slot_id = s.id and r.member_id = $1)
order by s.cooked_at desc`,
[memberId],
);
return rows.map((r) => ({ ...r, isCook: !!r.isCook }));
}
export type Thanks = { slotId: string; title: string; kudos: number; up: number; down: number; comments: string[] };
/** Für den Koch: Dankeschöns und Daumen der letzten sieben Tage. */
export async function thanksForCook(client: PoolClient, memberId: string): Promise<Thanks[]> {
const { rows } = await client.query(
`select s.id as "slotId", d.title,
(select count(*)::int from kudos k where k.slot_id = s.id) as kudos,
(select count(*)::int from ratings r where r.slot_id = s.id and r.thumbs_up) as up,
(select count(*)::int from ratings r where r.slot_id = s.id and not r.thumbs_up) as down,
coalesce((select array_agg(r.comment order by r.created_at) from ratings r where r.slot_id = s.id and r.comment is not null), '{}') as comments
from slots s join dishes d on d.id = s.dish_id
where s.cook_member_id = $1 and s.cooked_at > now() - interval '7 days'
order by s.cooked_at desc`,
[memberId],
);
return rows.filter((r) => r.kudos + r.up + r.down > 0);
}
+18
View File
@@ -0,0 +1,18 @@
// Zeit aus einem Schritttext lesen („30 Minuten köcheln“, „bake for 1 hour“),
// damit der Kochmodus auch ohne hinterlegten Timer einen anbietet. Bei einer
// Spanne („10–15 Minuten“) gilt die kürzere Zeit: lieber einmal früher nachsehen.
const UNITS: [RegExp, number][] = [
[/^(min|min\.|minute|minuten|minutes|mins)$/i, 60],
[/^(std|std\.|stunde|stunden|h|hour|hours|heure|heures|hora|horas)$/i, 3600],
[/^(sek|sek\.|sekunden|sec|secs|seconds|secondes|segundos)$/i, 1],
];
export function timerFromText(text: string): number | null {
const m = text.match(/(\d+(?:[.,]\d+)?)(?:\s*(?:-|–|bis|to|à|a)\s*\d+(?:[.,]\d+)?)?\s*([A-Za-zäöüÄÖÜ]+\.?)/);
if (!m) return null;
const word = m[2]!.replace(/\.$/, "");
const unit = UNITS.find(([re]) => re.test(word));
if (!unit) return null;
const seconds = Math.round(Number(m[1]!.replace(",", ".")) * unit[1]);
return seconds > 0 && seconds <= 24 * 3600 ? seconds : null;
}
+35 -1
View File
@@ -26,7 +26,10 @@
"cook": "Koch: {name}",
"allCooked": "Alles aus dieser Runde ist gekocht.",
"thePlan": "Der Plan",
"editPlan": "Bearbeiten"
"editPlan": "Bearbeiten",
"startCooking": "Kochen",
"readAlong": "Mitlesen",
"thanks": "Für {title}: {kudos, plural, one {1 Dankeschön} other {# Dankeschöns}} und {up, plural, one {1 Daumen hoch} other {# Daumen hoch}}."
},
"auth": {
"setup": {
@@ -527,5 +530,36 @@
"add": "Hinzufügen",
"remove": "{name} entfernen",
"offline": "{n, plural, =0 {Kein Netz. Die Liste bleibt bedienbar.} one {Kein Netz: 1 Haken wird nachgeholt.} other {Kein Netz: # Haken werden nachgeholt.}}"
},
"cooking": {
"eyebrow": "Kochen",
"eyebrowCook": "Kochen · {name}",
"awake": "Das Display bleibt an.",
"alarm": "Timer für Schritt {n} ist abgelaufen!",
"timers": "Laufende Timer",
"timerChip": "Schritt {n} · {time}",
"mise": "Alles bereit? · {n, plural, one {1 Portion} other {# Portionen}}",
"step": "Schritt {n} von {of}",
"start": "Los geht's",
"next": "Weiter",
"back": "Zurück",
"done": "{title} ist fertig",
"pause": "Timer anhalten",
"resume": "Timer fortsetzen",
"startTimer": "Timer starten",
"error": "Das hat nicht geklappt. Bitte versuch es noch einmal.",
"alreadyCooked": "Das ist schon gekocht. Guten Appetit!"
},
"rating": {
"eyebrow": "Wie war's?",
"question": "Wie war {title}?",
"thumbs": "Bewertung",
"up": "Lecker",
"down": "Nicht so",
"comment": "Ein Satz dazu (optional)",
"commentPlaceholder": "z. B. mehr Soße",
"send": "Abschicken",
"thank": "Danke an {name}",
"thanked": "Danke an {name} ist angekommen"
}
}
+35 -1
View File
@@ -26,7 +26,10 @@
"cook": "Cook: {name}",
"allCooked": "Everything from this round has been cooked.",
"thePlan": "The plan",
"editPlan": "Edit"
"editPlan": "Edit",
"startCooking": "Cook",
"readAlong": "Read along",
"thanks": "For {title}: {kudos, plural, one {1 thank-you} other {# thank-yous}} and {up, plural, one {1 thumbs up} other {# thumbs up}}."
},
"auth": {
"setup": {
@@ -527,5 +530,36 @@
"add": "Add",
"remove": "Remove {name}",
"offline": "{n, plural, =0 {No connection. The list keeps working.} one {No connection: 1 tick will be sent later.} other {No connection: # ticks will be sent later.}}"
},
"cooking": {
"eyebrow": "Cooking",
"eyebrowCook": "Cooking · {name}",
"awake": "The screen stays on.",
"alarm": "Timer for step {n} is done!",
"timers": "Running timers",
"timerChip": "Step {n} · {time}",
"mise": "All set? · {n, plural, one {1 portion} other {# portions}}",
"step": "Step {n} of {of}",
"start": "Let's go",
"next": "Next",
"back": "Back",
"done": "{title} is ready",
"pause": "Pause timer",
"resume": "Resume timer",
"startTimer": "Start timer",
"error": "That did not work. Please try again.",
"alreadyCooked": "This has been cooked already. Enjoy!"
},
"rating": {
"eyebrow": "How was it?",
"question": "How was {title}?",
"thumbs": "Rating",
"up": "Tasty",
"down": "Not really",
"comment": "A sentence (optional)",
"commentPlaceholder": "e.g. more sauce",
"send": "Send",
"thank": "Thank {name}",
"thanked": "Your thanks reached {name}"
}
}
+35 -1
View File
@@ -26,7 +26,10 @@
"cook": "Cook: {name}",
"allCooked": "Everything from this round has been cooked.",
"thePlan": "The plan",
"editPlan": "Edit"
"editPlan": "Edit",
"startCooking": "Cook",
"readAlong": "Read along",
"thanks": "For {title}: {kudos, plural, one {1 thank-you} other {# thank-yous}} and {up, plural, one {1 thumbs up} other {# thumbs up}}."
},
"auth": {
"setup": {
@@ -527,5 +530,36 @@
"add": "Add",
"remove": "Remove {name}",
"offline": "{n, plural, =0 {No connection. The list keeps working.} one {No connection: 1 tick will be sent later.} other {No connection: # ticks will be sent later.}}"
},
"cooking": {
"eyebrow": "Cooking",
"eyebrowCook": "Cooking · {name}",
"awake": "The screen stays on.",
"alarm": "Timer for step {n} is done!",
"timers": "Running timers",
"timerChip": "Step {n} · {time}",
"mise": "All set? · {n, plural, one {1 portion} other {# portions}}",
"step": "Step {n} of {of}",
"start": "Let's go",
"next": "Next",
"back": "Back",
"done": "{title} is ready",
"pause": "Pause timer",
"resume": "Resume timer",
"startTimer": "Start timer",
"error": "That did not work. Please try again.",
"alreadyCooked": "This has been cooked already. Enjoy!"
},
"rating": {
"eyebrow": "How was it?",
"question": "How was {title}?",
"thumbs": "Rating",
"up": "Tasty",
"down": "Not really",
"comment": "A sentence (optional)",
"commentPlaceholder": "e.g. more sauce",
"send": "Send",
"thank": "Thank {name}",
"thanked": "Your thanks reached {name}"
}
}
+35 -1
View File
@@ -26,7 +26,10 @@
"cook": "Cook: {name}",
"allCooked": "Everything from this round has been cooked.",
"thePlan": "The plan",
"editPlan": "Edit"
"editPlan": "Edit",
"startCooking": "Cook",
"readAlong": "Read along",
"thanks": "For {title}: {kudos, plural, one {1 thank-you} other {# thank-yous}} and {up, plural, one {1 thumbs up} other {# thumbs up}}."
},
"auth": {
"setup": {
@@ -527,5 +530,36 @@
"add": "Add",
"remove": "Remove {name}",
"offline": "{n, plural, =0 {No connection. The list keeps working.} one {No connection: 1 tick will be sent later.} other {No connection: # ticks will be sent later.}}"
},
"cooking": {
"eyebrow": "Cooking",
"eyebrowCook": "Cooking · {name}",
"awake": "The screen stays on.",
"alarm": "Timer for step {n} is done!",
"timers": "Running timers",
"timerChip": "Step {n} · {time}",
"mise": "All set? · {n, plural, one {1 portion} other {# portions}}",
"step": "Step {n} of {of}",
"start": "Let's go",
"next": "Next",
"back": "Back",
"done": "{title} is ready",
"pause": "Pause timer",
"resume": "Resume timer",
"startTimer": "Start timer",
"error": "That did not work. Please try again.",
"alreadyCooked": "This has been cooked already. Enjoy!"
},
"rating": {
"eyebrow": "How was it?",
"question": "How was {title}?",
"thumbs": "Rating",
"up": "Tasty",
"down": "Not really",
"comment": "A sentence (optional)",
"commentPlaceholder": "e.g. more sauce",
"send": "Send",
"thank": "Thank {name}",
"thanked": "Your thanks reached {name}"
}
}
+2 -2
View File
@@ -2,5 +2,5 @@ apiVersion: v2
name: lunch
description: Was gibt's? — die Familie entscheidet gemeinsam, was es gibt; aus dem Plan entsteht die Einkaufsliste
type: application
version: 26.11.12 # YY.M.<n> wie im AImighty-Markt — bei jeder Chart-Änderung erhöhen
appVersion: "26.11.12" # MUSS gleich version sein: der Linter prüft es, und der Image-Tag hängt daran
version: 26.11.13 # YY.M.<n> wie im AImighty-Markt — bei jeder Chart-Änderung erhöhen
appVersion: "26.11.13" # MUSS gleich version sein: der Linter prüft es, und der Image-Tag hängt daran
+2 -2
View File
@@ -21,7 +21,7 @@ metadata:
title: What's cooking?
description: The family decides together what's for dinner — and the shopping list writes itself. Runs entirely on your own box.
icon: https://git.aimighty.olares.de/aimighty/bilder/raw/branch/main/lunch/icon.png
version: 26.11.12
version: 26.11.13
categories:
- Applications
@@ -61,7 +61,7 @@ permission:
appData: true
spec:
versionName: '26.11.12'
versionName: '26.11.13'
featuredImage: https://git.aimighty.olares.de/aimighty/bilder/raw/branch/main/lunch/icon.png
promoteImage:
+5
View File
@@ -0,0 +1,5 @@
# Cooking mode and thank-yous
v26.11.13: Today now opens a cooking mode for what is up next: ingredients as a checklist in the planned portions, then one step at a time in large type, with timers that keep running while you move on and ring when done. The screen stays on, and swipes or arrow keys turn the page; on a tablet in landscape the ingredients sit next to the step. After the meal everyone gives a thumbs up or down, with a sentence if they like, and thanks the cook, who sees it on Today. Ratings feed the next round's suggestion.
## Deutsch
v26.11.13: „Heute“ öffnet jetzt einen Kochmodus für das, was als Nächstes dran ist: Zutaten als Checkliste in der geplanten Portionszahl, dann Schritt für Schritt in großer Schrift, mit Timern, die beim Weiterblättern weiterlaufen und am Ende klingeln. Das Display bleibt an, Wischen oder Pfeiltasten blättern; am Tablet im Querformat stehen die Zutaten neben dem Schritt. Nach dem Essen gibt jede Person Daumen hoch oder runter, gern mit einem Satz, und sagt dem Koch Danke, der das auf „Heute“ sieht. Die Bewertungen fließen in den Vorschlag der nächsten Runde.
+9 -3
View File
@@ -54,22 +54,28 @@ export default defineConfig({
dependencies: ["plan"],
use: { ...iphone, storageState: "e2e/.auth/kai.json" },
},
{
name: "kochen",
testMatch: /kochen\.spec\.ts/,
dependencies: ["einkauf"],
use: { ...iphone, storageState: "e2e/.auth/kai.json" },
},
{
name: "iphone-hell",
testMatch: /rundgang\.spec\.ts/,
dependencies: ["einkauf"],
dependencies: ["kochen"],
use: { ...iphone, colorScheme: "light", storageState: "e2e/.auth/kai.json" },
},
{
name: "iphone-dunkel",
testMatch: /rundgang\.spec\.ts/,
dependencies: ["einkauf"],
dependencies: ["kochen"],
use: { ...iphone, colorScheme: "dark", storageState: "e2e/.auth/kai.json" },
},
{
name: "desktop",
testMatch: /rundgang\.spec\.ts/,
dependencies: ["einkauf"],
dependencies: ["kochen"],
use: { ...devices["Desktop Chrome"], viewport: { width: 1280, height: 860 }, storageState: "e2e/.auth/kai.json" },
},
],
+81
View File
@@ -0,0 +1,81 @@
import { randomUUID } from "node:crypto";
import pg from "pg";
import { afterAll, beforeAll, describe, expect, it, vi } from "vitest";
import { seedHousehold } from "./fixture";
vi.mock("server-only", () => ({}));
// lib/cooking.ts gegen die Testdatenbank: Fertig, Ende der Runde, Bewertung,
// Dankeschön (nicht an sich selbst), offene Bewertungen, Rückmeldung an den Koch.
const url = process.env.TEST_DATABASE_URL;
describe.skipIf(!url)("cooking", () => {
const client = new pg.Client({ connectionString: url });
const h = randomUUID();
let kai = "";
let ben = "";
let roundId = "";
const slots: string[] = [];
let cooking: typeof import("@/lib/cooking");
let db: typeof import("@/lib/db");
const as = <T>(fn: (c: pg.PoolClient) => Promise<T>) => db.withHousehold(h, fn);
beforeAll(async () => {
process.env.DATABASE_URL = url;
await client.connect();
const ingredient = (await client.query("select id from ingredients limit 1")).rows[0].id;
kai = (await seedHousehold(client, h, ingredient)).member;
cooking = await import("@/lib/cooking");
db = await import("@/lib/db");
await as(async (c) => {
await c.query("update rounds set status = 'done'");
ben = (await c.query("insert into members (household_id, display_name, role) values ($1, 'Ben', 'child') returning id", [h])).rows[0].id;
roundId = (await c.query("insert into rounds (household_id, slots_count, default_portions, status) values ($1, 2, 4, 'shopping') returning id", [h])).rows[0].id;
for (const [i, t] of ["Curry", "Pizza"].entries()) {
const d = (await c.query("insert into dishes (household_id, title) values ($1, $2) returning id", [h, t])).rows[0].id;
slots.push((await c.query("insert into slots (household_id, round_id, position, dish_id, portions) values ($1, $2, $3, $4, 4) returning id", [h, roundId, i + 1, d])).rows[0].id);
}
});
});
afterAll(async () => {
await db.pool.end();
await client.end();
});
it("marks a slot cooked once, makes the finisher the cook, and ends the round with the last slot", async () => {
expect(await as((c) => cooking.markCooked(c, slots[0]!, kai))).toBe(true);
expect(await as((c) => cooking.markCooked(c, slots[0]!, kai))).toBe(false);
const status = () => as(async (c) => (await c.query("select status from rounds where id = $1", [roundId])).rows[0].status);
expect(await status()).toBe("shopping");
expect(await as((c) => cooking.markCooked(c, slots[1]!, kai))).toBe(true);
expect(await status()).toBe("done");
expect(await as(async (c) => (await c.query("select cook_member_id from slots where id = $1", [slots[0]])).rows[0].cook_member_id)).toBe(kai);
});
it("rates once per person (a second rating replaces it) and lists what is left to rate", async () => {
const mine = async () => (await as((c) => cooking.pendingRatings(c, ben))).map((r) => r.slotId).filter((id) => slots.includes(id));
expect((await mine()).sort()).toEqual([...slots].sort()); // dazu kommt der gekochte Slot aus der Fixture
await as((c) => cooking.rate(c, h, slots[0]!, ben, false, "mehr Soße"));
await as((c) => cooking.rate(c, h, slots[0]!, ben, true, " doch lecker "));
const r = await as(async (c) => (await c.query("select thumbs_up, comment from ratings where slot_id = $1", [slots[0]])).rows);
expect(r).toEqual([{ thumbs_up: true, comment: "doch lecker" }]);
expect(await mine()).toEqual([slots[1]]);
});
it("thanks the cook once, never oneself, and the cook sees it", async () => {
await as((c) => cooking.thank(c, h, slots[0]!, ben));
await as((c) => cooking.thank(c, h, slots[0]!, ben));
await expect(as((c) => cooking.thank(c, h, slots[0]!, kai))).rejects.toThrow("ownDish");
const thanks = await as((c) => cooking.thanksForCook(c, kai));
expect(thanks.find((x) => x.slotId === slots[0])).toMatchObject({ kudos: 1, up: 1, down: 0, comments: ["doch lecker"] });
});
it("refuses ratings for what has not been cooked", async () => {
const open = await as(async (c) => {
const d = (await c.query("select dish_id from slots where id = $1", [slots[0]])).rows[0].dish_id;
return (await c.query("insert into slots (household_id, round_id, position, dish_id, portions) values ($1, $2, 3, $3, 2) returning id", [h, roundId, d])).rows[0].id;
});
await expect(as((c) => cooking.rate(c, h, open, ben, true, null))).rejects.toThrow("notCooked");
});
});
+18
View File
@@ -0,0 +1,18 @@
import { describe, expect, it } from "vitest";
import { timerFromText } from "@/lib/timer";
describe("timer from text", () => {
it("reads minutes, hours and ranges in several languages", () => {
expect(timerFromText("Bei kleiner Hitze 30 Minuten köcheln lassen.")).toBe(1800);
expect(timerFromText("Gemüse dazugeben und 5 Minuten mitbraten.")).toBe(300);
expect(timerFromText("10–15 Min. backen")).toBe(600);
expect(timerFromText("Bake for 1 hour.")).toBe(3600);
expect(timerFromText("Laisser reposer 1,5 heures")).toBe(5400);
});
it("ignores numbers that are not times", () => {
expect(timerFromText("Ofen auf 200 °C vorheizen.")).toBeNull();
expect(timerFromText("2 Eier verquirlen")).toBeNull();
expect(timerFromText("Spaghetti kochen")).toBeNull();
});
});