Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
10831c7f65 | ||
|
|
582b4a0fca | ||
|
|
15d484c763 | ||
|
|
afdbf34b89 | ||
|
|
5952eda953 | ||
|
|
6f43b81f9b | ||
|
|
def3272442 | ||
|
|
92f852e335 | ||
|
|
cfb816b724 | ||
|
|
4e413fe600 |
No files matched your search
@@ -7,7 +7,7 @@
|
||||
> **Plattform:** Olares One (Kubernetes), Repo und CI auf Gitea — kein Supabase,
|
||||
> kein Vercel (E-0001). Eigene Gestaltung, nicht AImighty (E-0002).
|
||||
> Verteilung über den Markt, Repo öffentlich (E-0005).
|
||||
> **Status:** 26.11.40 — alle neun Arbeitspakete aus `docs/PROJEKTSTART.md` sind gebaut:
|
||||
> **Status:** 26.11.50 — alle neun Arbeitspakete aus `docs/PROJEKTSTART.md` sind gebaut:
|
||||
> Anmeldung (Passkeys, Kinder mit Gerät + PIN), Gerichte (Link, Kochbuchfoto, AI über den
|
||||
> Olares Router), Wünschen, Plan, Einkaufsliste (Echtzeit, offline), Kochmodus mit
|
||||
> Bewertung, Web-App; Einzahl bei Stück-Mengen (26.11.15), Preise und Kosten mit Ampel
|
||||
@@ -20,9 +20,11 @@
|
||||
> (26.11.33), foodplanhero für Maike (26.11.35), eine Schrift (26.11.37), Produktgruppen,
|
||||
> eigene Zutaten und Lieblingsprodukt je Haushalt (26.11.38, E-0015), Löffel und Gebinde
|
||||
> (26.11.39, E-0016), Anmelden per Mail-Link über Resend (26.11.40, E-0017; nur
|
||||
> anmelden, keine Geräte oder Passkeys aus einer Mail-Sitzung). Offen: Kai trägt
|
||||
> den Resend-Schlüssel unter Mehr › Mails verschicken ein.
|
||||
> **Letzte Aktualisierung:** 7. November 2026
|
||||
> anmelden, keine Geräte oder Passkeys aus einer Mail-Sitzung), Leiste bleibt nach der
|
||||
> Tastatur unten (26.11.41), Icon Kochmütze mit Herz (26.11.42), Fotos aus der Mediathek (26.11.43), gleich große Karten (26.11.44), Runde beenden/löschen/ändern,
|
||||
> Tage je Gericht von Hand und Kalender-Abo je Haushalt (26.11.45, E-0018), Einkaufsliste einsprechen (26.11.46), Herz für „Mein Gericht“ auf jeder Wunschkarte (26.11.47), Kochbuch mit bis zu sechs Seiten (26.11.48), Portionen rechnen beim Bearbeiten mit und mehr Maße (26.11.49), ml und l bei jeder Zutat (26.11.50). Offen: Kai trägt
|
||||
> den Resend-Schlüssel unter Mehr › Mails verschicken ein und abonniert den Kalender-Link einmal auf dem iPhone.
|
||||
> **Letzte Aktualisierung:** 8. November 2026
|
||||
|
||||
Diese Datei ist das Gedächtnis jeder Sitzung. Entscheidungen stehen in
|
||||
`docs/entscheidungen.md` und gelten vor dem Konzept. Bei Unsicherheit: stoppen
|
||||
|
||||
@@ -21,7 +21,7 @@ metadata:
|
||||
title: foodplanhero
|
||||
description: Plan. Cook. Smile. 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.40
|
||||
version: 26.11.50
|
||||
categories:
|
||||
- Applications
|
||||
|
||||
@@ -61,7 +61,7 @@ permission:
|
||||
appData: true
|
||||
|
||||
spec:
|
||||
versionName: '26.11.40'
|
||||
versionName: '26.11.50'
|
||||
|
||||
featuredImage: https://git.aimighty.olares.de/aimighty/bilder/raw/branch/main/lunch/icon.png
|
||||
promoteImage:
|
||||
|
||||
@@ -4,6 +4,7 @@ import { getLocale, getTranslations } from "next-intl/server";
|
||||
import { ShoppingList } from "@/components/shopping/shopping-list";
|
||||
import { StorePicker } from "@/components/shopping/store-picker";
|
||||
import { buttonVariants } from "@/components/ui/button";
|
||||
import { aiFor } from "@/lib/ai-settings";
|
||||
import { requireAdult } from "@/lib/auth/session";
|
||||
import { withHousehold } from "@/lib/db";
|
||||
import { currentRound } from "@/lib/rounds";
|
||||
@@ -37,7 +38,7 @@ export default async function ShoppingPage() {
|
||||
</Link>
|
||||
{data.chains.length ? <StorePicker chains={data.chains} /> : null}
|
||||
{"items" in data && data.items ? (
|
||||
<ShoppingList initial={data.items} aisles={data.aisles} me={session.displayName} />
|
||||
<ShoppingList initial={data.items} aisles={data.aisles} me={session.displayName} canRecord={!!(await aiFor(session.householdId))?.speechModel} />
|
||||
) : (
|
||||
<div className="flex flex-col gap-3 rounded-2xl border border-border p-4">
|
||||
<p>{data.round ? t("notYet") : t("noRound")}</p>
|
||||
|
||||
@@ -4,16 +4,17 @@ import { DishForm } from "@/components/dishes/dish-form";
|
||||
import { requireSession } from "@/lib/auth/session";
|
||||
import { withHousehold } from "@/lib/db";
|
||||
import { getDish } from "@/lib/dishes";
|
||||
import { fromBase, type BaseUnit, type KitchenUnit } from "@/lib/units";
|
||||
import { fromBase, niceQty, type BaseUnit, type DisplayUnit } from "@/lib/units";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
// Bearbeiten zeigt die Mengen für vier Portionen (oder was man dort einträgt).
|
||||
const PORTIONS = 4;
|
||||
// Bearbeiten zeigt die Mengen für so viele Portionen, wie das Rezept eingegeben wurde
|
||||
// (26.11.49); ältere Gerichte für vier. Gerundet, wie man es tippen würde.
|
||||
const OLDER = 4;
|
||||
|
||||
function amountIn(qty: number, unit: BaseUnit, display: KitchenUnit | null, packSize: number | null) {
|
||||
function amountIn(qty: number, unit: BaseUnit, display: DisplayUnit | null, packSize: number | null) {
|
||||
const n = display ? fromBase(qty, display, unit, packSize) : null;
|
||||
return n === null ? { qty, unit } : { qty: Math.round(n * 100) / 100, unit: display as string };
|
||||
return n === null ? { qty: niceQty(qty, unit), unit } : { qty: niceQty(n, display!), unit: display as string };
|
||||
}
|
||||
|
||||
export default async function EditDishPage({ params }: { params: Promise<{ id: string }> }) {
|
||||
@@ -25,6 +26,7 @@ export default async function EditDishPage({ params }: { params: Promise<{ id: s
|
||||
const t = await getTranslations("dishes");
|
||||
const dish = await withHousehold(session.householdId, (c) => getDish(c, id, locale));
|
||||
if (!dish) notFound();
|
||||
const portions = dish.recipePortions ?? OLDER;
|
||||
return (
|
||||
<main className="mx-auto flex max-w-md flex-col gap-5 px-4 py-6">
|
||||
<header className="flex flex-col gap-1">
|
||||
@@ -35,16 +37,16 @@ export default async function EditDishPage({ params }: { params: Promise<{ id: s
|
||||
initial={{
|
||||
id: dish.id,
|
||||
title: dish.title,
|
||||
portions: PORTIONS,
|
||||
portions,
|
||||
base: dish.base,
|
||||
tags: dish.tags,
|
||||
effortMinutes: dish.effortMinutes,
|
||||
isTrial: dish.isTrial,
|
||||
sourceUrl: dish.sourceUrl,
|
||||
ingredients: dish.ingredients.map((i) => ({
|
||||
ingredient: { id: i.ingredientId, name: i.name, unit: i.unit, kitchenUnit: i.kitchenUnit, packKind: i.packKind, packSize: i.packSize },
|
||||
ingredient: { id: i.ingredientId, name: i.name, unit: i.unit, kitchenUnit: i.kitchenUnit, packKind: i.packKind, packSize: i.kindSize, sizes: i.sizes },
|
||||
// Im Maß, in dem sie eingegeben wurde: „2 EL“, „1 Dose“ (26.11.39).
|
||||
...amountIn(i.qtyPerPortion * PORTIONS, i.unit, i.displayUnit, i.packSize),
|
||||
...amountIn(i.qtyPerPortion * portions, i.unit, i.displayUnit, i.packSize),
|
||||
note: i.note,
|
||||
product: i.product,
|
||||
})),
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { ChevronLeft, MonitorPlay } from "lucide-react";
|
||||
import { TrialNote } from "@/components/dishes/trial-note";
|
||||
import Link from "next/link";
|
||||
import { notFound } from "next/navigation";
|
||||
import { getLocale, getTranslations } from "next-intl/server";
|
||||
@@ -54,7 +55,7 @@ export default async function DishPage({ params }: { params: Promise<{ id: strin
|
||||
<div className="relative aspect-[4/3] overflow-hidden sm:mx-4 sm:mt-4 sm:rounded-2xl">
|
||||
<DishPhoto dishId={dish.id} photo={dish.photo} />
|
||||
<Link
|
||||
href="/gerichte"
|
||||
href={dish.isTrial ? "/gerichte?ansicht=ausprobieren" : "/gerichte"}
|
||||
aria-label={t("title")}
|
||||
className="absolute left-3 top-3 flex size-11 items-center justify-center rounded-full bg-background/90 text-foreground"
|
||||
>
|
||||
@@ -75,6 +76,7 @@ export default async function DishPage({ params }: { params: Promise<{ id: strin
|
||||
) : null}
|
||||
</header>
|
||||
{photos.length ? <PhotoGallery dishId={dish.id} title={dish.title} photos={photos} canManage={canWrite} /> : null}
|
||||
{dish.isTrial ? <TrialNote id={dish.id} canWrite={canWrite} /> : null}
|
||||
{canWrite ? <DishActions id={dish.id} /> : null}
|
||||
{dish.steps.length || dish.ingredients.length ? (
|
||||
<Link
|
||||
|
||||
@@ -85,7 +85,7 @@ export default async function DishesPage({ searchParams }: { searchParams: Promi
|
||||
{dishes.length ? (
|
||||
<ul className="grid grid-cols-2 gap-3 sm:grid-cols-3">
|
||||
{dishes.map((d) => (
|
||||
<li key={d.id}>
|
||||
<li key={d.id} className="h-full">
|
||||
<DishTile id={d.id} title={d.title} photo={d.photo} meta={meta(d)} />
|
||||
</li>
|
||||
))}
|
||||
@@ -107,7 +107,7 @@ export default async function DishesPage({ searchParams }: { searchParams: Promi
|
||||
href="/gerichte/hinzufuegen"
|
||||
className={cn(
|
||||
buttonVariants({ size: "lg" }),
|
||||
"fixed bottom-[calc(4.5rem+env(safe-area-inset-bottom))] right-4 z-10 shadow-lg",
|
||||
"kb-shift fixed bottom-[calc(4.5rem+env(safe-area-inset-bottom))] right-4 z-10 shadow-lg",
|
||||
)}
|
||||
>
|
||||
<Plus aria-hidden />
|
||||
|
||||
@@ -10,7 +10,8 @@ export default async function AppLayout({ children }: { children: React.ReactNod
|
||||
const session = await requireSession();
|
||||
return (
|
||||
<>
|
||||
<div className="pb-[calc(3.5rem+env(safe-area-inset-bottom))]">{children}</div>
|
||||
{/* Oben Platz für die Statusleiste des iPhones in der Web-App (26.11.44); im Browser 0. */}
|
||||
<div className="pb-[calc(3.5rem+env(safe-area-inset-bottom))] pt-[env(safe-area-inset-top)]">{children}</div>
|
||||
<AppNav variant={session.role === "child" ? "child" : session.role === "teen" ? "teen" : "adult"} />
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -13,6 +13,7 @@ import { aiFor } from "@/lib/ai-settings";
|
||||
import { InstallHint } from "@/components/install-hint";
|
||||
import { BudgetSettings } from "@/components/more/budget-settings";
|
||||
import { MailSignIn } from "@/components/more/mail-sign-in";
|
||||
import { CalendarSettings } from "@/components/more/calendar-settings";
|
||||
import { can, WITH_PASSKEY } from "@/lib/auth/roles";
|
||||
import { withHousehold } from "@/lib/db";
|
||||
import { isLocale } from "@/lib/locale";
|
||||
@@ -32,7 +33,7 @@ export default async function MorePage() {
|
||||
const t = await getTranslations("more");
|
||||
const tc = await getTranslations("costs.settings");
|
||||
const locale = await getLocale();
|
||||
const { members, passkeys, founder, kids, kidDevices, money, mail, dedication } = await withHousehold(session.householdId, async (client) => {
|
||||
const { members, passkeys, founder, kids, kidDevices, money, mail, calendar, dedication } = await withHousehold(session.householdId, async (client) => {
|
||||
const members = (await client.query("select id, display_name, role from members order by created_at")).rows;
|
||||
const founder = (await client.query("select created_by from households")).rows[0]?.created_by as string | null;
|
||||
const passkeys = (
|
||||
@@ -58,7 +59,10 @@ export default async function MorePage() {
|
||||
).rows[0]?.email as string | undefined;
|
||||
const sending = (await client.query("select from_address from household_mail where password_enc is not null")).rows[0]?.from_address as string | undefined;
|
||||
const mail = { verified: me?.verified ? (me.email as string) : null, pending: pending ?? null, sending: sending ?? null };
|
||||
return { members, passkeys, founder, kids, kidDevices, money, mail, dedication: await getDedication(client) };
|
||||
const calendar = (
|
||||
await client.query("select calendar_token_hash is not null as active, to_char(meal_time, 'HH24:MI') as time, meal_minutes as minutes from households")
|
||||
).rows[0] as { active: boolean; time: string; minutes: number };
|
||||
return { members, passkeys, founder, kids, kidDevices, money, mail, calendar, dedication: await getDedication(client) };
|
||||
});
|
||||
const aiReady = !!(await aiFor(session.householdId));
|
||||
const date = new Intl.DateTimeFormat(locale, { dateStyle: "medium" });
|
||||
@@ -140,6 +144,12 @@ export default async function MorePage() {
|
||||
</>
|
||||
) : null}
|
||||
|
||||
{session.role === "admin" ? (
|
||||
<Section title={t("calendar.title")} id="kalender">
|
||||
<CalendarSettings active={calendar.active} mealTime={calendar.time} mealMinutes={calendar.minutes} locked={session.via === "mail"} />
|
||||
</Section>
|
||||
) : null}
|
||||
|
||||
{session.role === "admin" ? (
|
||||
<Section title={t("mail.sendingTitle")} id="mails">
|
||||
<Link
|
||||
|
||||
@@ -17,7 +17,7 @@ import { withHousehold } from "@/lib/db";
|
||||
import { currentRound } from "@/lib/rounds";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { budget, favorites, roundWishes } from "@/lib/wishes";
|
||||
import { planSlots } from "@/lib/plan";
|
||||
import { dayLabel, planSlots } from "@/lib/plan";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
@@ -188,6 +188,7 @@ async function FamilyWishes({
|
||||
|
||||
async function PlanToday({ slots, adult, cook }: { slots: Awaited<ReturnType<typeof planSlots>>; adult: boolean; cook: boolean }) {
|
||||
const t = await getTranslations("today");
|
||||
const locale = await getLocale();
|
||||
const next = slots.find((s) => s.dishId && !s.cookedAt);
|
||||
return (
|
||||
<>
|
||||
@@ -200,7 +201,7 @@ async function PlanToday({ slots, adult, cook }: { slots: Awaited<ReturnType<typ
|
||||
<p className="eyebrow">{t("next")}</p>
|
||||
<h2 className="text-3xl leading-snug">{next.title}</h2>
|
||||
<p className="text-muted-foreground">
|
||||
{[t("portions", { n: next.portions }), next.cookName ? t("cook", { name: next.cookName }) : null].filter(Boolean).join(" · ")}
|
||||
{[dayLabel(next.plannedDay, locale), 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 />
|
||||
@@ -227,7 +228,7 @@ async function PlanToday({ slots, adult, cook }: { slots: Awaited<ReturnType<typ
|
||||
<span className="mr-2 text-sm text-muted-foreground">{i + 1}.</span>
|
||||
{s.title}
|
||||
</span>
|
||||
<span className="text-right text-sm text-muted-foreground">{s.cookName ?? ""}</span>
|
||||
<span className="text-right text-sm text-muted-foreground">{[dayLabel(s.plannedDay, locale), s.cookName].filter(Boolean).join(" · ")}</span>
|
||||
</li>
|
||||
))}
|
||||
</ol>
|
||||
|
||||
@@ -2,6 +2,7 @@ import Link from "next/link";
|
||||
import { getLocale, getTranslations } from "next-intl/server";
|
||||
import { buttonVariants } from "@/components/ui/button";
|
||||
import { PlanBoard, type SlotCost } from "@/components/plan/plan-board";
|
||||
import { RoundActions } from "@/components/plan/round-actions";
|
||||
import { costOverview } from "@/lib/costs";
|
||||
import { requirePlanner } from "@/lib/auth/session";
|
||||
import { withHousehold } from "@/lib/db";
|
||||
@@ -51,7 +52,13 @@ export default async function PlanPage() {
|
||||
) : null}
|
||||
</header>
|
||||
{"slots" in data && data.slots ? (
|
||||
<PlanBoard slots={data.slots} members={data.members} dishes={data.dishes} status={data.round!.status} money={data.money!} />
|
||||
<>
|
||||
<PlanBoard slots={data.slots} members={data.members} dishes={data.dishes} status={data.round!.status} money={data.money!} startDay={data.round!.shoppingDate} />
|
||||
<RoundActions
|
||||
current={{ shoppingDate: data.round!.shoppingDate, slotsCount: data.round!.slotsCount, defaultPortions: data.round!.defaultPortions }}
|
||||
canDelete={!data.slots.some((s) => s.cookedAt)}
|
||||
/>
|
||||
</>
|
||||
) : (
|
||||
<div className="flex flex-col gap-3 rounded-2xl border border-border p-4">
|
||||
<p>{t("noRound")}</p>
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import { guardWrite, isResponse } from "@/lib/auth/guard";
|
||||
import { fail } from "@/lib/auth/http";
|
||||
import { withHousehold } from "@/lib/db";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
// „In den Pool“ (26.11.41): ein Gericht aus „Ausprobieren“ zu den Stammgerichten.
|
||||
export async function POST(request: Request, { params }: { params: Promise<{ id: string }> }) {
|
||||
const { id } = await params;
|
||||
const session = await guardWrite(request);
|
||||
if (isResponse(session)) return session;
|
||||
if (!/^[0-9a-f-]{36}$/.test(id)) return fail("invalid", 400);
|
||||
const r = await withHousehold(session.householdId, (c) =>
|
||||
c.query("update dishes set is_trial = false, updated_at = now() where id = $1 and archived_at is null", [id]),
|
||||
);
|
||||
return r.rowCount === 1 ? new Response(null, { status: 204 }) : fail("notFound", 404);
|
||||
}
|
||||
@@ -8,6 +8,9 @@ import { draftFromRecipe } from "@/lib/recipe-draft";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
/** Seiten je Rezept (26.11.48); dieselbe Zahl wie in components/dishes/photo-import.tsx. */
|
||||
const MAX_PAGES = 6;
|
||||
|
||||
// Kochbuchfoto → Entwurf. Das Bildmodell schreibt die Zutatenzeilen wörtlich
|
||||
// ab; Zuordnung und Umrechnung macht die App selbst (lib/recipe-import.ts).
|
||||
// Das Foto wird nicht gespeichert.
|
||||
@@ -17,8 +20,8 @@ export async function POST(request: Request) {
|
||||
const ai = await aiFor(session.householdId);
|
||||
if (!ai?.visionModel) return fail("aiNotConfigured", 409);
|
||||
const form = await request.formData().catch(() => null);
|
||||
const files = (form?.getAll("photos") ?? []).filter((f): f is File => f instanceof File).slice(0, 2);
|
||||
if (!files.length) return fail("photo", 400);
|
||||
const files = (form?.getAll("photos") ?? []).filter((f): f is File => f instanceof File);
|
||||
if (!files.length || files.length > MAX_PAGES) return fail("photo", 400);
|
||||
let images: string[];
|
||||
try {
|
||||
images = await Promise.all(files.map(imageForModel));
|
||||
@@ -30,9 +33,15 @@ export async function POST(request: Request) {
|
||||
try {
|
||||
recipe = recipeFromReply(
|
||||
await askJson(ai, "vision", RECIPE_PROMPT, [
|
||||
{ type: "text", text: "Read the recipe on these cookbook pages." },
|
||||
{
|
||||
type: "text",
|
||||
text:
|
||||
images.length > 1
|
||||
? `Read the recipe on these ${images.length} cookbook pages, in order; it may continue from one page to the next.`
|
||||
: "Read the recipe on this cookbook page.",
|
||||
},
|
||||
...images.map((url) => ({ type: "image_url" as const, image_url: { url } })),
|
||||
]),
|
||||
], { timeoutMs: 120_000 + 30_000 * (images.length - 1) }),
|
||||
);
|
||||
} catch (error) {
|
||||
if (error instanceof AiNotConfigured) return fail("aiNotConfigured", 409);
|
||||
|
||||
@@ -1,30 +1,13 @@
|
||||
import { getLocale } from "next-intl/server";
|
||||
import { AiNotConfigured, AiUnavailable, transcribe } from "@/lib/ai";
|
||||
import { aiFor } from "@/lib/ai-settings";
|
||||
import { guardWrite, isResponse } from "@/lib/auth/guard";
|
||||
import { fail, json } from "@/lib/auth/http";
|
||||
import { json } from "@/lib/auth/http";
|
||||
import { transcribeUpload } from "@/lib/voice";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
const MAX_BYTES = 25 * 1024 * 1024; // rund zehn Minuten Sprache
|
||||
|
||||
// Gericht einsprechen, Schritt 1: Aufnahme → Abschrift (Router „default-stt“ oder
|
||||
// eigenes Sprachmodell). Die Aufnahme wird nicht gespeichert.
|
||||
// Gericht einsprechen, Schritt 1: Aufnahme → Abschrift.
|
||||
export async function POST(request: Request) {
|
||||
const session = await guardWrite(request);
|
||||
if (isResponse(session)) return session;
|
||||
const form = await request.formData().catch(() => null);
|
||||
const audio = form?.get("audio");
|
||||
if (!(audio instanceof File) || audio.size === 0 || audio.size > MAX_BYTES || !/^(audio|video)\//.test(audio.type)) return fail("audio", 400);
|
||||
const ai = await aiFor(session.householdId);
|
||||
if (!ai?.speechModel) return fail("noSpeech", 409);
|
||||
try {
|
||||
const ext = audio.type.includes("mp4") || audio.type.includes("m4a") ? "m4a" : audio.type.includes("ogg") ? "ogg" : audio.type.includes("wav") ? "wav" : "webm";
|
||||
const text = await transcribe(ai, audio, `aufnahme.${ext}`, await getLocale());
|
||||
if (!text) return fail("empty", 422);
|
||||
return json({ text });
|
||||
} catch (error) {
|
||||
if (error instanceof AiUnavailable || error instanceof AiNotConfigured) return fail("aiUnavailable", 503);
|
||||
throw error;
|
||||
}
|
||||
const result = await transcribeUpload(request, session.householdId);
|
||||
return result instanceof Response ? result : json(result);
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
import { getLocale } from "next-intl/server";
|
||||
import { z } from "zod";
|
||||
import { newCalendarToken, removeCalendarToken } from "@/lib/auth/calendar";
|
||||
import { guardWrite, isResponse, noMailSession } from "@/lib/auth/guard";
|
||||
import { fail, json, readJson } from "@/lib/auth/http";
|
||||
import { withAuth, withHousehold } from "@/lib/db";
|
||||
import { loadInstance } from "@/lib/auth/webauthn";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
// Kalender-Abo (26.11.45), nur für Admins und nie aus einer Mail-Sitzung: Der
|
||||
// Link zeigt den Plan jedem, der ihn hat.
|
||||
async function admin(request: Request) {
|
||||
const session = await guardWrite(request, ["admin"]);
|
||||
if (isResponse(session)) return session;
|
||||
return noMailSession(session) ?? session;
|
||||
}
|
||||
|
||||
/** Neuen Link erzeugen (auch: den alten ersetzen). Der Link kommt nur hier einmal heraus. */
|
||||
export async function POST(request: Request) {
|
||||
const session = await admin(request);
|
||||
if (isResponse(session)) return session;
|
||||
const locale = await getLocale();
|
||||
const token = await withHousehold(session.householdId, (c) => newCalendarToken(c, session.householdId, locale));
|
||||
const instance = await withAuth(loadInstance);
|
||||
const url = `${instance!.origin}/kalender/${token}.ics`;
|
||||
return json({ url }, 201);
|
||||
}
|
||||
|
||||
const timeInput = z.object({
|
||||
mealTime: z.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/),
|
||||
mealMinutes: z.number().int().min(15).max(240),
|
||||
});
|
||||
|
||||
/** Essenszeit für die Termine. */
|
||||
export async function PATCH(request: Request) {
|
||||
const session = await admin(request);
|
||||
if (isResponse(session)) return session;
|
||||
const body = timeInput.safeParse(await readJson(request));
|
||||
if (!body.success) return fail("invalid", 400);
|
||||
await withHousehold(session.householdId, (c) =>
|
||||
c.query("update households set meal_time = $2, meal_minutes = $3 where id = $1", [session.householdId, body.data.mealTime, body.data.mealMinutes]),
|
||||
);
|
||||
return json({ ok: true });
|
||||
}
|
||||
|
||||
/** Abo beenden: Der Link gilt nicht mehr. */
|
||||
export async function DELETE(request: Request) {
|
||||
const session = await admin(request);
|
||||
if (isResponse(session)) return session;
|
||||
await withHousehold(session.householdId, (c) => removeCalendarToken(c, session.householdId));
|
||||
return json({ ok: true });
|
||||
}
|
||||
@@ -4,10 +4,11 @@ import { fail, json, readJson } from "@/lib/auth/http";
|
||||
import { PLANNERS } from "@/lib/auth/roles";
|
||||
import { withHousehold } from "@/lib/db";
|
||||
import { setPackSize } from "@/lib/ingredients";
|
||||
import { COUNT_UNITS } from "@/lib/units";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
const body = z.object({ size: z.number().positive().max(100000) });
|
||||
const body = z.object({ size: z.number().positive().max(100000), unit: z.enum([...COUNT_UNITS, "g", "ml"]).optional() });
|
||||
|
||||
// Gebindegröße für den Haushalt (26.11.39): „bei uns hat die Dose 500 g“ — gilt für
|
||||
// alle Gerichte des Haushalts; ein Produkt mit Packung am Gericht geht vor.
|
||||
@@ -18,6 +19,6 @@ export async function PUT(request: Request, { params }: { params: Promise<{ id:
|
||||
const parsed = body.safeParse(await readJson(request));
|
||||
if (!parsed.success || !/^[0-9a-f-]{36}$/.test(id)) return fail("invalid", 400);
|
||||
const size = Math.round(parsed.data.size * 1000) / 1000;
|
||||
const ok = await withHousehold(session.householdId, (c) => setPackSize(c, session.householdId, id, size));
|
||||
const ok = await withHousehold(session.householdId, (c) => setPackSize(c, session.householdId, id, size, parsed.data.unit));
|
||||
return ok ? json({ size }) : fail("noPack", 404);
|
||||
}
|
||||
@@ -24,6 +24,7 @@ const view = (i: IngredientEntry, locale: string, all: IngredientEntry[], produc
|
||||
kitchenUnit: i.kitchenUnit ?? null,
|
||||
packKind: i.packKind ?? null,
|
||||
packSize: i.packSize ?? null,
|
||||
sizes: i.sizes ?? {},
|
||||
});
|
||||
|
||||
// Zutaten-Suche beim Tippen, in der Sprache der Person — mit den eigenen des
|
||||
|
||||
@@ -12,6 +12,8 @@ const change = z.object({
|
||||
portions: z.number().int().min(1).max(30).optional(),
|
||||
cookMemberId: id.nullable().optional(),
|
||||
locked: z.boolean().optional(),
|
||||
// Wochentag von Hand (26.11.45); null nimmt ihn weg.
|
||||
plannedDay: z.string().regex(/^\d{4}-\d{2}-\d{2}$/).nullable().optional(),
|
||||
});
|
||||
|
||||
async function dishExists(c: import("pg").PoolClient, dishId: string) {
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
import { guardWrite, isResponse } from "@/lib/auth/guard";
|
||||
import { fail, json } from "@/lib/auth/http";
|
||||
import { withHousehold } from "@/lib/db";
|
||||
import { currentRound, deleteRound, RoundHasCooked } from "@/lib/rounds";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
// Runde ganz löschen (26.11.45) — nur solange nichts gekocht ist. Wünsche,
|
||||
// Plan und Einkaufsliste gehen mit (on delete cascade).
|
||||
export async function POST(request: Request) {
|
||||
const session = await guardWrite(request);
|
||||
if (isResponse(session)) return session;
|
||||
return withHousehold(session.householdId, async (c) => {
|
||||
const round = await currentRound(c);
|
||||
if (!round) return fail("noRound", 409);
|
||||
try {
|
||||
await deleteRound(c, round.id);
|
||||
} catch (error) {
|
||||
if (error instanceof RoundHasCooked) return fail("cooked", 409);
|
||||
throw error;
|
||||
}
|
||||
return json({ ok: true });
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { guardWrite, isResponse } from "@/lib/auth/guard";
|
||||
import { fail, json } from "@/lib/auth/http";
|
||||
import { withHousehold } from "@/lib/db";
|
||||
import { currentRound, endRound } from "@/lib/rounds";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
// Runde beenden (26.11.45): Gekochtes bleibt Geschichte, danach ist Platz für die nächste.
|
||||
export async function POST(request: Request) {
|
||||
const session = await guardWrite(request);
|
||||
if (isResponse(session)) return session;
|
||||
return withHousehold(session.householdId, async (c) => {
|
||||
const round = await currentRound(c);
|
||||
if (!round) return fail("noRound", 409);
|
||||
await endRound(c, round.id);
|
||||
return json({ ok: true });
|
||||
});
|
||||
}
|
||||
@@ -1,7 +1,9 @@
|
||||
import { guardWrite, isResponse } from "@/lib/auth/guard";
|
||||
import { fail, json, readJson } from "@/lib/auth/http";
|
||||
import { withHousehold } from "@/lib/db";
|
||||
import { openRound, RoundExists, roundInput } from "@/lib/rounds";
|
||||
import { getLocale } from "next-intl/server";
|
||||
import { currentRound, openRound, RoundExists, roundInput, updateRound } from "@/lib/rounds";
|
||||
import { syncList } from "@/lib/shopping";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
@@ -19,3 +21,21 @@ export async function POST(request: Request) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
// Einstellungen der laufenden Runde ändern (26.11.45). Vorhandene Gerichte bleiben;
|
||||
// die Einkaufsliste rechnet sich neu, wenn es sie schon gibt.
|
||||
export async function PATCH(request: Request) {
|
||||
const session = await guardWrite(request);
|
||||
if (isResponse(session)) return session;
|
||||
const body = roundInput.safeParse(await readJson(request));
|
||||
if (!body.success) return fail("invalid", 400);
|
||||
const locale = await getLocale();
|
||||
return withHousehold(session.householdId, async (c) => {
|
||||
const round = await currentRound(c);
|
||||
if (!round) return fail("noRound", 409);
|
||||
await updateRound(c, round.id, body.data);
|
||||
const next = await currentRound(c);
|
||||
if (next && next.status !== "open") await syncList(c, session.householdId, next, locale);
|
||||
return json({ ok: true });
|
||||
});
|
||||
}
|
||||
@@ -14,10 +14,13 @@ export async function PATCH(request: Request) {
|
||||
}
|
||||
|
||||
export async function POST(request: Request) {
|
||||
const body = z.object({ label: z.string().trim().min(1).max(80) }).safeParse(await readJson(request));
|
||||
// Ein Posten getippt, oder mehrere auf einmal nach dem Einsprechen (26.11.46).
|
||||
const label = z.string().trim().min(1).max(80);
|
||||
const body = z.union([z.object({ label }), z.object({ labels: z.array(label).min(1).max(20) })]).safeParse(await readJson(request));
|
||||
if (!body.success) return fail("invalid", 400);
|
||||
const labels = "labels" in body.data ? body.data.labels : [body.data.label];
|
||||
return withShopping(request, async (c, round, session) => {
|
||||
await addManual(c, session.householdId, round.id, body.data.label);
|
||||
for (const l of labels) await addManual(c, session.householdId, round.id, l);
|
||||
return json({ ok: true }, 201);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import { guardWrite, isResponse } from "@/lib/auth/guard";
|
||||
import { json } from "@/lib/auth/http";
|
||||
import { SHOPPERS } from "@/lib/auth/roles";
|
||||
import { splitSpoken } from "@/lib/spoken-list";
|
||||
import { transcribeUpload } from "@/lib/voice";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
// Einkaufsliste einsprechen (Kai, 8.11.2026): Abschrift → einzelne Posten. Kein
|
||||
// Sprachmodell zerlegt — die Regeln in lib/spoken-list.ts tun es, und auf die
|
||||
// Liste kommt erst, was die Person geprüft hat.
|
||||
export async function POST(request: Request) {
|
||||
const session = await guardWrite(request, [...SHOPPERS]);
|
||||
if (isResponse(session)) return session;
|
||||
const result = await transcribeUpload(request, session.householdId);
|
||||
if (result instanceof Response) return result;
|
||||
return json({ text: result.text, items: splitSpoken(result.text) });
|
||||
}
|
||||
@@ -10,10 +10,10 @@ export const dynamic = "force-dynamic";
|
||||
export async function POST(request: Request) {
|
||||
const session = await guardWrite(request, [...WISHERS]);
|
||||
if (isResponse(session)) return session;
|
||||
const body = z.object({ dishId: z.string().uuid(), mine: z.boolean() }).safeParse(await readJson(request));
|
||||
const body = z.object({ dishId: z.string().uuid(), mine: z.boolean(), wish: z.boolean().optional() }).safeParse(await readJson(request));
|
||||
if (!body.success) return fail("invalid", 400);
|
||||
try {
|
||||
await withHousehold(session.householdId, (c) => setMine(c, session.memberId, body.data.dishId, body.data.mine));
|
||||
await withHousehold(session.householdId, (c) => setMine(c, session.memberId, body.data.dishId, body.data.mine, body.data.wish ? { wishIn: session.householdId } : {}));
|
||||
return json({ ok: true });
|
||||
} catch (error) {
|
||||
if (error instanceof WishRefused) return fail(error.reason, 409);
|
||||
|
||||
@@ -79,6 +79,12 @@
|
||||
--nav-space: 0px;
|
||||
}
|
||||
|
||||
/* Knopfleisten unten folgen der Korrektur der Navigation, wenn iOS nach der
|
||||
Tastatur zu kurz rechnet (lib/use-keyboard-nav.ts setzt --kb-shift, 26.11.41). */
|
||||
.kb-shift {
|
||||
translate: 0 var(--kb-shift, 0px);
|
||||
}
|
||||
|
||||
html {
|
||||
color-scheme: light dark;
|
||||
-webkit-text-size-adjust: 100%;
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
import { getTranslations } from "next-intl/server";
|
||||
import { householdForCalendar } from "@/lib/auth/calendar";
|
||||
import { clientIp } from "@/lib/auth/request";
|
||||
import { loadInstance } from "@/lib/auth/webauthn";
|
||||
import { buildCalendar, type CalendarEvent } from "@/lib/calendar";
|
||||
import { withAuth, withHousehold } from "@/lib/db";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
// Kalender-Abo (26.11.45): öffentlich, aber nur mit gültigem Link. Nur lesend,
|
||||
// nur Titel, Tag, Koch und Portionen — keine Zutaten, keine Wünsche.
|
||||
export async function GET(request: Request, { params }: { params: Promise<{ token: string }> }) {
|
||||
const raw = (await params).token.replace(/\.ics$/, "");
|
||||
const notFound = () => new Response("Not found", { status: 404, headers: { "cache-control": "no-store" } });
|
||||
if (!/^[A-Za-z0-9_-]{43}$/.test(raw)) return notFound();
|
||||
const found = await householdForCalendar(raw, clientIp(request));
|
||||
if (found === "tooMany") return new Response("Too many requests", { status: 429, headers: { "retry-after": "900" } });
|
||||
if (!found) return notFound();
|
||||
|
||||
const instance = await withAuth(loadInstance);
|
||||
const { household, slots } = await withHousehold(found.id, async (c) => ({
|
||||
household: (
|
||||
await c.query("select name, to_char(meal_time, 'HH24:MI') as time, meal_minutes as minutes, calendar_locale as locale from households where id = $1", [found.id])
|
||||
).rows[0] as { name: string; time: string; minutes: number; locale: string },
|
||||
// Laufende Runde und was in den letzten 60 Tagen einen Tag hatte.
|
||||
slots: (
|
||||
await c.query(
|
||||
`select s.id, to_char(s.planned_day, 'YYYY-MM-DD') as day, s.portions, d.id as "dishId", d.title, m.display_name as cook
|
||||
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.planned_day is not null and s.planned_day >= current_date - 60
|
||||
order by s.planned_day, s.position`,
|
||||
)
|
||||
).rows as { id: string; day: string; portions: number; dishId: string; title: string; cook: string | null }[],
|
||||
}));
|
||||
const t = await getTranslations({ locale: household.locale, namespace: "calendar" });
|
||||
const events: CalendarEvent[] = slots.map((s) => ({
|
||||
uid: `${s.id}@foodplanhero`,
|
||||
day: s.day,
|
||||
start: household.time,
|
||||
minutes: household.minutes,
|
||||
summary: s.title,
|
||||
description: [s.cook ? t("cook", { name: s.cook }) : null, t("portions", { n: s.portions }), instance ? t("open", { url: `${instance.origin}/gerichte/${s.dishId}` }) : null]
|
||||
.filter(Boolean)
|
||||
.join("\n"),
|
||||
url: instance ? `${instance.origin}/gerichte/${s.dishId}` : null,
|
||||
}));
|
||||
return new Response(buildCalendar(t("name", { household: household.name }), events), {
|
||||
headers: {
|
||||
"content-type": "text/calendar; charset=utf-8",
|
||||
"content-disposition": 'inline; filename="foodplanhero.ics"',
|
||||
"cache-control": "private, max-age=900",
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -1,13 +1,14 @@
|
||||
import { ChefHat } from "lucide-react";
|
||||
import Link from "next/link";
|
||||
import { redirect } from "next/navigation";
|
||||
import { getTranslations } from "next-intl/server";
|
||||
import { getLocale, getTranslations } from "next-intl/server";
|
||||
import { DishPhoto } from "@/components/dishes/dish-tile";
|
||||
import { AutoRefresh } from "@/components/kitchen/auto-refresh";
|
||||
import { currentKitchenDisplay } from "@/lib/auth/kids";
|
||||
import { getSession } from "@/lib/auth/session";
|
||||
import { withHousehold } from "@/lib/db";
|
||||
import { kitchenOverview } from "@/lib/kitchen";
|
||||
import { dayLabel } from "@/lib/plan";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
@@ -19,6 +20,7 @@ export default async function KitchenPage() {
|
||||
const t = await getTranslations("kitchen");
|
||||
const { next, dishes } = await withHousehold(device.householdId, kitchenOverview);
|
||||
const [today, ...later] = next;
|
||||
const locale = await getLocale();
|
||||
|
||||
return (
|
||||
<main className="mx-auto flex min-h-dvh max-w-6xl flex-col gap-6 px-4 py-6 pt-[max(1.5rem,env(safe-area-inset-top))] landscape:px-8">
|
||||
@@ -41,6 +43,7 @@ export default async function KitchenPage() {
|
||||
<DishPhoto dishId={today.dishId} photo={today.photo} />
|
||||
</div>
|
||||
<div className="flex flex-col justify-center gap-2 p-5">
|
||||
{today.plannedDay ? <p className="font-semibold">{dayLabel(today.plannedDay, locale)}</p> : null}
|
||||
<p className="text-3xl leading-tight">{today.title}</p>
|
||||
<p className="text-muted-foreground">
|
||||
{today.cookName ? t("portionsCook", { n: today.portions, name: today.cookName }) : t("portions", { n: today.portions })}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { iconUrl } from "@/lib/icon-version";
|
||||
import type { Metadata, Viewport } from "next";
|
||||
import localFont from "next/font/local";
|
||||
import { NextIntlClientProvider } from "next-intl";
|
||||
@@ -36,7 +37,7 @@ export async function generateMetadata(): Promise<Metadata> {
|
||||
media: `(device-width: ${cw}px) and (device-height: ${ch}px) and (-webkit-device-pixel-ratio: ${dpr}) and (orientation: portrait)`,
|
||||
})),
|
||||
},
|
||||
icons: { icon: "/icon.svg", apple: "/apple-touch-icon.png" },
|
||||
icons: { icon: iconUrl("/icon.svg"), apple: iconUrl("/apple-touch-icon.png") },
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { iconUrl } from "@/lib/icon-version";
|
||||
import type { MetadataRoute } from "next";
|
||||
import { getLocale, getTranslations } from "next-intl/server";
|
||||
|
||||
@@ -18,14 +19,14 @@ export default async function manifest(): Promise<MetadataRoute.Manifest> {
|
||||
theme_color: "#fdfcfe",
|
||||
// Lange auf das Symbol drücken: direkt zu Wünschen, Plan und Einkauf.
|
||||
shortcuts: [
|
||||
{ name: nav("wish"), url: "/wuenschen", icons: [{ src: "/icon-192.png", sizes: "192x192" }] },
|
||||
{ name: nav("plan"), url: "/plan", icons: [{ src: "/icon-192.png", sizes: "192x192" }] },
|
||||
{ name: nav("shopping"), url: "/einkauf", icons: [{ src: "/icon-192.png", sizes: "192x192" }] },
|
||||
{ name: nav("wish"), url: "/wuenschen", icons: [{ src: iconUrl("/icon-192.png"), sizes: "192x192" }] },
|
||||
{ name: nav("plan"), url: "/plan", icons: [{ src: iconUrl("/icon-192.png"), sizes: "192x192" }] },
|
||||
{ name: nav("shopping"), url: "/einkauf", icons: [{ src: iconUrl("/icon-192.png"), sizes: "192x192" }] },
|
||||
],
|
||||
icons: [
|
||||
{ src: "/icon-192.png", sizes: "192x192", type: "image/png" },
|
||||
{ src: "/icon-512.png", sizes: "512x512", type: "image/png" },
|
||||
{ src: "/icon-512-maskable.png", sizes: "512x512", type: "image/png", purpose: "maskable" },
|
||||
{ src: iconUrl("/icon-192.png"), sizes: "192x192", type: "image/png" },
|
||||
{ src: iconUrl("/icon-512.png"), sizes: "512x512", type: "image/png" },
|
||||
{ src: iconUrl("/icon-512-maskable.png"), sizes: "512x512", type: "image/png", purpose: "maskable" },
|
||||
],
|
||||
};
|
||||
}
|
||||
@@ -158,7 +158,7 @@ export function CookingMode({
|
||||
|
||||
{error ? <ErrorNotice>{t("error")}</ErrorNotice> : null}
|
||||
|
||||
<div className="sticky bottom-[var(--nav-space)] z-10 flex gap-2 bg-background py-2">
|
||||
<div className="kb-shift sticky bottom-[var(--nav-space)] 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>
|
||||
|
||||
@@ -7,7 +7,7 @@ import { Button } from "@/components/ui/button";
|
||||
import { labelFor } from "@/lib/ingredient-name";
|
||||
import type { Section } from "@/lib/recipe-style";
|
||||
import { timerFromText } from "@/lib/timer";
|
||||
import { type BaseUnit, type KitchenUnit } from "@/lib/units";
|
||||
import { type BaseUnit, type DisplayUnit } from "@/lib/units";
|
||||
import { useKitchenAmount } from "@/lib/use-kitchen-amount";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
@@ -21,7 +21,7 @@ export type Ingredient = {
|
||||
qtyPerPortion: number;
|
||||
unit: BaseUnit;
|
||||
note: string | null;
|
||||
displayUnit?: KitchenUnit | null;
|
||||
displayUnit?: DisplayUnit | null;
|
||||
packSize?: number | null;
|
||||
};
|
||||
export type Step = { section: Section; text: string; timerSeconds: number | null; ingredientIds: string[]; timerFrom?: string };
|
||||
|
||||
@@ -85,7 +85,6 @@ export function RateCard({ item }: { item: ToRate }) {
|
||||
ref={file}
|
||||
type="file"
|
||||
accept="image/*"
|
||||
capture="environment"
|
||||
className="sr-only"
|
||||
tabIndex={-1}
|
||||
aria-hidden
|
||||
|
||||
@@ -24,19 +24,24 @@ export function PhotoButton({
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [error, setError] = useState<"photo" | "full" | null>(null);
|
||||
|
||||
async function upload(file: File) {
|
||||
// Mehrere aus der Mediathek (26.11.43): nacheinander, bis fünf erreicht sind.
|
||||
async function upload(files: File[]) {
|
||||
setBusy(true);
|
||||
setError(null);
|
||||
const form = new FormData();
|
||||
form.append("photo", file);
|
||||
const res = await fetch(`/api/dishes/${id}/photos`, {
|
||||
method: "POST",
|
||||
body: form,
|
||||
});
|
||||
let failed: "photo" | "full" | null = null;
|
||||
for (const file of files.slice(0, Math.max(0, 5 - count))) {
|
||||
const form = new FormData();
|
||||
form.append("photo", file);
|
||||
const res = await fetch(`/api/dishes/${id}/photos`, { method: "POST", body: form }).catch(() => null);
|
||||
if (!res?.ok) {
|
||||
failed = res && (await res.json().catch(() => ({}))).error === "full" ? "full" : "photo";
|
||||
break;
|
||||
}
|
||||
}
|
||||
setBusy(false);
|
||||
if (input.current) input.current.value = "";
|
||||
if (res.ok) router.refresh();
|
||||
else setError((await res.json().catch(() => ({}))).error === "full" ? "full" : "photo");
|
||||
setError(failed);
|
||||
router.refresh();
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -45,11 +50,12 @@ export function PhotoButton({
|
||||
ref={input}
|
||||
type="file"
|
||||
accept="image/*"
|
||||
capture="environment"
|
||||
// Ohne capture: Das iPhone bietet Fotomediathek, Kamera und Dateien an (Kai, 26.11.43).
|
||||
multiple
|
||||
className="sr-only"
|
||||
tabIndex={-1}
|
||||
aria-hidden
|
||||
onChange={(e) => e.target.files?.[0] && upload(e.target.files[0])}
|
||||
onChange={(e) => e.target.files?.length && upload(Array.from(e.target.files))}
|
||||
/>
|
||||
<Button
|
||||
variant="secondary"
|
||||
|
||||
@@ -9,7 +9,7 @@ import { Input } from "@/components/ui/input";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import { ErrorNotice } from "@/components/ui/notice";
|
||||
import { BASES, TAGS } from "@/lib/categories";
|
||||
import { formatQuantity, isPackKind, parseNumber, type BaseUnit } from "@/lib/units";
|
||||
import { COUNT_UNITS, FIXED_UNITS, formatQuantity, isMetric, isPackKind, needsSize, niceQty, parseNumber, sizeKey, sizeOf, type BaseUnit, type CountUnit } from "@/lib/units";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { SECTIONS, type Section } from "@/lib/recipe-style";
|
||||
|
||||
@@ -18,7 +18,8 @@ import { PackSize } from "./pack-size";
|
||||
export { IngredientPicker, type Picked };
|
||||
// Produkt (optional): Name, Packung in der Einheit der Zeile, Kochzeit laut Packung.
|
||||
// inherited: Lieblingsprodukt des Haushalts für diese Zutat (26.11.38); remember: dieses Produkt für alle Gerichte merken.
|
||||
type Row = { key: number; ingredient: Picked | null; qty: string; unit: string; note: string; product: string; pack: string; cook: string; open: boolean; remember?: boolean; inherited?: string | null };
|
||||
// size: Größe eines Zählmaßes, das der Haushalt noch nicht kennt („1 Packung = 500 g“, 26.11.49).
|
||||
type Row = { key: number; ingredient: Picked | null; qty: string; unit: string; size?: string; note: string; product: string; pack: string; cook: string; open: boolean; remember?: boolean; inherited?: string | null };
|
||||
type StepRow = { key: number; text: string; timer: string; section: Section | "" };
|
||||
|
||||
export type DishFormValue = {
|
||||
@@ -48,24 +49,26 @@ export type DishFormValue = {
|
||||
styledByAi?: boolean;
|
||||
};
|
||||
|
||||
const UNITS_FOR: Record<BaseUnit, string[]> = {
|
||||
g: ["g", "kg", "tbsp", "tsp", "pinch"],
|
||||
ml: ["ml", "l", "tbsp", "tsp", "pinch"],
|
||||
piece: ["piece"],
|
||||
};
|
||||
|
||||
/** Maße für eine Zutat: die ihrer Basiseinheit und, wenn sie eins hat, ihr Gebinde (26.11.39). */
|
||||
const unitsFor = (p: Picked | null) => {
|
||||
const list = UNITS_FOR[p?.unit ?? "g"];
|
||||
return p?.packKind && p.packSize ? [...list, p.packKind] : list;
|
||||
/**
|
||||
* Maße für eine Zutat in drei Gruppen (26.11.49, Kai: „es fehlen Einheiten“): ihre
|
||||
* Grundeinheit, feste Küchenmaße (nicht bei Stück-Zutaten) und Zählmaße mit Größe.
|
||||
*/
|
||||
const unitGroups = (p: Picked | null): [string[], string[], string[]] => {
|
||||
const base = p?.unit ?? "g";
|
||||
// ml und l überall, auch bei Stück-Zutaten (26.11.50): dann mit Größe je Stück.
|
||||
if (base === "piece") return [["piece", "g", "kg", "ml", "l"], [], COUNT_UNITS.filter((u) => u !== "piece")];
|
||||
return [base === "g" ? ["g", "kg", "ml", "l"] : ["ml", "l", "g", "kg"], [...FIXED_UNITS], [...COUNT_UNITS]];
|
||||
};
|
||||
const unitsFor = (p: Picked | null) => unitGroups(p).flat();
|
||||
/** Bekannte Größe eines Zählmaßes für diese Zutat, sonst null. */
|
||||
const knownSize = (p: Picked | null, unit: string) => (p && needsSize(unit, p.unit) ? sizeOf(unit, p.unit, p) : null);
|
||||
|
||||
/**
|
||||
* Vorgewählte Einheit beim Wählen einer Zutat: ihr Löffelmaß (Olivenöl in EL), sonst
|
||||
* die Basiseinheit. Ein Gebinde wird angeboten, aber nie vorgewählt — wer nach
|
||||
* „Kokosmilch“ gleich „400“ tippt, meint Milliliter, nicht 400 Dosen.
|
||||
*/
|
||||
const preferredUnit = (p: Picked) => (p.kitchenUnit && unitsFor(p).includes(p.kitchenUnit) ? p.kitchenUnit : p.unit);
|
||||
const preferredUnit = (p: Picked) => (p.kitchenUnit && !isPackKind(p.kitchenUnit) && unitsFor(p).includes(p.kitchenUnit) ? p.kitchenUnit : p.unit);
|
||||
|
||||
let counter = 0;
|
||||
const next = () => ++counter;
|
||||
@@ -144,6 +147,28 @@ export function DishForm({ initial }: { initial?: DishFormValue }) {
|
||||
const [checked, setChecked] = useState(false);
|
||||
const [busy, setBusy] = useState(false);
|
||||
|
||||
// Portionen umstellen rechnet die Mengen mit (Kai, 8.11.2026, 26.11.49) — immer vom
|
||||
// Stand beim Betreten des Feldes aus, damit sich Rundungen nicht aufsummieren.
|
||||
const scaleFrom = useRef<{ portions: number; qty: Map<number, string> } | null>(null);
|
||||
function rememberAmounts() {
|
||||
const n = parseNumber(portions);
|
||||
scaleFrom.current = n && n >= 1 ? { portions: n, qty: new Map(rows.map((r) => [r.key, r.qty])) } : null;
|
||||
}
|
||||
function changePortions(value: string) {
|
||||
setPortions(value);
|
||||
const n = parseNumber(value);
|
||||
const from = scaleFrom.current;
|
||||
if (!from || !n || n < 1 || n > 30) return;
|
||||
setRows((rs) =>
|
||||
rs.map((r) => {
|
||||
const before = from.qty.get(r.key);
|
||||
const q = before !== undefined ? parseNumber(before) : null;
|
||||
if (before === undefined || q === null) return r;
|
||||
return { ...r, qty: n === from.portions ? before : formatQty(niceQty((q * n) / from.portions, r.unit)) };
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
const update = (key: number, patch: Partial<Row>) => setRows((rs) => rs.map((r) => (r.key === key ? { ...r, ...patch } : r)));
|
||||
const updateStep = (key: number, patch: Partial<StepRow>) => setSteps((ss) => ss.map((s) => (s.key === key ? { ...s, ...patch } : s)));
|
||||
const move = (index: number, by: number) =>
|
||||
@@ -163,12 +188,19 @@ export function DishForm({ initial }: { initial?: DishFormValue }) {
|
||||
setError("missingAmount");
|
||||
return;
|
||||
}
|
||||
// Ein Zählmaß ohne bekannte Größe braucht sie, sonst lässt sich nicht rechnen (26.11.49).
|
||||
const sizeMissing = (r: Row) => !!r.ingredient && needsSize(r.unit, r.ingredient.unit) && knownSize(r.ingredient, r.unit) === null && !(parseNumber(r.size ?? "") ?? 0);
|
||||
if (rows.some(sizeMissing)) {
|
||||
setError("missingSize");
|
||||
return;
|
||||
}
|
||||
const ingredients = rows
|
||||
.filter((r) => r.ingredient && r.qty.trim())
|
||||
.map((r) => ({
|
||||
ingredientId: r.ingredient!.id,
|
||||
qty: parseNumber(r.qty) ?? -1,
|
||||
unit: r.unit,
|
||||
size: r.ingredient && needsSize(r.unit, r.ingredient.unit) && knownSize(r.ingredient, r.unit) === null ? parseNumber(r.size ?? "") : null,
|
||||
note: r.note.trim() || null,
|
||||
product: r.product.trim()
|
||||
? {
|
||||
@@ -285,8 +317,19 @@ export function DishForm({ initial }: { initial?: DishFormValue }) {
|
||||
<Label htmlFor="portions" className="flex-1">
|
||||
{t("form.portions")}
|
||||
</Label>
|
||||
<Input id="portions" inputMode="numeric" className="w-20 text-center" value={portions} onChange={(e) => setPortions(e.target.value)} />
|
||||
<Input
|
||||
id="portions"
|
||||
inputMode="numeric"
|
||||
aria-describedby="portions-hint"
|
||||
className="w-20 text-center"
|
||||
value={portions}
|
||||
onFocus={rememberAmounts}
|
||||
onChange={(e) => changePortions(e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
<p id="portions-hint" className="-mt-1 text-sm text-muted-foreground">
|
||||
{t("form.portionsHint")}
|
||||
</p>
|
||||
{initial?.unmatched?.length ? (
|
||||
<div role="note" className="flex flex-col gap-2 rounded-2xl border border-border p-4 text-sm">
|
||||
<p className="font-medium">{t("form.unmatched")}</p>
|
||||
@@ -327,25 +370,67 @@ export function DishForm({ initial }: { initial?: DishFormValue }) {
|
||||
onChange={(e) => update(row.key, { unit: e.target.value })}
|
||||
className="min-h-11 rounded-xl border border-border bg-background px-3 text-base"
|
||||
>
|
||||
{unitsFor(row.ingredient).map((u) => (
|
||||
<option key={u} value={u}>
|
||||
{/* Ein Gebinde nennt seine Größe gleich mit: „Dose (400 g)“. */}
|
||||
{isPackKind(u) && row.ingredient?.packSize
|
||||
? t("form.unitWithSize", { unit: t(`form.units.${u}`), size: sizeText(row.ingredient.packSize, row.ingredient.unit) })
|
||||
: t(`form.units.${u}`)}
|
||||
</option>
|
||||
))}
|
||||
{unitGroups(row.ingredient).map((group, g) =>
|
||||
group.length ? (
|
||||
<optgroup key={g} label={t(`form.unitGroups.${["base", "kitchen", "count"][g]}`)}>
|
||||
{group.map((u) => {
|
||||
const size = knownSize(row.ingredient, u);
|
||||
return (
|
||||
<option key={u} value={u}>
|
||||
{/* Ein Zählmaß nennt seine Größe gleich mit: „Dose (400 g)“. */}
|
||||
{size && row.ingredient && row.ingredient.unit !== "piece"
|
||||
? t("form.unitWithSize", { unit: t(`form.units.${u}`), size: sizeText(size, row.ingredient.unit) })
|
||||
: t(`form.units.${u}`)}
|
||||
</option>
|
||||
);
|
||||
})}
|
||||
</optgroup>
|
||||
) : null,
|
||||
)}
|
||||
</select>
|
||||
</div>
|
||||
{row.ingredient && isPackKind(row.unit) && row.ingredient.packSize ? (
|
||||
<PackSize
|
||||
ingredient={row.ingredient}
|
||||
kind={row.unit}
|
||||
sizeText={sizeText}
|
||||
onSaved={(size) =>
|
||||
setRows((rs) => rs.map((r) => (r.ingredient?.id === row.ingredient!.id ? { ...r, ingredient: { ...r.ingredient!, packSize: size } } : r)))
|
||||
}
|
||||
/>
|
||||
{row.ingredient && needsSize(row.unit, row.ingredient.unit) ? (
|
||||
knownSize(row.ingredient, row.unit) !== null ? (
|
||||
<PackSize
|
||||
ingredient={row.ingredient}
|
||||
kind={sizeKey(row.unit) as CountUnit | "g" | "ml"}
|
||||
perPiece={isMetric(row.unit)}
|
||||
size={knownSize(row.ingredient, row.unit)!}
|
||||
sizeText={sizeText}
|
||||
onSaved={(size) =>
|
||||
setRows((rs) =>
|
||||
rs.map((r) =>
|
||||
r.ingredient?.id === row.ingredient!.id
|
||||
? {
|
||||
...r,
|
||||
ingredient: {
|
||||
...r.ingredient!,
|
||||
sizes: { ...r.ingredient!.sizes, [sizeKey(row.unit)]: size },
|
||||
packSize: r.ingredient!.packKind === row.unit ? size : r.ingredient!.packSize,
|
||||
},
|
||||
}
|
||||
: r,
|
||||
),
|
||||
)
|
||||
}
|
||||
/>
|
||||
) : (
|
||||
<div className="flex items-center gap-2">
|
||||
<Label htmlFor={`size-${row.key}`} className="flex-1 text-sm">
|
||||
{isMetric(row.unit)
|
||||
? t("form.sizeAskPerPiece", { base: sizeKey(row.unit) })
|
||||
: t("form.sizeAsk", { unit: t(`form.units.${row.unit}`), base: t(`form.units.${row.ingredient.unit}`) })}
|
||||
</Label>
|
||||
<Input
|
||||
id={`size-${row.key}`}
|
||||
inputMode="decimal"
|
||||
className="w-24 text-center"
|
||||
aria-invalid={checked && !(parseNumber(row.size ?? "") ?? 0) ? true : undefined}
|
||||
value={row.size ?? ""}
|
||||
onChange={(e) => update(row.key, { size: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
) : null}
|
||||
<Input
|
||||
aria-label={t("form.note")}
|
||||
@@ -491,7 +576,7 @@ export function DishForm({ initial }: { initial?: DishFormValue }) {
|
||||
</section>
|
||||
|
||||
{error ? <ErrorNotice>{t(`form.errors.${error}`)}</ErrorNotice> : null}
|
||||
<div className="sticky bottom-[var(--nav-space)] z-10 flex gap-2 bg-background py-2">
|
||||
<div className="kb-shift sticky bottom-[var(--nav-space)] z-10 flex gap-2 bg-background py-2">
|
||||
<Button type="button" variant="outline" onClick={() => router.back()}>
|
||||
{t("form.cancel")}
|
||||
</Button>
|
||||
|
||||
@@ -2,8 +2,9 @@ import { UtensilsCrossed } from "lucide-react";
|
||||
import Link from "next/link";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
// Kachel eines Gerichts: Foto (oder Illustration, bis eines da ist), Titel in
|
||||
// der Serifenschrift, darunter eine Zeile mit Zeit und Beilage.
|
||||
// Kachel eines Gerichts: Foto (oder Illustration, bis eines da ist), Titel,
|
||||
// darunter eine Zeile mit Zeit und Beilage. Alle Kacheln sind gleich hoch (Kai,
|
||||
// 26.11.44): Titel und Infozeile je höchstens zwei Zeilen, immer Platz für zwei.
|
||||
export function DishPhoto({ dishId, photo, className }: { dishId: string; photo: string | null; className?: string }) {
|
||||
if (photo) {
|
||||
const version = photo.split("-").at(-1)?.replace(".webp", "") ?? "";
|
||||
@@ -19,13 +20,18 @@ export function DishPhoto({ dishId, photo, className }: { dishId: string; photo:
|
||||
|
||||
export function DishTile({ id, title, photo, meta }: { id: string; title: string; photo: string | null; meta: string }) {
|
||||
return (
|
||||
<Link href={`/gerichte/${id}`} className="group flex flex-col overflow-hidden rounded-2xl bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">
|
||||
<Link
|
||||
href={`/gerichte/${id}`}
|
||||
title={title}
|
||||
className="group flex h-full flex-col overflow-hidden rounded-2xl bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
||||
>
|
||||
<div className="aspect-square overflow-hidden">
|
||||
<DishPhoto dishId={id} photo={photo} />
|
||||
</div>
|
||||
<div className="flex min-h-11 flex-col gap-0.5 p-3">
|
||||
<h2 className="text-lg leading-snug">{title}</h2>
|
||||
{meta ? <p className="text-xs text-muted-foreground">{meta}</p> : null}
|
||||
<div className="flex flex-1 flex-col gap-0.5 p-3">
|
||||
<h2 className="line-clamp-2 min-h-[2lh] text-lg leading-snug">{title}</h2>
|
||||
{/* Auch ohne Infozeile die gleiche Höhe: ein leerer Platzhalter. */}
|
||||
<p className="line-clamp-2 min-h-[2lh] text-xs text-muted-foreground">{meta || "\u00a0"}</p>
|
||||
</div>
|
||||
</Link>
|
||||
);
|
||||
|
||||
@@ -21,6 +21,8 @@ export type Picked = {
|
||||
kitchenUnit?: KitchenUnit | null;
|
||||
packKind?: PackKind | null;
|
||||
packSize?: number | null;
|
||||
/** Größen des Haushalts je Zählmaß (26.11.49). */
|
||||
sizes?: Partial<Record<string, number>>;
|
||||
};
|
||||
type Hit = Picked & { kinds: number; parentId: string | null; own: boolean };
|
||||
|
||||
@@ -55,7 +57,7 @@ export function IngredientPicker({ value, onPick, canCreate = false }: { value:
|
||||
}, [query, open, value?.name]);
|
||||
|
||||
const pick = (h: Picked) => {
|
||||
onPick({ id: h.id, name: h.name, unit: h.unit, group: h.group, product: h.product ?? null, kitchenUnit: h.kitchenUnit, packKind: h.packKind, packSize: h.packSize });
|
||||
onPick({ id: h.id, name: h.name, unit: h.unit, group: h.group, product: h.product ?? null, kitchenUnit: h.kitchenUnit, packKind: h.packKind, packSize: h.packSize, sizes: h.sizes });
|
||||
setQuery(h.name);
|
||||
setOpen(false);
|
||||
setCreating(false);
|
||||
|
||||
@@ -6,38 +6,44 @@ import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import { ErrorNotice } from "@/components/ui/notice";
|
||||
import { parseNumber, type BaseUnit, type PackKind } from "@/lib/units";
|
||||
import { parseNumber, type BaseUnit, type CountUnit } from "@/lib/units";
|
||||
|
||||
// Größe eines Gebindes (26.11.39): „1 Dose = 400 g“ — wer Gerichte pflegt, kann sie
|
||||
// für den Haushalt ändern („unsere Dose hat 500 g“). Gilt für alle Gerichte.
|
||||
// Größe eines Zählmaßes (26.11.39, alle Zählmaße seit 26.11.49): „1 Dose = 400 g“,
|
||||
// „1 Zehe = 3 g“ — wer Gerichte pflegt, kann sie für den Haushalt ändern. Gilt für alle Gerichte.
|
||||
export function PackSize({
|
||||
ingredient,
|
||||
kind,
|
||||
perPiece = false,
|
||||
size,
|
||||
sizeText,
|
||||
onSaved,
|
||||
}: {
|
||||
ingredient: { id: string; unit: BaseUnit; packSize?: number | null };
|
||||
kind: PackKind;
|
||||
ingredient: { id: string; unit: BaseUnit };
|
||||
/** Zählmaß, oder g/ml je Stück einer Stück-Zutat (perPiece, 26.11.50: „1 Stück = 500 ml“). */
|
||||
kind: CountUnit | "g" | "ml";
|
||||
perPiece?: boolean;
|
||||
size: number;
|
||||
sizeText: (size: number, unit: BaseUnit) => string;
|
||||
onSaved: (size: number) => void;
|
||||
}) {
|
||||
const t = useTranslations("dishes.form");
|
||||
const id = useId();
|
||||
const [open, setOpen] = useState(false);
|
||||
const [value, setValue] = useState(String(ingredient.packSize ?? ""));
|
||||
const [value, setValue] = useState(String(size));
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [error, setError] = useState(false);
|
||||
const unit = t(`units.${kind}`);
|
||||
const unit = t(`units.${perPiece ? "piece" : kind}`);
|
||||
const base: BaseUnit = perPiece ? (kind as BaseUnit) : ingredient.unit;
|
||||
|
||||
async function save() {
|
||||
const size = parseNumber(value);
|
||||
if (!size || size <= 0) return setError(true);
|
||||
const next = parseNumber(value);
|
||||
if (!next || next <= 0) return setError(true);
|
||||
setBusy(true);
|
||||
setError(false);
|
||||
const res = await fetch(`/api/ingredients/${ingredient.id}/pack`, {
|
||||
method: "PUT",
|
||||
headers: { "content-type": "application/json" },
|
||||
body: JSON.stringify({ size }),
|
||||
body: JSON.stringify({ size: next, unit: kind }),
|
||||
}).catch(() => null);
|
||||
setBusy(false);
|
||||
if (!res?.ok) return setError(true);
|
||||
@@ -48,7 +54,7 @@ export function PackSize({
|
||||
if (!open) {
|
||||
return (
|
||||
<div className="flex flex-wrap items-center gap-x-3 text-sm text-muted-foreground">
|
||||
<span>{t("packSize", { unit, size: sizeText(ingredient.packSize ?? 0, ingredient.unit) })}</span>
|
||||
<span>{t("packSize", { unit, size: sizeText(size, base) })}</span>
|
||||
<Button type="button" variant="ghost" className="min-h-11" onClick={() => setOpen(true)}>
|
||||
{t("packChange")}
|
||||
</Button>
|
||||
@@ -58,7 +64,7 @@ export function PackSize({
|
||||
return (
|
||||
<div className="flex flex-col gap-2 rounded-xl border border-border p-3">
|
||||
<Label htmlFor={id} className="text-sm">
|
||||
{t("packSizeLabel", { unit, base: t(`units.${ingredient.unit}`) })}
|
||||
{t("packSizeLabel", { unit, base: t(`units.${base}`) })}
|
||||
</Label>
|
||||
<div className="flex gap-2">
|
||||
<Input id={id} inputMode="decimal" value={value} onChange={(e) => setValue(e.target.value)} className="flex-1" />
|
||||
|
||||
@@ -1,28 +1,52 @@
|
||||
"use client";
|
||||
|
||||
import { Camera } from "lucide-react";
|
||||
import { Camera, Plus, X } from "lucide-react";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useState } from "react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { useEffect, useState } from "react";
|
||||
import { Button, buttonVariants } from "@/components/ui/button";
|
||||
import { ErrorNotice } from "@/components/ui/notice";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { DishForm, type DishFormValue } from "./dish-form";
|
||||
|
||||
// Kochbuchfoto → Entwurf. Das Bildmodell liest die Seite (app/api/dishes/photo-import),
|
||||
// die Person prüft und speichert. Das Foto selbst wird nicht aufbewahrt.
|
||||
/** Seiten je Rezept (26.11.48, Kai: „mehrere Seiten“). Der Server prüft dasselbe. */
|
||||
export const MAX_PAGES = 6;
|
||||
|
||||
type Page = { file: File; url: string };
|
||||
|
||||
// Kochbuchfoto → Entwurf. Das Bildmodell liest die Seiten (app/api/dishes/photo-import),
|
||||
// die Person prüft und speichert. Die Fotos selbst werden nicht aufbewahrt.
|
||||
// Seiten sammeln sich: Jede Aufnahme oder Auswahl kommt hinten dazu — am iPhone
|
||||
// liefert „Foto aufnehmen“ immer nur ein Bild.
|
||||
export function PhotoImport() {
|
||||
const t = useTranslations("dishes.photo");
|
||||
const [files, setFiles] = useState<File[]>([]);
|
||||
const [pages, setPages] = useState<Page[]>([]);
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [draft, setDraft] = useState<DishFormValue | null>(null);
|
||||
|
||||
// Vorschaubilder freigeben, wenn die Seite verlassen wird.
|
||||
useEffect(() => () => pages.forEach((p) => URL.revokeObjectURL(p.url)), []); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
|
||||
function add(list: FileList | null) {
|
||||
const files = Array.from(list ?? []);
|
||||
setPages((old) => [...old, ...files.slice(0, MAX_PAGES - old.length).map((file) => ({ file, url: URL.createObjectURL(file) }))]);
|
||||
setError(null);
|
||||
}
|
||||
|
||||
function remove(index: number) {
|
||||
setPages((old) => {
|
||||
URL.revokeObjectURL(old[index]!.url);
|
||||
return old.filter((_, i) => i !== index);
|
||||
});
|
||||
}
|
||||
|
||||
async function read(event: React.FormEvent) {
|
||||
event.preventDefault();
|
||||
if (!files.length) return;
|
||||
if (!pages.length) return;
|
||||
setBusy(true);
|
||||
setError(null);
|
||||
const body = new FormData();
|
||||
for (const f of files) body.append("photos", f);
|
||||
for (const p of pages) body.append("photos", p.file);
|
||||
const res = await fetch("/api/dishes/photo-import", { method: "POST", body });
|
||||
const data = await res.json().catch(() => ({}));
|
||||
setBusy(false);
|
||||
@@ -34,24 +58,65 @@ export function PhotoImport() {
|
||||
}
|
||||
|
||||
if (draft) return <DishForm initial={draft} />;
|
||||
const full = pages.length >= MAX_PAGES;
|
||||
return (
|
||||
<form onSubmit={read} className="flex flex-col gap-4">
|
||||
<label className="flex min-h-32 cursor-pointer flex-col items-center justify-center gap-2 rounded-2xl border border-dashed border-border p-6 text-center focus-within:ring-2 focus-within:ring-ring">
|
||||
<Camera aria-hidden className="size-8 text-accent" strokeWidth={1.5} />
|
||||
<span className="font-semibold">{files.length ? t("chosen", { n: files.length }) : t("choose")}</span>
|
||||
<span className="text-sm text-muted-foreground">{t("chooseHint")}</span>
|
||||
<input
|
||||
type="file"
|
||||
accept="image/*"
|
||||
capture="environment"
|
||||
multiple
|
||||
className="sr-only"
|
||||
aria-label={t("choose")}
|
||||
onChange={(e) => setFiles(Array.from(e.target.files ?? []).slice(0, 2))}
|
||||
/>
|
||||
</label>
|
||||
<input
|
||||
id="cookbook-pages"
|
||||
type="file"
|
||||
accept="image/*"
|
||||
multiple
|
||||
className="sr-only"
|
||||
aria-label={pages.length ? t("addPage") : t("choose")}
|
||||
disabled={full || busy}
|
||||
onChange={(e) => {
|
||||
add(e.target.files);
|
||||
e.target.value = ""; // dieselbe Datei darf noch einmal kommen
|
||||
}}
|
||||
/>
|
||||
{pages.length ? (
|
||||
<>
|
||||
<ol aria-label={t("chosen", { n: pages.length })} className="grid grid-cols-3 gap-3">
|
||||
{pages.map((p, i) => (
|
||||
<li key={p.url} className="relative overflow-hidden rounded-xl border border-border">
|
||||
{/* eslint-disable-next-line @next/next/no-img-element */}
|
||||
<img src={p.url} alt={t("page", { n: i + 1 })} className="aspect-[3/4] w-full object-cover" />
|
||||
<span className="absolute bottom-1 left-1 rounded-full bg-background/90 px-2 py-0.5 text-xs font-semibold">{t("page", { n: i + 1 })}</span>
|
||||
<button
|
||||
type="button"
|
||||
aria-label={t("removePage", { n: i + 1 })}
|
||||
disabled={busy}
|
||||
onClick={() => remove(i)}
|
||||
className="absolute right-0 top-0 flex size-11 items-center justify-center focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
||||
>
|
||||
<span className="flex size-8 items-center justify-center rounded-full bg-background/90">
|
||||
<X aria-hidden className="size-4" />
|
||||
</span>
|
||||
</button>
|
||||
</li>
|
||||
))}
|
||||
</ol>
|
||||
{full ? (
|
||||
<p className="text-sm text-muted-foreground">{t("full", { n: MAX_PAGES })}</p>
|
||||
) : (
|
||||
<label htmlFor="cookbook-pages" className={cn(buttonVariants({ variant: "outline" }), "cursor-pointer")}>
|
||||
<Plus aria-hidden />
|
||||
{t("addPage")}
|
||||
</label>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<label
|
||||
htmlFor="cookbook-pages"
|
||||
className="flex min-h-32 cursor-pointer flex-col items-center justify-center gap-2 rounded-2xl border border-dashed border-border p-6 text-center"
|
||||
>
|
||||
<Camera aria-hidden className="size-8 text-accent" strokeWidth={1.5} />
|
||||
<span className="font-semibold">{t("choose")}</span>
|
||||
<span className="text-sm text-muted-foreground">{t("chooseHint", { n: MAX_PAGES })}</span>
|
||||
</label>
|
||||
)}
|
||||
{error ? <ErrorNotice>{t(`errors.${error}`)}</ErrorNotice> : null}
|
||||
<Button type="submit" size="lg" disabled={busy || !files.length}>
|
||||
<Button type="submit" size="lg" disabled={busy || !pages.length}>
|
||||
{busy ? t("reading") : t("read")}
|
||||
</Button>
|
||||
{busy ? <p className="text-center text-sm text-muted-foreground">{t("readingHint")}</p> : null}
|
||||
|
||||
@@ -6,7 +6,7 @@ import { useState } from "react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { labelFor } from "@/lib/ingredient-name";
|
||||
import { SECTIONS, type Section } from "@/lib/recipe-style";
|
||||
import { scale, type BaseUnit, type KitchenUnit } from "@/lib/units";
|
||||
import { scale, type BaseUnit, type DisplayUnit } from "@/lib/units";
|
||||
import { useKitchenAmount } from "@/lib/use-kitchen-amount";
|
||||
|
||||
type Ingredient = {
|
||||
@@ -18,7 +18,7 @@ type Ingredient = {
|
||||
note: string | null;
|
||||
isStaple: boolean;
|
||||
product?: { name: string } | null;
|
||||
displayUnit?: KitchenUnit | null;
|
||||
displayUnit?: DisplayUnit | null;
|
||||
packSize?: number | null;
|
||||
};
|
||||
type Step = { section: Section; text: string; timerSeconds: number | null; ingredientIds: string[]; timerFrom?: string };
|
||||
|
||||
@@ -61,7 +61,7 @@ export function StarterPicker({ starters }: { starters: Starter[] }) {
|
||||
})}
|
||||
</ul>
|
||||
{error ? <ErrorNotice>{t("form.errors.unknown")}</ErrorNotice> : null}
|
||||
<div className="sticky bottom-[var(--nav-space)] z-10 bg-background/0 pb-2">
|
||||
<div className="kb-shift sticky bottom-[var(--nav-space)] z-10 bg-background/0 pb-2">
|
||||
<Button
|
||||
size="lg"
|
||||
className="w-full shadow-lg"
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
"use client";
|
||||
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useState } from "react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
|
||||
// Ein Gericht unter „Ausprobieren“ sagt das selbst (26.11.41, Kai: „neue Gerichte werden
|
||||
// nicht gespeichert“ — sie standen nur nicht im Pool). Mit einem Tipp in den Pool.
|
||||
export function TrialNote({ id, canWrite }: { id: string; canWrite: boolean }) {
|
||||
const t = useTranslations("dishes.detail");
|
||||
const router = useRouter();
|
||||
const [busy, setBusy] = useState(false);
|
||||
|
||||
async function toPool() {
|
||||
setBusy(true);
|
||||
const res = await fetch(`/api/dishes/${id}/pool`, { method: "POST" }).catch(() => null);
|
||||
setBusy(false);
|
||||
if (res?.ok) router.refresh();
|
||||
}
|
||||
|
||||
return (
|
||||
<div role="note" className="flex flex-col gap-3 rounded-xl border border-border px-4 py-3">
|
||||
<p className="text-sm">
|
||||
{t("inTrial")}{" "}
|
||||
<Link href="/gerichte?ansicht=ausprobieren" className="font-semibold underline underline-offset-4">
|
||||
{t("inTrialLink")}
|
||||
</Link>
|
||||
</p>
|
||||
{canWrite ? (
|
||||
<Button type="button" variant="outline" className="self-start" disabled={busy} onClick={toPool}>
|
||||
{t("toPool")}
|
||||
</Button>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
"use client";
|
||||
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useState } from "react";
|
||||
import { Button, buttonVariants } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import { ErrorNotice } from "@/components/ui/notice";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
async function call(method: string, body?: object) {
|
||||
const res = await fetch("/api/household/calendar", { method, headers: { "content-type": "application/json" }, body: body ? JSON.stringify(body) : undefined });
|
||||
return { ok: res.ok, data: await res.json().catch(() => ({})) };
|
||||
}
|
||||
|
||||
// Kalender abonnieren (26.11.45): Essenszeit, Link erzeugen, ersetzen, beenden.
|
||||
// Der Link steht nur einmal da — gespeichert ist nur sein Hash.
|
||||
export function CalendarSettings({ active, mealTime, mealMinutes, locked }: { active: boolean; mealTime: string; mealMinutes: number; locked: boolean }) {
|
||||
const t = useTranslations("more.calendar");
|
||||
const router = useRouter();
|
||||
const [time, setTime] = useState(mealTime);
|
||||
const [minutes, setMinutes] = useState(String(mealMinutes));
|
||||
const [url, setUrl] = useState<string | null>(null);
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [saved, setSaved] = useState(false);
|
||||
const [copied, setCopied] = useState(false);
|
||||
const [armed, setArmed] = useState(false);
|
||||
const [error, setError] = useState(false);
|
||||
|
||||
async function run(fn: () => Promise<{ ok: boolean; data: { url?: string } }>) {
|
||||
setBusy(true);
|
||||
setError(false);
|
||||
const r = await fn();
|
||||
setBusy(false);
|
||||
if (!r.ok) setError(true);
|
||||
else router.refresh();
|
||||
return r;
|
||||
}
|
||||
|
||||
if (locked) return <p className="rounded-xl border border-border px-4 py-3 text-sm">{t("locked")}</p>;
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-3">
|
||||
<p className="text-sm text-muted-foreground">{t("hint")}</p>
|
||||
<div className="flex items-end gap-3">
|
||||
<div className="flex flex-1 flex-col gap-2">
|
||||
<Label htmlFor="meal-time">{t("time")}</Label>
|
||||
<Input id="meal-time" type="time" value={time} onChange={(e) => (setTime(e.target.value), setSaved(false))} />
|
||||
</div>
|
||||
<div className="flex w-28 flex-col gap-2">
|
||||
<Label htmlFor="meal-minutes">{t("minutes")}</Label>
|
||||
<Input id="meal-minutes" type="number" inputMode="numeric" min={15} max={240} step={15} value={minutes} onChange={(e) => (setMinutes(e.target.value), setSaved(false))} />
|
||||
</div>
|
||||
</div>
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
disabled={busy}
|
||||
onClick={async () => {
|
||||
const r = await run(() => call("PATCH", { mealTime: time, mealMinutes: Number(minutes) }));
|
||||
setSaved(r.ok);
|
||||
}}
|
||||
>
|
||||
{saved ? t("saved") : t("saveTime")}
|
||||
</Button>
|
||||
|
||||
{url ? (
|
||||
<div className="flex flex-col gap-2 rounded-2xl bg-muted p-4">
|
||||
<p className="text-sm font-semibold">{t("linkOnce")}</p>
|
||||
<p data-testid="calendar-url" className="break-all font-mono text-sm">
|
||||
{url}
|
||||
</p>
|
||||
<div className="flex flex-wrap gap-2">
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
onClick={async () => {
|
||||
await navigator.clipboard?.writeText(url).catch(() => undefined);
|
||||
setCopied(true);
|
||||
}}
|
||||
>
|
||||
{copied ? t("copied") : t("copy")}
|
||||
</Button>
|
||||
<a href={url.replace(/^https?:/, "webcal:")} className={cn(buttonVariants({ variant: "default" }))}>
|
||||
{t("subscribe")}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<Button
|
||||
type="button"
|
||||
variant={active ? "outline" : "default"}
|
||||
disabled={busy}
|
||||
onClick={async () => {
|
||||
const r = await run(() => call("POST"));
|
||||
if (r.ok && r.data.url) {
|
||||
setUrl(r.data.url);
|
||||
setCopied(false);
|
||||
}
|
||||
}}
|
||||
>
|
||||
{active ? t("renew") : t("create")}
|
||||
</Button>
|
||||
{active ? <p className="text-sm text-muted-foreground">{t("renewHint")}</p> : null}
|
||||
{active ? (
|
||||
<Button
|
||||
type="button"
|
||||
variant={armed ? "default" : "ghost"}
|
||||
disabled={busy}
|
||||
onBlur={() => setArmed(false)}
|
||||
onClick={async () => {
|
||||
if (!armed) return setArmed(true);
|
||||
setArmed(false);
|
||||
const r = await run(() => call("DELETE"));
|
||||
if (r.ok) setUrl(null);
|
||||
}}
|
||||
>
|
||||
{armed ? t("confirmStop") : t("stop")}
|
||||
</Button>
|
||||
) : null}
|
||||
{error ? <ErrorNotice>{t("error")}</ErrorNotice> : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -27,6 +27,7 @@ export type Slot = {
|
||||
locked: boolean;
|
||||
cookedAt: string | null;
|
||||
reason: Reason | null;
|
||||
plannedDay: string | null;
|
||||
};
|
||||
type Member = { id: string; name: string };
|
||||
export type SlotCost = { perPortion: number | null; confidence: number; cls: "cheap" | "normal" | "expensive" | null };
|
||||
@@ -46,12 +47,14 @@ export function PlanBoard({
|
||||
dishes,
|
||||
status,
|
||||
money,
|
||||
startDay,
|
||||
}: {
|
||||
slots: Slot[];
|
||||
members: Member[];
|
||||
dishes: Dish[];
|
||||
status: string;
|
||||
money: Budget;
|
||||
startDay: string | null;
|
||||
}) {
|
||||
const t = useTranslations("plan");
|
||||
const tc = useTranslations("costs");
|
||||
@@ -150,8 +153,13 @@ export function PlanBoard({
|
||||
busy={busy}
|
||||
reason={reasonText(slot.reason)}
|
||||
cost={costLine(slot)}
|
||||
days={dayOptions(startDay, slot.plannedDay, locale)}
|
||||
onMove={(by) => move(index, by)}
|
||||
onChange={(change) => act("PATCH", "/api/plan/slots", { id: slot.id, ...change })}
|
||||
onChange={(change) => {
|
||||
// Sofort zeigen, was gewählt ist; der Server-Stand folgt mit refresh().
|
||||
setSlots((all) => all.map((s) => (s.id === slot.id ? { ...s, ...change } : s)));
|
||||
return act("PATCH", "/api/plan/slots", { id: slot.id, ...change });
|
||||
}}
|
||||
onRemove={() => act("DELETE", "/api/plan/slots", { id: slot.id })}
|
||||
onReplace={() => openPicker({ mode: "replace", slotId: slot.id })}
|
||||
/>
|
||||
@@ -186,7 +194,7 @@ export function PlanBoard({
|
||||
) : null}
|
||||
|
||||
{status === "open" && slots.length ? (
|
||||
<div className="sticky bottom-[var(--nav-space)] z-10 bg-background py-2">
|
||||
<div className="kb-shift sticky bottom-[var(--nav-space)] z-10 bg-background py-2">
|
||||
<Button type="button" size="lg" className="w-full" disabled={busy} onClick={() => act("POST", "/api/plan/approve")}>
|
||||
{t("approve")}
|
||||
</Button>
|
||||
@@ -226,6 +234,7 @@ function SlotCard({
|
||||
busy,
|
||||
reason,
|
||||
cost,
|
||||
days,
|
||||
onMove,
|
||||
onChange,
|
||||
onRemove,
|
||||
@@ -238,8 +247,9 @@ function SlotCard({
|
||||
busy: boolean;
|
||||
reason: string | null;
|
||||
cost: { text: string; dots: number } | null;
|
||||
days: { value: string; label: string }[];
|
||||
onMove: (by: number) => void;
|
||||
onChange: (change: object) => void;
|
||||
onChange: (change: Partial<Slot>) => void;
|
||||
onRemove: () => void;
|
||||
onReplace: () => void;
|
||||
}) {
|
||||
@@ -277,6 +287,7 @@ function SlotCard({
|
||||
<Confidence dots={cost.dots} label={tc(`confidence.${cost.dots}`)} />
|
||||
</p>
|
||||
) : null}
|
||||
{slot.plannedDay ? <p className="text-sm font-semibold">{days.find((d) => d.value === slot.plannedDay)?.label}</p> : null}
|
||||
{cooked ? <p className="text-sm font-semibold text-accent">{t("cooked")}</p> : null}
|
||||
</div>
|
||||
</div>
|
||||
@@ -305,6 +316,20 @@ function SlotCard({
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<select
|
||||
aria-label={t("day", { title: slot.title ?? "" })}
|
||||
value={slot.plannedDay ?? ""}
|
||||
disabled={busy}
|
||||
onChange={(e) => onChange({ plannedDay: e.target.value || null })}
|
||||
className="min-h-11 w-full rounded-xl border border-border bg-background px-3 text-base"
|
||||
>
|
||||
<option value="">{t("noDay")}</option>
|
||||
{days.map((d) => (
|
||||
<option key={d.value} value={d.value}>
|
||||
{d.label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<div className="flex w-full items-center justify-between gap-1">
|
||||
<div className="flex gap-1">
|
||||
<Button type="button" variant="ghost" size="icon" aria-label={t("up", { title: slot.title ?? "" })} disabled={busy || index === 0} onClick={() => onMove(-1)}>
|
||||
@@ -341,6 +366,23 @@ function SlotCard({
|
||||
);
|
||||
}
|
||||
|
||||
// Tage zur Wahl (26.11.45, nur von Hand): 14 ab dem Einkaufstag, ohne ihn ab heute.
|
||||
// Ein schon gesetzter Tag außerhalb bleibt wählbar.
|
||||
export function dayOptions(start: string | null, current: string | null, locale: string): { value: string; label: string }[] {
|
||||
const fmt = new Intl.DateTimeFormat(locale, { weekday: "short", day: "numeric", month: "short" });
|
||||
const iso = (d: Date) => `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
|
||||
const first = start ? new Date(`${start}T12:00:00`) : new Date();
|
||||
first.setHours(12, 0, 0, 0);
|
||||
const out: { value: string; label: string }[] = [];
|
||||
for (let i = 0; i < 14; i++) {
|
||||
const d = new Date(first);
|
||||
d.setDate(first.getDate() + i);
|
||||
out.push({ value: iso(d), label: fmt.format(d) });
|
||||
}
|
||||
if (current && !out.some((o) => o.value === current)) out.unshift({ value: current, label: fmt.format(new Date(`${current}T12:00:00`)) });
|
||||
return out;
|
||||
}
|
||||
|
||||
function DishPicker({ title, dishes, onPick, onClose }: { title: string; dishes: Dish[]; onPick: (id: string) => void; onClose: () => void }) {
|
||||
const t = useTranslations("plan");
|
||||
const [query, setQuery] = useState("");
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
"use client";
|
||||
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useState } from "react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { ErrorNotice } from "@/components/ui/notice";
|
||||
import { RoundForm } from "@/components/wishes/round-form";
|
||||
|
||||
type Current = { shoppingDate: string | null; slotsCount: number; defaultPortions: number };
|
||||
|
||||
// Runde bearbeiten, beenden, löschen (Kai, 8.11.2026, 26.11.45). Beenden und
|
||||
// Löschen fragen im Knopf selbst nach, wie RemoveButton.
|
||||
export function RoundActions({ current, canDelete }: { current: Current; canDelete: boolean }) {
|
||||
const t = useTranslations("plan.round");
|
||||
const router = useRouter();
|
||||
const [editing, setEditing] = useState(false);
|
||||
const [armed, setArmed] = useState<"end" | "delete" | null>(null);
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
async function run(kind: "end" | "delete") {
|
||||
if (armed !== kind) return setArmed(kind);
|
||||
setBusy(true);
|
||||
setError(null);
|
||||
const res = await fetch(`/api/rounds/${kind}`, { method: "POST" });
|
||||
const data = await res.json().catch(() => ({}));
|
||||
setBusy(false);
|
||||
setArmed(null);
|
||||
if (res.ok) {
|
||||
router.push("/plan");
|
||||
router.refresh();
|
||||
} else setError(data.error === "cooked" ? "cooked" : "unknown");
|
||||
}
|
||||
|
||||
return (
|
||||
<section aria-labelledby="round-actions" className="flex flex-col gap-3 rounded-2xl border border-border p-4">
|
||||
<h2 id="round-actions" className="eyebrow">
|
||||
{t("title")}
|
||||
</h2>
|
||||
{editing ? (
|
||||
<RoundForm defaultPortions={current.defaultPortions} current={current} onDone={() => setEditing(false)} />
|
||||
) : (
|
||||
<Button type="button" variant="outline" onClick={() => setEditing(true)}>
|
||||
{t("edit")}
|
||||
</Button>
|
||||
)}
|
||||
{editing ? (
|
||||
<Button type="button" variant="ghost" onClick={() => setEditing(false)}>
|
||||
{t("cancel")}
|
||||
</Button>
|
||||
) : null}
|
||||
<Button type="button" variant={armed === "end" ? "default" : "outline"} disabled={busy} onBlur={() => setArmed(null)} onClick={() => run("end")}>
|
||||
{armed === "end" ? t("confirmEnd") : t("end")}
|
||||
</Button>
|
||||
<p className="text-sm text-muted-foreground">{t("endHint")}</p>
|
||||
{canDelete ? (
|
||||
<Button type="button" variant={armed === "delete" ? "default" : "ghost"} disabled={busy} onBlur={() => setArmed(null)} onClick={() => run("delete")}>
|
||||
{armed === "delete" ? t("confirmDelete") : t("delete")}
|
||||
</Button>
|
||||
) : null}
|
||||
{error ? <ErrorNotice>{t(`errors.${error}`)}</ErrorNotice> : null}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -281,7 +281,7 @@ export function ReceiptReview({ receipt }: { receipt: Receipt }) {
|
||||
{done ? (
|
||||
<p className="text-sm text-muted-foreground">{t("doneText")}</p>
|
||||
) : (
|
||||
<div className="sticky bottom-[var(--nav-space)] z-10 flex gap-2 bg-background py-2">
|
||||
<div className="kb-shift sticky bottom-[var(--nav-space)] z-10 flex gap-2 bg-background py-2">
|
||||
<Button type="button" variant="outline" disabled={busy} onClick={remove} aria-label={t("delete")}>
|
||||
<Trash2 aria-hidden />
|
||||
</Button>
|
||||
|
||||
@@ -5,6 +5,7 @@ import { useLocale, useTranslations } from "next-intl";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { VoiceAdd } from "@/components/shopping/voice-add";
|
||||
import { formatQuantity, type PackKind } from "@/lib/units";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
@@ -46,7 +47,7 @@ function writeQueue(ops: Op[]) {
|
||||
// Einkaufsliste (Konzept, „Einkaufen“): große Haken, nach Gängen des Hauptladens,
|
||||
// in Echtzeit bei allen (SSE), und ohne Netz bedienbar — Haken landen in einer
|
||||
// Warteschlange im Browser und gehen raus, sobald wieder Netz da ist.
|
||||
export function ShoppingList({ initial, aisles, me }: { initial: Item[]; aisles: Aisle[]; me: string }) {
|
||||
export function ShoppingList({ initial, aisles, me, canRecord = false }: { initial: Item[]; aisles: Aisle[]; me: string; canRecord?: boolean }) {
|
||||
const t = useTranslations("shopping");
|
||||
const tm = useTranslations("measure");
|
||||
const locale = useLocale();
|
||||
@@ -131,6 +132,7 @@ export function ShoppingList({ initial, aisles, me }: { initial: Item[]; aisles:
|
||||
async function send(method: string, url: string, body: object) {
|
||||
const res = await fetch(url, { method, headers: { "content-type": "application/json" }, body: JSON.stringify(body) }).catch(() => null);
|
||||
if (res?.ok) await reload();
|
||||
return !!res?.ok;
|
||||
}
|
||||
|
||||
const amount = (i: Item) => {
|
||||
@@ -212,6 +214,7 @@ export function ShoppingList({ initial, aisles, me }: { initial: Item[]; aisles:
|
||||
<Plus aria-hidden />
|
||||
</Button>
|
||||
</form>
|
||||
{canRecord ? <VoiceAdd onAdd={(labels) => send("POST", "/api/shopping/items", { labels })} /> : null}
|
||||
|
||||
{done.length ? (
|
||||
<section className="flex flex-col gap-1" aria-labelledby="cart-title">
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
"use client";
|
||||
|
||||
import { Mic, Square, X } from "lucide-react";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useState } from "react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { ErrorNotice } from "@/components/ui/notice";
|
||||
import { useRecorder } from "@/lib/use-recorder";
|
||||
|
||||
const mmss = (s: number) => `${Math.floor(s / 60)}:${String(s % 60).padStart(2, "0")}`;
|
||||
|
||||
// Einkaufsliste einsprechen (Kai, 8.11.2026, 26.11.46): aufnehmen, Abschrift in
|
||||
// Posten zerlegen (lib/spoken-list.ts), prüfen und ändern, dann hinzufügen.
|
||||
export function VoiceAdd({ onAdd }: { onAdd: (labels: string[]) => Promise<boolean> }) {
|
||||
const t = useTranslations("shopping.voice");
|
||||
const [busy, setBusy] = useState<"transcribe" | "add" | null>(null);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [items, setItems] = useState<string[] | null>(null);
|
||||
const rec = useRecorder(upload);
|
||||
|
||||
async function upload(audio: Blob) {
|
||||
setBusy("transcribe");
|
||||
const form = new FormData();
|
||||
form.append("audio", new File([audio], "aufnahme", { type: audio.type }));
|
||||
const res = await fetch("/api/shopping/voice", { method: "POST", body: form }).catch(() => null);
|
||||
const data = await res?.json().catch(() => ({}));
|
||||
setBusy(null);
|
||||
if (!res?.ok) return setError(["noSpeech", "aiUnavailable", "empty", "audio"].includes(data?.error) ? data.error : "unknown");
|
||||
if (!data.items?.length) return setError("empty");
|
||||
setItems(data.items);
|
||||
}
|
||||
|
||||
async function add() {
|
||||
const labels = (items ?? []).map((i) => i.trim()).filter(Boolean);
|
||||
if (!labels.length) return;
|
||||
setBusy("add");
|
||||
const ok = await onAdd(labels);
|
||||
setBusy(null);
|
||||
if (ok) setItems(null);
|
||||
else setError("unknown");
|
||||
}
|
||||
|
||||
const filled = (items ?? []).filter((i) => i.trim()).length;
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-3">
|
||||
<div className="flex items-center gap-3">
|
||||
<Button
|
||||
type="button"
|
||||
variant={rec.recording ? "default" : "outline"}
|
||||
size="icon"
|
||||
disabled={busy !== null || items !== null}
|
||||
aria-label={rec.recording ? t("stop") : t("record")}
|
||||
onClick={async () => {
|
||||
setError(null);
|
||||
if (rec.recording) rec.stop();
|
||||
else if (!(await rec.start())) setError("mic");
|
||||
}}
|
||||
>
|
||||
{rec.recording ? <Square aria-hidden /> : <Mic aria-hidden />}
|
||||
</Button>
|
||||
<p aria-live="polite" className="text-sm text-muted-foreground">
|
||||
{rec.recording ? t("recording", { time: mmss(rec.seconds) }) : busy === "transcribe" ? t("transcribing") : items ? null : t("hint")}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{items ? (
|
||||
<section aria-labelledby="voice-items" className="flex flex-col gap-2 rounded-2xl bg-muted p-4">
|
||||
<h2 id="voice-items" className="eyebrow">
|
||||
{t("check")}
|
||||
</h2>
|
||||
<ul className="flex flex-col gap-2">
|
||||
{items.map((item, i) => (
|
||||
<li key={i} className="flex items-center gap-2">
|
||||
<Input
|
||||
aria-label={t("item", { n: i + 1 })}
|
||||
value={item}
|
||||
maxLength={80}
|
||||
onChange={(e) => setItems((all) => all!.map((x, j) => (j === i ? e.target.value : x)))}
|
||||
/>
|
||||
<Button type="button" variant="ghost" size="icon" aria-label={t("drop", { name: item })} onClick={() => setItems((all) => all!.filter((_, j) => j !== i))}>
|
||||
<X aria-hidden />
|
||||
</Button>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
<Button type="button" disabled={busy !== null || !filled} onClick={add}>
|
||||
{t("add", { n: filled })}
|
||||
</Button>
|
||||
<Button type="button" variant="ghost" disabled={busy !== null} onClick={() => setItems(null)}>
|
||||
{t("discard")}
|
||||
</Button>
|
||||
</section>
|
||||
) : null}
|
||||
{error ? <ErrorNotice>{t(`errors.${error}`)}</ErrorNotice> : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -36,12 +36,21 @@ function Stepper({ id, value, min, max, onChange, label }: { id: string; value:
|
||||
);
|
||||
}
|
||||
|
||||
export function RoundForm({ defaultPortions }: { defaultPortions: number }) {
|
||||
// Mit `current` ändert das Formular die laufende Runde (26.11.45), sonst eröffnet es eine.
|
||||
export function RoundForm({
|
||||
defaultPortions,
|
||||
current,
|
||||
onDone,
|
||||
}: {
|
||||
defaultPortions: number;
|
||||
current?: { shoppingDate: string | null; slotsCount: number; defaultPortions: number };
|
||||
onDone?: () => void;
|
||||
}) {
|
||||
const t = useTranslations("round");
|
||||
const router = useRouter();
|
||||
const [date, setDate] = useState(nextSaturday);
|
||||
const [slots, setSlots] = useState(5);
|
||||
const [portions, setPortions] = useState(defaultPortions);
|
||||
const [date, setDate] = useState(() => (current ? current.shoppingDate ?? "" : nextSaturday()));
|
||||
const [slots, setSlots] = useState(current?.slotsCount ?? 5);
|
||||
const [portions, setPortions] = useState(current?.defaultPortions ?? defaultPortions);
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
@@ -50,13 +59,16 @@ export function RoundForm({ defaultPortions }: { defaultPortions: number }) {
|
||||
setBusy(true);
|
||||
setError(null);
|
||||
const res = await fetch("/api/rounds", {
|
||||
method: "POST",
|
||||
method: current ? "PATCH" : "POST",
|
||||
headers: { "content-type": "application/json" },
|
||||
body: JSON.stringify({ shoppingDate: date || null, slotsCount: slots, defaultPortions: portions }),
|
||||
});
|
||||
const data = await res.json().catch(() => ({}));
|
||||
setBusy(false);
|
||||
if (res.ok) {
|
||||
if (res.ok && current) {
|
||||
onDone?.();
|
||||
router.refresh();
|
||||
} else if (res.ok) {
|
||||
router.push("/");
|
||||
router.refresh();
|
||||
} else setError(data.error === "roundExists" ? "roundExists" : "unknown");
|
||||
@@ -70,10 +82,10 @@ export function RoundForm({ defaultPortions }: { defaultPortions: number }) {
|
||||
</div>
|
||||
<Stepper id="slots" label={t("slots")} value={slots} min={1} max={14} onChange={setSlots} />
|
||||
<Stepper id="portions" label={t("portions")} value={portions} min={1} max={30} onChange={setPortions} />
|
||||
<p className="text-sm text-muted-foreground">{t("hint")}</p>
|
||||
{current ? null : <p className="text-sm text-muted-foreground">{t("hint")}</p>}
|
||||
{error ? <ErrorNotice>{t(`errors.${error}`)}</ErrorNotice> : null}
|
||||
<Button type="submit" size="lg" disabled={busy}>
|
||||
{t("submit")}
|
||||
{current ? t("save") : t("submit")}
|
||||
</Button>
|
||||
</form>
|
||||
);
|
||||
|
||||
@@ -97,7 +97,6 @@ export function WishBoard({
|
||||
const mineOf = (id: string) => (byDish.get(id) ?? []).filter((e) => e.isMine);
|
||||
const myDish = entries.find((e) => e.memberId === me && e.isMine);
|
||||
const myDishTitle = myDish ? tiles.find((x) => x.id === myDish.dishId)?.title : null;
|
||||
const wishedSomething = entries.some((e) => e.memberId === me && !e.isVeto);
|
||||
const shown = applyFilter(tiles, filter);
|
||||
|
||||
async function call(method: string, url: string, body?: object, key = "x") {
|
||||
@@ -174,12 +173,12 @@ export function WishBoard({
|
||||
<Heart aria-hidden className="size-4 shrink-0 fill-accent text-accent" />
|
||||
{t("mineChosen", { title: myDishTitle })}
|
||||
</p>
|
||||
) : wishedSomething ? (
|
||||
) : (
|
||||
<p className="flex items-center gap-2 text-sm text-muted-foreground">
|
||||
<Heart aria-hidden className="size-4 shrink-0" />
|
||||
{t("mineHint")}
|
||||
</p>
|
||||
) : null}
|
||||
)}
|
||||
|
||||
{error ? <ErrorNotice>{t(`errors.${error}`)}</ErrorNotice> : null}
|
||||
{message ? (
|
||||
@@ -218,12 +217,6 @@ export function WishBoard({
|
||||
<Check aria-hidden className="size-5" />
|
||||
</span>
|
||||
) : null}
|
||||
{mineNames.length ? (
|
||||
<span aria-hidden className="absolute right-2 top-2 inline-flex items-center gap-1 rounded-full bg-background/90 px-2 py-1 text-xs font-semibold">
|
||||
<Heart aria-hidden className={cn("size-4 text-accent", isMyDish && "fill-accent")} />
|
||||
{isMyDish ? t("mine") : t("mineOf", { names: mineNames.filter((n) => n !== t("you")).join(", ") })}
|
||||
</span>
|
||||
) : null}
|
||||
{favorite ? (
|
||||
<span aria-hidden className="absolute bottom-2 left-2 inline-flex items-center gap-1 rounded-full bg-background/90 px-2 py-1 text-xs font-semibold">
|
||||
<Crown aria-hidden className="size-4 text-accent" />
|
||||
@@ -234,7 +227,12 @@ export function WishBoard({
|
||||
<span className="flex min-h-11 flex-col gap-0.5 p-3 pr-12">
|
||||
<span className="font-semibold text-lg leading-snug">{tile.title}</span>
|
||||
{favorite ? <span className="sr-only">{t("favorite")}</span> : null}
|
||||
{mineNames.length ? <span className="sr-only">{isMyDish ? t("mine") : t("mineOf", { names: mineNames.join(", ") })}</span> : null}
|
||||
{mineNames.length ? (
|
||||
<span className="inline-flex items-center gap-1 text-xs font-semibold">
|
||||
<Heart aria-hidden className={cn("size-3.5 shrink-0 text-accent", isMyDish && "fill-accent")} />
|
||||
{isMyDish ? t("mine") : t("mineOf", { names: mineNames.filter((n) => n !== t("you")).join(", ") })}
|
||||
</span>
|
||||
) : null}
|
||||
{names.length ? <span className="text-xs text-muted-foreground">{t("wishedBy", { names: names.join(", ") })}</span> : null}
|
||||
{vetoList.length && !mineNames.length ? (
|
||||
<span className="inline-flex items-center gap-1 text-xs text-muted-foreground">
|
||||
@@ -244,6 +242,22 @@ export function WishBoard({
|
||||
) : null}
|
||||
</span>
|
||||
</button>
|
||||
{/* Herz (Kai, 8.11.2026, 26.11.47): ein Tipp macht das Gericht zu meinem —
|
||||
noch nicht gewünscht, wird es dabei gewünscht (ein Jeton). */}
|
||||
{own?.isVeto || own?.viaVeto ? null : (
|
||||
<button
|
||||
type="button"
|
||||
aria-pressed={isMyDish}
|
||||
aria-label={isMyDish ? t("mineUntoggle", { title: tile.title }) : t("mineToggle", { title: tile.title })}
|
||||
disabled={!!busy}
|
||||
onClick={() => call("POST", "/api/wishes/mine", isMyDish ? { dishId: tile.id, mine: false } : { dishId: tile.id, mine: true, wish: true }, tile.id)}
|
||||
className="absolute right-1 top-1 flex size-11 items-center justify-center rounded-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
||||
>
|
||||
<span className="flex size-9 items-center justify-center rounded-full bg-background/90 shadow-sm">
|
||||
<Heart aria-hidden className={cn("size-5", isMyDish ? "fill-accent text-accent" : "text-foreground")} />
|
||||
</span>
|
||||
</button>
|
||||
)}
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
-- Kalender-Abo (Kai, 8.11.2026, 26.11.45): ein Link je Haushalt, gespeichert nur
|
||||
-- sein Hash. Die Gerichte erscheinen an ihrem Tag (slots.planned_day, von Hand)
|
||||
-- zur Essenszeit des Haushalts.
|
||||
|
||||
alter table households add column calendar_token_hash bytea unique;
|
||||
alter table households add column meal_time time not null default '18:30';
|
||||
alter table households add column meal_minutes integer not null default 60 check (meal_minutes between 15 and 240);
|
||||
alter table households add column calendar_locale text not null default 'de' check (calendar_locale in ('de', 'en', 'fr', 'es'));
|
||||
@@ -0,0 +1,38 @@
|
||||
-- Rezept bearbeiten (Kai, 8.11.2026, 26.11.49).
|
||||
--
|
||||
-- 1. Ein Gericht merkt sich, für wie viele Portionen es eingegeben wurde. Bearbeiten
|
||||
-- zeigt die Mengen dann wieder so („500 g für 6“), statt immer für vier.
|
||||
-- 2. Mehr Maße: Tasse, Schuss, Messerspitze (fest), Becher, Stück, Würfel, Zehe,
|
||||
-- Scheibe (mit Größe je Zutat). Die Größen eines Haushalts gelten jetzt je
|
||||
-- Zutat und Maß: „1 Packung Hackfleisch = 500 g“, „1 Zehe Knoblauch = 3 g“.
|
||||
|
||||
alter table dishes add column recipe_portions integer check (recipe_portions between 1 and 30);
|
||||
|
||||
alter table ingredients drop constraint ingredients_kitchen_unit_check;
|
||||
alter table ingredients add constraint ingredients_kitchen_unit_check check (kitchen_unit in
|
||||
('tbsp', 'tsp', 'pinch', 'cup', 'dash', 'knifepoint', 'can', 'jar', 'pack', 'tub', 'bunch', 'piece', 'cube', 'clove', 'slice'));
|
||||
alter table ingredients drop constraint ingredients_pack_kind_check;
|
||||
alter table ingredients add constraint ingredients_pack_kind_check check (pack_kind in ('can', 'jar', 'pack', 'tub', 'bunch'));
|
||||
|
||||
alter table dish_ingredients drop constraint dish_ingredients_display_unit_check;
|
||||
alter table dish_ingredients add constraint dish_ingredients_display_unit_check check (display_unit in
|
||||
('tbsp', 'tsp', 'pinch', 'cup', 'dash', 'knifepoint', 'can', 'jar', 'pack', 'tub', 'bunch', 'piece', 'cube', 'clove', 'slice'));
|
||||
|
||||
alter table shopping_items drop constraint shopping_items_pack_kind_check;
|
||||
alter table shopping_items add constraint shopping_items_pack_kind_check check (pack_kind in ('can', 'jar', 'pack', 'tub', 'bunch'));
|
||||
|
||||
-- Größen je Zutat und Maß. Bisherige Zeilen galten dem Gebinde der Zutat.
|
||||
-- Unter FORCE sähe dieses Update keine Zeile (kein Haushalt gesetzt) — für die Dauer
|
||||
-- der Migration (eine Transaktion, scripts/migrate.mjs) ohne FORCE, danach wieder mit.
|
||||
alter table household_pack_sizes add column unit text;
|
||||
alter table household_pack_sizes no force row level security;
|
||||
alter table ingredients no force row level security;
|
||||
update household_pack_sizes h set unit = i.pack_kind from ingredients i where i.id = h.ingredient_id;
|
||||
delete from household_pack_sizes where unit is null;
|
||||
alter table ingredients force row level security;
|
||||
alter table household_pack_sizes force row level security;
|
||||
alter table household_pack_sizes alter column unit set not null;
|
||||
alter table household_pack_sizes add constraint household_pack_sizes_unit_check check (unit in
|
||||
('can', 'jar', 'pack', 'tub', 'bunch', 'piece', 'cube', 'clove', 'slice'));
|
||||
alter table household_pack_sizes drop constraint household_pack_sizes_pkey;
|
||||
alter table household_pack_sizes add primary key (household_id, ingredient_id, unit);
|
||||
@@ -0,0 +1,13 @@
|
||||
-- Milliliter und Liter überall (Kai, 8.11.2026, 26.11.50): auch bei Stück-Zutaten
|
||||
-- („750 ml Brühe“ aus Brühwürfeln). Die Größe steht dann als ml bzw. g je Stück
|
||||
-- unter dem Maß „ml“ bzw. „g“; kg und l nutzen sie mit. Das Rezept merkt sich das
|
||||
-- eingegebene Maß auch, wenn es Gewicht oder Volumen ist („200 ml“ Joghurt).
|
||||
|
||||
alter table household_pack_sizes drop constraint household_pack_sizes_unit_check;
|
||||
alter table household_pack_sizes add constraint household_pack_sizes_unit_check check (unit in
|
||||
('can', 'jar', 'pack', 'tub', 'bunch', 'piece', 'cube', 'clove', 'slice', 'g', 'ml'));
|
||||
|
||||
alter table dish_ingredients drop constraint dish_ingredients_display_unit_check;
|
||||
alter table dish_ingredients add constraint dish_ingredients_display_unit_check check (display_unit in
|
||||
('tbsp', 'tsp', 'pinch', 'cup', 'dash', 'knifepoint', 'can', 'jar', 'pack', 'tub', 'bunch', 'piece', 'cube', 'clove', 'slice',
|
||||
'g', 'kg', 'ml', 'l'));
|
||||
@@ -177,7 +177,7 @@ acht Paletten Variante H gewählt). Löst die Palette aus E-0002 ab; der Rest vo
|
||||
- **Schrift:** ~~Überschriften in Newsreader, Text in Geist~~ — seit 26.11.37 Poppins
|
||||
überall (E-0014).
|
||||
- **Abschnitte** ohne Kasten, getrennt durch feine Linien.
|
||||
- **Symbol:** Teller mit Dampf auf Coral, Blatt in Lavendel (`docs/icon/lunch.svg`).
|
||||
- **Symbol:** Kochmütze mit Herz auf Coral (seit 26.11.42, Kai: Entwurf a; vorher Teller mit Dampf und Lavendel-Blatt), `docs/icon/lunch.svg`.
|
||||
- **Kontrast** jeder Schrift auf ihrer Fläche mindestens 4,5:1, hell und dunkel —
|
||||
`tests/contrast.test.ts` rechnet ihn aus den Token.
|
||||
|
||||
@@ -335,3 +335,79 @@ Das prüft `noMailSession` in `lib/auth/guard.ts`. Mail-Sitzungen gelten 30 Tage
|
||||
statt 180. Adresse entfernen oder ändern beendet sie.
|
||||
|
||||
Sicherheitsprüfung: `docs/sicherheit/login-2026-11-07.md`.
|
||||
|
||||
## E-0018 · Runde beenden, Tage von Hand, Kalender-Abo je Haushalt
|
||||
|
||||
*8.11.2026 · Kai („Ich möchte einen Plan löschen können und bearbeiten … die
|
||||
Gerichte auf Wochentage verteilen … und diesen Kalender abonnieren“).*
|
||||
|
||||
**Runde:** Bis 26.11.44 endete eine Runde nur, wenn alles gekocht war; wer
|
||||
etwas ausließ, kam nie zur nächsten. Jetzt steht unter dem Plan der Abschnitt
|
||||
„Runde“:
|
||||
- **Einstellungen ändern:** Einkaufstag, Zahl der Mahlzeiten, Portionen.
|
||||
Vorhandene Gerichte bleiben, die Einkaufsliste rechnet sich neu.
|
||||
- **Runde beenden:** Gekochtes und Bewertungen bleiben Geschichte, Ungekochtes
|
||||
verfällt. Danach „Runde eröffnen“.
|
||||
- **Runde löschen:** nur solange nichts gekocht ist, damit keine Bewertung
|
||||
verloren geht. Wünsche, Plan und Einkaufsliste gehen mit.
|
||||
- Beenden und Löschen fragen im Knopf selbst nach (zweiter Tipp).
|
||||
- Eine beendete Runde wieder öffnen gibt es nicht (Kai).
|
||||
|
||||
**Tage:** nur von Hand, kein Vorschlag (Kai). Je Gericht eine Auswahl mit
|
||||
14 Tagen ab dem Einkaufstag; „Ohne Tag“ bleibt der Normalfall. Der Tag steht auf
|
||||
der Plankarte, auf „Heute“ und im Küchendisplay. Ein Tag darf mehrere Gerichte
|
||||
haben.
|
||||
|
||||
**Kalender:** ein Link je Haushalt (Kai), mit Uhrzeit (Kai): die Essenszeit des
|
||||
Haushalts, Vorgabe 18:30, eine Stunde.
|
||||
- Öffentlich unter `/kalender/<token>.ics`, iCalendar mit `TZID=Europe/Berlin`.
|
||||
- Gespeichert ist nur der Hash des Tokens; den Link sieht die Person einmal.
|
||||
„Neuen Link erzeugen“ macht den alten ungültig, „Abo beenden“ ebenso.
|
||||
- Nur Admins, nie aus einer Mail-Sitzung — der Link zeigt den Plan jedem, der
|
||||
ihn hat.
|
||||
- Inhalt: Titel, Tag, Koch, Portionen und ein Link zum Gericht. Keine Zutaten,
|
||||
keine Wünsche.
|
||||
- Fehlversuche bremsen je Adresse und gemeinsam; gültige Abrufe zählen nicht,
|
||||
weil Kalender stündlich nachfragen.
|
||||
|
||||
**Nachtrag 26.11.46 · Einkaufsliste einsprechen** (Kai, 8.11.2026): Neben dem
|
||||
Freitextfeld der Einkaufsliste steht ein Mikrofon, sobald ein Sprachmodell
|
||||
eingerichtet ist (dasselbe wie bei „Gericht einsprechen“). Die Abschrift zerlegt
|
||||
`lib/spoken-list.ts` ohne Sprachmodell in Posten (Komma, „und“, Satzende;
|
||||
Füllwörter wie „wir brauchen noch“, „bitte“ fallen weg). Die Person prüft und
|
||||
ändert die Posten, erst dann kommen sie unter „Sonstiges“ auf die Liste. Die
|
||||
Aufnahme wird nicht gespeichert.
|
||||
|
||||
**Nachtrag 26.11.47 · „Mein Gericht“ per Herz** (Kai, 8.11.2026, „Jede Karte“):
|
||||
Jede Wunschkarte trägt oben rechts ein Herz — Herz, nicht Stern, weil das Herz
|
||||
schon „Mein Gericht“ heißt und ein Stern nach Bewertung aussähe. Ein Tipp aufs
|
||||
leere Herz wünscht das Gericht (ein Jeton) und macht es zu meinem, in einer
|
||||
Transaktion (`setMine` mit `wishIn`): ohne Jeton entsteht nichts. Gefüllt
|
||||
nimmt ein Tipp es zurück, der Wunsch bleibt. Eins pro Runde, ein neues ersetzt
|
||||
das alte. Kein Herz an eigenen Vetos und an Wünschen aus einem Veto. Der Weg
|
||||
über „…“ bleibt.
|
||||
|
||||
**Nachtrag 26.11.49 · Portionen und mehr Maße** (Kai, 8.11.2026: „Mengen, Einheiten
|
||||
und Portionen kann ich nicht sauber eingeben“):
|
||||
- Ein Gericht merkt sich, für wie viele Portionen es eingegeben wurde
|
||||
(`dishes.recipe_portions`). Bearbeiten zeigt die Mengen wieder so, lesbar gerundet
|
||||
(`niceQty`), statt immer für vier.
|
||||
- Portionen umstellen rechnet die Mengen mit (Kai: „Mengen rechnen mit“), immer vom
|
||||
Stand beim Betreten des Feldes aus.
|
||||
- Feste Maße kommen dazu: Tasse, Schuss, Messerspitze.
|
||||
- Zählmaße gelten für jede Zutat: Dose, Glas, Packung, Becher, Bund, Stück, Würfel,
|
||||
Zehe, Scheibe. Ihre Größe kennt der Haushalt je Zutat und Maß
|
||||
(`household_pack_sizes.unit`), sonst das Gebinde der Zutat. Würfel, Zehe und
|
||||
Scheibe einer Stück-Zutat sind je ein Stück.
|
||||
- Fehlt eine Größe, fragt das Formular („Wie viel ist 1 Packung? (in g)“) und merkt
|
||||
sie sich. Gerechnet wird nie ohne sie.
|
||||
- Die Migration nimmt FORCE für die Dauer des Daten-Updates von
|
||||
`household_pack_sizes` und `ingredients`. Abzüge von vorher bekommen beim
|
||||
Zurückspielen das Maß aus dem Gebinde der Zutat.
|
||||
|
||||
**Nachtrag 26.11.50 · Milliliter und Liter überall** (Kai, 8.11.2026, „auch bei
|
||||
Stück-Zutaten“): Gramm-Zutaten nehmen auch ml und l, Flüssiges auch g und kg (1 zu 1,
|
||||
wie beim Löffel). Stück-Zutaten nehmen g, kg, ml und l mit einer Größe je Stück
|
||||
(„1 Brühwürfel = 500 ml“), gespeichert unter dem Maß `g` bzw. `ml` in
|
||||
`household_pack_sizes` (Migration 0027). Das Rezept zeigt das eingegebene Maß
|
||||
(„750 ml (1½ Stück)“), die Einkaufsliste weiter Stück.
|
||||
@@ -1,15 +1,8 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
||||
<rect width="512" height="512" rx="112" fill="#f39380"/>
|
||||
<!-- Teller -->
|
||||
<circle cx="256" cy="292" r="142" fill="#fefdff"/>
|
||||
<circle cx="256" cy="292" r="98" fill="none" stroke="#e7e1f6" stroke-width="14"/>
|
||||
<!-- Dampf -->
|
||||
<g fill="none" stroke="#fefdff" stroke-width="18" stroke-linecap="round">
|
||||
<path d="M206 78c-16 18 16 30 0 48"/>
|
||||
<path d="M256 64c-16 20 16 34 0 54"/>
|
||||
<path d="M306 78c-16 18 16 30 0 48"/>
|
||||
</g>
|
||||
<!-- Salbeiblatt -->
|
||||
<path d="M206 316c20-62 86-82 116-72-6 52-58 98-116 72z" fill="#7761b0"/>
|
||||
<path d="M214 312c30-24 58-42 96-62" stroke="#fefdff" stroke-width="7" stroke-linecap="round" fill="none"/>
|
||||
</svg>
|
||||
<!-- foodplanhero (Kai, 7.11.2026, 26.11.42): Kochmütze mit Herz, für Maike. Koralle wie bisher. --><rect width="512" height="512" rx="112" fill="#f39380"/><g>
|
||||
<circle cx="178" cy="214" r="70" fill="#fefdff"/>
|
||||
<circle cx="256" cy="176" r="86" fill="#fefdff"/>
|
||||
<circle cx="334" cy="214" r="70" fill="#fefdff"/>
|
||||
<rect x="158" y="210" width="196" height="132" fill="#fefdff"/>
|
||||
<rect x="150" y="350" width="212" height="56" rx="20" fill="#fefdff"/>
|
||||
</g><path d="M256 318 C230 298 202 276 202 250 C202 230 217 218 234 218 C245 218 252 224 256 233 C260 224 267 218 278 218 C295 218 310 230 310 250 C310 276 282 298 256 318 Z" fill="#f39380"/></svg>
|
||||
|
Before Width: | Height: | Size: 719 B After Width: | Height: | Size: 720 B |
@@ -108,6 +108,10 @@ test.describe("receipts", () => {
|
||||
req.on("data", (c) => (raw += c));
|
||||
req.on("end", () => {
|
||||
if (req.headers.authorization !== "Bearer sk-test") return res.writeHead(401).end();
|
||||
// Einkaufsliste einsprechen (26.11.46): feste Abschrift.
|
||||
if (req.url === "/v1/audio/transcriptions") {
|
||||
return res.writeHead(200, { "content-type": "application/json" }).end(JSON.stringify({ text: "Wir brauchen noch Hafermilch, zwei Gurken und Spülmittel, bitte." }));
|
||||
}
|
||||
if (raw.includes("supermarket receipt photo")) {
|
||||
return res.writeHead(200, { "content-type": "application/json" }).end(
|
||||
reply({
|
||||
@@ -174,6 +178,26 @@ test.describe("receipts", () => {
|
||||
await page.getByRole("link", { name: /Spaghetti Bolognese/ }).click();
|
||||
await expect(page.locator("section", { hasText: "Kosten" }).last().locator("li", { hasText: "Spaghetti" }).first()).toContainText("3,58 € je kg · vom Bon");
|
||||
});
|
||||
|
||||
test("the list can be dictated: items are split, checked, then added", async ({ page }) => {
|
||||
await page.goto("/einkauf");
|
||||
await page.getByRole("button", { name: "Einkaufsliste einsprechen" }).click();
|
||||
await expect(page.getByText(/Aufnahme läuft/)).toBeVisible();
|
||||
await page.waitForTimeout(1200);
|
||||
await page.getByRole("button", { name: "Aufnahme beenden" }).click();
|
||||
const check = page.getByRole("region", { name: "Erkannt — bitte prüfen" });
|
||||
await expect(check.getByRole("textbox")).toHaveCount(3);
|
||||
await expect(check.getByLabel("Posten 1")).toHaveValue("Hafermilch");
|
||||
await expect(check.getByLabel("Posten 2")).toHaveValue("Zwei Gurken");
|
||||
await check.getByRole("button", { name: "Spülmittel weglassen" }).click();
|
||||
await check.getByLabel("Posten 2").fill("2 Gurken");
|
||||
await check.getByRole("button", { name: "2 Posten hinzufügen" }).click();
|
||||
await expect(check).toHaveCount(0);
|
||||
const other = page.getByRole("region", { name: "Sonstiges" });
|
||||
await expect(other).toContainText("Hafermilch");
|
||||
await expect(other).toContainText("2 Gurken");
|
||||
await expect(page.getByText("Spülmittel")).toHaveCount(0);
|
||||
});
|
||||
});
|
||||
|
||||
/** Nach links wischen wie am Handy (Chromium hat keine Wischgeste). */
|
||||
|
||||
@@ -153,7 +153,7 @@ test.describe("recipe link", () => {
|
||||
recipeYield: "4 Portionen",
|
||||
totalTime: "PT45M",
|
||||
image: "/bild.jpg",
|
||||
recipeIngredient: ["250 g rote Linsen", "2 Zwiebeln", "1 Becher Sahne", "1 Schuss Milch", "1 Handvoll Glück"],
|
||||
recipeIngredient: ["250 g rote Linsen", "2 Zwiebeln", "1 Becher Sahne", "2 EL Eier", "1 Handvoll Glück"],
|
||||
recipeInstructions: [{ "@type": "HowToStep", text: "Zwiebeln anschwitzen." }, { "@type": "HowToStep", text: "Linsen dazu und weich kochen." }],
|
||||
},
|
||||
],
|
||||
@@ -202,12 +202,14 @@ test.describe("recipe link", () => {
|
||||
await expect(amounts.nth(2)).toHaveValue("1");
|
||||
await expect(page.getByRole("combobox", { name: "Einheit" }).nth(2).locator("option:checked")).toHaveText("Packung (200 ml)");
|
||||
await expect(amounts.nth(3)).toHaveValue("");
|
||||
// Ein Schuss Milch: Menge fehlt — Speichern sagt es, statt die Zeile wegzulassen.
|
||||
// Eier in Esslöffeln passen nicht: Menge fehlt — Speichern sagt es, statt die Zeile wegzulassen.
|
||||
await page.getByRole("button", { name: "Speichern" }).click();
|
||||
await expect(page.locator("main [role=alert]")).toContainText("fehlt die Menge");
|
||||
await amounts.nth(3).fill("50");
|
||||
await amounts.nth(3).fill("2");
|
||||
await page.getByRole("button", { name: "Speichern" }).click();
|
||||
await expect(page.getByRole("heading", { level: 1 })).toHaveText("Linsensuppe vom Blog");
|
||||
// Gespeichert unter „Ausprobieren“ — und die Seite sagt es (26.11.41).
|
||||
await expect(page.getByRole("note").filter({ hasText: "Steht unter „Ausprobieren“" })).toBeVisible();
|
||||
await expect(page.locator("main img").first()).toHaveAttribute("src", /\/api\/fotos\//);
|
||||
await expect(page.locator(`main a[href="${origin}/rezept"]`)).toBeVisible();
|
||||
});
|
||||
@@ -221,6 +223,8 @@ test.describe("cookbook photo and AI setting", () => {
|
||||
const origin = process.env.IMPORT_TEST_ORIGIN ?? "http://127.0.0.1:3021";
|
||||
const reply = (r: object) => JSON.stringify({ choices: [{ message: { content: "```json\n" + JSON.stringify(r) + "\n```" } }] });
|
||||
|
||||
let pagesSeen = 0;
|
||||
|
||||
test.beforeAll(async () => {
|
||||
const { createServer } = await import("node:http");
|
||||
server = createServer((req, res) => {
|
||||
@@ -271,6 +275,7 @@ test.describe("cookbook photo and AI setting", () => {
|
||||
// Andere Hausform-Anfragen: Fehler — dann ordnen die Regeln ein.
|
||||
if (raw.includes("house style")) return res.writeHead(500).end();
|
||||
const withImage = raw.includes("image_url");
|
||||
if (withImage) pagesSeen = (raw.match(/"type":"image_url"/g) ?? []).length;
|
||||
res.writeHead(200, { "content-type": "application/json" }).end(
|
||||
withImage
|
||||
? reply({ title: "Kartoffelsalat aus dem Kochbuch", portions: 4, minutes: 40, ingredients: ["1 kg Kartoffeln", "2 Zwiebeln", "1 Glas Gurken"], steps: ["Kartoffeln kochen.", "Alles mischen."] })
|
||||
@@ -321,9 +326,19 @@ test.describe("cookbook photo and AI setting", () => {
|
||||
test("a cookbook photo becomes a draft marked as read by the AI", async ({ page }) => {
|
||||
await page.goto("/gerichte/foto");
|
||||
const jpg = await sharp({ create: { width: 1000, height: 1400, channels: 3, background: { r: 245, g: 240, b: 230 } } }).jpeg().toBuffer();
|
||||
await page.locator("input[type=file]").setInputFiles({ name: "seite.jpg", mimeType: "image/jpeg", buffer: jpg });
|
||||
// Mehrere Seiten (26.11.48): jede Auswahl kommt hinten dazu, einzelne lassen sich entfernen.
|
||||
const input = page.locator("input[type=file]");
|
||||
await input.setInputFiles({ name: "seite1.jpg", mimeType: "image/jpeg", buffer: jpg });
|
||||
await expect(page.getByRole("img", { name: "Seite 1" })).toBeVisible();
|
||||
await input.setInputFiles({ name: "seite2.jpg", mimeType: "image/jpeg", buffer: jpg });
|
||||
await expect(page.getByRole("img", { name: "Seite 2" })).toBeVisible();
|
||||
await page.getByRole("button", { name: "Seite 1 entfernen" }).click();
|
||||
await expect(page.getByRole("img", { name: /^Seite/ })).toHaveCount(1);
|
||||
await input.setInputFiles({ name: "seite3.jpg", mimeType: "image/jpeg", buffer: jpg });
|
||||
await expect(page.getByRole("list", { name: "2 Seiten" })).toBeVisible();
|
||||
await page.getByRole("button", { name: "Rezept lesen" }).click();
|
||||
await expect(page.locator("#title")).toHaveValue("Kartoffelsalat aus dem Kochbuch");
|
||||
expect(pagesSeen).toBe(2);
|
||||
await expect(page.getByRole("note").first()).toContainText("Von der AI gelesen");
|
||||
await expect(page.getByRole("note").filter({ hasText: "Von der AI in die foodplanhero-Form gebracht" })).toBeVisible();
|
||||
await expect(page.getByLabel("Schritt 1", { exact: true })).toHaveValue("Kartoffeln waschen.");
|
||||
@@ -428,7 +443,7 @@ test("spoons and cans: the ingredient preselects its measure, the dish shows spo
|
||||
await expect(page.getByText("1 Dose = 400 g")).toBeVisible();
|
||||
// Unsere Dose hat 500 g.
|
||||
await page.getByRole("button", { name: "Größe ändern" }).click();
|
||||
await page.getByLabel("Größe einer Dose in g").fill("500");
|
||||
await page.getByLabel("Wie viel ist 1 Dose? (in g)").fill("500");
|
||||
await page.getByRole("button", { name: "Übernehmen" }).click();
|
||||
await expect(page.getByText("1 Dose = 500 g")).toBeVisible();
|
||||
await page.getByRole("textbox", { name: "Menge", exact: true }).nth(1).fill("1");
|
||||
@@ -459,7 +474,7 @@ test("spoons and cans: the ingredient preselects its measure, the dish shows spo
|
||||
|
||||
// Aufräumen: Größe zurück, Gericht aus dem Pool — damit Plan und Einkauf gleich bleiben.
|
||||
await page.getByRole("button", { name: "Größe ändern" }).click();
|
||||
await page.getByLabel("Größe einer Dose in g").fill("400");
|
||||
await page.getByLabel("Wie viel ist 1 Dose? (in g)").fill("400");
|
||||
await page.getByRole("button", { name: "Übernehmen" }).click();
|
||||
await expect(page.getByText("1 Dose = 400 g")).toBeVisible();
|
||||
await page.goto("/gerichte");
|
||||
@@ -467,3 +482,132 @@ test("spoons and cans: the ingredient preselects its measure, the dish shows spo
|
||||
await page.getByRole("button", { name: "Entfernen" }).click();
|
||||
await expect(page).toHaveURL(/entfernt=/);
|
||||
});
|
||||
|
||||
// Kai: „Neue Gerichte werden nicht gespeichert“ — sie standen unter „Ausprobieren“, ohne dass
|
||||
// die Seite es sagte (26.11.41). Jetzt: Hinweis, Weg dorthin, und mit einem Tipp in den Pool.
|
||||
test("portions are remembered and scale the amounts; a pack and cloves for any ingredient (26.11.49)", async ({ page }) => {
|
||||
await page.goto("/gerichte/neu");
|
||||
await page.fill("#title", "Hackbraten");
|
||||
await page.fill("#portions", "6");
|
||||
await page.getByRole("combobox", { name: "Zutat suchen" }).first().fill("Gemischtes Hack");
|
||||
await page.getByRole("option", { name: "Gemischtes Hackfleisch", exact: true }).click();
|
||||
const amounts = page.getByRole("textbox", { name: "Menge", exact: true });
|
||||
const units = page.getByRole("combobox", { name: "Einheit" });
|
||||
await amounts.nth(0).fill("1");
|
||||
await units.nth(0).selectOption("pack");
|
||||
// Hackfleisch hat keine Packungsgröße: Speichern fragt danach, statt still zu rechnen.
|
||||
await page.getByRole("button", { name: "Speichern" }).click();
|
||||
await expect(page.locator("main [role=alert]")).toContainText("1 Packung = 500 g");
|
||||
await page.getByLabel("Wie viel ist 1 Packung? (in g)").fill("500");
|
||||
await page.getByRole("button", { name: "Zutaten" }).click();
|
||||
await page.getByRole("combobox", { name: "Zutat suchen" }).nth(1).fill("Knoblauchz");
|
||||
await page.getByRole("option", { name: "Knoblauchzehe", exact: true }).click();
|
||||
await amounts.nth(1).fill("3");
|
||||
await units.nth(1).selectOption("clove");
|
||||
await page.getByRole("button", { name: "Speichern" }).click();
|
||||
await expect(page.getByRole("heading", { level: 1 })).toHaveText("Hackbraten");
|
||||
|
||||
// Bearbeiten zeigt das Rezept wieder für 6 Portionen, im eingegebenen Maß.
|
||||
await page.getByRole("link", { name: "Bearbeiten" }).click();
|
||||
await expect(page.locator("#portions")).toHaveValue("6");
|
||||
await expect(amounts.nth(0)).toHaveValue("1");
|
||||
await expect(units.nth(0).locator("option:checked")).toHaveText("Packung (500 g)");
|
||||
await expect(amounts.nth(1)).toHaveValue("3");
|
||||
await expect(units.nth(1)).toHaveValue("clove");
|
||||
// Portionen umstellen rechnet mit.
|
||||
await page.fill("#portions", "3");
|
||||
await expect(amounts.nth(0)).toHaveValue("0,5");
|
||||
await expect(amounts.nth(1)).toHaveValue("1,5");
|
||||
await page.fill("#portions", "6");
|
||||
await expect(amounts.nth(0)).toHaveValue("1");
|
||||
await page.fill("#portions", "3");
|
||||
await page.getByRole("button", { name: "Speichern" }).click();
|
||||
await expect(page.getByRole("heading", { level: 1 })).toHaveText("Hackbraten");
|
||||
await page.getByRole("link", { name: "Bearbeiten" }).click();
|
||||
await expect(page.locator("#portions")).toHaveValue("3");
|
||||
await expect(amounts.nth(0)).toHaveValue("0,5");
|
||||
// Wieder aus dem Pool, damit der Plan später nicht anders vorschlägt.
|
||||
await page.goto("/gerichte");
|
||||
await page.getByRole("link", { name: /Hackbraten/ }).click();
|
||||
await page.getByRole("button", { name: "Entfernen" }).click();
|
||||
await expect(page).toHaveURL(/entfernt=/);
|
||||
});
|
||||
|
||||
test("millilitres for a piece ingredient: stock cubes in ml with the size per piece (26.11.50)", async ({ page }) => {
|
||||
await page.goto("/gerichte/neu");
|
||||
await page.fill("#title", "Brühnudeln");
|
||||
await page.getByRole("combobox", { name: "Zutat suchen" }).first().fill("Brühwürf");
|
||||
await page.getByRole("option", { name: "Brühwürfel", exact: true }).click();
|
||||
const amounts = page.getByRole("textbox", { name: "Menge", exact: true });
|
||||
const units = page.getByRole("combobox", { name: "Einheit" });
|
||||
await amounts.nth(0).fill("750");
|
||||
await units.nth(0).selectOption("ml");
|
||||
await page.getByLabel("Wie viel ml ist 1 Stück?").fill("500");
|
||||
await page.getByRole("button", { name: "Speichern" }).click();
|
||||
await expect(page.getByRole("heading", { level: 1 })).toHaveText("Brühnudeln");
|
||||
await page.getByRole("link", { name: "Bearbeiten" }).click();
|
||||
await expect(amounts.nth(0)).toHaveValue("750");
|
||||
await expect(units.nth(0)).toHaveValue("ml");
|
||||
await expect(page.getByText("1 Stück = 500 ml")).toBeVisible();
|
||||
await page.goto("/gerichte");
|
||||
await page.getByRole("link", { name: /Brühnudeln/ }).click();
|
||||
await page.getByRole("button", { name: "Entfernen" }).click();
|
||||
await expect(page).toHaveURL(/entfernt=/);
|
||||
});
|
||||
|
||||
test("a dish to try says so, links to its tab and moves to the pool with one tap", async ({ page }) => {
|
||||
await page.goto("/gerichte/neu");
|
||||
await page.fill("#title", "Probe-Auflauf");
|
||||
await page.getByRole("combobox", { name: "Zutat suchen" }).first().fill("Zwieb");
|
||||
await page.getByRole("option", { name: "Zwiebeln", exact: true }).click();
|
||||
await page.getByRole("textbox", { name: "Menge", exact: true }).first().fill("2");
|
||||
await page.getByLabel("Erst mal ausprobieren").check();
|
||||
await page.getByRole("button", { name: "Speichern" }).click();
|
||||
await expect(page.getByRole("heading", { level: 1 })).toHaveText("Probe-Auflauf");
|
||||
const note = page.getByRole("note").filter({ hasText: "Steht unter „Ausprobieren“" });
|
||||
await expect(note).toBeVisible();
|
||||
await expect(page.locator("main").getByRole("link", { name: "Gerichte", exact: true })).toHaveAttribute("href", "/gerichte?ansicht=ausprobieren");
|
||||
await note.getByRole("button", { name: "In den Pool" }).click();
|
||||
await expect(note).toHaveCount(0);
|
||||
// Fotos auch aus der Mediathek, mehrere auf einmal (26.11.43): kein capture, multiple.
|
||||
const picker = page.locator("input[type=file]");
|
||||
expect(await picker.getAttribute("capture")).toBeNull();
|
||||
expect(await picker.getAttribute("multiple")).not.toBeNull();
|
||||
const shots = await Promise.all(
|
||||
[[200, 80, 60], [60, 140, 90]].map(async ([r, g, b], i) => ({
|
||||
name: `mediathek-${i}.png`,
|
||||
mimeType: "image/png",
|
||||
buffer: await sharp({ create: { width: 800, height: 600, channels: 3, background: { r: r!, g: g!, b: b! } } }).png().toBuffer(),
|
||||
})),
|
||||
);
|
||||
await picker.setInputFiles(shots);
|
||||
await expect(page.getByRole("heading", { name: "Fotos · 2 von 5" })).toBeVisible();
|
||||
await page.goto("/gerichte");
|
||||
await expect(page.getByRole("link", { name: /Probe-Auflauf/ })).toBeVisible();
|
||||
// Aufräumen, damit der Plan danach denselben Bestand vorschlägt.
|
||||
await page.getByRole("link", { name: /Probe-Auflauf/ }).click();
|
||||
await page.getByRole("button", { name: "Entfernen" }).click();
|
||||
await expect(page).toHaveURL(/entfernt=/);
|
||||
});
|
||||
|
||||
|
||||
// Kai: „Die Karten sollen immer dieselbe Größe haben“ (26.11.44) — auch bei langen Titeln.
|
||||
test("dish cards in the pool all have the same size, long titles end with an ellipsis", async ({ page }) => {
|
||||
await page.goto("/gerichte/neu");
|
||||
await page.fill("#title", "Gyros-Nudelauflauf in Metaxasoße mit extra viel Käse vom Blech");
|
||||
await page.getByRole("combobox", { name: "Zutat suchen" }).first().fill("Zwieb");
|
||||
await page.getByRole("option", { name: "Zwiebeln", exact: true }).click();
|
||||
await page.getByRole("textbox", { name: "Menge", exact: true }).first().fill("1");
|
||||
await page.getByRole("button", { name: "Speichern" }).click();
|
||||
await expect(page.getByRole("heading", { level: 1 })).toContainText("Gyros-Nudelauflauf");
|
||||
await page.goto("/gerichte");
|
||||
const sizes = await page.locator("main ul li a").evaluateAll((els) => els.map((e) => Math.round(e.getBoundingClientRect().height)));
|
||||
expect(sizes.length).toBeGreaterThan(2);
|
||||
expect(new Set(sizes).size).toBe(1);
|
||||
// Der volle Titel bleibt erreichbar.
|
||||
await expect(page.getByRole("link", { name: /Gyros-Nudelauflauf/ })).toHaveAttribute("title", /extra viel Käse vom Blech/);
|
||||
// Aufräumen, damit der Plan danach denselben Bestand vorschlägt.
|
||||
await page.getByRole("link", { name: /Gyros-Nudelauflauf/ }).click();
|
||||
await page.getByRole("button", { name: "Entfernen" }).click();
|
||||
await expect(page).toHaveURL(/entfernt=/);
|
||||
});
|
||||
@@ -72,10 +72,9 @@ test("a child wishes, makes a favourite, and has no veto", async () => {
|
||||
|
||||
test("a child makes a wish their own dish, sure to be in the plan", async () => {
|
||||
await tablet.goto("/wuenschen");
|
||||
await expect(tablet.getByText("Mach einen Wunsch zu deinem Gericht")).toBeVisible();
|
||||
await tablet.getByRole("button", { name: "Optionen für Spaghetti Bolognese" }).click();
|
||||
await tablet.getByRole("dialog").getByRole("button", { name: "Als mein Gericht" }).click();
|
||||
await expect(tablet.getByRole("dialog")).toBeHidden();
|
||||
await expect(tablet.getByText("Tipp aufs Herz")).toBeVisible();
|
||||
await tablet.getByRole("button", { name: "Spaghetti Bolognese als mein Gericht" }).click();
|
||||
await expect(tablet.getByRole("button", { name: "Spaghetti Bolognese nicht mehr mein Gericht" })).toHaveAttribute("aria-pressed", "true");
|
||||
await expect(tablet.getByText("Dein Gericht: Spaghetti Bolognese — kommt sicher in den Plan.")).toBeVisible();
|
||||
await expect(tablet.getByRole("button", { name: /^Wunsch zurücknehmen: Spaghetti Bolognese/ })).toContainText("Mein Gericht");
|
||||
});
|
||||
|
||||
@@ -73,29 +73,51 @@ test("scrolling never moves the bar, even while the address bar comes and goes",
|
||||
}
|
||||
});
|
||||
|
||||
test("after typing, a stale gap is bridged briefly and dropped at the first touch", async ({ page }) => {
|
||||
const shiftOf = (page: Page) => page.getByRole("navigation", { name: "Navigation" }).evaluate((el) => (el as HTMLElement).style.transform);
|
||||
const kbShift = (page: Page) => page.evaluate(() => document.documentElement.style.getPropertyValue("--kb-shift"));
|
||||
|
||||
// 26.11.41 (Kai, Bild: Leiste und „Speichern“ mitten im Bild): iOS rechnet nach der
|
||||
// Tastatur in der Web-App manchmal lange zu kurz — auch nach Berührung und Scrollen.
|
||||
test("after typing, a stuck keyboard gap stays bridged through touch and scroll until iOS recovers", async ({ page }) => {
|
||||
await page.goto("/mehr");
|
||||
const field = page.locator("#kid-name");
|
||||
await field.focus();
|
||||
await expect(page.getByRole("navigation", { name: "Navigation" })).toBeHidden(); // beim Tippen weg
|
||||
// iOS lässt das Layout nach dem Schließen der Tastatur 300 px zu kurz stehen.
|
||||
await moveViewport(page, 300);
|
||||
await moveViewport(page, 300); // iOS lässt das Layout 300 px zu kurz stehen
|
||||
await field.blur();
|
||||
const nav = page.getByRole("navigation", { name: "Navigation" });
|
||||
await expect(nav).toBeVisible();
|
||||
await expect.poll(() => nav.evaluate((el) => (el as HTMLElement).style.transform)).toBe("translateY(300px)");
|
||||
await expect.poll(() => shiftOf(page)).toBe("translateY(300px)");
|
||||
await expect.poll(() => kbShift(page)).toBe("300px");
|
||||
// Berühren, scrollen, über die erste Sekunde hinaus: bleibt unten.
|
||||
await page.evaluate(() => window.dispatchEvent(new Event("touchstart")));
|
||||
await expect.poll(() => nav.evaluate((el) => (el as HTMLElement).style.transform)).toBe("");
|
||||
await page.evaluate(() => window.dispatchEvent(new Event("touchend")));
|
||||
await page.mouse.wheel(0, 400);
|
||||
await page.waitForTimeout(1300);
|
||||
await moveViewport(page, 300);
|
||||
await expect.poll(() => shiftOf(page)).toBe("translateY(300px)");
|
||||
// iOS rechnet wieder richtig: Korrektur weg, Leiste unten.
|
||||
await moveViewport(page, 0);
|
||||
await expect.poll(() => shiftOf(page)).toBe("");
|
||||
await expect.poll(() => kbShift(page)).toBe("");
|
||||
await navAtBottom(page);
|
||||
// Danach ist nichts mehr scharf: eine neue Lücke ohne Tippen bleibt unberührt.
|
||||
await moveViewport(page, 300);
|
||||
await page.waitForTimeout(100);
|
||||
expect(await shiftOf(page)).toBe("");
|
||||
});
|
||||
|
||||
test("the bridge ends by itself after a second, and never starts without typing", async ({ page }) => {
|
||||
test("never without typing; after the first second only a keyboard-sized gap counts", async ({ page }) => {
|
||||
await page.goto("/mehr");
|
||||
const nav = page.getByRole("navigation", { name: "Navigation" });
|
||||
await moveViewport(page, 300); // ohne Tastatur: nichts tun
|
||||
await page.waitForTimeout(100);
|
||||
expect(await nav.evaluate((el) => (el as HTMLElement).style.transform)).toBe("");
|
||||
expect(await shiftOf(page)).toBe("");
|
||||
await moveViewport(page, 0);
|
||||
await page.locator("#kid-name").focus();
|
||||
await page.locator("#kid-name").blur();
|
||||
await expect.poll(() => nav.evaluate((el) => (el as HTMLElement).style.transform)).toBe("translateY(300px)");
|
||||
await expect.poll(() => nav.evaluate((el) => (el as HTMLElement).style.transform), { timeout: 3000 }).toBe("");
|
||||
await page.waitForTimeout(1300);
|
||||
// Gummiband oder Rundung (unter STUCK_MIN): Lunch fasst die Leiste nicht an.
|
||||
await moveViewport(page, 80);
|
||||
await page.waitForTimeout(100);
|
||||
expect(await shiftOf(page)).toBe("");
|
||||
await moveViewport(page, 0);
|
||||
await navAtBottom(page);
|
||||
});
|
||||
@@ -16,7 +16,7 @@ test("the suggestion starts with the wishes and says why", async ({ page }) => {
|
||||
await expect(items(page)).toHaveCount(4);
|
||||
await expect(items(page).first()).toContainText("Spaghetti Bolognese");
|
||||
await expect(items(page).first()).toContainText("Gericht von Ben (sicher)"); // Bens Gericht (kinder.spec)
|
||||
await expect(items(page).first().getByRole("combobox")).toHaveValue(/.+/); // Kai kocht („Ich koche das“)
|
||||
await expect(items(page).first().getByRole("combobox", { name: /^Wer kocht/ })).toHaveValue(/.+/); // Kai kocht („Ich koche das“)
|
||||
await expect(titles(page)).not.toContainText(["Flammkuchen"]);
|
||||
});
|
||||
|
||||
@@ -36,7 +36,7 @@ test("a locked slot survives a new suggestion; portions and cook change", async
|
||||
|
||||
const lentils = items(page).filter({ hasText: "Linseneintopf" });
|
||||
await lentils.getByRole("combobox", { name: "Wer kocht Linseneintopf?" }).selectOption({ label: "Koch: Ben" });
|
||||
await expect(lentils.getByRole("combobox")).toHaveValue(/.+/);
|
||||
await expect(lentils.getByRole("combobox", { name: /^Wer kocht/ })).toHaveValue(/.+/);
|
||||
});
|
||||
|
||||
test("a dish can be replaced, moved by keyboard and removed", async ({ page }) => {
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
// 26.11.45 (Kai, 8.11.2026): Tag je Gericht von Hand, Runde ändern, Kalender-Abo,
|
||||
// Runde beenden und löschen. Läuft nach „mail“ — die Runde aus plan/kochen hat
|
||||
// schon Gekochtes, also nur „Beenden“.
|
||||
test.describe.configure({ mode: "serial" });
|
||||
|
||||
const cards = (page: import("@playwright/test").Page) => page.locator("main ol > li");
|
||||
|
||||
test("a dish gets a day by hand and shows it on the plan and today", async ({ page }) => {
|
||||
await page.goto("/plan");
|
||||
const card = cards(page).filter({ has: page.getByRole("combobox", { name: /^Tag für/ }) }).first();
|
||||
const title = (await card.locator("h2").textContent())!;
|
||||
const day = card.getByRole("combobox", { name: `Tag für ${title}` });
|
||||
await expect(day).toHaveValue("");
|
||||
const label = (await day.locator("option").nth(2).textContent())!;
|
||||
await day.selectOption({ label });
|
||||
await expect(day).not.toHaveValue("");
|
||||
await expect(card.locator("p", { hasText: label })).toBeVisible();
|
||||
await page.goto("/");
|
||||
await expect(page.locator("main li").filter({ hasText: title })).toContainText(label);
|
||||
});
|
||||
|
||||
test("the round's settings can change", async ({ page }) => {
|
||||
await page.goto("/plan");
|
||||
const before = await page.locator("header p.text-muted-foreground").textContent();
|
||||
await page.getByRole("button", { name: "Einstellungen ändern" }).click();
|
||||
await page.getByRole("button", { name: "Warme Mahlzeiten: mehr" }).click();
|
||||
await page.getByRole("button", { name: "Speichern" }).click();
|
||||
await expect(page.getByRole("button", { name: "Einstellungen ändern" })).toBeVisible();
|
||||
await expect(page.locator("header p.text-muted-foreground")).not.toHaveText(before!);
|
||||
});
|
||||
|
||||
test("the household calendar link serves the plan, and a new link kills the old", async ({ page, playwright }) => {
|
||||
await page.goto("/mehr#kalender");
|
||||
await page.getByLabel("Essenszeit").fill("19:00");
|
||||
await page.getByRole("button", { name: "Essenszeit speichern" }).click();
|
||||
await expect(page.getByRole("button", { name: "Gespeichert" })).toBeVisible();
|
||||
await page.getByRole("button", { name: "Kalender-Abo starten" }).click();
|
||||
const first = (await page.getByTestId("calendar-url").textContent())!;
|
||||
expect(first).toMatch(/\/kalender\/[A-Za-z0-9_-]{43}\.ics$/);
|
||||
await expect(page.getByRole("link", { name: "Im Kalender öffnen" })).toHaveAttribute("href", /^webcal:\/\//);
|
||||
|
||||
// Ohne Sitzung: Der Link allein reicht.
|
||||
const anon = await playwright.request.newContext();
|
||||
const res = await anon.get(first);
|
||||
expect(res.status()).toBe(200);
|
||||
expect(res.headers()["content-type"]).toContain("text/calendar");
|
||||
const ics = await res.text();
|
||||
expect(ics).toContain("BEGIN:VEVENT");
|
||||
expect(ics).toMatch(/DTSTART;TZID=Europe\/Berlin:\d{8}T190000/);
|
||||
|
||||
await page.getByRole("button", { name: "Neuen Link erzeugen" }).click();
|
||||
await expect(page.getByTestId("calendar-url")).not.toHaveText(first);
|
||||
const second = (await page.getByTestId("calendar-url").textContent())!;
|
||||
expect((await anon.get(first)).status()).toBe(404);
|
||||
expect((await anon.get(second)).status()).toBe(200);
|
||||
await anon.dispose();
|
||||
});
|
||||
|
||||
test("a round with cooked dishes can only end; then the next one opens and an empty one can go", async ({ page }) => {
|
||||
await page.goto("/plan");
|
||||
await expect(page.getByRole("button", { name: "Runde löschen" })).toHaveCount(0);
|
||||
const end = page.getByRole("button", { name: "Runde beenden" });
|
||||
await end.click();
|
||||
await page.getByRole("button", { name: /Wirklich beenden/ }).click();
|
||||
await expect(page.getByRole("link", { name: "Runde eröffnen" })).toBeVisible();
|
||||
|
||||
await page.getByRole("link", { name: "Runde eröffnen" }).click();
|
||||
await page.getByRole("button", { name: "Runde eröffnen" }).click();
|
||||
await expect(page).toHaveURL(/\/$/);
|
||||
await page.goto("/plan");
|
||||
await page.getByRole("button", { name: "Runde löschen" }).click();
|
||||
await page.getByRole("button", { name: /Wirklich löschen/ }).click();
|
||||
await expect(page.getByRole("link", { name: "Runde eröffnen" })).toBeVisible();
|
||||
|
||||
// Für den Rundgang danach wieder eine Runde.
|
||||
await page.getByRole("link", { name: "Runde eröffnen" }).click();
|
||||
await page.getByRole("button", { name: "Runde eröffnen" }).click();
|
||||
await expect(page).toHaveURL(/\/$/);
|
||||
});
|
||||
@@ -28,6 +28,30 @@ test("tokens, veto and the joker share one line, even on the iPhone", async ({ p
|
||||
await expect(page.getByText("1 Veto frei")).toBeVisible();
|
||||
});
|
||||
|
||||
test("the heart makes a dish my dish in one tap, and takes it back (26.11.47)", async ({ page }) => {
|
||||
await page.goto("/wuenschen");
|
||||
await expect(page.getByText("Tipp aufs Herz")).toBeVisible();
|
||||
await page.getByRole("button", { name: "Linseneintopf als mein Gericht" }).click();
|
||||
const heart = page.getByRole("button", { name: "Linseneintopf nicht mehr mein Gericht" });
|
||||
await expect(heart).toHaveAttribute("aria-pressed", "true");
|
||||
await expect(page.getByRole("button", { name: /^Wunsch zurücknehmen: Linseneintopf/ })).toHaveAttribute("aria-pressed", "true");
|
||||
await expect(page.getByText("1 Jeton frei")).toBeVisible();
|
||||
await expect(page.getByText("Dein Gericht: Linseneintopf — kommt sicher in den Plan.")).toBeVisible();
|
||||
// Zurück: das Herz ist leer, der Wunsch bleibt.
|
||||
await heart.click();
|
||||
await expect(page.getByRole("button", { name: "Linseneintopf als mein Gericht" })).toHaveAttribute("aria-pressed", "false");
|
||||
await expect(page.getByText("1 Jeton frei")).toBeVisible();
|
||||
// Der Weg über das Blatt geht weiter.
|
||||
await page.getByRole("button", { name: "Optionen für Linseneintopf" }).click();
|
||||
await page.getByRole("dialog").getByRole("button", { name: "Als mein Gericht" }).click();
|
||||
await expect(page.getByRole("dialog")).toBeHidden();
|
||||
await expect(page.getByRole("button", { name: "Linseneintopf nicht mehr mein Gericht" })).toHaveAttribute("aria-pressed", "true");
|
||||
await page.getByRole("button", { name: "Linseneintopf nicht mehr mein Gericht" }).click();
|
||||
await expect(page.getByRole("button", { name: "Linseneintopf als mein Gericht" })).toBeVisible();
|
||||
await page.getByRole("button", { name: /^Wunsch zurücknehmen: Linseneintopf/ }).click();
|
||||
await expect(page.getByText("2 Jetons frei")).toBeVisible();
|
||||
});
|
||||
|
||||
test("each tap spends a token, and the server says when they are gone", async ({ page }) => {
|
||||
await page.goto("/");
|
||||
await page.getByRole("link", { name: "Wünschen" }).click();
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
import "server-only";
|
||||
import type { PoolClient } from "pg";
|
||||
import { withAuth } from "@/lib/db";
|
||||
import { hashToken, randomToken } from "./tokens";
|
||||
import { tooManyAttempts } from "./throttle";
|
||||
|
||||
// Kalender-Abo (26.11.45): ein Link je Haushalt. Gespeichert wird nur der Hash;
|
||||
// den Link sieht die Person einmal, danach nur „Neuen Link erzeugen“.
|
||||
|
||||
/** Neuen Link erzeugen; ein alter verliert damit seine Gültigkeit. */
|
||||
export async function newCalendarToken(client: PoolClient, householdId: string, locale: string): Promise<string> {
|
||||
const token = randomToken();
|
||||
await client.query("update households set calendar_token_hash = $2, calendar_locale = $3 where id = $1", [householdId, hashToken(token), locale]);
|
||||
return token;
|
||||
}
|
||||
|
||||
export async function removeCalendarToken(client: PoolClient, householdId: string): Promise<void> {
|
||||
await client.query("update households set calendar_token_hash = null where id = $1", [householdId]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Haushalt zum Link, oder null. Fehlversuche bremsen je Adresse und gemeinsam,
|
||||
* damit niemand Links durchprobiert; gültige Abrufe zählen nicht (Kalender
|
||||
* fragen stündlich nach).
|
||||
*/
|
||||
export async function householdForCalendar(token: string, ip: string): Promise<{ id: string } | "tooMany" | null> {
|
||||
return withAuth(async (c) => {
|
||||
const blocked = await c.query<{ n: number }>(
|
||||
"select count(*)::int as n from auth_attempts where key = any($1) and at > now() - interval '15 minutes'",
|
||||
[[`cal:${ip}`]],
|
||||
);
|
||||
if ((blocked.rows[0]?.n ?? 0) > 20) return "tooMany";
|
||||
const { rows } = await c.query<{ id: string }>("select id from households where calendar_token_hash = $1", [hashToken(token)]);
|
||||
if (rows[0]) return rows[0];
|
||||
if ((await tooManyAttempts(c, `cal:${ip}`, 20, 15)) || (await tooManyAttempts(c, "cal:*", 200, 15))) return "tooMany";
|
||||
return null;
|
||||
});
|
||||
}
|
||||
@@ -197,6 +197,14 @@ export async function restoreBackup(backup: Backup): Promise<void> {
|
||||
createdBy = rows[0]?.created_by ?? null;
|
||||
rows = rows.map((r) => ({ ...r, created_by: null }));
|
||||
}
|
||||
if (table === "household_pack_sizes" && rows.some((r) => !r.unit)) {
|
||||
// Abzüge vor 26.11.49 kennen nur das Gebinde der Zutat — dessen Maß nachtragen.
|
||||
const kinds = new Map(
|
||||
(await client.query("select id, pack_kind from ingredients where pack_kind is not null")).rows.map((r) => [r.id as string, r.pack_kind as string]),
|
||||
);
|
||||
rows = rows.map((r) => (r.unit ? r : { ...r, unit: kinds.get(r.ingredient_id as string) ?? null })).filter((r) => r.unit);
|
||||
if (!rows.length) continue;
|
||||
}
|
||||
const existing = (
|
||||
await client.query<{ column_name: string }>(
|
||||
"select column_name from information_schema.columns where table_schema = 'public' and table_name = $1",
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
// Kalender-Abo (26.11.45): iCalendar nach RFC 5545, rein und ohne Datenbank,
|
||||
// damit Escapen, Falten und Zeitzone im Test stehen.
|
||||
|
||||
export type CalendarEvent = {
|
||||
uid: string;
|
||||
/** YYYY-MM-DD */
|
||||
day: string;
|
||||
/** HH:MM, Ortszeit Europe/Berlin */
|
||||
start: string;
|
||||
minutes: number;
|
||||
summary: string;
|
||||
description: string;
|
||||
url: string | null;
|
||||
};
|
||||
|
||||
const TZ = "Europe/Berlin";
|
||||
|
||||
// Sommer- und Winterzeit wie seit 1996: letzter Sonntag im März und im Oktober.
|
||||
const VTIMEZONE = [
|
||||
"BEGIN:VTIMEZONE",
|
||||
`TZID:${TZ}`,
|
||||
"BEGIN:DAYLIGHT",
|
||||
"TZOFFSETFROM:+0100",
|
||||
"TZOFFSETTO:+0200",
|
||||
"TZNAME:CEST",
|
||||
"DTSTART:19700329T020000",
|
||||
"RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU",
|
||||
"END:DAYLIGHT",
|
||||
"BEGIN:STANDARD",
|
||||
"TZOFFSETFROM:+0200",
|
||||
"TZOFFSETTO:+0100",
|
||||
"TZNAME:CET",
|
||||
"DTSTART:19701025T030000",
|
||||
"RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU",
|
||||
"END:STANDARD",
|
||||
"END:VTIMEZONE",
|
||||
];
|
||||
|
||||
/** Text nach RFC 5545 3.3.11: Backslash, Semikolon, Komma, Zeilenumbruch. */
|
||||
export function escapeText(value: string): string {
|
||||
return value.replace(/\\/g, "\\\\").replace(/;/g, "\;").replace(/,/g, "\\,").replace(/\r?\n/g, "\\n");
|
||||
}
|
||||
|
||||
/** Zeilen über 75 Oktette falten (3.1), ohne ein UTF-8-Zeichen zu teilen. */
|
||||
export function fold(line: string): string {
|
||||
const bytes = (s: string) => Buffer.byteLength(s, "utf8");
|
||||
if (bytes(line) <= 75) return line;
|
||||
const parts: string[] = [];
|
||||
let current = "";
|
||||
let limit = 75;
|
||||
for (const ch of line) {
|
||||
if (bytes(current + ch) > limit) {
|
||||
parts.push(current);
|
||||
current = "";
|
||||
limit = 74; // Fortsetzungszeilen beginnen mit einem Leerzeichen
|
||||
}
|
||||
current += ch;
|
||||
}
|
||||
parts.push(current);
|
||||
return parts.join("\r\n ");
|
||||
}
|
||||
|
||||
function local(day: string, time: string): string {
|
||||
return `${day.replace(/-/g, "")}T${time.replace(":", "").slice(0, 4)}00`;
|
||||
}
|
||||
|
||||
function addMinutes(day: string, time: string, minutes: number): string {
|
||||
// Ortszeit als reine Wanduhr rechnen: UTC dient nur als Rechenbrett.
|
||||
const [h, m] = time.split(":").map(Number);
|
||||
const d = new Date(`${day}T00:00:00Z`);
|
||||
d.setUTCMinutes(h! * 60 + m! + minutes);
|
||||
const iso = d.toISOString();
|
||||
return `${iso.slice(0, 10).replace(/-/g, "")}T${iso.slice(11, 13)}${iso.slice(14, 16)}00`;
|
||||
}
|
||||
|
||||
function stamp(now: Date): string {
|
||||
return now.toISOString().replace(/[-:]/g, "").replace(/\.\d{3}/, "");
|
||||
}
|
||||
|
||||
export function buildCalendar(name: string, events: CalendarEvent[], now = new Date()): string {
|
||||
const lines = [
|
||||
"BEGIN:VCALENDAR",
|
||||
"VERSION:2.0",
|
||||
"PRODID:-//foodplanhero//Lunch//DE",
|
||||
"CALSCALE:GREGORIAN",
|
||||
"METHOD:PUBLISH",
|
||||
`X-WR-CALNAME:${escapeText(name)}`,
|
||||
`X-WR-TIMEZONE:${TZ}`,
|
||||
"REFRESH-INTERVAL;VALUE=DURATION:PT1H",
|
||||
"X-PUBLISHED-TTL:PT1H",
|
||||
...VTIMEZONE,
|
||||
];
|
||||
for (const e of events) {
|
||||
lines.push(
|
||||
"BEGIN:VEVENT",
|
||||
`UID:${e.uid}`,
|
||||
`DTSTAMP:${stamp(now)}`,
|
||||
`DTSTART;TZID=${TZ}:${local(e.day, e.start)}`,
|
||||
`DTEND;TZID=${TZ}:${addMinutes(e.day, e.start, e.minutes)}`,
|
||||
`SUMMARY:${escapeText(e.summary)}`,
|
||||
);
|
||||
if (e.description) lines.push(`DESCRIPTION:${escapeText(e.description)}`);
|
||||
if (e.url) lines.push(`URL:${e.url}`);
|
||||
lines.push("TRANSP:TRANSPARENT", "END:VEVENT");
|
||||
}
|
||||
lines.push("END:VCALENDAR");
|
||||
return lines.map(fold).join("\r\n") + "\r\n";
|
||||
}
|
||||
@@ -5,15 +5,16 @@ import { BASES, TAGS } from "./categories";
|
||||
import type { IngredientEntry } from "./ingredient-search";
|
||||
import { allIngredients } from "./ingredients";
|
||||
import { linkIngredients, orderSections, SECTIONS, sectionsByRules, styleByRules, type Section, type StepIngredient } from "./recipe-style";
|
||||
import { impliedKitchenUnit, isKitchenUnit, isPackKind, toBase, type BaseUnit, type InputUnit, type KitchenUnit, type PackKind } from "./units";
|
||||
import { COUNT_UNITS, FIXED_UNITS, impliedKitchenUnit, isKitchenUnit, isMetric, isPackKind, needsSize, sizeKey, sizeOf, toBase, type BaseUnit, type DisplayUnit, type InputUnit, type KitchenUnit, type PackKind } from "./units";
|
||||
|
||||
// Gerichte des Haushalts lesen und schreiben. Mengen kommen so, wie man sie
|
||||
// für das ganze Rezept eintippt (z. B. „500 g für 4 Portionen“), und werden
|
||||
// hier in Basiseinheiten pro Portion umgerechnet (CLAUDE.md, Regel 2).
|
||||
// Alle Funktionen laufen in withHousehold(…).
|
||||
|
||||
// Seit 26.11.39 auch Gebinde: Dose, Glas, Packung, Bund — Größe aus der Zutat oder dem Produkt.
|
||||
export const INPUT_UNITS = ["g", "kg", "ml", "l", "piece", "tbsp", "tsp", "pinch", "can", "jar", "pack", "bunch"] as const;
|
||||
// Seit 26.11.39 auch Gebinde, seit 26.11.49 alle Küchenmaße (lib/units.ts): Tasse, Schuss,
|
||||
// Msp., Becher, Stück, Würfel, Zehe, Scheibe — Zählmaße mit Größe je Zutat.
|
||||
export const INPUT_UNITS = ["g", "kg", "ml", "l", ...FIXED_UNITS, ...COUNT_UNITS] as const;
|
||||
|
||||
export const dishInput = z.object({
|
||||
title: z.string().trim().min(1).max(120),
|
||||
@@ -32,6 +33,8 @@ export const dishInput = z.object({
|
||||
qty: z.number().positive().max(100000),
|
||||
unit: z.enum(INPUT_UNITS),
|
||||
note: z.string().trim().max(120).nullable().optional(),
|
||||
// Größe eines Zählmaßes in der Basiseinheit, wenn der Haushalt sie noch nicht kennt (26.11.49).
|
||||
size: z.number().positive().max(100000).nullable().optional(),
|
||||
// Produkt, das man nimmt; Packung in der Einheit der Zeile, Kochzeit laut Packung.
|
||||
product: z
|
||||
.object({
|
||||
@@ -71,6 +74,8 @@ export type DishSummary = {
|
||||
|
||||
export type DishDetail = DishSummary & {
|
||||
sourceUrl: string | null;
|
||||
/** Für wie viele Portionen das Rezept eingegeben wurde (26.11.49); null bei älteren Gerichten. */
|
||||
recipePortions: number | null;
|
||||
ingredients: {
|
||||
ingredientId: string;
|
||||
name: string;
|
||||
@@ -82,11 +87,13 @@ export type DishDetail = DishSummary & {
|
||||
isStaple: boolean;
|
||||
product: Product | null;
|
||||
/** Eingegebenes Küchenmaß („2 EL“, „1 Dose“), sonst null (26.11.39). */
|
||||
displayUnit: KitchenUnit | null;
|
||||
displayUnit: DisplayUnit | null;
|
||||
/** Gebinde der Zutat und seine Größe in der Basiseinheit: Produkt, sonst Haushalt, sonst Vorgabe. */
|
||||
packKind: PackKind | null;
|
||||
packSize: number | null;
|
||||
kitchenUnit: KitchenUnit | null;
|
||||
kindSize: number | null;
|
||||
sizes: Partial<Record<string, number>>;
|
||||
}[];
|
||||
// timerFrom: Name des Produkts, wenn der Timer von seiner Packung stammt.
|
||||
steps: { section: Section; text: string; timerSeconds: number | null; ingredientIds: string[]; timerFrom?: string }[];
|
||||
@@ -110,7 +117,7 @@ export async function listDishes(client: PoolClient): Promise<DishSummary[]> {
|
||||
}
|
||||
|
||||
export async function getDish(client: PoolClient, id: string, locale: string): Promise<DishDetail | null> {
|
||||
const dish = (await client.query(`select ${summaryColumns}, source_url as "sourceUrl" from dishes where id = $1 and archived_at is null`, [id]))
|
||||
const dish = (await client.query(`select ${summaryColumns}, source_url as "sourceUrl", recipe_portions as "recipePortions" from dishes where id = $1 and archived_at is null`, [id]))
|
||||
.rows[0];
|
||||
if (!dish) return null;
|
||||
const entries = new Map((await allIngredients(client)).map((i) => [i.id, i]));
|
||||
@@ -136,10 +143,14 @@ export async function getDish(client: PoolClient, id: string, locale: string): P
|
||||
: r.house_product
|
||||
? { name: r.house_product, pack: r.house_pack, cookMinutes: r.house_cook, fromHousehold: true }
|
||||
: null,
|
||||
displayUnit: r.display_unit as KitchenUnit | null,
|
||||
displayUnit: r.display_unit as DisplayUnit | null,
|
||||
packKind: entries.get(r.ingredient_id)?.packKind ?? null,
|
||||
packSize: ((r.product ? r.product_pack : r.house_pack) ?? entries.get(r.ingredient_id)?.packSize ?? null) as number | null,
|
||||
// Größe zum eingegebenen Maß (26.11.49): beim Gebinde Produkt, sonst Haushalt bzw. Zutat.
|
||||
packSize: sizeForDisplay(r, entries.get(r.ingredient_id)),
|
||||
kitchenUnit: entries.get(r.ingredient_id)?.kitchenUnit ?? null,
|
||||
// Fürs Bearbeiten (26.11.49): Gebindegröße der Zutat und alle Größen des Haushalts.
|
||||
kindSize: entries.get(r.ingredient_id)?.packSize ?? null,
|
||||
sizes: entries.get(r.ingredient_id)?.sizes ?? {},
|
||||
})).map((i) => ({
|
||||
...i,
|
||||
// Ohne eingegebenes Maß (ältere Gerichte, Vorlagen): Löffel oder Gebinde, wo es passt (26.11.39).
|
||||
@@ -181,6 +192,16 @@ export function withProductTimers<S extends { section: Section; timerSeconds: nu
|
||||
});
|
||||
}
|
||||
|
||||
function sizeForDisplay(
|
||||
r: { display_unit: string | null; unit: BaseUnit; product: string | null; product_pack: number | null; house_pack: number | null },
|
||||
entry: IngredientEntry | undefined,
|
||||
): number | null {
|
||||
const productPack = (r.product ? r.product_pack : r.house_pack) ?? null;
|
||||
const d = r.display_unit;
|
||||
if (!d || isPackKind(d)) return productPack ?? (d ? sizeOf(d, r.unit, entry ?? {}) : (entry?.packSize ?? null));
|
||||
return needsSize(d, r.unit) ? sizeOf(d, r.unit, entry ?? {}) : null;
|
||||
}
|
||||
|
||||
export class InvalidAmount extends Error {}
|
||||
|
||||
/** Legt an (id leer) oder ersetzt Inhalt, Zutaten und Schritte. Gibt die Kennung zurück. */
|
||||
@@ -195,16 +216,22 @@ export async function saveDish(client: PoolClient, householdId: string, memberId
|
||||
if (!entry) throw new InvalidAmount(i.ingredientId);
|
||||
const base = entry.unit;
|
||||
const unit = i.unit as InputUnit;
|
||||
// Ein Gebinde nur, wenn die Zutat eines hat — „1 Dose Zwiebeln“ gibt es nicht.
|
||||
if (isPackKind(unit) && entry.packKind !== unit) throw new InvalidAmount(i.ingredientId);
|
||||
// Packung des Produkts: bei einem Gebinde in der Basiseinheit („400“ g), sonst in der Einheit der Zeile.
|
||||
const pack = i.product?.pack ? toBase(i.product.pack, isPackKind(unit) ? base : unit, base) : null;
|
||||
// Größe des Gebindes: Produkt am Gericht, sonst Lieblingsprodukt, sonst Haushalt bzw. Vorgabe.
|
||||
const size = (i.product ? pack : null) ?? house.get(i.ingredientId) ?? entry.packSize ?? null;
|
||||
const counted = needsSize(unit, base);
|
||||
// Packung des Produkts: bei einem Zählmaß in der Basiseinheit („400“ g), sonst in der Einheit der Zeile.
|
||||
const pack = i.product?.pack ? toBase(i.product.pack, counted ? base : unit, base) : null;
|
||||
// Größe eines Zählmaßes (26.11.49): beim Gebinde zuerst das Produkt bzw. Lieblingsprodukt,
|
||||
// dann was der Haushalt für Zutat und Maß kennt, dann das Gebinde der Zutat, zuletzt die
|
||||
// im Formular eingetragene Größe — die wird dann für den Haushalt gemerkt.
|
||||
const known = counted ? ((isPackKind(unit) ? ((i.product ? pack : null) ?? house.get(i.ingredientId) ?? null) : null) ?? sizeOf(unit, base, entry)) : null;
|
||||
const size = known ?? (counted ? (i.size ?? null) : null);
|
||||
const total = toBase(i.qty, unit, base, size);
|
||||
if (total === null) throw new InvalidAmount(i.ingredientId);
|
||||
const displayUnit = isKitchenUnit(unit) ? unit : null;
|
||||
return { ...i, base, perPortion: Math.round((total / input.portions) * 1000) / 1000, position, pack, displayUnit };
|
||||
// Eingegebenes Maß merken: Küchenmaße, und Gewicht/Volumen einer anderen Familie
|
||||
// („200 ml“ Joghurt, „750 ml“ Brühwürfel, 26.11.50); kg bei g und l bei ml nicht.
|
||||
const family = (u: string) => (u === "g" || u === "kg" ? "g" : u === "ml" || u === "l" ? "ml" : u);
|
||||
const displayUnit = (unit !== base && isKitchenUnit(unit)) || (isMetric(unit) && family(unit) !== base) ? (unit as DisplayUnit) : null;
|
||||
const rememberSize = counted && known === null && size ? { unit: sizeKey(unit), size } : null;
|
||||
return { ...i, base, perPortion: Math.round((total / input.portions) * 1000) / 1000, position, pack, displayUnit, rememberSize };
|
||||
});
|
||||
const values = [
|
||||
input.title,
|
||||
@@ -213,11 +240,12 @@ export async function saveDish(client: PoolClient, householdId: string, memberId
|
||||
input.effortMinutes,
|
||||
input.isTrial,
|
||||
input.sourceUrl ?? null,
|
||||
input.portions, // recipe_portions (26.11.49): Bearbeiten zeigt die Mengen wieder so
|
||||
];
|
||||
let dishId = id;
|
||||
if (dishId) {
|
||||
const updated = await client.query(
|
||||
`update dishes set title = $2, base = $3, tags = $4, effort_minutes = $5, is_trial = $6, source_url = $7, updated_at = now()
|
||||
`update dishes set title = $2, base = $3, tags = $4, effort_minutes = $5, is_trial = $6, source_url = $7, recipe_portions = $8, updated_at = now()
|
||||
where id = $1 and archived_at is null`,
|
||||
[dishId, ...values],
|
||||
);
|
||||
@@ -227,8 +255,8 @@ export async function saveDish(client: PoolClient, householdId: string, memberId
|
||||
} else {
|
||||
dishId = (
|
||||
await client.query(
|
||||
`insert into dishes (household_id, title, base, tags, effort_minutes, is_trial, source_url, created_by)
|
||||
values ($1, $2, $3, $4, $5, $6, $7, $8) returning id`,
|
||||
`insert into dishes (household_id, title, base, tags, effort_minutes, is_trial, source_url, recipe_portions, created_by)
|
||||
values ($1, $2, $3, $4, $5, $6, $7, $8, $9) returning id`,
|
||||
[householdId, ...values, memberId],
|
||||
)
|
||||
).rows[0].id as string;
|
||||
@@ -241,6 +269,13 @@ export async function saveDish(client: PoolClient, householdId: string, memberId
|
||||
[householdId, dishId, r.ingredientId, r.perPortion, r.base, r.note ?? null, r.position,
|
||||
r.product?.name ?? null, r.product ? r.pack : null, r.product?.cookMinutes ?? null, r.displayUnit],
|
||||
);
|
||||
if (r.rememberSize) {
|
||||
await client.query(
|
||||
`insert into household_pack_sizes (household_id, ingredient_id, unit, pack_size) values ($1, $2, $3, $4)
|
||||
on conflict (household_id, ingredient_id, unit) do nothing`,
|
||||
[householdId, r.ingredientId, r.rememberSize.unit, r.rememberSize.size],
|
||||
);
|
||||
}
|
||||
if (r.product?.remember) {
|
||||
await client.query(
|
||||
`insert into household_products (household_id, ingredient_id, product, product_pack, cook_minutes) values ($1, $2, $3, $4, $5)
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
// Version der App-Symbole (docs/icon/lunch.svg → scripts/app-icons.mjs). Ändert sich
|
||||
// das Symbol, hier hochzählen: Die Adressen ändern sich, Browser und Service Worker
|
||||
// holen das neue statt des gemerkten (26.11.42, Kochmütze mit Herz).
|
||||
export const ICON_VERSION = "2";
|
||||
export const iconUrl = (path: string) => `${path}?v=${ICON_VERSION}`;
|
||||
@@ -23,6 +23,8 @@ export type IngredientEntry = {
|
||||
/** Übliches Gebinde und seine Größe in der Basiseinheit (Haushaltsgröße schon eingerechnet). */
|
||||
packKind?: PackKind | null;
|
||||
packSize?: number | null;
|
||||
/** Größen des Haushalts je Zählmaß, in der Basiseinheit (26.11.49). */
|
||||
sizes?: Partial<Record<string, number>>;
|
||||
};
|
||||
|
||||
export function normalize(text: string): string {
|
||||
|
||||
@@ -2,6 +2,10 @@ import "server-only";
|
||||
import type { PoolClient } from "pg";
|
||||
import { pool } from "@/lib/db";
|
||||
import type { IngredientEntry } from "./ingredient-search";
|
||||
import { needsSize, type CountUnit } from "./units";
|
||||
|
||||
/** Maß einer Haushaltsgröße: ein Zählmaß, oder g/ml je Stück einer Stück-Zutat (26.11.50). */
|
||||
export type SizeUnit = CountUnit | "g" | "ml";
|
||||
|
||||
// Die kanonischen Zutaten sind global und ändern sich nur beim Einspielen
|
||||
// (Neustart). Einmal laden, im Speicher halten. Eigene Zutaten eines Haushalts
|
||||
@@ -30,21 +34,30 @@ export async function allIngredients(client?: PoolClient): Promise<IngredientEnt
|
||||
const global = await globalIngredients();
|
||||
if (!client) return global;
|
||||
const own = (await client.query(`select ${COLUMNS}, true as own from ingredients where household_id is not null order by key`)).rows as IngredientEntry[];
|
||||
const sizes = new Map(
|
||||
(await client.query("select ingredient_id, pack_size::float as size from household_pack_sizes")).rows.map((r) => [r.ingredient_id as string, r.size as number]),
|
||||
);
|
||||
// Größen je Zutat und Maß (26.11.49): „1 Packung Hackfleisch = 500 g“.
|
||||
const sizes = new Map<string, Record<string, number>>();
|
||||
for (const r of (await client.query("select ingredient_id, unit, pack_size::float as size from household_pack_sizes")).rows) {
|
||||
sizes.set(r.ingredient_id, { ...sizes.get(r.ingredient_id), [r.unit]: r.size });
|
||||
}
|
||||
const all = own.length ? [...global, ...own] : global;
|
||||
return sizes.size ? all.map((i) => (sizes.has(i.id) && i.packKind ? { ...i, packSize: sizes.get(i.id)! } : i)) : all;
|
||||
if (!sizes.size) return all;
|
||||
return all.map((i) => {
|
||||
const own = sizes.get(i.id);
|
||||
if (!own) return i;
|
||||
// Das Gebinde der Zutat nimmt die Haushaltsgröße gleich mit (Einkaufsliste, Anzeige).
|
||||
return { ...i, sizes: own, packSize: i.packKind && own[i.packKind] ? own[i.packKind] : i.packSize };
|
||||
});
|
||||
}
|
||||
|
||||
/** Gebindegröße für den Haushalt setzen (wer Gerichte pflegt). Nur für Zutaten mit Gebinde. */
|
||||
export async function setPackSize(client: PoolClient, householdId: string, ingredientId: string, size: number): Promise<boolean> {
|
||||
/** Größe eines Zählmaßes für den Haushalt setzen (wer Gerichte pflegt). Ohne Maß: das Gebinde der Zutat. */
|
||||
export async function setPackSize(client: PoolClient, householdId: string, ingredientId: string, size: number, unit?: SizeUnit): Promise<boolean> {
|
||||
const entry = (await allIngredients(client)).find((i) => i.id === ingredientId);
|
||||
if (!entry?.packKind) return false;
|
||||
const kind = unit ?? entry?.packKind;
|
||||
if (!entry || !kind || !needsSize(kind, entry.unit)) return false;
|
||||
await client.query(
|
||||
`insert into household_pack_sizes (household_id, ingredient_id, pack_size) values ($1, $2, $3)
|
||||
on conflict (household_id, ingredient_id) do update set pack_size = excluded.pack_size, updated_at = now()`,
|
||||
[householdId, ingredientId, size],
|
||||
`insert into household_pack_sizes (household_id, ingredient_id, unit, pack_size) values ($1, $2, $3, $4)
|
||||
on conflict (household_id, ingredient_id, unit) do update set pack_size = excluded.pack_size, updated_at = now()`,
|
||||
[householdId, ingredientId, kind, size],
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -15,14 +15,15 @@ export async function presenter(): Promise<{ householdId: string; display: boole
|
||||
return device ? { householdId: device.householdId, display: true } : null;
|
||||
}
|
||||
|
||||
export type PlannedDish = { slotId: string; dishId: string; title: string; photo: string | null; portions: number; cookName: string | null };
|
||||
export type PlannedDish = { slotId: string; dishId: string; title: string; photo: string | null; portions: number; cookName: string | null; plannedDay: string | null };
|
||||
|
||||
/** Die noch nicht gekochten Gerichte der laufenden Runde, in Reihenfolge; das erste ist „Heute“. */
|
||||
export async function upcoming(client: PoolClient): Promise<PlannedDish[]> {
|
||||
const round = await currentRound(client);
|
||||
if (!round || round.status === "open") return [];
|
||||
const { rows } = await client.query(
|
||||
`select s.id as "slotId", d.id as "dishId", d.title, d.photo_path as photo, s.portions, m.display_name as "cookName"
|
||||
`select s.id as "slotId", d.id as "dishId", d.title, d.photo_path as photo, s.portions, m.display_name as "cookName",
|
||||
to_char(s.planned_day, 'YYYY-MM-DD') as "plannedDay"
|
||||
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.round_id = $1 and s.cooked_at is null order by s.position`,
|
||||
[round.id],
|
||||
|
||||
@@ -21,6 +21,8 @@ export type SlotView = {
|
||||
locked: boolean;
|
||||
cookedAt: string | null;
|
||||
reason: Reason | null;
|
||||
/** Wochentag, von Hand gesetzt (26.11.45), sonst null. */
|
||||
plannedDay: string | null;
|
||||
};
|
||||
|
||||
function parseReason(text: string | null): Reason | null {
|
||||
@@ -35,7 +37,8 @@ function parseReason(text: string | null): Reason | null {
|
||||
export async function planSlots(client: PoolClient, roundId: string): Promise<SlotView[]> {
|
||||
const { rows } = await client.query(
|
||||
`select s.id, s.position, s.dish_id as "dishId", d.title, d.photo_path as photo, d.base, s.portions,
|
||||
s.cook_member_id as "cookMemberId", m.display_name as "cookName", s.locked, s.cooked_at::text as "cookedAt", s.reason
|
||||
s.cook_member_id as "cookMemberId", m.display_name as "cookName", s.locked, s.cooked_at::text as "cookedAt", s.reason,
|
||||
to_char(s.planned_day, 'YYYY-MM-DD') as "plannedDay"
|
||||
from slots s left join dishes d on d.id = s.dish_id left join members m on m.id = s.cook_member_id
|
||||
where s.round_id = $1 order by s.position`,
|
||||
[roundId],
|
||||
@@ -102,7 +105,7 @@ export async function makeSuggestion(client: PoolClient, householdId: string, ro
|
||||
}
|
||||
}
|
||||
|
||||
export type SlotChange = { dishId?: string; portions?: number; cookMemberId?: string | null; locked?: boolean };
|
||||
export type SlotChange = { dishId?: string; portions?: number; cookMemberId?: string | null; locked?: boolean; plannedDay?: string | null };
|
||||
|
||||
export async function updateSlot(client: PoolClient, roundId: string, id: string, change: SlotChange): Promise<boolean> {
|
||||
const sets: string[] = [];
|
||||
@@ -118,6 +121,7 @@ export async function updateSlot(client: PoolClient, roundId: string, id: string
|
||||
if (change.portions !== undefined) add("portions", change.portions);
|
||||
if (change.cookMemberId !== undefined) add("cook_member_id", change.cookMemberId);
|
||||
if (change.locked !== undefined) add("locked", change.locked);
|
||||
if (change.plannedDay !== undefined) add("planned_day", change.plannedDay);
|
||||
if (!sets.length) return true;
|
||||
const { rowCount } = await client.query(`update slots set ${sets.join(", ")} where id = $1 and round_id = $2`, values);
|
||||
return rowCount === 1;
|
||||
@@ -165,3 +169,9 @@ export async function approve(client: PoolClient, round: Round, memberId: string
|
||||
);
|
||||
return rowCount === 1;
|
||||
}
|
||||
|
||||
/** Tag eines Gerichts zum Anzeigen, z. B. „Mo., 9. Nov.“ (26.11.45). */
|
||||
export function dayLabel(day: string | null, locale: string): string | null {
|
||||
if (!day) return null;
|
||||
return new Intl.DateTimeFormat(locale, { weekday: "short", day: "numeric", month: "short" }).format(new Date(`${day}T12:00:00`));
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
// lib/fetch-safe.ts, das Zuordnen der Zutaten lib/ingredient-search.ts.
|
||||
|
||||
import { searchIngredients, type IngredientEntry } from "./ingredient-search";
|
||||
import { isPackKind, parseNumber, toBase, type InputUnit, type KitchenUnit, type PackKind } from "./units";
|
||||
import { isPackKind, needsSize, parseNumber, sizeOf, toBase, type InputUnit, type KitchenUnit, type PackKind } from "./units";
|
||||
|
||||
export type RawRecipe = {
|
||||
title: string;
|
||||
@@ -126,14 +126,21 @@ const UNIT_WORDS: [RegExp, InputUnit, number?][] = [
|
||||
[/^(tl|teel[öo]ffel|tsp|teaspoons?|cc|c\.\s?à\s?c\.?|cucharaditas?)$/i, "tsp"],
|
||||
[/^(prisen?|pinch(es)?|pinc[ée]es?|pizcas?)$/i, "pinch"],
|
||||
[/^(cups?|tassen?|tazas?)$/i, "cup"],
|
||||
// Seit 26.11.49 eigene Maße: Schuss, Messerspitze, Becher, Würfel, Zehe, Scheibe.
|
||||
[/^(schuss|sch(ü|ue)sse|dash(es)?|traits?|chorritos?)$/i, "dash"],
|
||||
[/^(msp|messerspitzen?)$/i, "knifepoint"],
|
||||
[/^(becher|tubs?|pots?|tarrinas?)$/i, "tub"],
|
||||
[/^(w(ü|ue)rfel|cubes?|cubitos?)$/i, "cube"],
|
||||
[/^(zehen?|cloves?|gousses?|dientes?)$/i, "clove"],
|
||||
[/^(scheiben?|slices?|tranches?|rebanadas?|lonchas?)$/i, "slice"],
|
||||
[/^(oz|ounces?)$/i, "g", 28.35],
|
||||
[/^(lbs?|pounds?)$/i, "g", 453.6],
|
||||
// Gebinde (26.11.39): Größe kommt aus der Zutat, nie aus dem Text oder einem Modell.
|
||||
[/^(dosen?|cans?|tins?|bo[iî]tes?|latas?)$/i, "can"],
|
||||
[/^(gl(a|ä)s(er)?|jars?|bocal|bocaux|tarros?|frascos?)$/i, "jar"],
|
||||
[/^(pck|pkg|pack(ung(en)?|s)?|p(a|ä)ckchen|becher|paquets?|paquetes?|sachets?|sobres?|w(ü|ue)rfel|kugeln?)$/i, "pack"],
|
||||
[/^(pck|pkg|pack(ung(en)?|s)?|p(a|ä)ckchen|paquets?|paquetes?|sachets?|sobres?|kugeln?)$/i, "pack"],
|
||||
[/^(bund|bunch(es)?|bouquets?|bottes?|manojos?)$/i, "bunch"],
|
||||
[/^(st(ü|ue)ck|stk\.?|pieces?|pi[eè]ces?|unidad(es)?|zehen?|cloves?|gousses?|dientes?|scheiben?|slices?|tranches?|rebanadas?)$/i, "piece"],
|
||||
[/^(st(ü|ue)ck|stk\.?|pieces?|pi[eè]ces?|unidad(es)?)$/i, "piece"],
|
||||
];
|
||||
|
||||
export type ParsedLine = { raw: string; qty: number | null; unit: InputUnit | null; factor: number; name: string };
|
||||
@@ -180,6 +187,7 @@ export type MatchedLine = {
|
||||
kitchenUnit?: KitchenUnit | null;
|
||||
packKind?: PackKind | null;
|
||||
packSize?: number | null;
|
||||
sizes?: Partial<Record<string, number>>;
|
||||
} | null;
|
||||
qty: number | null;
|
||||
unit: InputUnit | null;
|
||||
@@ -202,13 +210,17 @@ export function matchLines(lines: string[], list: IngredientEntry[], locale: str
|
||||
kitchenUnit: hit.kitchenUnit ?? null,
|
||||
packKind: hit.packKind ?? null,
|
||||
packSize: hit.packSize ?? null,
|
||||
sizes: hit.sizes ?? {},
|
||||
};
|
||||
let qty = p.qty !== null ? p.qty * p.factor : null;
|
||||
let unit = p.unit;
|
||||
// Ein Gebinde ist das der Zutat („1 Becher Sahne“ → ihre Packung); ohne Gebinde
|
||||
// zählt bei Stück-Zutaten das Stück („1 Bund Petersilie“ ist ein Stück Petersilie).
|
||||
if (unit && isPackKind(unit)) unit = hit.packKind && hit.packSize ? hit.packKind : hit.unit === "piece" ? "piece" : unit;
|
||||
if (qty !== null && unit && toBase(qty, unit, hit.unit, hit.packSize) === null) {
|
||||
// Ein Zählmaß ohne bekannte Größe („2 Zehen“ bei Knoblauch in Gramm) bleibt stehen:
|
||||
// Das Formular fragt nach der Größe (26.11.49). Sonst passt das Maß nicht — Menge leer.
|
||||
const size = unit ? sizeOf(unit, hit.unit, hit) : null;
|
||||
if (qty !== null && unit && toBase(qty, unit, hit.unit, size) === null && !(needsSize(unit, hit.unit) && size === null)) {
|
||||
qty = null;
|
||||
unit = null;
|
||||
}
|
||||
|
||||
@@ -43,3 +43,31 @@ export async function openRound(client: PoolClient, householdId: string, memberI
|
||||
);
|
||||
return rows[0].id;
|
||||
}
|
||||
|
||||
// Runde beenden, löschen, ändern (Kai, 8.11.2026, 26.11.45). Bis dahin endete eine
|
||||
// Runde nur, wenn alles gekocht war — wer etwas ausließ, kam nie zur nächsten.
|
||||
|
||||
/** Beenden: Gekochtes und Bewertungen bleiben Geschichte, Ungekochtes verfällt. */
|
||||
export async function endRound(client: PoolClient, roundId: string): Promise<boolean> {
|
||||
const { rowCount } = await client.query("update rounds set status = 'done' where id = $1 and status <> 'done'", [roundId]);
|
||||
return rowCount === 1;
|
||||
}
|
||||
|
||||
export class RoundHasCooked extends Error {}
|
||||
|
||||
/** Ganz löschen — nur solange nichts gekocht ist, damit keine Bewertung verloren geht. */
|
||||
export async function deleteRound(client: PoolClient, roundId: string): Promise<boolean> {
|
||||
const cooked = await client.query("select 1 from slots where round_id = $1 and cooked_at is not null limit 1", [roundId]);
|
||||
if (cooked.rowCount) throw new RoundHasCooked();
|
||||
const { rowCount } = await client.query("delete from rounds where id = $1 and status <> 'done'", [roundId]);
|
||||
return rowCount === 1;
|
||||
}
|
||||
|
||||
/** Einkaufstag, Zahl der Mahlzeiten und Standardportionen nachträglich ändern. */
|
||||
export async function updateRound(client: PoolClient, roundId: string, input: z.infer<typeof roundInput>): Promise<boolean> {
|
||||
const { rowCount } = await client.query(
|
||||
"update rounds set shopping_date = $2, slots_count = $3, default_portions = $4 where id = $1 and status <> 'done'",
|
||||
[roundId, input.shoppingDate, input.slotsCount, input.defaultPortions],
|
||||
);
|
||||
return rowCount === 1;
|
||||
}
|
||||
@@ -17,7 +17,7 @@ export type Item = {
|
||||
unit: "g" | "ml" | "piece" | null;
|
||||
packCount: number | null;
|
||||
packSize: number | null;
|
||||
packKind: "can" | "jar" | "pack" | "bunch" | null;
|
||||
packKind: "can" | "jar" | "pack" | "tub" | "bunch" | null;
|
||||
dishes: string[];
|
||||
aislePosition: number | null;
|
||||
manual: boolean;
|
||||
@@ -66,7 +66,7 @@ export async function syncList(client: PoolClient, householdId: string, round: R
|
||||
join dish_ingredients di on di.dish_id = d.id
|
||||
join ingredients i on i.id = di.ingredient_id
|
||||
left join household_products hp on hp.ingredient_id = di.ingredient_id
|
||||
left join household_pack_sizes hps on hps.ingredient_id = di.ingredient_id
|
||||
left join household_pack_sizes hps on hps.ingredient_id = di.ingredient_id and hps.unit = i.pack_kind
|
||||
where s.round_id = $1 and s.cooked_at is null
|
||||
order by s.position`,
|
||||
[round.id, locale],
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
// Einkaufsliste einsprechen (26.11.46): Abschrift → Posten, ohne Sprachmodell.
|
||||
// „Milch, zwei Packungen Eier und Brot, bitte“ → Milch · zwei Packungen Eier · Brot.
|
||||
// Was falsch getrennt ist („Salz und Pfeffer“), korrigiert die Person vor dem Hinzufügen.
|
||||
|
||||
const SEPARATORS = /[,;\n]+|\.\s+|\s+(?:und dann|und|sowie|außerdem|dann|and then|and|then|et|y)\s+/giu;
|
||||
|
||||
// Füllwörter am Anfang oder Ende eines Postens.
|
||||
const LEADING =
|
||||
/^(?:(?:ich|wir)\s+(?:brauche|brauchen|hätte gern|hätten gern|möchte|möchten)|brauchen wir|bitte|noch|auch|außerdem|schreib(?:e)?(?:\s+auf)?|setz(?:e)?|kauf(?:e|en)?|wir haben kein(?:e|en)?|es fehlt|es fehlen|(?:we|i)\s+need|please|also|add|buy|get)\s+/iu;
|
||||
const TRAILING = /\s+(?:bitte|noch|kaufen|einkaufen|auf die liste|mitbringen|please|too|as well)$/iu;
|
||||
|
||||
export function splitSpoken(text: string): string[] {
|
||||
const out: string[] = [];
|
||||
for (const raw of text.split(SEPARATORS)) {
|
||||
let item = raw.trim().replace(/[.!?…]+$/u, "").trim();
|
||||
for (let i = 0; i < 3; i++) {
|
||||
const before = item;
|
||||
item = item.replace(LEADING, "").replace(TRAILING, "").trim();
|
||||
if (item === before) break;
|
||||
}
|
||||
if (!item || /^(?:bitte|danke|das wär'?s|das ist alles|fertig|(?:ich|wir) brauche[n]?|please|thanks|that's it)$/iu.test(item)) continue;
|
||||
item = item.charAt(0).toLocaleUpperCase("de") + item.slice(1);
|
||||
if (item.length > 80) item = item.slice(0, 80).trim();
|
||||
if (!out.some((o) => o.toLocaleLowerCase("de") === item.toLocaleLowerCase("de"))) out.push(item);
|
||||
if (out.length >= 20) break;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
@@ -4,19 +4,67 @@
|
||||
|
||||
export type BaseUnit = "g" | "ml" | "piece";
|
||||
|
||||
/** Gebinde, in denen man kauft: Dose, Glas, Packung, Bund (26.11.39). */
|
||||
export const PACK_KINDS = ["can", "jar", "pack", "bunch"] as const;
|
||||
/** Gebinde, in denen man kauft: Dose, Glas, Packung, Becher, Bund (26.11.39, Becher 26.11.49). */
|
||||
export const PACK_KINDS = ["can", "jar", "pack", "tub", "bunch"] as const;
|
||||
export type PackKind = (typeof PACK_KINDS)[number];
|
||||
|
||||
/**
|
||||
* Zählmaße mit einer Größe je Zutat (26.11.49, Kai: „überall“): die Gebinde und
|
||||
* Stück, Würfel, Zehe, Scheibe. „1 Packung Hackfleisch = 500 g“, „1 Zehe = 3 g“ —
|
||||
* die Größe kennt der Haushalt (household_pack_sizes) oder die Zutat.
|
||||
*/
|
||||
export const COUNT_UNITS = [...PACK_KINDS, "piece", "cube", "clove", "slice"] as const;
|
||||
export type CountUnit = (typeof COUNT_UNITS)[number];
|
||||
|
||||
/** Feste Küchenmaße für Gramm- und Flüssig-Zutaten: Löffel, Prise, Tasse, Schuss, Messerspitze. */
|
||||
export const FIXED_UNITS = ["tbsp", "tsp", "pinch", "cup", "dash", "knifepoint"] as const;
|
||||
export type FixedUnit = (typeof FIXED_UNITS)[number];
|
||||
|
||||
/** Küchenmaße, die ein Rezept so anzeigt, wie sie eingegeben wurden (26.11.39). */
|
||||
export const KITCHEN_UNITS = ["tbsp", "tsp", "pinch", ...PACK_KINDS] as const;
|
||||
export const KITCHEN_UNITS = [...FIXED_UNITS, ...COUNT_UNITS] as const;
|
||||
export type KitchenUnit = (typeof KITCHEN_UNITS)[number];
|
||||
|
||||
export const isPackKind = (u: string): u is PackKind => (PACK_KINDS as readonly string[]).includes(u);
|
||||
export const isCountUnit = (u: string): u is CountUnit => (COUNT_UNITS as readonly string[]).includes(u);
|
||||
export const isFixedUnit = (u: string): u is FixedUnit => (FIXED_UNITS as readonly string[]).includes(u);
|
||||
export const isKitchenUnit = (u: string): u is KitchenUnit => (KITCHEN_UNITS as readonly string[]).includes(u);
|
||||
|
||||
/** Gewicht und Volumen (26.11.50, Kai: „Milliliter und Liter“ überall, auch bei Stück-Zutaten). */
|
||||
export const METRIC = ["g", "kg", "ml", "l"] as const;
|
||||
export type Metric = (typeof METRIC)[number];
|
||||
export const isMetric = (u: string): u is Metric => (METRIC as readonly string[]).includes(u);
|
||||
const METRIC_FACTOR: Record<Metric, number> = { g: 1, kg: 1000, ml: 1, l: 1000 };
|
||||
|
||||
/** Maß, in dem ein Rezept eine Menge zeigt, wie sie eingegeben wurde. */
|
||||
export type DisplayUnit = KitchenUnit | Metric;
|
||||
|
||||
/** Maße, die man tippt oder in Rezepten liest. */
|
||||
export type InputUnit = BaseUnit | "kg" | "l" | "cl" | "tbsp" | "tsp" | "pinch" | "cup" | PackKind;
|
||||
export type InputUnit = BaseUnit | "kg" | "l" | "cl" | KitchenUnit;
|
||||
|
||||
/**
|
||||
* Ein Maß, das in dieser Basiseinheit eine Größe je Zutat braucht: Zählmaße („Stück“
|
||||
* bei Stück-Zutaten ist keins) und Gewicht oder Volumen bei Stück-Zutaten
|
||||
* („750 ml Brühe“ bei Brühwürfeln: 1 Stück = 500 ml).
|
||||
*/
|
||||
export const needsSize = (unit: string, base: BaseUnit): boolean =>
|
||||
(isCountUnit(unit) && !(unit === "piece" && base === "piece")) || (base === "piece" && isMetric(unit));
|
||||
|
||||
/** Unter welchem Maß eine Größe steht: kg und l teilen sich die von g und ml (je Stück). */
|
||||
export const sizeKey = (unit: string): string => (unit === "kg" ? "g" : unit === "l" ? "ml" : unit);
|
||||
|
||||
/** Ohne Angabe: Würfel, Zehe, Scheibe einer Stück-Zutat sind je ein Stück. */
|
||||
export function defaultSize(unit: string, base: BaseUnit): number | null {
|
||||
return base === "piece" && (unit === "cube" || unit === "clove" || unit === "slice") ? 1 : null;
|
||||
}
|
||||
|
||||
/** Größe eines Zählmaßes für eine Zutat: Haushalt, sonst ihr Gebinde, sonst die Vorgabe oben. */
|
||||
export function sizeOf(
|
||||
unit: string,
|
||||
base: BaseUnit,
|
||||
entry: { packKind?: string | null; packSize?: number | null; sizes?: Partial<Record<string, number>> | null },
|
||||
): number | null {
|
||||
return entry.sizes?.[sizeKey(unit)] ?? (entry.packKind === unit ? (entry.packSize ?? null) : null) ?? defaultSize(unit, base);
|
||||
}
|
||||
|
||||
/** Hochrechnen: Menge pro Portion × Portionen. */
|
||||
export function scale(qtyPerPortion: number, portions: number): number {
|
||||
@@ -26,8 +74,8 @@ export function scale(qtyPerPortion: number, portions: number): number {
|
||||
// Küchenmaße in Basiseinheiten. Löffel und Tassen sind Volumen; für feste
|
||||
// Zutaten (Einheit g) gilt eine mittlere Dichte — genau genug für ein
|
||||
// Familienrezept, und die Planerin sieht und korrigiert die Menge.
|
||||
const VOLUME_ML: Partial<Record<InputUnit, number>> = { ml: 1, cl: 10, l: 1000, tbsp: 15, tsp: 5, cup: 240, pinch: 0.5 };
|
||||
const SOLID_G: Partial<Record<InputUnit, number>> = { g: 1, kg: 1000, tbsp: 12, tsp: 4, cup: 150, pinch: 0.5 };
|
||||
const VOLUME_ML: Partial<Record<InputUnit, number>> = { ml: 1, cl: 10, l: 1000, tbsp: 15, tsp: 5, cup: 240, pinch: 0.5, dash: 10, knifepoint: 0.5 };
|
||||
const SOLID_G: Partial<Record<InputUnit, number>> = { g: 1, kg: 1000, tbsp: 12, tsp: 4, cup: 150, pinch: 0.5, dash: 10, knifepoint: 0.5 };
|
||||
|
||||
/**
|
||||
* Eingabe in die Basiseinheit der Zutat bringen. Gibt null zurück, wenn die
|
||||
@@ -36,7 +84,12 @@ const SOLID_G: Partial<Record<InputUnit, number>> = { g: 1, kg: 1000, tbsp: 12,
|
||||
*/
|
||||
export function toBase(qty: number, unit: InputUnit, base: BaseUnit, packSize?: number | null): number | null {
|
||||
if (!Number.isFinite(qty) || qty < 0) return null;
|
||||
if (isPackKind(unit)) return packSize && packSize > 0 ? qty * packSize : null;
|
||||
// Stück-Zutat in Gewicht oder Volumen: Größe ist ml bzw. g je Stück.
|
||||
if (base === "piece" && isMetric(unit)) return packSize && packSize > 0 ? (qty * METRIC_FACTOR[unit]) / packSize : null;
|
||||
if (needsSize(unit, base)) {
|
||||
const size = packSize ?? defaultSize(unit, base);
|
||||
return size && size > 0 ? qty * size : null;
|
||||
}
|
||||
if (base === "piece") return unit === "piece" ? qty : null;
|
||||
if (unit === "piece") return null;
|
||||
if (base === "ml") {
|
||||
@@ -91,8 +144,13 @@ export function formatQuantity(qty: number, unit: BaseUnit, locale = "de"): Form
|
||||
}
|
||||
|
||||
/** Menge in Basiseinheit zurück in das Küchenmaß, in dem sie eingegeben wurde (fürs Bearbeiten). */
|
||||
export function fromBase(qty: number, unit: KitchenUnit, base: BaseUnit, packSize?: number | null): number | null {
|
||||
if (isPackKind(unit)) return packSize && packSize > 0 ? qty / packSize : null;
|
||||
export function fromBase(qty: number, unit: DisplayUnit, base: BaseUnit, packSize?: number | null): number | null {
|
||||
if (base === "piece" && isMetric(unit)) return packSize && packSize > 0 ? (qty * packSize) / METRIC_FACTOR[unit] : null;
|
||||
if (isMetric(unit)) return qty / METRIC_FACTOR[unit]; // g ↔ ml wie beim Löffel: 1 zu 1
|
||||
if (needsSize(unit, base)) {
|
||||
const size = packSize ?? defaultSize(unit, base);
|
||||
return size && size > 0 ? qty / size : null;
|
||||
}
|
||||
const f = base === "ml" ? VOLUME_ML[unit] : base === "g" ? SOLID_G[unit] : undefined;
|
||||
return f ? qty / f : null;
|
||||
}
|
||||
@@ -118,7 +176,7 @@ export type KitchenFormatted = {
|
||||
export function formatKitchen(
|
||||
qty: number,
|
||||
base: BaseUnit,
|
||||
display: KitchenUnit | null | undefined,
|
||||
display: DisplayUnit | null | undefined,
|
||||
packSize: number | null | undefined,
|
||||
locale: string,
|
||||
word: (unit: KitchenUnit, count: number) => string,
|
||||
@@ -128,15 +186,22 @@ export function formatKitchen(
|
||||
if (!display) return { main: plainText, extra: "" };
|
||||
const n = fromBase(qty, display, base, packSize);
|
||||
if (n === null) return { main: plainText, extra: "" };
|
||||
if (isMetric(display)) {
|
||||
// Im eingegebenen Maß („750 ml“, „1,5 l“); bei Stück-Zutaten die Stück dahinter (26.11.50).
|
||||
const family = display === "g" || display === "kg" ? "g" : "ml";
|
||||
const f = formatQuantity(n * METRIC_FACTOR[display], family, locale);
|
||||
return { main: `${f.amount} ${f.unit}`, extra: base === "piece" ? `${pieces(qty, locale)} ${word("piece", qty)}` : "" };
|
||||
}
|
||||
if (isPackKind(display)) {
|
||||
// Ein Achtel Packung Butter hilft niemandem — dann nur Gramm.
|
||||
if (n < 0.25 - 1e-9) return { main: plainText, extra: "" };
|
||||
const count = pieces(n, locale);
|
||||
return { main: plainText, extra: `${count} ${word(display, n)}` };
|
||||
}
|
||||
const count = spoons(n, locale);
|
||||
// Löffel auf halbe, Stück, Zehen, Würfel und Scheiben auf Küchenbrüche (26.11.49).
|
||||
const count = isCountUnit(display) ? pieces(n, locale) : spoons(n, locale);
|
||||
// Eine Prise wiegt nichts, was man nachwiegen würde — ohne Klammer.
|
||||
return { main: `${count} ${word(display, n)}`, extra: display === "pinch" || base === "piece" ? "" : plainText };
|
||||
return { main: `${count} ${word(display, n)}`, extra: display === "pinch" || display === "knifepoint" || base === "piece" ? "" : plainText };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -162,6 +227,17 @@ export function impliedKitchenUnit(
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Eine Menge fürs Formular, so wie man sie tippen würde (26.11.49): Zählmaße und
|
||||
* Löffel auf Viertel, ab 10 ganze Zahlen, sonst höchstens zwei Stellen.
|
||||
* Aus 333,333 g wird 333, aus 1,4999 Dosen 1,5.
|
||||
*/
|
||||
export function niceQty(qty: number, unit: string): number {
|
||||
if (isKitchenUnit(unit)) return Math.max(0.25, Math.round(qty * 4) / 4);
|
||||
if (qty >= 10) return Math.round(qty);
|
||||
return Math.round(qty * 100) / 100;
|
||||
}
|
||||
|
||||
/** Für die Einkaufsliste: Stück immer aufrunden (½ Zwiebel kauft man nicht). */
|
||||
export function shoppingQuantity(qty: number, unit: BaseUnit): number {
|
||||
return unit === "piece" ? Math.ceil(qty - 1e-9) : qty;
|
||||
|
||||
@@ -11,8 +11,11 @@ import { useEffect, useRef, useState } from "react";
|
||||
// Größenereignis des sichtbaren Bereichs. In Safari fährt beim Scrollen die
|
||||
// Adressleiste ein und aus, iOS meldet das verzögert — die Leiste rutschte mit
|
||||
// (Kai, 7.11.2026). Jetzt gilt: Beim Scrollen fasst Lunch die Leiste nie an.
|
||||
// Korrigiert wird nur im Fenster nach dem Schließen der Tastatur, und die erste
|
||||
// Berührung oder der erste Scroll danach nimmt die Korrektur zurück.
|
||||
// Korrigiert wird nur nach dem Schließen der Tastatur und nur in der Web-App.
|
||||
//
|
||||
// Seit 26.11.41: Die Korrektur bleibt, solange iOS den Bildschirm zu kurz rechnet —
|
||||
// erkennbar an einer Lücke in Tastaturgröße (STUCK_MIN), die das Scrollen in einer
|
||||
// Web-App sonst nie erzeugt. Kleine Lücken (Gummiband) fasst Lunch weiter nicht an.
|
||||
|
||||
/** Wie lange nach dem Schließen der Tastatur nachgemessen wird. */
|
||||
export const SETTLE_MS = 1000;
|
||||
@@ -33,6 +36,22 @@ const EDITABLE =
|
||||
|
||||
export const isEditable = (el: Element | null) => !!el && el.matches(EDITABLE);
|
||||
|
||||
/**
|
||||
* Ab dieser Lücke ist es die stehengebliebene Tastatur, kein Gummiband (26.11.41).
|
||||
* iOS-Tastaturen sind 250–400 pt hoch; Gummiband und Rundungen bleiben weit darunter.
|
||||
*/
|
||||
export const STUCK_MIN = 150;
|
||||
|
||||
/**
|
||||
* Die Korrektur nach dem Schließen der Tastatur (26.11.41, Kai: Leiste mitten im Bild,
|
||||
* auch nach dem Scrollen). Im ersten Augenblick gilt jede Lücke über 40 px; danach nur
|
||||
* noch eine in Tastaturgröße — so lange, bis iOS selbst wieder richtig rechnet.
|
||||
*/
|
||||
export function stuckShift(gap: number, settling: boolean): number {
|
||||
if (settling) return gap;
|
||||
return gap >= STUCK_MIN ? gap : 0;
|
||||
}
|
||||
|
||||
/** Liefert, ob gerade getippt wird, und eine Ref für die Leiste, die unten gehalten wird. */
|
||||
export function useKeyboardSafeNav<T extends HTMLElement>() {
|
||||
const ref = useRef<T>(null);
|
||||
@@ -45,17 +64,37 @@ export function useKeyboardSafeNav<T extends HTMLElement>() {
|
||||
|
||||
useEffect(() => {
|
||||
const vv = window.visualViewport;
|
||||
let until = 0; // Ende des Fensters nach dem Schließen der Tastatur
|
||||
const root = document.documentElement;
|
||||
// Nach dem Schließen der Tastatur scharf, bis iOS den Bildschirm wieder voll rechnet.
|
||||
// In der Web-App gibt es keine Adressleiste — eine Lücke in Tastaturgröße ist dort
|
||||
// immer der Fehler, auch noch nach Berührung und Scrollen (bis 26.11.40 ließ Lunch
|
||||
// die Korrektur bei der ersten Berührung fallen, und die Leiste sprang zurück).
|
||||
let armed = false;
|
||||
let settleUntil = 0;
|
||||
let frame = 0;
|
||||
const apply = (shift: number) => {
|
||||
if (ref.current) ref.current.style.transform = shift ? `translateY(${shift}px)` : "";
|
||||
// Klebende Knopfleisten (Speichern, Los geht's …) folgen über --kb-shift (globals.css).
|
||||
if (shift) root.style.setProperty("--kb-shift", `${shift}px`);
|
||||
else root.style.removeProperty("--kb-shift");
|
||||
};
|
||||
const clear = () => {
|
||||
until = 0;
|
||||
if (ref.current) ref.current.style.transform = "";
|
||||
armed = false;
|
||||
settleUntil = 0;
|
||||
apply(0);
|
||||
};
|
||||
const pin = () => {
|
||||
const el = ref.current;
|
||||
if (!el || !vv) return;
|
||||
if (Date.now() > until || !isStandalone()) return clear();
|
||||
const gap = keyboardGap(vv, document.documentElement.clientHeight);
|
||||
el.style.transform = gap ? `translateY(${gap}px)` : "";
|
||||
frame = 0;
|
||||
if (!armed || !vv || !isStandalone()) return clear();
|
||||
const shift = stuckShift(keyboardGap(vv, root.clientHeight), Date.now() < settleUntil);
|
||||
apply(shift);
|
||||
// iOS rechnet wieder richtig: entschärfen.
|
||||
if (!shift && Date.now() >= settleUntil) armed = false;
|
||||
};
|
||||
// Bei jedem Ereignis neu messen, nie einen alten Wert stehen lassen: Rechnet iOS
|
||||
// zwischendurch wieder richtig, fällt die Korrektur im selben Bild weg.
|
||||
const schedule = () => {
|
||||
if (armed && !frame) frame = requestAnimationFrame(pin);
|
||||
};
|
||||
const onFocusIn = (e: FocusEvent) => {
|
||||
if (isEditable(e.target as Element)) {
|
||||
@@ -68,38 +107,34 @@ export function useKeyboardSafeNav<T extends HTMLElement>() {
|
||||
setTimeout(() => {
|
||||
if (isEditable(document.activeElement)) return;
|
||||
setTyping(false);
|
||||
if (!isStandalone()) return;
|
||||
window.scrollTo(window.scrollX, window.scrollY); // stößt das Neuvermessen an
|
||||
until = Date.now() + SETTLE_MS;
|
||||
requestAnimationFrame(pin);
|
||||
setTimeout(pin, 300); // nach der Animation der Tastatur noch einmal
|
||||
setTimeout(() => {
|
||||
if (!until) return;
|
||||
clear();
|
||||
// Steht die Leiste ohne Korrektur noch falsch, iOS noch einmal neu messen lassen.
|
||||
if (vv && isStandalone() && keyboardGap(vv, document.documentElement.clientHeight)) {
|
||||
window.scrollTo(window.scrollX, window.scrollY + 1);
|
||||
window.scrollTo(window.scrollX, window.scrollY - 1);
|
||||
}
|
||||
}, SETTLE_MS + 50);
|
||||
armed = true;
|
||||
settleUntil = Date.now() + SETTLE_MS;
|
||||
schedule();
|
||||
setTimeout(schedule, 300); // nach der Animation der Tastatur noch einmal
|
||||
setTimeout(schedule, SETTLE_MS + 50); // Ende des ersten Augenblicks
|
||||
}, 50);
|
||||
};
|
||||
// Sobald die Person wieder berührt (jeder Scroll am Handy beginnt so) oder am Rad
|
||||
// dreht, gilt die Lage, die iOS selbst rechnet. Kein „scroll“: Den lösen auch das
|
||||
// scrollTo oben und iOS beim Schließen der Tastatur aus.
|
||||
const onUser = () => until && clear();
|
||||
document.addEventListener("focusin", onFocusIn);
|
||||
document.addEventListener("focusout", onFocusOut);
|
||||
vv?.addEventListener("resize", pin);
|
||||
window.addEventListener("touchstart", onUser, { passive: true });
|
||||
window.addEventListener("wheel", onUser, { passive: true });
|
||||
vv?.addEventListener("resize", schedule);
|
||||
vv?.addEventListener("scroll", schedule);
|
||||
window.addEventListener("scroll", schedule, { passive: true });
|
||||
window.addEventListener("resize", schedule);
|
||||
window.addEventListener("touchend", schedule, { passive: true });
|
||||
window.addEventListener("orientationchange", clear);
|
||||
return () => {
|
||||
if (frame) cancelAnimationFrame(frame);
|
||||
document.removeEventListener("focusin", onFocusIn);
|
||||
document.removeEventListener("focusout", onFocusOut);
|
||||
vv?.removeEventListener("resize", pin);
|
||||
window.removeEventListener("touchstart", onUser);
|
||||
window.removeEventListener("wheel", onUser);
|
||||
vv?.removeEventListener("resize", schedule);
|
||||
vv?.removeEventListener("scroll", schedule);
|
||||
window.removeEventListener("scroll", schedule);
|
||||
window.removeEventListener("resize", schedule);
|
||||
window.removeEventListener("touchend", schedule);
|
||||
window.removeEventListener("orientationchange", clear);
|
||||
clear();
|
||||
};
|
||||
}, []);
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
|
||||
import { useLocale, useTranslations } from "next-intl";
|
||||
import { isOne } from "./ingredient-name";
|
||||
import { formatKitchen, type BaseUnit, type KitchenUnit } from "./units";
|
||||
import { formatKitchen, type BaseUnit, type DisplayUnit, type KitchenUnit } from "./units";
|
||||
|
||||
/** Was eine Zutat für die Mengenanzeige mitbringt (lib/dishes.ts, getDish). */
|
||||
export type Measured = {
|
||||
unit: BaseUnit;
|
||||
displayUnit?: KitchenUnit | null;
|
||||
displayUnit?: DisplayUnit | null;
|
||||
packSize?: number | null;
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
|
||||
// Aufnahme im Browser (MediaRecorder): iPhone liefert audio/mp4, andere webm.
|
||||
// Nach „stop“ geht die Aufnahme an `onDone`; Mikrofon wird sofort freigegeben.
|
||||
export function useRecorder(onDone: (audio: Blob) => void) {
|
||||
const [recording, setRecording] = useState(false);
|
||||
const [seconds, setSeconds] = useState(0);
|
||||
const recorder = useRef<MediaRecorder | null>(null);
|
||||
const chunks = useRef<Blob[]>([]);
|
||||
const done = useRef(onDone);
|
||||
done.current = onDone;
|
||||
|
||||
useEffect(() => {
|
||||
if (!recording) return;
|
||||
const tick = setInterval(() => setSeconds((s) => s + 1), 1000);
|
||||
return () => clearInterval(tick);
|
||||
}, [recording]);
|
||||
|
||||
async function start(): Promise<boolean> {
|
||||
try {
|
||||
const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
|
||||
const type = ["audio/mp4", "audio/webm;codecs=opus", "audio/webm"].find((x) => MediaRecorder.isTypeSupported?.(x));
|
||||
const rec = new MediaRecorder(stream, type ? { mimeType: type } : undefined);
|
||||
chunks.current = [];
|
||||
rec.ondataavailable = (e) => e.data.size && chunks.current.push(e.data);
|
||||
rec.onstop = () => {
|
||||
stream.getTracks().forEach((track) => track.stop());
|
||||
done.current(new Blob(chunks.current, { type: rec.mimeType || "audio/webm" }));
|
||||
};
|
||||
rec.start(1000);
|
||||
recorder.current = rec;
|
||||
setSeconds(0);
|
||||
setRecording(true);
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function stop() {
|
||||
setRecording(false);
|
||||
recorder.current?.stop();
|
||||
}
|
||||
|
||||
return { recording, seconds, start, stop };
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
import "server-only";
|
||||
import { getLocale } from "next-intl/server";
|
||||
import { AiNotConfigured, AiUnavailable, transcribe } from "@/lib/ai";
|
||||
import { aiFor } from "@/lib/ai-settings";
|
||||
import { fail } from "@/lib/auth/http";
|
||||
|
||||
const MAX_BYTES = 25 * 1024 * 1024; // rund zehn Minuten Sprache
|
||||
|
||||
/**
|
||||
* Aufnahme aus dem Formular (Feld „audio“) → Abschrift über den Router
|
||||
* („default-stt“) oder das eigene Sprachmodell. Die Aufnahme wird nicht gespeichert.
|
||||
* Gemeinsam für „Gericht einsprechen“ (26.11.24) und die Einkaufsliste (26.11.46).
|
||||
*/
|
||||
export async function transcribeUpload(request: Request, householdId: string): Promise<{ text: string } | Response> {
|
||||
const form = await request.formData().catch(() => null);
|
||||
const audio = form?.get("audio");
|
||||
if (!(audio instanceof File) || audio.size === 0 || audio.size > MAX_BYTES || !/^(audio|video)\//.test(audio.type)) return fail("audio", 400);
|
||||
const ai = await aiFor(householdId);
|
||||
if (!ai?.speechModel) return fail("noSpeech", 409);
|
||||
try {
|
||||
const ext = audio.type.includes("mp4") || audio.type.includes("m4a") ? "m4a" : audio.type.includes("ogg") ? "ogg" : audio.type.includes("wav") ? "wav" : "webm";
|
||||
const text = await transcribe(ai, audio, `aufnahme.${ext}`, await getLocale());
|
||||
if (!text) return fail("empty", 422);
|
||||
return { text };
|
||||
} catch (error) {
|
||||
if (error instanceof AiUnavailable || error instanceof AiNotConfigured) return fail("aiUnavailable", 503);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -139,7 +139,9 @@ export async function lastMine(client: PoolClient, roundId: string): Promise<{ m
|
||||
}
|
||||
|
||||
/** Einen eigenen Wunsch zu „Mein Gericht“ machen (ein anderes verliert es) oder es zurücknehmen. */
|
||||
export async function setMine(client: PoolClient, memberId: string, dishId: string, on: boolean): Promise<void> {
|
||||
// Mit `wishIn` (26.11.47, Herz auf der Karte) wünscht ein Tipp das Gericht zuerst
|
||||
// (ein Jeton) — in derselben Transaktion, also ganz oder gar nicht.
|
||||
export async function setMine(client: PoolClient, memberId: string, dishId: string, on: boolean, opts: { wishIn?: string } = {}): Promise<void> {
|
||||
await client.query("select pg_advisory_xact_lock(hashtext('wish:' || $1))", [memberId]);
|
||||
const round = (await client.query("select id from rounds where status = 'open' order by created_at desc limit 1")).rows[0];
|
||||
if (!round) throw new WishRefused("noRound");
|
||||
@@ -147,9 +149,17 @@ export async function setMine(client: PoolClient, memberId: string, dishId: stri
|
||||
await client.query("update wishes set is_mine = false where round_id = $1 and member_id = $2 and dish_id = $3", [round.id, memberId, dishId]);
|
||||
return;
|
||||
}
|
||||
const own = (
|
||||
await client.query("select id from wishes where round_id = $1 and member_id = $2 and dish_id = $3 and not is_veto and veto_id is null", [round.id, memberId, dishId])
|
||||
).rows[0];
|
||||
const ownWish = () =>
|
||||
client.query("select id from wishes where round_id = $1 and member_id = $2 and dish_id = $3 and not is_veto and veto_id is null", [round.id, memberId, dishId]);
|
||||
let own = (await ownWish()).rows[0];
|
||||
if (!own && opts.wishIn) {
|
||||
// Ein eigenes Veto oder ein Wunsch aus einem Veto wird nicht still umgedeutet.
|
||||
const other = await client.query("select 1 from wishes where round_id = $1 and member_id = $2 and dish_id = $3", [round.id, memberId, dishId]);
|
||||
if (other.rowCount) throw new WishRefused("notWished");
|
||||
if ((await lastMine(client, round.id)).some((m) => m.memberId === memberId && m.dishId === dishId && m.served)) throw new WishRefused("repeat");
|
||||
await addWish(client, opts.wishIn, memberId, dishId);
|
||||
own = (await ownWish()).rows[0];
|
||||
}
|
||||
if (!own) throw new WishRefused("notWished");
|
||||
if ((await lastMine(client, round.id)).some((m) => m.memberId === memberId && m.dishId === dishId && m.served)) throw new WishRefused("repeat");
|
||||
await client.query("update wishes set is_mine = false where round_id = $1 and member_id = $2 and is_mine", [round.id, memberId]);
|
||||
|
||||
@@ -309,6 +309,25 @@
|
||||
"step2": "Unter Domains „foodplanhero.de“ hinzufügen, Region EU. Liegt die Domain bei Cloudflare, setzt „Auto configure“ die DNS-Einträge.",
|
||||
"step3": "Unter API Keys einen Schlüssel mit „Sending access“ für diese Domain anlegen und hier eintragen.",
|
||||
"step4": "Speichern, Testmail schicken."
|
||||
},
|
||||
"calendar": {
|
||||
"title": "Kalender abonnieren",
|
||||
"hint": "Gerichte mit Tag erscheinen in eurem Kalender — zur Essenszeit, ein Link für den ganzen Haushalt. Wer den Link hat, sieht den Plan.",
|
||||
"time": "Essenszeit",
|
||||
"minutes": "Dauer (Min.)",
|
||||
"saveTime": "Essenszeit speichern",
|
||||
"saved": "Gespeichert",
|
||||
"create": "Kalender-Abo starten",
|
||||
"renew": "Neuen Link erzeugen",
|
||||
"renewHint": "Ein neuer Link macht den alten ungültig. Abonnierte Kalender brauchen dann den neuen.",
|
||||
"linkOnce": "Dein Link — er steht nur jetzt hier:",
|
||||
"copy": "Kopieren",
|
||||
"copied": "Kopiert",
|
||||
"subscribe": "Im Kalender öffnen",
|
||||
"stop": "Abo beenden",
|
||||
"confirmStop": "Wirklich beenden? Noch einmal tippen",
|
||||
"locked": "Nach der Anmeldung per Mail geht das nicht. Melde dich mit dem Passkey an.",
|
||||
"error": "Das hat nicht geklappt. Bitte versuch es noch einmal."
|
||||
}
|
||||
},
|
||||
"nav": {
|
||||
@@ -377,7 +396,7 @@
|
||||
"remove": "Entfernen",
|
||||
"removed": "„{title}“ ist aus dem Pool entfernt.",
|
||||
"undo": "Rückgängig",
|
||||
"photo": "Foto aufnehmen",
|
||||
"photo": "Foto hinzufügen",
|
||||
"photoError": "Das Foto ließ sich nicht lesen. Nimm ein JPEG, PNG oder HEIC bis 15 MB.",
|
||||
"stepTimer": "{n} Min.",
|
||||
"source": "Quelle",
|
||||
@@ -385,7 +404,10 @@
|
||||
"stepTimerProduct": "{n} Min. laut Packung ({product})",
|
||||
"photoAdd": "Foto dazu ({n} von {max})",
|
||||
"photoFull": "5 Fotos sind das Maximum",
|
||||
"present": "Präsentieren"
|
||||
"present": "Präsentieren",
|
||||
"inTrial": "Steht unter „Ausprobieren“, noch nicht im Pool. Dort zieht es der Joker „Etwas Neues“.",
|
||||
"inTrialLink": "Zu „Ausprobieren“",
|
||||
"toPool": "In den Pool"
|
||||
},
|
||||
"form": {
|
||||
"newTitle": "Neues Gericht",
|
||||
@@ -429,13 +451,21 @@
|
||||
"can": "Dose",
|
||||
"jar": "Glas",
|
||||
"pack": "Packung",
|
||||
"bunch": "Bund"
|
||||
"bunch": "Bund",
|
||||
"cup": "Tasse",
|
||||
"dash": "Schuss",
|
||||
"knifepoint": "Msp.",
|
||||
"tub": "Becher",
|
||||
"cube": "Würfel",
|
||||
"clove": "Zehe",
|
||||
"slice": "Scheibe"
|
||||
},
|
||||
"errors": {
|
||||
"invalid": "Bitte gib einen Titel an und prüfe die Mengen.",
|
||||
"amount": "Eine Menge passt nicht zur Zutat (z. B. Gramm bei Stück).",
|
||||
"unknown": "Das hat nicht geklappt. Bitte versuch es noch einmal.",
|
||||
"missingAmount": "Bei einer Zutat fehlt die Menge. Trag sie ein oder entferne die Zeile."
|
||||
"missingAmount": "Bei einer Zutat fehlt die Menge. Trag sie ein oder entferne die Zeile.",
|
||||
"missingSize": "Bei einem Maß fehlt noch, wie viel es enthält (z. B. 1 Packung = 500 g)."
|
||||
},
|
||||
"unmatched": "Diese Zeilen konnten wir keiner Zutat zuordnen. Füge sie bei Bedarf selbst hinzu:",
|
||||
"byAi": "Von der AI gelesen. Prüf jede Zutat und Menge, bevor du speicherst.",
|
||||
@@ -458,10 +488,18 @@
|
||||
"unitWithSize": "{unit} ({size})",
|
||||
"packSize": "1 {unit} = {size}",
|
||||
"packChange": "Größe ändern",
|
||||
"packSizeLabel": "Größe einer {unit} in {base}",
|
||||
"packSizeLabel": "Wie viel ist 1 {unit}? (in {base})",
|
||||
"packSave": "Übernehmen",
|
||||
"packHint": "Gilt für alle Gerichte eures Haushalts.",
|
||||
"packError": "Die Größe ließ sich nicht speichern."
|
||||
"packError": "Die Größe ließ sich nicht speichern.",
|
||||
"unitGroups": {
|
||||
"base": "Gewicht und Menge",
|
||||
"kitchen": "Löffel & Co.",
|
||||
"count": "Stück & Gebinde"
|
||||
},
|
||||
"sizeAsk": "Wie viel ist 1 {unit}? (in {base})",
|
||||
"portionsHint": "Die Mengen rechnen mit, wenn du die Portionen änderst.",
|
||||
"sizeAskPerPiece": "Wie viel {base} ist 1 Stück?"
|
||||
},
|
||||
"addLinkText": "Wir lesen Zutaten und Schritte von der Rezeptseite.",
|
||||
"link": {
|
||||
@@ -482,9 +520,9 @@
|
||||
"addPhotoText": "Die AI liest Zutaten und Schritte von der Seite ab.",
|
||||
"photo": {
|
||||
"title": "Kochbuch fotografieren",
|
||||
"choose": "Seite fotografieren",
|
||||
"chosen": "{n, plural, one {1 Foto gewählt} other {# Fotos gewählt}}",
|
||||
"chooseHint": "Eine Rezeptseite, höchstens zwei Fotos. Das Foto wird nicht gespeichert.",
|
||||
"choose": "Seite fotografieren oder wählen",
|
||||
"chosen": "{n, plural, one {1 Seite} other {# Seiten}}",
|
||||
"chooseHint": "Bis zu {n} Seiten, in der Reihenfolge des Rezepts – neu aufgenommen oder aus der Mediathek. Die Fotos werden nicht gespeichert.",
|
||||
"read": "Rezept lesen",
|
||||
"reading": "Die AI liest …",
|
||||
"readingHint": "Das kann eine Minute dauern.",
|
||||
@@ -497,7 +535,11 @@
|
||||
"aiUnavailable": "Die AI ist gerade nicht erreichbar. Versuch es später noch einmal.",
|
||||
"aiNotConfigured": "Die AI ist nicht eingerichtet.",
|
||||
"unknown": "Das hat nicht geklappt. Bitte versuch es noch einmal."
|
||||
}
|
||||
},
|
||||
"addPage": "Weitere Seite hinzufügen",
|
||||
"page": "Seite {n}",
|
||||
"removePage": "Seite {n} entfernen",
|
||||
"full": "Mehr als {n} Seiten gehen nicht auf einmal."
|
||||
},
|
||||
"wish": "Wünschen",
|
||||
"sections": {
|
||||
@@ -561,7 +603,8 @@
|
||||
"errors": {
|
||||
"roundExists": "Es läuft schon eine Runde.",
|
||||
"unknown": "Das hat nicht geklappt. Bitte versuch es noch einmal."
|
||||
}
|
||||
},
|
||||
"save": "Speichern"
|
||||
},
|
||||
"wish": {
|
||||
"eyebrow": "Runde",
|
||||
@@ -628,12 +671,14 @@
|
||||
"mineOf": "Gericht von {names}",
|
||||
"mineSet": "Als mein Gericht",
|
||||
"mineUnset": "Nicht mehr mein Gericht",
|
||||
"mineHint": "Mach einen Wunsch zu deinem Gericht: Das kommt sicher in den Plan, kein Veto streicht es.",
|
||||
"mineHint": "Tipp aufs Herz: Dein Gericht kommt sicher in den Plan, kein Veto streicht es.",
|
||||
"mineChosen": "Dein Gericht: {title} — kommt sicher in den Plan.",
|
||||
"mineExplain": "Eins pro Runde. Kein Veto streicht es, und der Plan setzt es zuerst.",
|
||||
"protected": "Geschützt: Das ist das Gericht von jemandem. Dagegen gibt es kein Veto.",
|
||||
"vetoCount": "{n, plural, one {1 Veto} other {# Vetos}}",
|
||||
"jokerShort": "Neues"
|
||||
"jokerShort": "Neues",
|
||||
"mineToggle": "{title} als mein Gericht",
|
||||
"mineUntoggle": "{title} nicht mehr mein Gericht"
|
||||
},
|
||||
"kids": {
|
||||
"title": "Wer bist du?",
|
||||
@@ -713,7 +758,23 @@
|
||||
"roundStatus": "Das geht in diesem Schritt der Runde nicht mehr.",
|
||||
"cooked": "Was schon gekocht ist, bleibt so.",
|
||||
"unknown": "Das hat nicht geklappt. Bitte versuch es noch einmal."
|
||||
}
|
||||
},
|
||||
"round": {
|
||||
"title": "Runde",
|
||||
"edit": "Einstellungen ändern",
|
||||
"cancel": "Abbrechen",
|
||||
"end": "Runde beenden",
|
||||
"confirmEnd": "Wirklich beenden? Noch einmal tippen",
|
||||
"endHint": "Gekochtes und Bewertungen bleiben. Danach kannst du die nächste Runde eröffnen.",
|
||||
"delete": "Runde löschen",
|
||||
"confirmDelete": "Wirklich löschen? Noch einmal tippen",
|
||||
"errors": {
|
||||
"cooked": "Es ist schon etwas gekocht. Beende die Runde stattdessen.",
|
||||
"unknown": "Das hat nicht geklappt. Bitte versuch es noch einmal."
|
||||
}
|
||||
},
|
||||
"day": "Tag für {title}",
|
||||
"noDay": "Ohne Tag"
|
||||
},
|
||||
"shopping": {
|
||||
"eyebrow": "Einkauf",
|
||||
@@ -742,7 +803,27 @@
|
||||
"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.}}",
|
||||
"packOf": "{count} {word} à {size}"
|
||||
"packOf": "{count} {word} à {size}",
|
||||
"voice": {
|
||||
"record": "Einkaufsliste einsprechen",
|
||||
"stop": "Aufnahme beenden",
|
||||
"recording": "Aufnahme läuft · {time}",
|
||||
"transcribing": "Wird abgeschrieben …",
|
||||
"hint": "Einsprechen, z. B. „Milch, Eier und Brot“",
|
||||
"check": "Erkannt — bitte prüfen",
|
||||
"item": "Posten {n}",
|
||||
"drop": "{name} weglassen",
|
||||
"add": "{n, plural, one {# Posten hinzufügen} other {# Posten hinzufügen}}",
|
||||
"discard": "Verwerfen",
|
||||
"errors": {
|
||||
"mic": "Das Mikrofon ist nicht freigegeben. Erlaube es in den Einstellungen des Browsers.",
|
||||
"noSpeech": "Für Sprache ist noch kein Modell eingerichtet (Mehr › AI).",
|
||||
"aiUnavailable": "Die Abschrift ist gerade nicht erreichbar. Bitte versuch es gleich noch einmal.",
|
||||
"empty": "Da war nichts zu verstehen. Bitte noch einmal.",
|
||||
"audio": "Die Aufnahme ging nicht durch. Bitte noch einmal.",
|
||||
"unknown": "Das hat nicht geklappt. Bitte versuch es noch einmal."
|
||||
}
|
||||
}
|
||||
},
|
||||
"cooking": {
|
||||
"eyebrow": "Kochen",
|
||||
@@ -1092,7 +1173,15 @@
|
||||
"can": "{n, plural, one {Dose} other {Dosen}}",
|
||||
"jar": "{n, plural, one {Glas} other {Gläser}}",
|
||||
"pack": "{n, plural, one {Packung} other {Packungen}}",
|
||||
"bunch": "{n, plural, one {Bund} other {Bund}}"
|
||||
"bunch": "{n, plural, one {Bund} other {Bund}}",
|
||||
"cup": "{n, plural, one {Tasse} other {Tassen}}",
|
||||
"dash": "{n, plural, one {Schuss} other {Schuss}}",
|
||||
"knifepoint": "{n, plural, one {Msp.} other {Msp.}}",
|
||||
"tub": "{n, plural, one {Becher} other {Becher}}",
|
||||
"piece": "{n, plural, one {Stück} other {Stück}}",
|
||||
"cube": "{n, plural, one {Würfel} other {Würfel}}",
|
||||
"clove": "{n, plural, one {Zehe} other {Zehen}}",
|
||||
"slice": "{n, plural, one {Scheibe} other {Scheiben}}"
|
||||
},
|
||||
"mail": {
|
||||
"login": {
|
||||
@@ -1113,5 +1202,11 @@
|
||||
"button": "foodplanhero öffnen",
|
||||
"note": "Diese Mail kam über die Einstellung unter Mehr › Mails verschicken."
|
||||
}
|
||||
},
|
||||
"calendar": {
|
||||
"name": "{household} · Essen",
|
||||
"cook": "Es kocht {name}",
|
||||
"portions": "{n, plural, one {# Portion} other {# Portionen}}",
|
||||
"open": "In foodplanhero öffnen: {url}"
|
||||
}
|
||||
}
|
||||
@@ -309,6 +309,25 @@
|
||||
"step2": "Under Domains, add “foodplanhero.de”, region EU. If the domain is on Cloudflare, “Auto configure” sets the DNS records.",
|
||||
"step3": "Under API Keys, create a key with “Sending access” for this domain and enter it here.",
|
||||
"step4": "Save, send a test mail."
|
||||
},
|
||||
"calendar": {
|
||||
"title": "Subscribe to calendar",
|
||||
"hint": "Dishes with a day show up in your calendar at meal time — one link for the whole household. Anyone with the link can see the plan.",
|
||||
"time": "Meal time",
|
||||
"minutes": "Length (min)",
|
||||
"saveTime": "Save meal time",
|
||||
"saved": "Saved",
|
||||
"create": "Start calendar subscription",
|
||||
"renew": "Create new link",
|
||||
"renewHint": "A new link makes the old one stop working. Subscribed calendars then need the new one.",
|
||||
"linkOnce": "Your link — it only shows here now:",
|
||||
"copy": "Copy",
|
||||
"copied": "Copied",
|
||||
"subscribe": "Open in calendar",
|
||||
"stop": "Stop subscription",
|
||||
"confirmStop": "Really stop? Tap again",
|
||||
"locked": "This doesn’t work after signing in by mail. Sign in with your passkey.",
|
||||
"error": "That didn’t work. Please try again."
|
||||
}
|
||||
},
|
||||
"nav": {
|
||||
@@ -377,7 +396,7 @@
|
||||
"remove": "Remove",
|
||||
"removed": "\"{title}\" was removed from the pool.",
|
||||
"undo": "Undo",
|
||||
"photo": "Take a photo",
|
||||
"photo": "Add photo",
|
||||
"photoError": "The photo couldn't be read. Use a JPEG, PNG or HEIC up to 15 MB.",
|
||||
"stepTimer": "{n} min",
|
||||
"source": "Source",
|
||||
@@ -385,7 +404,10 @@
|
||||
"stepTimerProduct": "{n} min per pack ({product})",
|
||||
"photoAdd": "Add photo ({n} of {max})",
|
||||
"photoFull": "5 photos is the maximum",
|
||||
"present": "Present"
|
||||
"present": "Present",
|
||||
"inTrial": "Listed under “To try”, not yet in the pool. The joker “Something new” picks from there.",
|
||||
"inTrialLink": "Go to “To try”",
|
||||
"toPool": "Move to pool"
|
||||
},
|
||||
"form": {
|
||||
"newTitle": "New dish",
|
||||
@@ -429,13 +451,21 @@
|
||||
"can": "Can",
|
||||
"jar": "Jar",
|
||||
"pack": "Pack",
|
||||
"bunch": "Bunch"
|
||||
"bunch": "Bunch",
|
||||
"cup": "cup",
|
||||
"dash": "dash",
|
||||
"knifepoint": "pinch (tip of knife)",
|
||||
"tub": "Tub",
|
||||
"cube": "cube",
|
||||
"clove": "clove",
|
||||
"slice": "slice"
|
||||
},
|
||||
"errors": {
|
||||
"invalid": "Please give a title and check the amounts.",
|
||||
"amount": "An amount doesn't fit the ingredient (e.g. grams for pieces).",
|
||||
"unknown": "That didn't work. Please try again.",
|
||||
"missingAmount": "An ingredient has no amount. Enter it or remove the row."
|
||||
"missingAmount": "An ingredient has no amount. Enter it or remove the row.",
|
||||
"missingSize": "A measure still needs its size (e.g. 1 pack = 500 g)."
|
||||
},
|
||||
"unmatched": "We could not match these lines to an ingredient. Add them yourself if needed:",
|
||||
"byAi": "Read by the AI. Check every ingredient and amount before you save.",
|
||||
@@ -458,10 +488,18 @@
|
||||
"unitWithSize": "{unit} ({size})",
|
||||
"packSize": "1 {unit} = {size}",
|
||||
"packChange": "Change size",
|
||||
"packSizeLabel": "Size of one {unit} in {base}",
|
||||
"packSizeLabel": "How much is 1 {unit}? (in {base})",
|
||||
"packSave": "Apply",
|
||||
"packHint": "Applies to all dishes of your household.",
|
||||
"packError": "The size could not be saved."
|
||||
"packError": "The size could not be saved.",
|
||||
"unitGroups": {
|
||||
"base": "Weight and volume",
|
||||
"kitchen": "Spoons & co.",
|
||||
"count": "Pieces & packs"
|
||||
},
|
||||
"sizeAsk": "How much is 1 {unit}? (in {base})",
|
||||
"portionsHint": "The amounts change along when you change the portions.",
|
||||
"sizeAskPerPiece": "How many {base} is 1 piece?"
|
||||
},
|
||||
"addLinkText": "We read ingredients and steps from the recipe page.",
|
||||
"link": {
|
||||
@@ -482,9 +520,9 @@
|
||||
"addPhotoText": "The AI reads ingredients and steps from the page.",
|
||||
"photo": {
|
||||
"title": "Photograph a cookbook",
|
||||
"choose": "Take a photo of the page",
|
||||
"chosen": "{n, plural, one {1 photo chosen} other {# photos chosen}}",
|
||||
"chooseHint": "One recipe page, at most two photos. The photo is not kept.",
|
||||
"choose": "Take or choose a photo of the page",
|
||||
"chosen": "{n, plural, one {1 page} other {# pages}}",
|
||||
"chooseHint": "Up to {n} pages, in the order of the recipe – taken now or from your library. The photos are not stored.",
|
||||
"read": "Read recipe",
|
||||
"reading": "The AI is reading …",
|
||||
"readingHint": "This can take a minute.",
|
||||
@@ -497,7 +535,11 @@
|
||||
"aiUnavailable": "The AI cannot be reached right now. Please try again later.",
|
||||
"aiNotConfigured": "The AI is not set up.",
|
||||
"unknown": "That did not work. Please try again."
|
||||
}
|
||||
},
|
||||
"addPage": "Add another page",
|
||||
"page": "Page {n}",
|
||||
"removePage": "Remove page {n}",
|
||||
"full": "No more than {n} pages at once."
|
||||
},
|
||||
"wish": "Make a wish",
|
||||
"sections": {
|
||||
@@ -561,7 +603,8 @@
|
||||
"errors": {
|
||||
"roundExists": "A round is already running.",
|
||||
"unknown": "That did not work. Please try again."
|
||||
}
|
||||
},
|
||||
"save": "Save"
|
||||
},
|
||||
"wish": {
|
||||
"eyebrow": "Round",
|
||||
@@ -628,12 +671,14 @@
|
||||
"mineOf": "{names}'s dish",
|
||||
"mineSet": "Make it my dish",
|
||||
"mineUnset": "No longer my dish",
|
||||
"mineHint": "Make one wish your dish: it is sure to be in the plan, and no veto removes it.",
|
||||
"mineHint": "Tap the heart: your dish is sure to make the plan, no veto can strike it.",
|
||||
"mineChosen": "Your dish: {title} — sure to be in the plan.",
|
||||
"mineExplain": "One per round. No veto removes it, and the plan puts it first.",
|
||||
"protected": "Protected: this is someone's dish. There is no veto against it.",
|
||||
"vetoCount": "{n, plural, one {1 veto} other {# vetoes}}",
|
||||
"jokerShort": "Something new"
|
||||
"jokerShort": "Something new",
|
||||
"mineToggle": "{title} as my dish",
|
||||
"mineUntoggle": "{title} no longer my dish"
|
||||
},
|
||||
"kids": {
|
||||
"title": "Who are you?",
|
||||
@@ -713,7 +758,23 @@
|
||||
"roundStatus": "That is no longer possible at this stage of the round.",
|
||||
"cooked": "What has been cooked stays as it is.",
|
||||
"unknown": "That did not work. Please try again."
|
||||
}
|
||||
},
|
||||
"round": {
|
||||
"title": "Round",
|
||||
"edit": "Change settings",
|
||||
"cancel": "Cancel",
|
||||
"end": "End round",
|
||||
"confirmEnd": "Really end? Tap again",
|
||||
"endHint": "Cooked meals and ratings stay. Then you can open the next round.",
|
||||
"delete": "Delete round",
|
||||
"confirmDelete": "Really delete? Tap again",
|
||||
"errors": {
|
||||
"cooked": "Something has been cooked already. End the round instead.",
|
||||
"unknown": "That didn’t work. Please try again."
|
||||
}
|
||||
},
|
||||
"day": "Day for {title}",
|
||||
"noDay": "No day"
|
||||
},
|
||||
"shopping": {
|
||||
"eyebrow": "Shopping",
|
||||
@@ -742,7 +803,27 @@
|
||||
"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.}}",
|
||||
"packOf": "{count} {word} of {size}"
|
||||
"packOf": "{count} {word} of {size}",
|
||||
"voice": {
|
||||
"record": "Dictate to the shopping list",
|
||||
"stop": "Stop recording",
|
||||
"recording": "Recording · {time}",
|
||||
"transcribing": "Transcribing …",
|
||||
"hint": "Say it, e.g. “milk, eggs and toilet paper”",
|
||||
"check": "Recognised — please check",
|
||||
"item": "Item {n}",
|
||||
"drop": "Leave out {name}",
|
||||
"add": "{n, plural, one {Add # item} other {Add # items}}",
|
||||
"discard": "Discard",
|
||||
"errors": {
|
||||
"mic": "The microphone isn’t allowed. Allow it in your browser settings.",
|
||||
"noSpeech": "No speech model is set up yet (More › AI).",
|
||||
"aiUnavailable": "Transcription isn’t reachable right now. Please try again shortly.",
|
||||
"empty": "Nothing could be understood. Please try again.",
|
||||
"audio": "The recording didn’t come through. Please try again.",
|
||||
"unknown": "That didn’t work. Please try again."
|
||||
}
|
||||
}
|
||||
},
|
||||
"cooking": {
|
||||
"eyebrow": "Cooking",
|
||||
@@ -1092,7 +1173,15 @@
|
||||
"can": "{n, plural, one {can} other {cans}}",
|
||||
"jar": "{n, plural, one {jar} other {jars}}",
|
||||
"pack": "{n, plural, one {pack} other {packs}}",
|
||||
"bunch": "{n, plural, one {bunch} other {bunches}}"
|
||||
"bunch": "{n, plural, one {bunch} other {bunches}}",
|
||||
"cup": "{n, plural, one {cup} other {cups}}",
|
||||
"dash": "{n, plural, one {dash} other {dashes}}",
|
||||
"knifepoint": "{n, plural, one {pinch} other {pinches}}",
|
||||
"tub": "{n, plural, one {tub} other {tubs}}",
|
||||
"piece": "{n, plural, one {piece} other {pieces}}",
|
||||
"cube": "{n, plural, one {cube} other {cubes}}",
|
||||
"clove": "{n, plural, one {clove} other {cloves}}",
|
||||
"slice": "{n, plural, one {slice} other {slices}}"
|
||||
},
|
||||
"mail": {
|
||||
"login": {
|
||||
@@ -1113,5 +1202,11 @@
|
||||
"button": "Open foodplanhero",
|
||||
"note": "This mail was sent with the setting under More › Sending mail."
|
||||
}
|
||||
},
|
||||
"calendar": {
|
||||
"name": "{household} · Meals",
|
||||
"cook": "{name} is cooking",
|
||||
"portions": "{n, plural, one {# portion} other {# portions}}",
|
||||
"open": "Open in foodplanhero: {url}"
|
||||
}
|
||||
}
|
||||
@@ -309,6 +309,25 @@
|
||||
"step2": "En Domains añade «foodplanhero.de», región EU. Si el dominio está en Cloudflare, «Auto configure» crea los registros DNS.",
|
||||
"step3": "En API Keys crea una clave con «Sending access» para este dominio e introdúcela aquí.",
|
||||
"step4": "Guarda y envía un correo de prueba."
|
||||
},
|
||||
"calendar": {
|
||||
"title": "Suscribirse al calendario",
|
||||
"hint": "Los platos con día aparecen en vuestro calendario a la hora de comer — un enlace para todo el hogar. Quien tenga el enlace ve el plan.",
|
||||
"time": "Hora de comer",
|
||||
"minutes": "Duración (min)",
|
||||
"saveTime": "Guardar hora",
|
||||
"saved": "Guardado",
|
||||
"create": "Iniciar suscripción",
|
||||
"renew": "Crear enlace nuevo",
|
||||
"renewHint": "Un enlace nuevo invalida el anterior. Los calendarios suscritos necesitan entonces el nuevo.",
|
||||
"linkOnce": "Tu enlace — solo se muestra ahora:",
|
||||
"copy": "Copiar",
|
||||
"copied": "Copiado",
|
||||
"subscribe": "Abrir en el calendario",
|
||||
"stop": "Terminar suscripción",
|
||||
"confirmStop": "¿Terminar de verdad? Toca otra vez",
|
||||
"locked": "No funciona tras entrar por correo. Entra con tu passkey.",
|
||||
"error": "No ha funcionado. Inténtalo de nuevo."
|
||||
}
|
||||
},
|
||||
"nav": {
|
||||
@@ -377,7 +396,7 @@
|
||||
"remove": "Remove",
|
||||
"removed": "\"{title}\" was removed from the pool.",
|
||||
"undo": "Undo",
|
||||
"photo": "Take a photo",
|
||||
"photo": "Add photo",
|
||||
"photoError": "The photo couldn't be read. Use a JPEG, PNG or HEIC up to 15 MB.",
|
||||
"stepTimer": "{n} min",
|
||||
"source": "Source",
|
||||
@@ -385,7 +404,10 @@
|
||||
"stepTimerProduct": "{n} min según el paquete ({product})",
|
||||
"photoAdd": "Añadir foto ({n} de {max})",
|
||||
"photoFull": "5 fotos es el máximo",
|
||||
"present": "Present"
|
||||
"present": "Present",
|
||||
"inTrial": "Listed under “To try”, not yet in the pool. The joker “Something new” picks from there.",
|
||||
"inTrialLink": "Go to “To try”",
|
||||
"toPool": "Move to pool"
|
||||
},
|
||||
"form": {
|
||||
"newTitle": "New dish",
|
||||
@@ -429,13 +451,21 @@
|
||||
"can": "Lata",
|
||||
"jar": "Tarro",
|
||||
"pack": "Paquete",
|
||||
"bunch": "Manojo"
|
||||
"bunch": "Manojo",
|
||||
"cup": "taza",
|
||||
"dash": "chorrito",
|
||||
"knifepoint": "punta de cuchillo",
|
||||
"tub": "Tarrina",
|
||||
"cube": "cubito",
|
||||
"clove": "diente",
|
||||
"slice": "loncha"
|
||||
},
|
||||
"errors": {
|
||||
"invalid": "Please give a title and check the amounts.",
|
||||
"amount": "An amount doesn't fit the ingredient (e.g. grams for pieces).",
|
||||
"unknown": "That didn't work. Please try again.",
|
||||
"missingAmount": "A un ingrediente le falta la cantidad. Escríbela o quita la fila."
|
||||
"missingAmount": "A un ingrediente le falta la cantidad. Escríbela o quita la fila.",
|
||||
"missingSize": "A una medida le falta su tamaño (p. ej. 1 paquete = 500 g)."
|
||||
},
|
||||
"unmatched": "No pudimos asignar estas líneas a un ingrediente. Añádelas tú si hace falta:",
|
||||
"byAi": "Read by the AI. Check every ingredient and amount before you save.",
|
||||
@@ -458,10 +488,18 @@
|
||||
"unitWithSize": "{unit} ({size})",
|
||||
"packSize": "1 {unit} = {size}",
|
||||
"packChange": "Cambiar tamaño",
|
||||
"packSizeLabel": "Tamaño de un(a) {unit} en {base}",
|
||||
"packSizeLabel": "¿Cuánto es 1 {unit}? (en {base})",
|
||||
"packSave": "Aplicar",
|
||||
"packHint": "Vale para todos los platos de tu hogar.",
|
||||
"packError": "No se pudo guardar el tamaño."
|
||||
"packError": "No se pudo guardar el tamaño.",
|
||||
"unitGroups": {
|
||||
"base": "Peso y volumen",
|
||||
"kitchen": "Cucharas y más",
|
||||
"count": "Piezas y envases"
|
||||
},
|
||||
"sizeAsk": "¿Cuánto es 1 {unit}? (en {base})",
|
||||
"portionsHint": "Las cantidades cambian contigo cuando cambias las raciones.",
|
||||
"sizeAskPerPiece": "¿Cuántos {base} es 1 pieza?"
|
||||
},
|
||||
"addLinkText": "Leemos los ingredientes y los pasos de la página de la receta.",
|
||||
"link": {
|
||||
@@ -482,9 +520,9 @@
|
||||
"addPhotoText": "The AI reads ingredients and steps from the page.",
|
||||
"photo": {
|
||||
"title": "Photograph a cookbook",
|
||||
"choose": "Take a photo of the page",
|
||||
"chosen": "{n, plural, one {1 photo chosen} other {# photos chosen}}",
|
||||
"chooseHint": "One recipe page, at most two photos. The photo is not kept.",
|
||||
"choose": "Take or choose a photo of the page",
|
||||
"chosen": "{n, plural, one {1 página} other {# páginas}}",
|
||||
"chooseHint": "Hasta {n} páginas, en el orden de la receta – tomadas ahora o de la fototeca. Las fotos no se guardan.",
|
||||
"read": "Read recipe",
|
||||
"reading": "The AI is reading …",
|
||||
"readingHint": "This can take a minute.",
|
||||
@@ -497,7 +535,11 @@
|
||||
"aiUnavailable": "The AI cannot be reached right now. Please try again later.",
|
||||
"aiNotConfigured": "The AI is not set up.",
|
||||
"unknown": "That did not work. Please try again."
|
||||
}
|
||||
},
|
||||
"addPage": "Añadir otra página",
|
||||
"page": "Página {n}",
|
||||
"removePage": "Quitar la página {n}",
|
||||
"full": "No más de {n} páginas a la vez."
|
||||
},
|
||||
"wish": "Make a wish",
|
||||
"sections": {
|
||||
@@ -561,7 +603,8 @@
|
||||
"errors": {
|
||||
"roundExists": "A round is already running.",
|
||||
"unknown": "That did not work. Please try again."
|
||||
}
|
||||
},
|
||||
"save": "Guardar"
|
||||
},
|
||||
"wish": {
|
||||
"eyebrow": "Round",
|
||||
@@ -628,12 +671,14 @@
|
||||
"mineOf": "{names}'s dish",
|
||||
"mineSet": "Make it my dish",
|
||||
"mineUnset": "No longer my dish",
|
||||
"mineHint": "Make one wish your dish: it is sure to be in the plan, and no veto removes it.",
|
||||
"mineHint": "Toca el corazón: tu plato entra seguro en el plan, ningún veto lo quita.",
|
||||
"mineChosen": "Your dish: {title} — sure to be in the plan.",
|
||||
"mineExplain": "One per round. No veto removes it, and the plan puts it first.",
|
||||
"protected": "Protected: this is someone's dish. There is no veto against it.",
|
||||
"vetoCount": "{n, plural, one {1 veto} other {# vetoes}}",
|
||||
"jokerShort": "Something new"
|
||||
"jokerShort": "Something new",
|
||||
"mineToggle": "{title} como mi plato",
|
||||
"mineUntoggle": "{title} ya no es mi plato"
|
||||
},
|
||||
"kids": {
|
||||
"title": "Who are you?",
|
||||
@@ -713,7 +758,23 @@
|
||||
"roundStatus": "That is no longer possible at this stage of the round.",
|
||||
"cooked": "What has been cooked stays as it is.",
|
||||
"unknown": "That did not work. Please try again."
|
||||
}
|
||||
},
|
||||
"round": {
|
||||
"title": "Ronda",
|
||||
"edit": "Cambiar ajustes",
|
||||
"cancel": "Cancelar",
|
||||
"end": "Terminar ronda",
|
||||
"confirmEnd": "¿Terminar de verdad? Toca otra vez",
|
||||
"endHint": "Lo cocinado y las valoraciones se quedan. Después puedes abrir la siguiente ronda.",
|
||||
"delete": "Borrar ronda",
|
||||
"confirmDelete": "¿Borrar de verdad? Toca otra vez",
|
||||
"errors": {
|
||||
"cooked": "Ya se ha cocinado algo. Mejor termina la ronda.",
|
||||
"unknown": "No ha funcionado. Inténtalo de nuevo."
|
||||
}
|
||||
},
|
||||
"day": "Día para {title}",
|
||||
"noDay": "Sin día"
|
||||
},
|
||||
"shopping": {
|
||||
"eyebrow": "Shopping",
|
||||
@@ -742,7 +803,27 @@
|
||||
"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.}}",
|
||||
"packOf": "{count} {word} de {size}"
|
||||
"packOf": "{count} {word} de {size}",
|
||||
"voice": {
|
||||
"record": "Dictar la lista de la compra",
|
||||
"stop": "Detener grabación",
|
||||
"recording": "Grabando · {time}",
|
||||
"transcribing": "Transcribiendo …",
|
||||
"hint": "Dilo, p. ej. «leche, huevos y papel higiénico»",
|
||||
"check": "Reconocido — revísalo",
|
||||
"item": "Artículo {n}",
|
||||
"drop": "Quitar {name}",
|
||||
"add": "{n, plural, one {Añadir # artículo} other {Añadir # artículos}}",
|
||||
"discard": "Descartar",
|
||||
"errors": {
|
||||
"mic": "El micrófono no está permitido. Permítelo en los ajustes del navegador.",
|
||||
"noSpeech": "Aún no hay modelo de voz (Más › AI).",
|
||||
"aiUnavailable": "La transcripción no está disponible ahora. Inténtalo en un momento.",
|
||||
"empty": "No se entendió nada. Inténtalo de nuevo.",
|
||||
"audio": "La grabación no llegó. Inténtalo de nuevo.",
|
||||
"unknown": "No ha funcionado. Inténtalo de nuevo."
|
||||
}
|
||||
}
|
||||
},
|
||||
"cooking": {
|
||||
"eyebrow": "Cooking",
|
||||
@@ -1092,7 +1173,15 @@
|
||||
"can": "{n, plural, one {lata} other {latas}}",
|
||||
"jar": "{n, plural, one {tarro} other {tarros}}",
|
||||
"pack": "{n, plural, one {paquete} other {paquetes}}",
|
||||
"bunch": "{n, plural, one {manojo} other {manojos}}"
|
||||
"bunch": "{n, plural, one {manojo} other {manojos}}",
|
||||
"cup": "{n, plural, one {taza} other {tazas}}",
|
||||
"dash": "{n, plural, one {chorrito} other {chorritos}}",
|
||||
"knifepoint": "{n, plural, one {punta de cuchillo} other {puntas de cuchillo}}",
|
||||
"tub": "{n, plural, one {tarrina} other {tarrinas}}",
|
||||
"piece": "{n, plural, one {pieza} other {piezas}}",
|
||||
"cube": "{n, plural, one {cubito} other {cubitos}}",
|
||||
"clove": "{n, plural, one {diente} other {dientes}}",
|
||||
"slice": "{n, plural, one {loncha} other {lonchas}}"
|
||||
},
|
||||
"mail": {
|
||||
"login": {
|
||||
@@ -1113,5 +1202,11 @@
|
||||
"button": "Abrir foodplanhero",
|
||||
"note": "Este correo usó el ajuste de Más › Envío de correos."
|
||||
}
|
||||
},
|
||||
"calendar": {
|
||||
"name": "{household} · Comidas",
|
||||
"cook": "Cocina {name}",
|
||||
"portions": "{n, plural, one {# ración} other {# raciones}}",
|
||||
"open": "Abrir en foodplanhero: {url}"
|
||||
}
|
||||
}
|
||||
@@ -309,6 +309,25 @@
|
||||
"step2": "Sous Domains, ajoute « foodplanhero.de », région EU. Si le domaine est chez Cloudflare, « Auto configure » crée les entrées DNS.",
|
||||
"step3": "Sous API Keys, crée une clé avec « Sending access » pour ce domaine et saisis-la ici.",
|
||||
"step4": "Enregistre, envoie un e-mail de test."
|
||||
},
|
||||
"calendar": {
|
||||
"title": "S’abonner au calendrier",
|
||||
"hint": "Les plats avec un jour apparaissent dans votre calendrier à l’heure du repas — un lien pour tout le foyer. Qui a le lien voit le plan.",
|
||||
"time": "Heure du repas",
|
||||
"minutes": "Durée (min)",
|
||||
"saveTime": "Enregistrer l’heure",
|
||||
"saved": "Enregistré",
|
||||
"create": "Démarrer l’abonnement",
|
||||
"renew": "Créer un nouveau lien",
|
||||
"renewHint": "Un nouveau lien rend l’ancien inutilisable. Les calendriers abonnés ont alors besoin du nouveau.",
|
||||
"linkOnce": "Votre lien — il ne s’affiche que maintenant :",
|
||||
"copy": "Copier",
|
||||
"copied": "Copié",
|
||||
"subscribe": "Ouvrir dans le calendrier",
|
||||
"stop": "Arrêter l’abonnement",
|
||||
"confirmStop": "Vraiment arrêter ? Touchez encore",
|
||||
"locked": "Impossible après une connexion par e-mail. Connectez-vous avec votre passkey.",
|
||||
"error": "Cela n’a pas marché. Veuillez réessayer."
|
||||
}
|
||||
},
|
||||
"nav": {
|
||||
@@ -377,7 +396,7 @@
|
||||
"remove": "Remove",
|
||||
"removed": "\"{title}\" was removed from the pool.",
|
||||
"undo": "Undo",
|
||||
"photo": "Take a photo",
|
||||
"photo": "Add photo",
|
||||
"photoError": "The photo couldn't be read. Use a JPEG, PNG or HEIC up to 15 MB.",
|
||||
"stepTimer": "{n} min",
|
||||
"source": "Source",
|
||||
@@ -385,7 +404,10 @@
|
||||
"stepTimerProduct": "{n} min selon le paquet ({product})",
|
||||
"photoAdd": "Ajouter une photo ({n} sur {max})",
|
||||
"photoFull": "5 photos au maximum",
|
||||
"present": "Present"
|
||||
"present": "Present",
|
||||
"inTrial": "Listed under “To try”, not yet in the pool. The joker “Something new” picks from there.",
|
||||
"inTrialLink": "Go to “To try”",
|
||||
"toPool": "Move to pool"
|
||||
},
|
||||
"form": {
|
||||
"newTitle": "New dish",
|
||||
@@ -429,13 +451,21 @@
|
||||
"can": "Boîte",
|
||||
"jar": "Bocal",
|
||||
"pack": "Paquet",
|
||||
"bunch": "Botte"
|
||||
"bunch": "Botte",
|
||||
"cup": "tasse",
|
||||
"dash": "trait",
|
||||
"knifepoint": "pointe de couteau",
|
||||
"tub": "Pot",
|
||||
"cube": "cube",
|
||||
"clove": "gousse",
|
||||
"slice": "tranche"
|
||||
},
|
||||
"errors": {
|
||||
"invalid": "Please give a title and check the amounts.",
|
||||
"amount": "An amount doesn't fit the ingredient (e.g. grams for pieces).",
|
||||
"unknown": "That didn't work. Please try again.",
|
||||
"missingAmount": "Il manque la quantité d’un ingrédient. Indique-la ou supprime la ligne."
|
||||
"missingAmount": "Il manque la quantité d’un ingrédient. Indique-la ou supprime la ligne.",
|
||||
"missingSize": "Il manque encore la taille d’une mesure (p. ex. 1 paquet = 500 g)."
|
||||
},
|
||||
"unmatched": "Nous n’avons pas pu associer ces lignes à un ingrédient. Ajoute-les toi-même si besoin :",
|
||||
"byAi": "Read by the AI. Check every ingredient and amount before you save.",
|
||||
@@ -458,10 +488,18 @@
|
||||
"unitWithSize": "{unit} ({size})",
|
||||
"packSize": "1 {unit} = {size}",
|
||||
"packChange": "Modifier la taille",
|
||||
"packSizeLabel": "Taille d’un(e) {unit} en {base}",
|
||||
"packSizeLabel": "Combien fait 1 {unit} ? (en {base})",
|
||||
"packSave": "Appliquer",
|
||||
"packHint": "Vaut pour tous les plats de votre foyer.",
|
||||
"packError": "Impossible d’enregistrer la taille."
|
||||
"packError": "Impossible d’enregistrer la taille.",
|
||||
"unitGroups": {
|
||||
"base": "Poids et volume",
|
||||
"kitchen": "Cuillères & co.",
|
||||
"count": "Pièces & emballages"
|
||||
},
|
||||
"sizeAsk": "Combien fait 1 {unit} ? (en {base})",
|
||||
"portionsHint": "Les quantités suivent quand tu changes les portions.",
|
||||
"sizeAskPerPiece": "Combien de {base} fait 1 pièce ?"
|
||||
},
|
||||
"addLinkText": "Nous lisons les ingrédients et les étapes sur la page de la recette.",
|
||||
"link": {
|
||||
@@ -482,9 +520,9 @@
|
||||
"addPhotoText": "The AI reads ingredients and steps from the page.",
|
||||
"photo": {
|
||||
"title": "Photograph a cookbook",
|
||||
"choose": "Take a photo of the page",
|
||||
"chosen": "{n, plural, one {1 photo chosen} other {# photos chosen}}",
|
||||
"chooseHint": "One recipe page, at most two photos. The photo is not kept.",
|
||||
"choose": "Take or choose a photo of the page",
|
||||
"chosen": "{n, plural, one {1 page} other {# pages}}",
|
||||
"chooseHint": "Jusqu’à {n} pages, dans l’ordre de la recette – prises maintenant ou depuis la photothèque. Les photos ne sont pas conservées.",
|
||||
"read": "Read recipe",
|
||||
"reading": "The AI is reading …",
|
||||
"readingHint": "This can take a minute.",
|
||||
@@ -497,7 +535,11 @@
|
||||
"aiUnavailable": "The AI cannot be reached right now. Please try again later.",
|
||||
"aiNotConfigured": "The AI is not set up.",
|
||||
"unknown": "That did not work. Please try again."
|
||||
}
|
||||
},
|
||||
"addPage": "Ajouter une page",
|
||||
"page": "Page {n}",
|
||||
"removePage": "Retirer la page {n}",
|
||||
"full": "Pas plus de {n} pages à la fois."
|
||||
},
|
||||
"wish": "Make a wish",
|
||||
"sections": {
|
||||
@@ -561,7 +603,8 @@
|
||||
"errors": {
|
||||
"roundExists": "A round is already running.",
|
||||
"unknown": "That did not work. Please try again."
|
||||
}
|
||||
},
|
||||
"save": "Enregistrer"
|
||||
},
|
||||
"wish": {
|
||||
"eyebrow": "Round",
|
||||
@@ -628,12 +671,14 @@
|
||||
"mineOf": "{names}'s dish",
|
||||
"mineSet": "Make it my dish",
|
||||
"mineUnset": "No longer my dish",
|
||||
"mineHint": "Make one wish your dish: it is sure to be in the plan, and no veto removes it.",
|
||||
"mineHint": "Touche le cœur : ton plat entre à coup sûr dans le plan, aucun veto ne le retire.",
|
||||
"mineChosen": "Your dish: {title} — sure to be in the plan.",
|
||||
"mineExplain": "One per round. No veto removes it, and the plan puts it first.",
|
||||
"protected": "Protected: this is someone's dish. There is no veto against it.",
|
||||
"vetoCount": "{n, plural, one {1 veto} other {# vetoes}}",
|
||||
"jokerShort": "Something new"
|
||||
"jokerShort": "Something new",
|
||||
"mineToggle": "{title} comme mon plat",
|
||||
"mineUntoggle": "{title} n’est plus mon plat"
|
||||
},
|
||||
"kids": {
|
||||
"title": "Who are you?",
|
||||
@@ -713,7 +758,23 @@
|
||||
"roundStatus": "That is no longer possible at this stage of the round.",
|
||||
"cooked": "What has been cooked stays as it is.",
|
||||
"unknown": "That did not work. Please try again."
|
||||
}
|
||||
},
|
||||
"round": {
|
||||
"title": "Tour",
|
||||
"edit": "Modifier les réglages",
|
||||
"cancel": "Annuler",
|
||||
"end": "Terminer le tour",
|
||||
"confirmEnd": "Vraiment terminer ? Touchez encore",
|
||||
"endHint": "Les plats cuisinés et les notes restent. Ensuite, vous pouvez ouvrir le tour suivant.",
|
||||
"delete": "Supprimer le tour",
|
||||
"confirmDelete": "Vraiment supprimer ? Touchez encore",
|
||||
"errors": {
|
||||
"cooked": "Un plat a déjà été cuisiné. Terminez plutôt le tour.",
|
||||
"unknown": "Cela n’a pas marché. Veuillez réessayer."
|
||||
}
|
||||
},
|
||||
"day": "Jour pour {title}",
|
||||
"noDay": "Sans jour"
|
||||
},
|
||||
"shopping": {
|
||||
"eyebrow": "Shopping",
|
||||
@@ -742,7 +803,27 @@
|
||||
"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.}}",
|
||||
"packOf": "{count} {word} de {size}"
|
||||
"packOf": "{count} {word} de {size}",
|
||||
"voice": {
|
||||
"record": "Dicter la liste de courses",
|
||||
"stop": "Arrêter l’enregistrement",
|
||||
"recording": "Enregistrement · {time}",
|
||||
"transcribing": "Transcription …",
|
||||
"hint": "Dis-le, p. ex. « lait, œufs et papier toilette »",
|
||||
"check": "Reconnu — vérifie",
|
||||
"item": "Article {n}",
|
||||
"drop": "Retirer {name}",
|
||||
"add": "{n, plural, one {Ajouter # article} other {Ajouter # articles}}",
|
||||
"discard": "Abandonner",
|
||||
"errors": {
|
||||
"mic": "Le micro n’est pas autorisé. Autorise-le dans les réglages du navigateur.",
|
||||
"noSpeech": "Aucun modèle vocal n’est configuré (Plus › AI).",
|
||||
"aiUnavailable": "La transcription n’est pas joignable. Réessaie dans un instant.",
|
||||
"empty": "Rien n’a été compris. Réessaie.",
|
||||
"audio": "L’enregistrement n’est pas passé. Réessaie.",
|
||||
"unknown": "Cela n’a pas marché. Réessaie."
|
||||
}
|
||||
}
|
||||
},
|
||||
"cooking": {
|
||||
"eyebrow": "Cooking",
|
||||
@@ -1092,7 +1173,15 @@
|
||||
"can": "{n, plural, one {boîte} other {boîtes}}",
|
||||
"jar": "{n, plural, one {bocal} other {bocaux}}",
|
||||
"pack": "{n, plural, one {paquet} other {paquets}}",
|
||||
"bunch": "{n, plural, one {botte} other {bottes}}"
|
||||
"bunch": "{n, plural, one {botte} other {bottes}}",
|
||||
"cup": "{n, plural, one {tasse} other {tasses}}",
|
||||
"dash": "{n, plural, one {trait} other {traits}}",
|
||||
"knifepoint": "{n, plural, one {pointe de couteau} other {pointes de couteau}}",
|
||||
"tub": "{n, plural, one {pot} other {pots}}",
|
||||
"piece": "{n, plural, one {pièce} other {pièces}}",
|
||||
"cube": "{n, plural, one {cube} other {cubes}}",
|
||||
"clove": "{n, plural, one {gousse} other {gousses}}",
|
||||
"slice": "{n, plural, one {tranche} other {tranches}}"
|
||||
},
|
||||
"mail": {
|
||||
"login": {
|
||||
@@ -1113,5 +1202,11 @@
|
||||
"button": "Ouvrir foodplanhero",
|
||||
"note": "Cet e-mail utilise le réglage sous Plus › Envoi d’e-mails."
|
||||
}
|
||||
},
|
||||
"calendar": {
|
||||
"name": "{household} · Repas",
|
||||
"cook": "{name} cuisine",
|
||||
"portions": "{n, plural, one {# portion} other {# portions}}",
|
||||
"open": "Ouvrir dans foodplanhero : {url}"
|
||||
}
|
||||
}
|
||||
@@ -2,5 +2,5 @@ apiVersion: v2
|
||||
name: lunch
|
||||
description: foodplanhero (Plan. Cook. Smile.) — die Familie entscheidet gemeinsam, was es gibt; aus dem Plan entsteht die Einkaufsliste
|
||||
type: application
|
||||
version: 26.11.40 # YY.M.<n> wie im AImighty-Markt — bei jeder Chart-Änderung erhöhen
|
||||
appVersion: "26.11.40" # MUSS gleich version sein: der Linter prüft es, und der Image-Tag hängt daran
|
||||
version: 26.11.50 # YY.M.<n> wie im AImighty-Markt — bei jeder Chart-Änderung erhöhen
|
||||
appVersion: "26.11.50" # MUSS gleich version sein: der Linter prüft es, und der Image-Tag hängt daran
|
||||
@@ -21,7 +21,7 @@ metadata:
|
||||
title: foodplanhero
|
||||
description: Plan. Cook. Smile. 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.40
|
||||
version: 26.11.50
|
||||
categories:
|
||||
- Applications
|
||||
|
||||
@@ -61,7 +61,7 @@ permission:
|
||||
appData: true
|
||||
|
||||
spec:
|
||||
versionName: '26.11.40'
|
||||
versionName: '26.11.50'
|
||||
|
||||
featuredImage: https://git.aimighty.olares.de/aimighty/bilder/raw/branch/main/lunch/icon.png
|
||||
promoteImage:
|
||||
|
||||
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 13 KiB |
@@ -0,0 +1,5 @@
|
||||
# The bottom bar stays at the bottom, and dishes to try say so
|
||||
v26.11.41: On the iPhone, the bottom bar and the buttons above it (Save, Cancel) could get stuck in the middle of the screen after typing, and stayed there even after scrolling. iOS sometimes keeps calculating the screen as if the keyboard were still open, long after it has closed. foodplanhero now holds the bar at the bottom for as long as that lasts, through touches and scrolling, and lets go as soon as iOS calculates correctly again. The buttons above the bar and the plus button on the dishes page follow the bar. Small movements such as bouncing at the end of a page are left alone. Dishes created from a photo, text or recipe link go to "To try" first, which is what the joker "Something new" picks from. Their page now says so, links to that tab and has a "Move to pool" button; the back arrow leads to "To try".
|
||||
|
||||
## Deutsch
|
||||
v26.11.41: Am iPhone konnten nach dem Tippen die Leiste unten und die Knöpfe darüber (Speichern, Abbrechen) mitten im Bild stehen bleiben, auch nach dem Scrollen. iOS rechnet den Bildschirm manchmal noch lange so, als wäre die Tastatur offen, obwohl sie längst zu ist. foodplanhero hält die Leiste jetzt unten, solange das dauert, auch beim Berühren und Scrollen, und lässt sie los, sobald iOS wieder richtig rechnet. Die Knöpfe über der Leiste und der Plus-Knopf bei den Gerichten gehen mit. Kleine Bewegungen wie das Nachfedern am Seitenende bleiben unberührt. Gerichte aus Foto, Text oder Rezept-Link stehen zuerst unter „Ausprobieren“, daraus zieht der Joker „Etwas Neues“. Ihre Seite sagt das jetzt, führt zu diesem Reiter und hat einen Knopf „In den Pool“; der Pfeil zurück führt zu „Ausprobieren“.
|
||||
@@ -0,0 +1,5 @@
|
||||
# A new icon: chef's hat with a heart
|
||||
v26.11.42: foodplanhero has a new icon: a white chef's hat with a heart, on the familiar coral. It replaces the plate with the leaf on the home screen, in the browser tab and in the market. To see it on the home screen, remove the app there once and add it again.
|
||||
|
||||
## Deutsch
|
||||
v26.11.42: foodplanhero hat ein neues Symbol: eine weiße Kochmütze mit Herz auf dem vertrauten Koralle. Sie ersetzt den Teller mit dem Blatt auf dem Home-Bildschirm, im Browser-Tab und im Markt. Damit das iPhone es zeigt, die App vom Home-Bildschirm einmal entfernen und neu hinzufügen.
|
||||
@@ -0,0 +1,5 @@
|
||||
# Photos from your library
|
||||
v26.11.43: Photos for a dish no longer have to be taken with the camera. Tapping "Add photo" on the iPhone now offers the photo library, the camera and files, and you can pick several photos from the library at once, up to five per dish. The same works for photos of a cookbook page and for the photo after cooking.
|
||||
|
||||
## Deutsch
|
||||
v26.11.43: Fotos für ein Gericht müssen nicht mehr mit der Kamera aufgenommen werden. „Foto hinzufügen“ bietet am iPhone jetzt Fotomediathek, Kamera und Dateien an, und aus der Mediathek lassen sich mehrere Fotos auf einmal wählen, bis zu fünf je Gericht. Genauso geht es beim Foto einer Kochbuchseite und beim Foto nach dem Kochen.
|
||||
@@ -0,0 +1,5 @@
|
||||
# Dish cards of equal size
|
||||
v26.11.44: All cards in the dish pool now have the same size, however long the name is. Titles take at most two lines and end with an ellipsis if they are longer; the full name is on the dish page. In the home-screen app on the iPhone, the top of each page no longer slides under the clock and battery.
|
||||
|
||||
## Deutsch
|
||||
v26.11.44: Alle Karten im Gerichte-Pool sind jetzt gleich groß, egal wie lang der Name ist. Titel nehmen höchstens zwei Zeilen und enden bei längeren Namen mit „…“; der volle Name steht auf der Gerichtsseite. In der Web-App auf dem iPhone rutscht der obere Rand der Seiten nicht mehr unter Uhr und Akku.
|
||||
@@ -0,0 +1,5 @@
|
||||
# End, delete or change a round; days per dish; subscribe to the calendar
|
||||
v26.11.45: Below the plan you can now change the round's settings, end the round so the next one can start, or delete it as long as nothing has been cooked. Each dish can get a day by hand; the day shows on the plan, on Today and on the kitchen display. Under More › Subscribe to calendar an admin creates one link for the household: dishes with a day appear in any calendar app at the household's meal time.
|
||||
|
||||
## Deutsch
|
||||
v26.11.45: Unter dem Plan lassen sich jetzt die Einstellungen der Runde ändern, die Runde beenden, damit die nächste beginnen kann, oder ganz löschen, solange noch nichts gekocht ist. Jedes Gericht kann von Hand einen Tag bekommen; er steht auf dem Plan, auf „Heute“ und im Küchendisplay. Unter Mehr › Kalender abonnieren erstellt ein Admin einen Link für den Haushalt: Gerichte mit Tag erscheinen in jeder Kalender-App zur Essenszeit.
|
||||
@@ -0,0 +1,5 @@
|
||||
# Dictate the shopping list
|
||||
v26.11.46: The shopping list has a microphone next to the free-text field. Say what is missing, for example "milk, two cucumbers and washing-up liquid": the app splits it into items, you check and change them, then they go on the list. It uses the same speech model as dictating a dish; the recording is not stored.
|
||||
|
||||
## Deutsch
|
||||
v26.11.46: Die Einkaufsliste hat neben dem Freitextfeld ein Mikrofon. Sag, was fehlt, etwa „Milch, zwei Gurken und Spülmittel“: Die App teilt es in Posten auf, du prüfst und änderst sie, dann kommen sie auf die Liste. Es nutzt dasselbe Sprachmodell wie „Gericht einsprechen“; die Aufnahme wird nicht gespeichert.
|
||||
@@ -0,0 +1,5 @@
|
||||
# My dish with one tap on the heart
|
||||
v26.11.47: Every dish card under Wishes now has a heart in the top corner. One tap makes the dish your dish — it is wished at the same time if it was not yet (one token) and is then sure to make the plan, no veto can strike it. A filled heart shows your dish; tap again to take it back, the wish stays. One per round; a new one replaces the old.
|
||||
|
||||
## Deutsch
|
||||
v26.11.47: Jede Gerichtskarte unter „Wünschen“ hat jetzt oben ein Herz. Ein Tipp macht das Gericht zu deinem Gericht — war es noch nicht gewünscht, wird es dabei gewünscht (ein Jeton), und es kommt sicher in den Plan, kein Veto streicht es. Ein gefülltes Herz zeigt dein Gericht; nochmal tippen nimmt es zurück, der Wunsch bleibt. Eins pro Runde; ein neues ersetzt das alte.
|
||||
@@ -0,0 +1,5 @@
|
||||
# Cookbook photos with several pages
|
||||
v26.11.48: A cookbook recipe can now span up to six pages. Each photo you take or pick is added to the others, shown as Page 1, Page 2 and so on, and any page can be removed again. The AI reads the pages in order as one recipe. The photos are not stored.
|
||||
|
||||
## Deutsch
|
||||
v26.11.48: Ein Rezept aus dem Kochbuch darf jetzt bis zu sechs Seiten haben. Jedes aufgenommene oder gewählte Foto kommt zu den anderen dazu, als Seite 1, Seite 2 und so weiter, und jede Seite lässt sich wieder entfernen. Die AI liest die Seiten der Reihe nach als ein Rezept. Die Fotos werden nicht gespeichert.
|
||||
@@ -0,0 +1,5 @@
|
||||
# Portions that scale, and more measures
|
||||
v26.11.49: Editing a dish now shows the amounts for the number of portions it was entered for, rounded the way you would type them. Changing the portions scales all amounts along. New measures: cup, dash and a knife tip, plus can, jar, pack, tub, bunch, piece, cube, clove and slice for any ingredient — the first time, the app asks how much one contains (for example 1 pack of mince = 500 g) and remembers it for your household.
|
||||
|
||||
## Deutsch
|
||||
v26.11.49: Beim Bearbeiten stehen die Mengen jetzt für so viele Portionen, wie das Gericht eingegeben wurde, gerundet wie man sie tippt. Portionen umstellen rechnet alle Mengen mit. Neue Maße: Tasse, Schuss und Messerspitze, dazu Dose, Glas, Packung, Becher, Bund, Stück, Würfel, Zehe und Scheibe für jede Zutat — beim ersten Mal fragt die App, wie viel eins enthält (etwa 1 Packung Hackfleisch = 500 g), und merkt es sich für euren Haushalt.
|
||||
@@ -0,0 +1,5 @@
|
||||
# Millilitres and litres for every ingredient
|
||||
v26.11.50: Every ingredient can now be entered in millilitres and litres as well as grams and kilos — also ingredients counted in pieces, such as stock cubes: the first time, the app asks how many millilitres one piece makes (for example 1 cube = 500 ml) and remembers it. The recipe shows "750 ml (1½ pieces)"; the shopping list still counts pieces.
|
||||
|
||||
## Deutsch
|
||||
v26.11.50: Jede Zutat lässt sich jetzt auch in Millilitern und Litern eintragen, ebenso in Gramm und Kilo — auch Zutaten, die man in Stück zählt, wie Brühwürfel: Beim ersten Mal fragt die App, wie viel ml ein Stück ergibt (etwa 1 Würfel = 500 ml), und merkt es sich. Das Rezept zeigt „750 ml (1½ Stück)“, die Einkaufsliste zählt weiter Stück.
|
||||
@@ -88,10 +88,17 @@ export default defineConfig({
|
||||
dependencies: ["leiste"],
|
||||
use: { ...iphone, storageState: "e2e/.auth/kai.json" },
|
||||
},
|
||||
{
|
||||
// Runde beenden/löschen, Tage, Kalender (26.11.45): beendet die Runde, deshalb spät.
|
||||
name: "runde",
|
||||
testMatch: /runde\.spec\.ts/,
|
||||
dependencies: ["mail"],
|
||||
use: { ...iphone, storageState: "e2e/.auth/kai.json" },
|
||||
},
|
||||
{
|
||||
name: "iphone-hell",
|
||||
testMatch: /rundgang\.spec\.ts/,
|
||||
dependencies: ["mail"],
|
||||
dependencies: ["runde"],
|
||||
use: { ...iphone, colorScheme: "light", storageState: "e2e/.auth/kai.json" },
|
||||
},
|
||||
{
|
||||
|
||||
|
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 8.4 KiB |