Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1d875fa02e | ||
|
|
2f56f3a479 | ||
|
|
c81d9c365a | ||
|
|
f4619d22ed | ||
|
|
4f4983f70e | ||
|
|
e9300278d4 | ||
|
|
ffee757b81 | ||
|
|
241a836028 | ||
|
|
68f42d709c | ||
|
|
e6a6386541 | ||
|
|
0248aff0ed |
No files matched your search
@@ -1,13 +1,13 @@
|
||||
# „Was gibt's?“ (lunch) — Projekt-Briefing für Claude Code
|
||||
# foodplanhero (lunch) — Projekt-Briefing für Claude Code
|
||||
|
||||
> **Produkt:** „Was gibt's?“ — die Familie entscheidet gemeinsam, was es warm
|
||||
> **Produkt:** foodplanhero („Plan. Cook. Smile.“, für Maike; bis 26.11.34 „Was gibt's?“) — die Familie entscheidet gemeinsam, was es warm
|
||||
> gibt, und aus dem Plan entsteht die Einkaufsliste. Konzept: `docs/konzept.md`.
|
||||
> **Technischer Name:** `lunch` (E-0003). **Maintainer:** Kai Böhm.
|
||||
> **Nutzerin, für die gebaut wird:** die Planerin (bei uns Maike).
|
||||
> **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.28 — alle neun Arbeitspakete aus `docs/PROJEKTSTART.md` sind gebaut:
|
||||
> **Status:** 26.11.39 — 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
|
||||
@@ -15,7 +15,11 @@
|
||||
> Rolle „Jugendlich“ (26.11.19), Rezepte in einer Form (26.11.20),
|
||||
> Produkte je Gericht (26.11.21), Veto mit Gegenvorschlag (26.11.22),
|
||||
> bis zu 5 Fotos je Gericht (26.11.23), Gerichte einsprechen (26.11.24), Kassenbons (V2b, 26.11.25),
|
||||
> Führung (26.11.27), Präsentationsmodus und Küchendisplay (26.11.28). Offen ist der
|
||||
> Führung (26.11.27), Präsentationsmodus und Küchendisplay (26.11.28),
|
||||
> lange Bons und Aldi (26.11.29), „Mein Gericht“ (26.11.30), Bons „nicht zum Kochen“
|
||||
> (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). Offen ist der
|
||||
> Magic Link (braucht SMTP).
|
||||
> **Letzte Aktualisierung:** 7. November 2026
|
||||
|
||||
@@ -84,8 +88,8 @@ Datenmodells (`households`, `dishes`, `rounds`, `slots`, …).
|
||||
Wiederholung der Vorrunde, Frisches zuerst; jeder Slot trägt einen Satz, warum.
|
||||
6. **Gestaltung (E-0002, E-0009):** Pastell Coral & Lavendel, nur als Token in
|
||||
`app/globals.css` (nie Farbwerte am Bauteil); Hauptaktion als Pille in Coral mit
|
||||
dunkler Schrift, Etiketten `.eyebrow` in tiefem Lavendel, Überschriften in Newsreader
|
||||
(lokal, `app/fonts/`), Abschnitte mit feinen Linien statt Kästen. Dunkler Modus von
|
||||
dunkler Schrift, Etiketten `.eyebrow` in tiefem Lavendel, eine Schrift: Poppins überall, Caveat nur
|
||||
für „by Maike“ (lokal, `app/fonts/`, E-0014), Abschnitte mit feinen Linien statt Kästen. Dunkler Modus von
|
||||
Anfang an; `tests/contrast.test.ts` verlangt 4,5:1. shadcn/ui, Icons aus Lucide,
|
||||
keine Emojis, nichts vom CDN. Leere Zustände sagen, was als Nächstes zu tun ist.
|
||||
Mobile zuerst. Ändert sich das Symbol: `docs/icon/lunch.svg`, dann
|
||||
@@ -386,6 +390,20 @@ Vorlagen ersetzt. `tests/seed.test.ts` prüft die Dateien. Ein Haushalt
|
||||
(Anzahl × Packung), nur wenn die Packung zur Einheit der Zutat passt), Status `done`,
|
||||
**Foto gelöscht**. Migration 0016 (`store_name`, `error`, `attempts`, `match_source`).
|
||||
|
||||
- Seit 26.11.29 (Aldi-Bon von Kai): Das Modell antwortet je Zeile kurz als
|
||||
`[text, qty, unit_price, total_price]` (alte Objektform geht weiter), mit 16.000 Token
|
||||
und 5 Minuten (`READ` in `lib/receipts.ts`). `receiptFromText` rettet bei abgebrochener
|
||||
Antwort jede vollständige Zeile (`error = 'partial'`, Hinweis in der Prüfung).
|
||||
`tidyLines`: Mengen-/Gewichtszeile über dem Artikel gehört zu ihm, Pfand und Leergut
|
||||
fallen weg. Nach drei Fehlversuchen `failed`, nicht ewig `queued`. Das Foto des Bons
|
||||
bleibt außerhalb des Repos; Tests bauen die Zeilen nach.
|
||||
- Seit 26.11.33: „Nicht zum Kochen“ = Alias **ohne** Zutat (`ingredient_aliases.ingredient_id`
|
||||
null, Migration 0020) → `suggestLines` liefert `source: "skip"`, die Zeile steht
|
||||
zugeklappt am Ende (`receipt_lines.skipped`). Gelernt wird nur, was jemand selbst
|
||||
weggewischt hat (`Decision.skip`); Unerkanntes bleibt offen. Preis immer über
|
||||
`unitPrice` (`lib/receipt-read.ts`): Zeilenpreis ÷ (Anzahl × Packung); ohne Packung kein
|
||||
Preis — die Prüfung warnt. Gewogene Zeilen (`weighed`) bekommen 1000 vorgefüllt.
|
||||
|
||||
## Führung (seit 26.11.27)
|
||||
|
||||
- `lib/onboarding.ts` (rein, getestet): `setupSteps` (Gerichte ≥ 5 → Laden → Familie →
|
||||
@@ -394,6 +412,33 @@ Vorlagen ersetzt. `tests/seed.test.ts` prüft die Dateien. Ein Haushalt
|
||||
- Gemerkt wird nur, was nicht aus den Daten folgt: `households.onboarding` (Familie
|
||||
übersprungen, ausgeblendet, „Fertig“ gesehen) und `members.seen_intro` (Migration 0017).
|
||||
- Tests auf „Heute“ greifen Inhaltskarten über `main article h2`, nicht die erste h2.
|
||||
- In einer Karte (`bg-secondary`) kein `outline`-Knopf: Seitenfläche auf Kartenfläche wirkt
|
||||
im Dunkeln wie ein Loch. Zweite Wege als Textlink, Nebenknöpfe bündig (`px-0`), seit 26.11.31.
|
||||
|
||||
## foodplanhero für Maike (seit 26.11.35, E-0013)
|
||||
|
||||
- Name in der Oberfläche „foodplanhero“ (`app.name`), technisch bleibt alles `lunch`
|
||||
(appid, Chart, Datenbank). Slogan „Plan. Cook. Smile.“.
|
||||
- `components/brand/brand.tsx`: `Wordmark` (Poppins Bold, „hero“ in `--hero`), `Slogan`
|
||||
(`active` hebt plan/cook/smile hervor), `Portrait` (grüner Ring, „by Maike“ in Caveat,
|
||||
5,31° gedreht — nach Kais Figma). Schriften lokal: `app/fonts` (woff2) und
|
||||
`lib/brand-fonts` (woff fürs Startbild, `outputFileTracingIncludes` in next.config).
|
||||
- Widmung je Haushalt (`households.dedication_*`, Migration 0021): Foto unter
|
||||
`/app/data/fotos/<haushalt>/widmung-*.webp`, nie im Repo. `/api/widmung/foto` liefert es
|
||||
auch ohne Sitzung (Anmelden, Einladung, Startbild) — von Kai so gewollt.
|
||||
- Startbild: `/startbild/<w>x<h>` (`next/og`), Größen in `lib/startup-sizes.ts`, verlinkt
|
||||
über `appleWebApp.startupImage`. Nur solange die App lädt, keine künstliche Pause.
|
||||
|
||||
## Mein Gericht (seit 26.11.30, Kai und Mike, E-0012)
|
||||
|
||||
- `wishes.is_mine` (Migration 0019, eins je Person und Runde, nie an einem Veto oder
|
||||
Gegenvorschlag). `setMine` in `lib/wishes.ts`: nur ein eigener Wunsch; nicht dasselbe
|
||||
wie in der Vorrunde, wenn es dort in den Plan kam (`lastMine`, Fehler `repeat`).
|
||||
- Kein Veto dagegen (`protected`); ein Veto, das nachträglich ein eigenes Gericht trifft,
|
||||
zählt nicht mehr im Budget. `suggest` setzt eigene Gerichte zuerst (Grund `mine`),
|
||||
bei zu wenig Slots zuerst, wer in der Vorrunde leer ausging (`owed`).
|
||||
- `roundWishes(c, round, viewer)`: Für Kinder und Jugendliche kommt ein fremdes Veto
|
||||
ohne Namen an — wer ein Veto eingelegt hat, sehen nur `admin` und `member`.
|
||||
|
||||
## Präsentation und Küchendisplay (seit 26.11.28)
|
||||
|
||||
@@ -423,9 +468,15 @@ Vorlagen ersetzt. `tests/seed.test.ts` prüft die Dateien. Ein Haushalt
|
||||
|
||||
- iOS lässt eine feste Leiste nach dem Schließen der Tastatur oft dort stehen, wo die
|
||||
Tastatur endete (Kai, 7.11.2026). `components/app-nav.tsx` nutzt deshalb
|
||||
`useKeyboardSafeNav` (`lib/use-keyboard-nav.ts`): beim Tippen `hidden`, danach am
|
||||
`visualViewport` ausgerichtet (`translateY` um die Lücke) und ein Scroll auf der
|
||||
Stelle. Eine neue feste Leiste unten nutzt denselben Haken. `e2e/pwa.spec.ts` wacht.
|
||||
`useKeyboardSafeNav` (`lib/use-keyboard-nav.ts`): beim Tippen `hidden`, danach ein
|
||||
Scroll auf der Stelle und **nur eine Sekunde lang** `translateY` um die Lücke
|
||||
(`keyboardGap`, ab 40 px), nur in der Web-App vom Home-Bildschirm; die erste Berührung
|
||||
beendet es. Eine neue feste Leiste unten nutzt denselben Haken.
|
||||
- **Nie beim Scrollen verschieben** (26.11.32): Bis 26.11.31 hing die Korrektur an jedem
|
||||
`visualViewport`-Ereignis, und die Leiste rutschte beim Scrollen mit, wenn Safaris
|
||||
Adressleiste ein- und ausfuhr. Kein Listener auf `scroll` des sichtbaren Bereichs.
|
||||
`e2e/leiste.spec.ts` täuscht den iOS-Sichtbereich vor und wacht darüber (fällt mit dem
|
||||
alten Haken durch).
|
||||
- Feste Knopfleisten unten nehmen `sticky bottom-[var(--nav-space)]` (seit 26.11.26), nie
|
||||
einen festen Abstand: Beim Tippen setzt der Haken `data-typing` an `<html>`, dann ist
|
||||
`--nav-space` 0 und die Knöpfe sitzen über der Tastatur.
|
||||
|
||||
+7
-7
@@ -1,5 +1,5 @@
|
||||
# ============================================================================
|
||||
# OlaresManifest.yaml — Lunch („Was gibt's?“)
|
||||
# OlaresManifest.yaml — foodplanhero (lunch, bis 26.11.34 „Was gibt's?“)
|
||||
#
|
||||
# Linter-Regeln, die hier zwingend gelten (scripts/check-chart.sh):
|
||||
# - metadata.name, metadata.appid, Chart.yaml.name und der Ordnername
|
||||
@@ -18,10 +18,10 @@ workloadReplicas:
|
||||
metadata:
|
||||
name: lunch
|
||||
appid: lunch
|
||||
title: What's cooking?
|
||||
description: The family decides together what's for dinner — and the shopping list writes itself. Runs entirely on your own box.
|
||||
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.28
|
||||
version: 26.11.39
|
||||
categories:
|
||||
- Applications
|
||||
|
||||
@@ -38,7 +38,7 @@ entrances:
|
||||
- name: lunch
|
||||
host: lunch
|
||||
port: 3000
|
||||
title: What's cooking?
|
||||
title: foodplanhero
|
||||
icon: https://git.aimighty.olares.de/aimighty/bilder/raw/branch/main/lunch/icon.png
|
||||
authLevel: public
|
||||
invisible: false
|
||||
@@ -61,14 +61,14 @@ permission:
|
||||
appData: true
|
||||
|
||||
spec:
|
||||
versionName: '26.11.28'
|
||||
versionName: '26.11.39'
|
||||
|
||||
featuredImage: https://git.aimighty.olares.de/aimighty/bilder/raw/branch/main/lunch/icon.png
|
||||
promoteImage:
|
||||
- https://git.aimighty.olares.de/aimighty/bilder/raw/branch/main/lunch/icon.png
|
||||
|
||||
fullDescription: |
|
||||
**What's cooking?** takes the daily "what are we eating?" off the
|
||||
**foodplanhero** — Plan. Cook. Smile. — takes the daily "what are we eating?" off the
|
||||
person who usually plans.
|
||||
|
||||
Everyone in the family wishes for dishes in ten seconds — children
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
# Was gibt's? (lunch)
|
||||
# foodplanhero (lunch)
|
||||
|
||||
Die Familie entscheidet gemeinsam, was es warm gibt, und aus dem Plan entsteht die Einkaufsliste — als PWA auf der eigenen Olares One. Konzept in [`docs/konzept.md`](docs/konzept.md), Weichen in [`docs/entscheidungen.md`](docs/entscheidungen.md), Regeln für jede Sitzung in [`CLAUDE.md`](CLAUDE.md), Daten und Arbeitspakete für den Start in [`docs/PROJEKTSTART.md`](docs/PROJEKTSTART.md).
|
||||
@@ -22,6 +22,11 @@ export default async function ReceiptPage({ params }: { params: Promise<{ id: st
|
||||
<h1 className="text-4xl leading-tight">{receipt.status === "done" ? t("doneTitle") : t("reviewTitle")}</h1>
|
||||
{receipt.storeName ? <p className="text-muted-foreground">{t("read", { store: receipt.storeName })}</p> : null}
|
||||
</header>
|
||||
{receipt.status === "review" && receipt.error === "partial" ? (
|
||||
<p role="status" className="rounded-2xl border border-border p-4">
|
||||
{t("partialHint")}
|
||||
</p>
|
||||
) : null}
|
||||
<ReceiptReview receipt={receipt} />
|
||||
</main>
|
||||
);
|
||||
|
||||
@@ -45,7 +45,9 @@ export default async function ReceiptsPage() {
|
||||
<Link href={`/bons/${r.id}`} className="flex min-h-14 items-center justify-between gap-3 py-2">
|
||||
<span className="flex min-w-0 flex-col">
|
||||
<span className="font-semibold">{label}</span>
|
||||
<span className={cn("text-sm", r.status === "review" ? "text-accent" : "text-muted-foreground")}>{status}</span>
|
||||
<span className={cn("text-sm", r.status === "review" ? "text-accent" : "text-muted-foreground")}>{status}
|
||||
{r.error === "partial" ? ` · ${t("errors.partial")}` : ""}
|
||||
</span>
|
||||
</span>
|
||||
{r.total !== null ? <span className="tabular-nums">{money.format(r.total)}</span> : null}
|
||||
</Link>
|
||||
|
||||
@@ -4,12 +4,18 @@ 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";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
// Bearbeiten zeigt die Mengen für vier Portionen (oder was man dort einträgt).
|
||||
const PORTIONS = 4;
|
||||
|
||||
function amountIn(qty: number, unit: BaseUnit, display: KitchenUnit | 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 };
|
||||
}
|
||||
|
||||
export default async function EditDishPage({ params }: { params: Promise<{ id: string }> }) {
|
||||
const { id } = await params;
|
||||
if (!/^[0-9a-f-]{36}$/.test(id)) notFound();
|
||||
@@ -36,8 +42,9 @@ export default async function EditDishPage({ params }: { params: Promise<{ id: s
|
||||
isTrial: dish.isTrial,
|
||||
sourceUrl: dish.sourceUrl,
|
||||
ingredients: dish.ingredients.map((i) => ({
|
||||
ingredient: { id: i.ingredientId, name: i.name, unit: i.unit },
|
||||
qty: i.qtyPerPortion * PORTIONS,
|
||||
ingredient: { id: i.ingredientId, name: i.name, unit: i.unit, kitchenUnit: i.kitchenUnit, packKind: i.packKind, packSize: i.packSize },
|
||||
// Im Maß, in dem sie eingegeben wurde: „2 EL“, „1 Dose“ (26.11.39).
|
||||
...amountIn(i.qtyPerPortion * PORTIONS, i.unit, i.displayUnit, i.packSize),
|
||||
note: i.note,
|
||||
product: i.product,
|
||||
})),
|
||||
|
||||
@@ -5,6 +5,7 @@ import { CookingMode } from "@/components/cooking/cooking-mode";
|
||||
import { requireSession } from "@/lib/auth/session";
|
||||
import { cookingSlot } from "@/lib/cooking";
|
||||
import { withHousehold } from "@/lib/db";
|
||||
import { Slogan } from "@/components/brand/brand";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
@@ -22,6 +23,7 @@ export default async function CookingPage({ params }: { params: Promise<{ id: st
|
||||
<header className="flex flex-col gap-1">
|
||||
<p className="eyebrow">{slot.cookName ? t("eyebrowCook", { name: slot.cookName }) : t("eyebrow")}</p>
|
||||
<h1 className="text-4xl leading-tight">{slot.dish.title}</h1>
|
||||
<Slogan active="cook" />
|
||||
</header>
|
||||
{slot.cookedAt ? (
|
||||
<p className="rounded-2xl border border-border p-4">{t("alreadyCooked")}</p>
|
||||
|
||||
+19
-2
@@ -6,6 +6,9 @@ import { LanguageSelect, SignOutButton } from "@/components/more/account-actions
|
||||
import { RemoveButton } from "@/components/more/remove-button";
|
||||
import { requireAdult } from "@/lib/auth/session";
|
||||
import { KidDevices, KidsAdmin } from "@/components/more/kids-admin";
|
||||
import { DedicationForm } from "@/components/more/dedication-form";
|
||||
import { Portrait, Slogan, Wordmark } from "@/components/brand/brand";
|
||||
import { getDedication, photoVersion } from "@/lib/dedication";
|
||||
import { aiFor } from "@/lib/ai-settings";
|
||||
import { InstallHint } from "@/components/install-hint";
|
||||
import { BudgetSettings } from "@/components/more/budget-settings";
|
||||
@@ -27,7 +30,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 } = await withHousehold(session.householdId, async (client) => {
|
||||
const { members, passkeys, founder, kids, kidDevices, money, 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 = (
|
||||
@@ -43,7 +46,7 @@ export default async function MorePage() {
|
||||
)
|
||||
).rows;
|
||||
const money = (await client.query("select budget_per_round::float as budget, expensive_per_slots as per, currency from households")).rows[0];
|
||||
return { members, passkeys, founder, kids, kidDevices, money };
|
||||
return { members, passkeys, founder, kids, kidDevices, money, dedication: await getDedication(client) };
|
||||
});
|
||||
const aiReady = !!(await aiFor(session.householdId));
|
||||
const date = new Intl.DateTimeFormat(locale, { dateStyle: "medium" });
|
||||
@@ -134,6 +137,20 @@ export default async function MorePage() {
|
||||
</Section>
|
||||
) : null}
|
||||
|
||||
{dedication.photo || dedication.text || session.role === "admin" ? (
|
||||
<Section title={t("dedication.title", { name: dedication.name ?? "Maike" })} id="widmung">
|
||||
{dedication.photo ? (
|
||||
<Portrait src={`/api/widmung/foto?v=${photoVersion(dedication.photo)}`} name={dedication.name ?? "Maike"} size={160} className="my-2" />
|
||||
) : null}
|
||||
{dedication.text ? <p className="whitespace-pre-line text-lg leading-relaxed">{dedication.text}</p> : null}
|
||||
<p className="flex flex-col items-center gap-2 py-2 text-center">
|
||||
<Wordmark className="text-2xl" />
|
||||
<Slogan />
|
||||
</p>
|
||||
{session.role === "admin" ? <DedicationForm name={dedication.name ?? ""} text={dedication.text ?? ""} hasPhoto={!!dedication.photo} /> : null}
|
||||
</Section>
|
||||
) : null}
|
||||
|
||||
<Section title={t("language")}>
|
||||
<LanguageSelect current={isLocale(locale) ? locale : "de"} />
|
||||
</Section>
|
||||
|
||||
+3
-1
@@ -37,7 +37,7 @@ export default async function TodayPage() {
|
||||
const round = await currentRound(c);
|
||||
if (round && round.status !== "open") return { round, slots: await planSlots(c, round.id) };
|
||||
if (!round) return { round };
|
||||
const entries = await roundWishes(c, round.id);
|
||||
const entries = await roundWishes(c, round.id, { memberId: session.memberId, adult: can(PLANNERS, session.role) });
|
||||
const titles = new Map<string, string>(
|
||||
(await c.query("select id, title from dishes where id = any($1)", [[...new Set(entries.map((e) => e.dishId))]])).rows.map((r) => [r.id, r.title]),
|
||||
);
|
||||
@@ -163,6 +163,7 @@ async function FamilyWishes({
|
||||
const wishes = entries.filter((e) => !e.isVeto);
|
||||
if (!wishes.length) return <p className="text-sm text-muted-foreground">{t("noWishesYet")}</p>;
|
||||
const fav = favorites(entries);
|
||||
const mine = new Set(entries.filter((e) => e.isMine).map((e) => e.dishId));
|
||||
const byDish = new Map<string, string[]>();
|
||||
for (const e of wishes) byDish.set(e.dishId, [...(byDish.get(e.dishId) ?? []), e.memberId === me ? t("you") : e.memberName]);
|
||||
const rows = [...byDish].sort(([a, x], [b, y]) => y.length - x.length || (titles.get(a) ?? "").localeCompare(titles.get(b) ?? ""));
|
||||
@@ -174,6 +175,7 @@ async function FamilyWishes({
|
||||
<li key={dishId} className="flex min-h-11 items-center justify-between gap-3 py-2">
|
||||
<span className="flex items-center gap-2">
|
||||
{fav.has(dishId) ? <Crown aria-label={t("favorite")} className="size-4 shrink-0 text-accent" /> : null}
|
||||
{mine.has(dishId) ? <Heart aria-label={t("mineDish")} className="size-4 shrink-0 fill-accent text-accent" /> : null}
|
||||
<span>{titles.get(dishId)}</span>
|
||||
</span>
|
||||
<span className="text-right text-sm text-muted-foreground">{names.join(", ")}</span>
|
||||
|
||||
@@ -9,6 +9,7 @@ import { listDishes } from "@/lib/dishes";
|
||||
import { planSlots } from "@/lib/plan";
|
||||
import { currentRound } from "@/lib/rounds";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { Slogan } from "@/components/brand/brand";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
@@ -42,6 +43,7 @@ export default async function PlanPage() {
|
||||
<header className="flex flex-col gap-1">
|
||||
<p className="eyebrow">{data.round ? t(`status.${data.round.status}`) : t("eyebrow")}</p>
|
||||
<h1 className="text-4xl leading-tight">{t("title")}</h1>
|
||||
{data.round && data.round.status !== "open" ? <Slogan active="plan" /> : null}
|
||||
{data.round ? (
|
||||
<p className="text-muted-foreground">
|
||||
{[day, t("meals", { n: data.round.slotsCount }), t("wishes", { n: "wishCount" in data ? data.wishCount ?? 0 : 0 })].filter(Boolean).join(" · ")}
|
||||
|
||||
@@ -13,12 +13,12 @@ export const dynamic = "force-dynamic";
|
||||
export default async function WishPage() {
|
||||
const session = await requireSession();
|
||||
const t = await getTranslations("wish");
|
||||
const adult = session.role === "admin" || session.role === "member";
|
||||
const data = await withHousehold(session.householdId, async (c) => {
|
||||
const round = await currentRound(c);
|
||||
if (!round || round.status !== "open") return { round };
|
||||
return { round, tiles: await wishTiles(c), entries: await roundWishes(c, round.id), budget: await budget(c, round.id, session.memberId) };
|
||||
return { round, tiles: await wishTiles(c), entries: await roundWishes(c, round.id, { memberId: session.memberId, adult }), budget: await budget(c, round.id, session.memberId) };
|
||||
});
|
||||
const adult = session.role === "admin" || session.role === "member";
|
||||
return (
|
||||
<main className="mx-auto flex max-w-2xl flex-col gap-4 px-4 py-6">
|
||||
<header className="flex flex-col gap-1">
|
||||
|
||||
@@ -6,6 +6,7 @@ import { getTranslations } from "next-intl/server";
|
||||
import { AuthShell } from "@/components/auth/auth-shell";
|
||||
import { LoginButton } from "@/components/auth/login-button";
|
||||
import { getSession, isSetUp } from "@/lib/auth/session";
|
||||
import { photoVersion, publicDedication } from "@/lib/dedication";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
@@ -13,8 +14,10 @@ export default async function SignInPage() {
|
||||
if (!(await isSetUp())) redirect("/einrichten");
|
||||
if (await getSession()) redirect("/");
|
||||
const t = await getTranslations("auth.login");
|
||||
const d = await publicDedication();
|
||||
const portrait = d?.photo ? { src: `/api/widmung/foto?v=${photoVersion(d.photo)}`, name: d.name ?? "Maike" } : null;
|
||||
return (
|
||||
<AuthShell title={t("title")} intro={t("intro")}>
|
||||
<AuthShell title={t("title")} intro={t("intro")} portrait={portrait}>
|
||||
<LoginButton />
|
||||
{(await cookies()).has(KIDS_COOKIE) ? (
|
||||
<Link href="/kinder" className="mx-auto inline-flex min-h-11 items-center text-sm font-semibold underline-offset-4 hover:underline">
|
||||
|
||||
@@ -42,5 +42,5 @@ export async function POST(request: Request) {
|
||||
byAi = true;
|
||||
}
|
||||
const imageUrl = recipe.image ? new URL(recipe.image, page.url).toString() : null;
|
||||
return json({ ...(await draftFromRecipe(recipe, await getLocale(), { sourceUrl: page.url, imageUrl, ai })), byAi });
|
||||
return json({ ...(await draftFromRecipe(recipe, await getLocale(), { sourceUrl: page.url, imageUrl, ai, householdId: session.householdId })), byAi });
|
||||
}
|
||||
@@ -40,5 +40,5 @@ export async function POST(request: Request) {
|
||||
throw error;
|
||||
}
|
||||
if (!recipe) return fail("noRecipe", 422);
|
||||
return json({ ...(await draftFromRecipe(recipe, await getLocale(), { ai })), byAi: true });
|
||||
return json({ ...(await draftFromRecipe(recipe, await getLocale(), { ai, householdId: session.householdId })), byAi: true });
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import { guardWrite, isResponse } from "@/lib/auth/guard";
|
||||
import { fail, json, readJson } from "@/lib/auth/http";
|
||||
import { stepIngredient } from "@/lib/dishes";
|
||||
import { allIngredients } from "@/lib/ingredients";
|
||||
import { withHousehold } from "@/lib/db";
|
||||
import { standardizeSteps } from "@/lib/recipe-standardize";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
@@ -24,7 +25,7 @@ export async function POST(request: Request) {
|
||||
const body = input.safeParse(await readJson(request));
|
||||
if (!body.success) return fail("invalid", 400);
|
||||
const locale = await getLocale();
|
||||
const all = new Map((await allIngredients()).map((e) => [e.id, e]));
|
||||
const all = new Map((await withHousehold(session.householdId, (c) => allIngredients(c))).map((e) => [e.id, e]));
|
||||
const own = body.data.ingredientIds.map((id) => all.get(id)).filter((e) => !!e);
|
||||
const styled = await standardizeSteps(
|
||||
await aiFor(session.householdId),
|
||||
|
||||
@@ -28,5 +28,5 @@ export async function POST(request: Request) {
|
||||
}
|
||||
if (!recipe) return fail("noRecipe", 422);
|
||||
recipe = { ...recipe, ingredients: guardAmounts(recipe.ingredients, body.data.text), steps: guardSteps(recipe.steps, body.data.text) };
|
||||
return json({ ...(await draftFromRecipe(recipe, await getLocale(), { ai })), byAi: true });
|
||||
return json({ ...(await draftFromRecipe(recipe, await getLocale(), { ai, householdId: session.householdId })), byAi: true });
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
import { guardWrite, isResponse } from "@/lib/auth/guard";
|
||||
import { fail, json } from "@/lib/auth/http";
|
||||
import { withHousehold } from "@/lib/db";
|
||||
import { PhotoRejected, removePhoto, storePhoto } from "@/lib/photos";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
// Widmung pflegen (26.11.35): Name, ein paar Sätze, ein Foto — nur Admins.
|
||||
// Felder als Formular, damit das Foto in derselben Anfrage mitkommen kann.
|
||||
export async function PUT(request: Request) {
|
||||
const session = await guardWrite(request, ["admin"]);
|
||||
if (isResponse(session)) return session;
|
||||
const form = await request.formData().catch(() => null);
|
||||
if (!form) return fail("invalid", 400);
|
||||
const name = String(form.get("name") ?? "").trim();
|
||||
const text = String(form.get("text") ?? "").trim();
|
||||
if (name.length > 40 || text.length > 800) return fail("invalid", 400);
|
||||
const file = form.get("photo");
|
||||
const drop = form.get("removePhoto") === "1";
|
||||
try {
|
||||
const result = await withHousehold(session.householdId, async (c) => {
|
||||
const old = (await c.query("select dedication_photo as photo from households")).rows[0]?.photo as string | null;
|
||||
let photo = old;
|
||||
if (file instanceof File && file.size > 0) photo = await storePhoto(session.householdId, "widmung", file);
|
||||
else if (drop) photo = null;
|
||||
await c.query("update households set dedication_name = $1, dedication_text = $2, dedication_photo = $3", [name || null, text || null, photo]);
|
||||
return { old, photo };
|
||||
});
|
||||
if (result.old && result.old !== result.photo) await removePhoto(result.old);
|
||||
return json({ ok: true, photo: !!result.photo });
|
||||
} catch (error) {
|
||||
if (error instanceof PhotoRejected) return fail("photo", 400);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import { z } from "zod";
|
||||
import { guardWrite, isResponse } from "@/lib/auth/guard";
|
||||
import { fail, json, readJson } from "@/lib/auth/http";
|
||||
import { PLANNERS } from "@/lib/auth/roles";
|
||||
import { withHousehold } from "@/lib/db";
|
||||
import { setPackSize } from "@/lib/ingredients";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
const body = z.object({ size: z.number().positive().max(100000) });
|
||||
|
||||
// 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.
|
||||
export async function PUT(request: Request, { params }: { params: Promise<{ id: string }> }) {
|
||||
const { id } = await params;
|
||||
const session = await guardWrite(request, [...PLANNERS]);
|
||||
if (isResponse(session)) return session;
|
||||
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));
|
||||
return ok ? json({ size }) : fail("noPack", 404);
|
||||
}
|
||||
@@ -1,17 +1,65 @@
|
||||
import { getLocale } from "next-intl/server";
|
||||
import { guardRead, isResponse } from "@/lib/auth/guard";
|
||||
import { json } from "@/lib/auth/http";
|
||||
import { searchIngredients } from "@/lib/ingredient-search";
|
||||
import { allIngredients } from "@/lib/ingredients";
|
||||
import { z } from "zod";
|
||||
import { guardRead, guardWrite, isResponse } from "@/lib/auth/guard";
|
||||
import { fail, json, readJson } from "@/lib/auth/http";
|
||||
import { PLANNERS } from "@/lib/auth/roles";
|
||||
import { CATEGORIES } from "@/lib/categories";
|
||||
import { withHousehold } from "@/lib/db";
|
||||
import { searchIngredients, type IngredientEntry } from "@/lib/ingredient-search";
|
||||
import { allIngredients, createOwnIngredient, OwnIngredientRefused } from "@/lib/ingredients";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
// Zutaten-Suche beim Tippen, in der Sprache der Person.
|
||||
const view = (i: IngredientEntry, locale: string, all: IngredientEntry[], products = new Map<string, string>()) => ({
|
||||
id: i.id,
|
||||
name: i.names[locale] ?? i.names.en,
|
||||
unit: i.unit,
|
||||
group: !!i.isGroup,
|
||||
kinds: i.isGroup ? all.filter((e) => e.parentId === i.id).length : 0,
|
||||
parentId: i.parentId ?? null,
|
||||
own: !!i.own,
|
||||
// Gemerktes Produkt des Haushalts — das Formular zeigt es gleich beim Wählen.
|
||||
product: products.get(i.id) ?? null,
|
||||
// Küchenmaß und Gebinde (26.11.39); die Größe mit der des Haushalts verrechnet.
|
||||
kitchenUnit: i.kitchenUnit ?? null,
|
||||
packKind: i.packKind ?? null,
|
||||
packSize: i.packSize ?? null,
|
||||
});
|
||||
|
||||
// Zutaten-Suche beim Tippen, in der Sprache der Person — mit den eigenen des
|
||||
// Haushalts und den Produktgruppen (26.11.38). Ohne q: nur die Gruppen (fürs Anlegen).
|
||||
export async function GET(request: Request) {
|
||||
const session = await guardRead();
|
||||
if (isResponse(session)) return session;
|
||||
const q = new URL(request.url).searchParams.get("q") ?? "";
|
||||
const locale = await getLocale();
|
||||
const hits = searchIngredients(await allIngredients(), q.slice(0, 60), locale);
|
||||
return json(hits.map((i) => ({ id: i.id, name: i.names[locale] ?? i.names.en, unit: i.unit })));
|
||||
const { all, products } = await withHousehold(session.householdId, async (c) => ({
|
||||
all: await allIngredients(c),
|
||||
products: new Map((await c.query("select ingredient_id, product from household_products")).rows.map((r) => [r.ingredient_id as string, r.product as string])),
|
||||
}));
|
||||
const hits = q.trim() ? searchIngredients(all, q.slice(0, 60), locale) : all.filter((i) => i.isGroup);
|
||||
return json(hits.map((i) => view(i, locale, all, products)));
|
||||
}
|
||||
|
||||
const create = z.object({
|
||||
name: z.string().trim().min(1).max(60),
|
||||
unit: z.enum(["g", "ml", "piece"]),
|
||||
parentId: z.string().uuid().nullable(),
|
||||
category: z.enum(CATEGORIES),
|
||||
});
|
||||
|
||||
// Eigene Zutat anlegen — wer Gerichte pflegt (Kai: „Ja, wer Gerichte pflegt“).
|
||||
export async function POST(request: Request) {
|
||||
const session = await guardWrite(request, [...PLANNERS]);
|
||||
if (isResponse(session)) return session;
|
||||
const body = create.safeParse(await readJson(request));
|
||||
if (!body.success) return fail("invalid", 400);
|
||||
const locale = await getLocale();
|
||||
try {
|
||||
const entry = await withHousehold(session.householdId, (c) => createOwnIngredient(c, session.householdId, body.data));
|
||||
return json(view(entry, locale, []), 201);
|
||||
} catch (error) {
|
||||
if (error instanceof OwnIngredientRefused) return fail(error.message, 409);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,7 @@ const body = z.object({
|
||||
ingredientId: uuid.nullable(),
|
||||
packQty: z.number().positive().max(100000).nullable(),
|
||||
packUnit: z.enum(["g", "ml", "piece"]).nullable(),
|
||||
skip: z.boolean().optional(),
|
||||
}),
|
||||
)
|
||||
.max(200),
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
import { fail } from "@/lib/auth/http";
|
||||
import { currentKitchenDisplay } from "@/lib/auth/kids";
|
||||
import { getSession } from "@/lib/auth/session";
|
||||
import { withHousehold } from "@/lib/db";
|
||||
import { publicDedication } from "@/lib/dedication";
|
||||
import { readPhoto } from "@/lib/photos";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
// Maikes Foto (26.11.35). Mit Sitzung oder Küchendisplay das des eigenen Haushalts;
|
||||
// ohne — Anmelden und Startbild — das des Haushalts dieser Box. Kai hat das so
|
||||
// gewollt („Anmelden und Einrichten“): Wer die Adresse kennt, sieht Maike.
|
||||
export async function GET() {
|
||||
const session = await getSession();
|
||||
const household = session?.householdId ?? (await currentKitchenDisplay())?.householdId;
|
||||
const photo = household
|
||||
? ((await withHousehold(household, async (c) => (await c.query("select dedication_photo as p from households")).rows[0]?.p)) as string | null)
|
||||
: ((await publicDedication())?.photo ?? null);
|
||||
if (!photo) return fail("notFound", 404);
|
||||
const body = await readPhoto(photo).catch(() => null);
|
||||
if (!body) return fail("notFound", 404);
|
||||
return new Response(new Uint8Array(body), { headers: { "content-type": "image/webp", "cache-control": "public, max-age=31536000, immutable" } });
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import { z } from "zod";
|
||||
import { guardWrite, isResponse } from "@/lib/auth/guard";
|
||||
import { fail, json, readJson } from "@/lib/auth/http";
|
||||
import { withHousehold } from "@/lib/db";
|
||||
import { setMine, WISHERS, WishRefused } from "@/lib/wishes";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
// „Mein Gericht“ setzen oder zurücknehmen — jede Person, die mitisst, für sich selbst.
|
||||
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));
|
||||
if (!body.success) return fail("invalid", 400);
|
||||
try {
|
||||
await withHousehold(session.householdId, (c) => setMine(c, session.memberId, body.data.dishId, body.data.mine));
|
||||
return json({ ok: true });
|
||||
} catch (error) {
|
||||
if (error instanceof WishRefused) return fail(error.reason, 409);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ import { AuthShell } from "@/components/auth/auth-shell";
|
||||
import { InviteForm } from "@/components/auth/invite-form";
|
||||
import { findInvitation } from "@/lib/auth/invitations";
|
||||
import { withAuth } from "@/lib/db";
|
||||
import { photoVersion, publicDedication } from "@/lib/dedication";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
// Der Link ist ein Geheimnis: nie als Referrer weitergeben.
|
||||
@@ -14,8 +15,12 @@ export default async function InvitationPage({ params }: { params: Promise<{ tok
|
||||
const invitation = token.length <= 100 ? await withAuth((client) => findInvitation(client, token)) : null;
|
||||
if (!invitation) return <AuthShell title={t("expiredTitle")} intro={t("expiredText")} />;
|
||||
const isDevice = Boolean(invitation.memberId);
|
||||
// Wer neu dazukommt, sieht zuerst, wem die App gewidmet ist (26.11.35).
|
||||
const d = await publicDedication();
|
||||
const portrait = d?.photo ? { src: `/api/widmung/foto?v=${photoVersion(d.photo)}`, name: d.name ?? "Maike" } : null;
|
||||
return (
|
||||
<AuthShell
|
||||
portrait={portrait}
|
||||
title={t("title", { household: invitation.householdName })}
|
||||
intro={isDevice ? t("introDevice", { name: invitation.memberName ?? "" }) : t("introPerson")}
|
||||
>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Copyright 2020 The Newsreader Project Authors (http://github.com/productiontype/Newsreader) Newsreader-Italic[opsz,wght].ttf: Copyright 2020 The Newsreader Project Authors (http://github.com/productiontype/Newsreader)
|
||||
Copyright 2014 The Caveat Project Authors (https://github.com/googlefonts/caveat)
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
@@ -0,0 +1,93 @@
|
||||
Copyright 2020 The Poppins Project Authors (https://github.com/itfoundry/Poppins) Poppins-ThinItalic.ttf: Copyright 2020 The Poppins Project Authors (https://github.com/itfoundry/Poppins) Poppins-ExtraLight.ttf: Copyright 2020 The Poppins Project Authors (https://github.com/itfoundry/Poppins) Poppins-ExtraLightItalic.ttf: Copyright 2020 The Poppins Project Authors (https://github.com/itfoundry/Poppins) Poppins-Light.ttf: Copyright 2020 The Poppins Project Authors (https://github.com/itfoundry/Poppins) Poppins-LightItalic.ttf: Copyright 2020 The Poppins Project Authors (https://github.com/itfoundry/Poppins) Poppins-Regular.ttf: Copyright 2020 The Poppins Project Authors (https://github.com/itfoundry/Poppins) Poppins-Italic.ttf: Copyright 2020 The Poppins Project Authors (https://github.com/itfoundry/Poppins) Poppins-Medium.ttf: Copyright 2020 The Poppins Project Authors (https://github.com/itfoundry/Poppins) Poppins-MediumItalic.ttf: Copyright 2020 The Poppins Project Authors (https://github.com/itfoundry/Poppins) Poppins-SemiBold.ttf: Copyright 2020 The Poppins Project Authors (https://github.com/itfoundry/Poppins) Poppins-SemiBoldItalic.ttf: Copyright 2020 The Poppins Project Authors (https://github.com/itfoundry/Poppins) Poppins-Bold.ttf: Copyright 2020 The Poppins Project Authors (https://github.com/itfoundry/Poppins) Poppins-BoldItalic.ttf: Copyright 2020 The Poppins Project Authors (https://github.com/itfoundry/Poppins) Poppins-ExtraBold.ttf: Copyright 2020 The Poppins Project Authors (https://github.com/itfoundry/Poppins) Poppins-ExtraBoldItalic.ttf: Copyright 2020 The Poppins Project Authors (https://github.com/itfoundry/Poppins) Poppins-Black.ttf: Copyright 2020 The Poppins Project Authors (https://github.com/itfoundry/Poppins) Poppins-BlackItalic.ttf: Copyright 2020 The Poppins Project Authors (https://github.com/itfoundry/Poppins)
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
http://scripts.sil.org/OFL
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+9
-6
@@ -23,6 +23,7 @@
|
||||
--ok: oklch(0.58 0.13 155); /* Ampel: im Rahmen */
|
||||
--warn: oklch(0.75 0.15 75); /* Ampel: knapp darüber */
|
||||
--over: oklch(0.58 0.19 25); /* Ampel: deutlich darüber */
|
||||
--hero: oklch(0.5 0.08 150); /* foodplanhero: „hero“ im Logo, Maikes Ring (26.11.35) */
|
||||
--radius: 1rem;
|
||||
}
|
||||
|
||||
@@ -40,6 +41,7 @@
|
||||
--secondary-foreground: var(--foreground);
|
||||
--accent: oklch(0.84 0.07 300);
|
||||
--ring: oklch(0.84 0.07 300);
|
||||
--hero: oklch(0.78 0.09 150);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,9 +62,11 @@
|
||||
--color-ok: var(--ok);
|
||||
--color-warn: var(--warn);
|
||||
--color-over: var(--over);
|
||||
--color-hero: var(--hero);
|
||||
--radius-xl: var(--radius);
|
||||
--font-sans: var(--font-geist-sans), ui-sans-serif, system-ui, sans-serif;
|
||||
--font-serif: var(--font-newsreader), ui-serif, Georgia, serif;
|
||||
--font-sans: var(--font-poppins), ui-sans-serif, system-ui, sans-serif;
|
||||
--font-brand: var(--font-sans);
|
||||
--font-hand: var(--font-caveat), cursive;
|
||||
}
|
||||
|
||||
/* Abstand fester Knopfleisten (Speichern, Übernehmen, Weiter) zur unteren Navigation.
|
||||
@@ -89,12 +93,11 @@ body {
|
||||
}
|
||||
|
||||
@layer base {
|
||||
/* Überschriften in der Serifenschrift, etwas enger gesetzt. */
|
||||
/* Überschriften in Poppins SemiBold, etwas enger gesetzt (E-0014: eine Schrift). */
|
||||
h1,
|
||||
h2 {
|
||||
font-family: var(--font-newsreader), ui-serif, Georgia, serif;
|
||||
font-weight: 500;
|
||||
letter-spacing: -0.01em;
|
||||
font-weight: 600;
|
||||
letter-spacing: -0.02em;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+24
-9
@@ -1,18 +1,24 @@
|
||||
import type { Metadata, Viewport } from "next";
|
||||
import { GeistSans } from "geist/font/sans";
|
||||
import localFont from "next/font/local";
|
||||
import { NextIntlClientProvider } from "next-intl";
|
||||
import { getLocale, getTranslations } from "next-intl/server";
|
||||
import "./globals.css";
|
||||
import { STARTUP_SIZES } from "@/lib/startup-sizes";
|
||||
|
||||
// Überschriften in einer Serifenschrift (E-0009), lokal aus app/fonts —
|
||||
// nie vom CDN. Newsreader, SIL Open Font License (app/fonts/Newsreader-OFL.txt).
|
||||
const serif = localFont({
|
||||
src: "./fonts/newsreader-latin-opsz-normal.woff2",
|
||||
weight: "200 800",
|
||||
variable: "--font-newsreader",
|
||||
// Eine Schrift für alles (Kai, 7.11.2026, E-0014): Poppins — Logo, Überschriften,
|
||||
// Text —, dazu Caveat nur für Maikes Unterschrift „by Maike“. Beide SIL Open Font
|
||||
// License (app/fonts/Poppins-OFL.txt, Caveat-OFL.txt), lokal, nie vom CDN.
|
||||
const sans = localFont({
|
||||
src: [
|
||||
{ path: "./fonts/poppins-latin-400-normal.woff2", weight: "400" },
|
||||
{ path: "./fonts/poppins-latin-500-normal.woff2", weight: "500" },
|
||||
{ path: "./fonts/poppins-latin-600-normal.woff2", weight: "600" },
|
||||
{ path: "./fonts/poppins-latin-700-normal.woff2", weight: "700" },
|
||||
],
|
||||
variable: "--font-poppins",
|
||||
display: "swap",
|
||||
});
|
||||
const hand = localFont({ src: "./fonts/caveat-latin-400-normal.woff2", weight: "400", variable: "--font-caveat", display: "swap" });
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
const t = await getTranslations("app");
|
||||
@@ -20,7 +26,16 @@ export async function generateMetadata(): Promise<Metadata> {
|
||||
title: t("name"),
|
||||
description: t("tagline"),
|
||||
applicationName: t("name"),
|
||||
appleWebApp: { capable: true, title: t("name"), statusBarStyle: "default" },
|
||||
appleWebApp: {
|
||||
capable: true,
|
||||
title: t("name"),
|
||||
statusBarStyle: "default",
|
||||
// Startbild mit Maike, solange die Web-App lädt (app/startbild, 26.11.35).
|
||||
startupImage: STARTUP_SIZES.map(([w, h, cw, ch, dpr]) => ({
|
||||
url: `/startbild/${w}x${h}`,
|
||||
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" },
|
||||
};
|
||||
}
|
||||
@@ -38,7 +53,7 @@ export const viewport: Viewport = {
|
||||
export default async function RootLayout({ children }: { children: React.ReactNode }) {
|
||||
const locale = await getLocale();
|
||||
return (
|
||||
<html lang={locale} className={`${GeistSans.variable} ${serif.variable}`}>
|
||||
<html lang={locale} className={`${sans.variable} ${hand.variable}`}>
|
||||
<body className="min-h-dvh antialiased">
|
||||
<NextIntlClientProvider>{children}</NextIntlClientProvider>
|
||||
</body>
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
import { readFile } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { ImageResponse } from "next/og";
|
||||
import sharp from "sharp";
|
||||
import { publicDedication } from "@/lib/dedication";
|
||||
import { readPhoto } from "@/lib/photos";
|
||||
import { STARTUP_SIZES } from "@/lib/startup-sizes";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
// Startbild der Web-App (26.11.35): iOS zeigt es, solange die App vom
|
||||
// Home-Bildschirm lädt — keine künstliche Pause. foodplanhero, „PLAN. COOK.
|
||||
// SMILE.“ und, wenn hochgeladen, Maike im grünen Ring mit „by Maike“.
|
||||
//
|
||||
// Farben als Hex, weil der Bildbauer kein OKLCH kennt — umgerechnet aus den
|
||||
// Token in app/globals.css (--background, --foreground, --hero).
|
||||
const BG = "#fefdff";
|
||||
const FG = "#1d1c23";
|
||||
const HERO = "#3f704b";
|
||||
|
||||
const fonts = (async () => {
|
||||
const dir = path.join(process.cwd(), "lib", "brand-fonts");
|
||||
const [bold, medium, hand] = await Promise.all(
|
||||
["poppins-latin-700-normal.woff", "poppins-latin-500-normal.woff", "caveat-latin-400-normal.woff"].map((f) => readFile(path.join(dir, f))),
|
||||
);
|
||||
return [
|
||||
{ name: "Poppins", data: bold!, weight: 700 as const, style: "normal" as const },
|
||||
{ name: "Poppins", data: medium!, weight: 500 as const, style: "normal" as const },
|
||||
{ name: "Caveat", data: hand!, weight: 400 as const, style: "normal" as const },
|
||||
];
|
||||
})();
|
||||
|
||||
export async function GET(_: Request, { params }: { params: Promise<{ size: string }> }) {
|
||||
const { size } = await params;
|
||||
const match = STARTUP_SIZES.find(([w, h]) => size === `${w}x${h}`);
|
||||
if (!match) return new Response("not found", { status: 404 });
|
||||
const [width, height, , , dpr] = match;
|
||||
const unit = dpr; // CSS-Pixel → Bildpixel
|
||||
const d = await publicDedication().catch(() => null);
|
||||
let photo: string | null = null;
|
||||
if (d?.photo) {
|
||||
const raw = await readPhoto(d.photo).catch(() => null);
|
||||
if (raw) photo = `data:image/png;base64,${(await sharp(raw).resize(240 * unit, 240 * unit, { fit: "cover" }).png().toBuffer()).toString("base64")}`;
|
||||
}
|
||||
const name = d?.name ?? "Maike";
|
||||
return new ImageResponse(
|
||||
(
|
||||
<div style={{ width, height, background: BG, display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", gap: 18 * unit }}>
|
||||
<div style={{ display: "flex", fontFamily: "Poppins", fontWeight: 700, fontSize: 44 * unit, color: FG, letterSpacing: -0.5 * unit }}>
|
||||
foodplan<span style={{ color: HERO }}>hero</span>
|
||||
</div>
|
||||
<div style={{ display: "flex", fontFamily: "Poppins", fontWeight: 500, fontSize: 14 * unit, color: FG, letterSpacing: 3.5 * unit }}>PLAN. COOK. SMILE.</div>
|
||||
{photo ? (
|
||||
<div style={{ display: "flex", flexDirection: "column", alignItems: "center", marginTop: 28 * unit }}>
|
||||
{/* eslint-disable-next-line @next/next/no-img-element -- Bildbauer, kein DOM */}
|
||||
<img src={photo} width={180 * unit} height={180 * unit} style={{ borderRadius: 9999, border: `${6 * unit}px solid ${HERO}`, objectFit: "cover" }} alt="" />
|
||||
<div style={{ display: "flex", fontFamily: "Caveat", fontSize: 40 * unit, color: FG, marginTop: -10 * unit, transform: "rotate(5.31deg)" }}>by {name}</div>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
),
|
||||
{ width, height, fonts: await fonts, headers: { "cache-control": "public, max-age=3600" } },
|
||||
);
|
||||
}
|
||||
@@ -1,13 +1,29 @@
|
||||
import Image from "next/image";
|
||||
import { Portrait, Slogan, Wordmark } from "@/components/brand/brand";
|
||||
|
||||
// Rahmen für Einrichten, Anmelden und Einladung: Symbol, Titel, Text, Inhalt.
|
||||
export function AuthShell({ title, intro, children }: { title: string; intro?: string; children?: React.ReactNode }) {
|
||||
// Rahmen für Einrichten, Anmelden und Einladung — alles mittig, Zeilen ausgeglichen
|
||||
// (text-balance, Kai 7.11.2026: kein „an.“ allein in der Zeile): foodplanhero mit Slogan (seit
|
||||
// 26.11.35 statt des Symbols), wo es eins gibt Maikes Porträt, dann Titel, Text, Inhalt.
|
||||
export function AuthShell({
|
||||
title,
|
||||
intro,
|
||||
portrait,
|
||||
children,
|
||||
}: {
|
||||
title: string;
|
||||
intro?: string;
|
||||
portrait?: { src: string; name: string } | null;
|
||||
children?: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<main className="mx-auto flex min-h-dvh w-full max-w-sm flex-col justify-center gap-6 px-4 py-10">
|
||||
<div className="flex flex-col items-center gap-4 text-center">
|
||||
<Image src="/icon.svg" alt="" width={56} height={56} priority />
|
||||
<h1 className="text-4xl leading-tight">{title}</h1>
|
||||
{intro ? <p className="text-muted-foreground">{intro}</p> : null}
|
||||
<p className="flex flex-col items-center gap-2">
|
||||
<Wordmark className="text-4xl" />
|
||||
<Slogan />
|
||||
</p>
|
||||
{portrait ? <Portrait src={portrait.src} name={portrait.name} size={120} className="my-2" /> : null}
|
||||
<h1 className="text-balance text-4xl leading-tight">{title}</h1>
|
||||
{intro ? <p className="mx-auto max-w-[34ch] text-balance text-muted-foreground">{intro}</p> : null}
|
||||
</div>
|
||||
{children}
|
||||
</main>
|
||||
|
||||
@@ -42,7 +42,7 @@ export function InviteForm({ token, suggestedName, askName }: { token: string; s
|
||||
<Button type="submit" size="lg" disabled={busy}>
|
||||
{busy ? t("working") : t("invite.submit")}
|
||||
</Button>
|
||||
<p className="text-sm text-muted-foreground">{t("setup.passkeyHint")}</p>
|
||||
<p className="mx-auto max-w-[36ch] text-balance text-center text-sm text-muted-foreground">{t("setup.passkeyHint")}</p>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
@@ -31,7 +31,7 @@ export function LoginButton() {
|
||||
<KeyRound aria-hidden />
|
||||
{busy ? t("working") : t("login.submit")}
|
||||
</Button>
|
||||
<p className="text-sm text-muted-foreground">{t("login.noPasskey")}</p>
|
||||
<p className="mx-auto max-w-[36ch] text-balance text-center text-sm text-muted-foreground">{t("login.noPasskey")}</p>
|
||||
<Link href="/wiederherstellen" className="inline-flex min-h-11 items-center self-center text-sm underline underline-offset-4">
|
||||
{t("login.lost")}
|
||||
</Link>
|
||||
|
||||
@@ -50,7 +50,7 @@ export function RecoveryForm() {
|
||||
{busy ? t("working") : t("recovery.submit")}
|
||||
</Button>
|
||||
</form>
|
||||
<p className="text-sm text-muted-foreground">{t("recovery.others")}</p>
|
||||
<p className="mx-auto max-w-[36ch] text-balance text-center text-sm text-muted-foreground">{t("recovery.others")}</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -48,7 +48,7 @@ export function SetupForm() {
|
||||
<Button type="submit" size="lg" disabled={busy}>
|
||||
{busy ? t("working") : t("setup.submit")}
|
||||
</Button>
|
||||
<p className="text-sm text-muted-foreground">{t("setup.passkeyHint")}</p>
|
||||
<p className="mx-auto max-w-[36ch] text-balance text-center text-sm text-muted-foreground">{t("setup.passkeyHint")}</p>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
// foodplanhero (Kai für Maike, 26.11.35): Wortmarke, Slogan und Maikes Porträt —
|
||||
// wie in Kais Figma-Entwurf: Poppins Bold, „hero“ in Grün; „PLAN. COOK. SMILE.“ in
|
||||
// Poppins Medium mit 25 % Abstand; „by Maike“ in Caveat, leicht gedreht.
|
||||
|
||||
export function Wordmark({ className }: { className?: string }) {
|
||||
return (
|
||||
<span className={cn("font-brand font-bold leading-none tracking-tight", className)}>
|
||||
foodplan<span className="text-hero">hero</span>
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
export type SloganStep = "plan" | "cook" | "smile";
|
||||
const WORDS: SloganStep[] = ["plan", "cook", "smile"];
|
||||
|
||||
/** „PLAN. COOK. SMILE.“ — mit active ist das Wort hervorgehoben, das gerade passiert. */
|
||||
export function Slogan({ active, className }: { active?: SloganStep; className?: string }) {
|
||||
return (
|
||||
<span className={cn("font-brand text-xs font-medium uppercase tracking-[0.25em]", className)}>
|
||||
{WORDS.map((w, i) => (
|
||||
<span key={w} className={cn(active && w !== active && "text-muted-foreground", active === w && "text-hero")}>
|
||||
{w}.{i < WORDS.length - 1 ? " " : ""}
|
||||
</span>
|
||||
))}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
/** Maike im Kreis mit grünem Ring, darunter „by Maike“ in Schreibschrift. */
|
||||
export function Portrait({ src, name, size = 128, className }: { src: string; name: string; size?: number; className?: string }) {
|
||||
return (
|
||||
<figure className={cn("relative mx-auto flex flex-col items-center", className)} style={{ width: size }}>
|
||||
{/* eslint-disable-next-line @next/next/no-img-element -- eigenes Foto von der Box */}
|
||||
<img src={src} alt={name} width={size} height={size} className="aspect-square w-full rounded-full border-4 border-hero object-cover" />
|
||||
<figcaption className="-mt-3 rotate-[5.31deg] font-hand text-3xl leading-none text-foreground">by {name}</figcaption>
|
||||
</figure>
|
||||
);
|
||||
}
|
||||
@@ -1,19 +1,29 @@
|
||||
"use client";
|
||||
|
||||
import { Pause, Play, Timer as TimerIcon } from "lucide-react";
|
||||
import { useLocale, useTranslations } from "next-intl";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useEffect, useState } from "react";
|
||||
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 { formatQuantity, type BaseUnit } from "@/lib/units";
|
||||
import { type BaseUnit, type KitchenUnit } from "@/lib/units";
|
||||
import { useKitchenAmount } from "@/lib/use-kitchen-amount";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
// Gemeinsames von Kochmodus und Präsentation (26.11.28): Display an lassen,
|
||||
// Timer gegen die Uhr, Mengen in der Portionszahl.
|
||||
|
||||
export type Ingredient = { ingredientId: string; name: string; forms: { one: string; other: string } | null; qtyPerPortion: number; unit: BaseUnit; note: string | null };
|
||||
export type Ingredient = {
|
||||
ingredientId: string;
|
||||
name: string;
|
||||
forms: { one: string; other: string } | null;
|
||||
qtyPerPortion: number;
|
||||
unit: BaseUnit;
|
||||
note: string | null;
|
||||
displayUnit?: KitchenUnit | null;
|
||||
packSize?: number | null;
|
||||
};
|
||||
export type Step = { section: Section; text: string; timerSeconds: number | null; ingredientIds: string[]; timerFrom?: string };
|
||||
export type Running = { step: number; endsAt: number | null; left: number; done: boolean };
|
||||
|
||||
@@ -98,12 +108,10 @@ export const withTextTimer = (s: Step): Step => ({ ...s, timerSeconds: s.timerSe
|
||||
|
||||
/** „250 g“ in der Portionszahl, und der passende Name (Einzahl/Mehrzahl). */
|
||||
export function useAmount(portions: number) {
|
||||
const locale = useLocale();
|
||||
const kitchen = useKitchenAmount();
|
||||
return {
|
||||
amount: (i: Ingredient) => {
|
||||
const f = formatQuantity(i.qtyPerPortion * portions, i.unit, locale);
|
||||
return `${f.amount}${f.unit ? ` ${f.unit}` : ""}`;
|
||||
},
|
||||
// „2 EL (30 ml)“, „400 g (1 Dose)“ — lib/units.ts formatKitchen (26.11.39).
|
||||
amount: (i: Ingredient) => kitchen.text(i, i.qtyPerPortion * portions),
|
||||
label: (i: Ingredient) => labelFor(i, i.qtyPerPortion * portions),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import { useRef, useState } from "react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { Slogan } from "@/components/brand/brand";
|
||||
|
||||
type ToRate = { slotId: string; dishId: string; title: string; cookName: string | null; isCook: boolean; thanked: boolean };
|
||||
|
||||
@@ -43,7 +44,10 @@ export function RateCard({ item }: { item: ToRate }) {
|
||||
|
||||
return (
|
||||
<article className="flex flex-col gap-3 rounded-2xl bg-muted p-5" aria-labelledby={`rate-${item.slotId}`}>
|
||||
<p className="eyebrow">{t("eyebrow")}</p>
|
||||
<p className="flex flex-wrap items-baseline justify-between gap-x-3 gap-y-1">
|
||||
<span className="eyebrow">{t("eyebrow")}</span>
|
||||
<Slogan active="smile" />
|
||||
</p>
|
||||
<h2 id={`rate-${item.slotId}`} className="text-2xl leading-snug">
|
||||
{t("question", { title: item.title })}
|
||||
</h2>
|
||||
|
||||
@@ -2,20 +2,23 @@
|
||||
|
||||
import { ArrowDown, ArrowUp, Plus, Sparkles, X, Package, Wand2 } from "lucide-react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useLocale, useTranslations } from "next-intl";
|
||||
import { useEffect, useId, useRef, useState } from "react";
|
||||
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 { BASES, TAGS } from "@/lib/categories";
|
||||
import { parseNumber, type BaseUnit } from "@/lib/units";
|
||||
import { formatQuantity, isPackKind, parseNumber, type BaseUnit } from "@/lib/units";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { SECTIONS, type Section } from "@/lib/recipe-style";
|
||||
|
||||
export type Picked = { id: string; name: string; unit: BaseUnit };
|
||||
import { IngredientPicker, type Picked } from "./ingredient-picker";
|
||||
import { PackSize } from "./pack-size";
|
||||
export { IngredientPicker, type Picked };
|
||||
// Produkt (optional): Name, Packung in der Einheit der Zeile, Kochzeit laut Packung.
|
||||
type Row = { key: number; ingredient: Picked | null; qty: string; unit: string; note: string; product: string; pack: string; cook: string; open: boolean };
|
||||
// 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 };
|
||||
type StepRow = { key: number; text: string; timer: string; section: Section | "" };
|
||||
|
||||
export type DishFormValue = {
|
||||
@@ -32,7 +35,7 @@ export type DishFormValue = {
|
||||
qty: number | null;
|
||||
unit?: string | null;
|
||||
note: string | null;
|
||||
product?: { name: string; pack: number | null; cookMinutes: number | null } | null;
|
||||
product?: { name: string; pack: number | null; cookMinutes: number | null; fromHousehold?: boolean } | null;
|
||||
}[];
|
||||
steps: { text: string; timerMinutes: number | null; section?: Section | null }[];
|
||||
sourceUrl?: string | null;
|
||||
@@ -51,6 +54,19 @@ const UNITS_FOR: Record<BaseUnit, string[]> = {
|
||||
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;
|
||||
};
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
let counter = 0;
|
||||
const next = () => ++counter;
|
||||
|
||||
@@ -61,6 +77,11 @@ const formatQty = (n: number) => String(Math.round(n * 100) / 100).replace(".",
|
||||
// Portion um (lib/dishes.ts).
|
||||
export function DishForm({ initial }: { initial?: DishFormValue }) {
|
||||
const t = useTranslations("dishes");
|
||||
const locale = useLocale();
|
||||
const sizeText = (size: number, unit: BaseUnit) => {
|
||||
const f = formatQuantity(size, unit, locale);
|
||||
return `${f.amount}${f.unit ? ` ${f.unit}` : ""}`;
|
||||
};
|
||||
const router = useRouter();
|
||||
const [title, setTitle] = useState(initial?.title ?? "");
|
||||
const [portions, setPortions] = useState(String(initial?.portions ?? 4));
|
||||
@@ -74,12 +95,14 @@ export function DishForm({ initial }: { initial?: DishFormValue }) {
|
||||
key: next(),
|
||||
ingredient: i.ingredient,
|
||||
qty: i.qty !== null ? formatQty(i.qty) : "",
|
||||
unit: i.unit && UNITS_FOR[i.ingredient.unit].includes(i.unit) ? i.unit : i.ingredient.unit,
|
||||
unit: i.unit && unitsFor(i.ingredient).includes(i.unit) ? i.unit : i.ingredient.unit,
|
||||
note: i.note ?? "",
|
||||
product: i.product?.name ?? "",
|
||||
pack: i.product?.pack ? formatQty(i.product.pack) : "",
|
||||
cook: i.product?.cookMinutes ? String(i.product.cookMinutes) : "",
|
||||
open: !!i.product,
|
||||
// Ein geerbtes Lieblingsprodukt füllt die Felder nicht — leer heißt: es gilt weiter.
|
||||
product: i.product && !i.product.fromHousehold ? i.product.name : "",
|
||||
pack: i.product?.pack && !i.product.fromHousehold ? formatQty(i.product.pack) : "",
|
||||
cook: i.product?.cookMinutes && !i.product.fromHousehold ? String(i.product.cookMinutes) : "",
|
||||
open: !!i.product && !i.product.fromHousehold,
|
||||
inherited: i.product?.fromHousehold ? i.product.name : null,
|
||||
}))
|
||||
: [{ key: next(), ingredient: null, qty: "", unit: "g", note: "", product: "", pack: "", cook: "", open: false }],
|
||||
);
|
||||
@@ -152,6 +175,7 @@ export function DishForm({ initial }: { initial?: DishFormValue }) {
|
||||
name: r.product.trim(),
|
||||
pack: r.pack.trim() ? (parseNumber(r.pack) ?? null) : null,
|
||||
cookMinutes: r.cook.trim() ? Math.round(parseNumber(r.cook) ?? 0) || null : null,
|
||||
remember: !!r.remember,
|
||||
}
|
||||
: null,
|
||||
}));
|
||||
@@ -277,7 +301,7 @@ export function DishForm({ initial }: { initial?: DishFormValue }) {
|
||||
{rows.map((row) => (
|
||||
<li key={row.key} className="flex flex-col gap-2 rounded-2xl bg-muted p-3">
|
||||
<div className="flex items-start gap-2">
|
||||
<IngredientPicker value={row.ingredient} onPick={(p) => update(row.key, { ingredient: p, unit: p.unit })} />
|
||||
<IngredientPicker canCreate value={row.ingredient} onPick={(p) => update(row.key, { ingredient: p, unit: preferredUnit(p), inherited: row.product ? row.inherited : (p.product ?? null) })} />
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
@@ -303,13 +327,26 @@ 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"
|
||||
>
|
||||
{UNITS_FOR[row.ingredient?.unit ?? "g"].map((u) => (
|
||||
{unitsFor(row.ingredient).map((u) => (
|
||||
<option key={u} value={u}>
|
||||
{t(`form.units.${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>
|
||||
))}
|
||||
</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)))
|
||||
}
|
||||
/>
|
||||
) : null}
|
||||
<Input
|
||||
aria-label={t("form.note")}
|
||||
placeholder={t("form.notePlaceholder")}
|
||||
@@ -333,7 +370,7 @@ export function DishForm({ initial }: { initial?: DishFormValue }) {
|
||||
<div className="grid grid-cols-2 gap-2">
|
||||
<div className="flex flex-col gap-1">
|
||||
<Label htmlFor={`pack-${row.key}`} className="text-sm">
|
||||
{t("form.productPack", { unit: t(`form.units.${row.unit}`) })}
|
||||
{t("form.productPack", { unit: t(`form.units.${isPackKind(row.unit) ? (row.ingredient?.unit ?? "g") : row.unit}`) })}
|
||||
</Label>
|
||||
<Input id={`pack-${row.key}`} inputMode="decimal" value={row.pack} onChange={(e) => update(row.key, { pack: e.target.value })} />
|
||||
</div>
|
||||
@@ -345,12 +382,19 @@ export function DishForm({ initial }: { initial?: DishFormValue }) {
|
||||
</div>
|
||||
</div>
|
||||
<p className="text-xs text-muted-foreground">{t("form.productHint")}</p>
|
||||
<label className="flex min-h-11 items-center gap-3 text-sm">
|
||||
<input type="checkbox" checked={!!row.remember} onChange={(e) => update(row.key, { remember: e.target.checked })} className="size-5 accent-primary" />
|
||||
{t("form.rememberProduct", { name: row.ingredient?.name ?? "" })}
|
||||
</label>
|
||||
</fieldset>
|
||||
) : (
|
||||
<Button type="button" variant="ghost" className="self-start" disabled={!row.ingredient} onClick={() => update(row.key, { open: true })}>
|
||||
<Package aria-hidden />
|
||||
{t("form.addProduct")}
|
||||
</Button>
|
||||
<div className="flex flex-col gap-1">
|
||||
{row.inherited ? <p className="text-sm text-muted-foreground">{t("form.inheritedProduct", { product: row.inherited })}</p> : null}
|
||||
<Button type="button" variant="ghost" className="self-start" disabled={!row.ingredient} onClick={() => update(row.key, { open: true })}>
|
||||
<Package aria-hidden />
|
||||
{row.inherited ? t("form.otherProduct") : t("form.addProduct")}
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</li>
|
||||
))}
|
||||
@@ -461,67 +505,3 @@ export function DishForm({ initial }: { initial?: DishFormValue }) {
|
||||
|
||||
// Zutat suchen und wählen. Tippen sucht in der Sprache der Person, auch über
|
||||
// Synonyme (lib/ingredient-search.ts); ein Tipp auf einen Treffer wählt ihn.
|
||||
export function IngredientPicker({ value, onPick }: { value: Picked | null; onPick: (p: Picked) => void }) {
|
||||
const t = useTranslations("dishes.form");
|
||||
const id = useId();
|
||||
const [query, setQuery] = useState(value?.name ?? "");
|
||||
const [hits, setHits] = useState<Picked[]>([]);
|
||||
const [open, setOpen] = useState(false);
|
||||
const timer = useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (!open || !query.trim() || query === value?.name) {
|
||||
setHits([]);
|
||||
return;
|
||||
}
|
||||
if (timer.current) clearTimeout(timer.current);
|
||||
timer.current = setTimeout(async () => {
|
||||
const res = await fetch(`/api/ingredients?q=${encodeURIComponent(query)}`);
|
||||
if (res.ok) setHits(await res.json());
|
||||
}, 150);
|
||||
}, [query, open, value?.name]);
|
||||
|
||||
return (
|
||||
<div className="relative flex-1">
|
||||
<Input
|
||||
id={id}
|
||||
role="combobox"
|
||||
aria-expanded={open && hits.length > 0}
|
||||
aria-controls={`${id}-list`}
|
||||
aria-autocomplete="list"
|
||||
aria-label={t("searchIngredient")}
|
||||
placeholder={t("searchIngredient")}
|
||||
value={query}
|
||||
autoComplete="off"
|
||||
onFocus={() => setOpen(true)}
|
||||
onChange={(e) => {
|
||||
setQuery(e.target.value);
|
||||
setOpen(true);
|
||||
}}
|
||||
/>
|
||||
{open && query.trim() && query !== value?.name ? (
|
||||
<ul id={`${id}-list`} role="listbox" className="absolute inset-x-0 top-full z-20 mt-1 overflow-hidden rounded-xl border border-border bg-card shadow-lg">
|
||||
{hits.length ? (
|
||||
hits.map((h) => (
|
||||
<li key={h.id} role="option" aria-selected={value?.id === h.id}>
|
||||
<button
|
||||
type="button"
|
||||
className="flex min-h-11 w-full items-center px-4 text-left hover:bg-muted"
|
||||
onClick={() => {
|
||||
onPick(h);
|
||||
setQuery(h.name);
|
||||
setOpen(false);
|
||||
}}
|
||||
>
|
||||
{h.name}
|
||||
</button>
|
||||
</li>
|
||||
))
|
||||
) : (
|
||||
<li className="px-4 py-3 text-sm text-muted-foreground">{t("noHits")}</li>
|
||||
)}
|
||||
</ul>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,208 @@
|
||||
"use client";
|
||||
|
||||
import { Plus } from "lucide-react";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useEffect, useId, useRef, useState } from "react";
|
||||
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 { CATEGORIES } from "@/lib/categories";
|
||||
import { normalize } from "@/lib/ingredient-search";
|
||||
import type { BaseUnit, KitchenUnit, PackKind } from "@/lib/units";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export type Picked = {
|
||||
id: string;
|
||||
name: string;
|
||||
unit: BaseUnit;
|
||||
group?: boolean;
|
||||
product?: string | null;
|
||||
kitchenUnit?: KitchenUnit | null;
|
||||
packKind?: PackKind | null;
|
||||
packSize?: number | null;
|
||||
};
|
||||
type Hit = Picked & { kinds: number; parentId: string | null; own: boolean };
|
||||
|
||||
// Zutat suchen und wählen (26.11.38): Ein Oberbegriff („Pasta“) steht oben als
|
||||
// „beliebige Sorte“, seine Sorten eingerückt darunter. Findet die Suche nichts
|
||||
// Passendes, legt, wer Gerichte pflegt, eine eigene Zutat für den Haushalt an.
|
||||
export function IngredientPicker({ value, onPick, canCreate = false }: { value: Picked | null; onPick: (p: Picked) => void; canCreate?: boolean }) {
|
||||
const t = useTranslations("dishes.form");
|
||||
const ti = useTranslations("ingredients");
|
||||
const id = useId();
|
||||
const [query, setQuery] = useState(value?.name ?? "");
|
||||
const [hits, setHits] = useState<Hit[]>([]);
|
||||
const [open, setOpen] = useState(false);
|
||||
const [creating, setCreating] = useState(false);
|
||||
// Für welche Eingabe die Treffer gelten — „anlegen“ erst, wenn die Suche geantwortet hat.
|
||||
const [answered, setAnswered] = useState("");
|
||||
const timer = useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (!open || !query.trim() || query === value?.name) {
|
||||
setHits([]);
|
||||
return;
|
||||
}
|
||||
if (timer.current) clearTimeout(timer.current);
|
||||
timer.current = setTimeout(async () => {
|
||||
const res = await fetch(`/api/ingredients?q=${encodeURIComponent(query)}`);
|
||||
if (res.ok) {
|
||||
setHits(await res.json());
|
||||
setAnswered(query);
|
||||
}
|
||||
}, 150);
|
||||
}, [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 });
|
||||
setQuery(h.name);
|
||||
setOpen(false);
|
||||
setCreating(false);
|
||||
};
|
||||
const groupIds = new Set(hits.filter((h) => h.group).map((h) => h.id));
|
||||
const exact = hits.some((h) => normalize(h.name) === normalize(query));
|
||||
const offerCreate = canCreate && query.trim().length >= 2 && !exact && answered === query;
|
||||
|
||||
return (
|
||||
<div className="relative flex-1">
|
||||
<Input
|
||||
id={id}
|
||||
role="combobox"
|
||||
aria-expanded={open && hits.length > 0}
|
||||
aria-controls={`${id}-list`}
|
||||
aria-autocomplete="list"
|
||||
aria-label={t("searchIngredient")}
|
||||
placeholder={t("searchIngredient")}
|
||||
value={query}
|
||||
autoComplete="off"
|
||||
onFocus={() => setOpen(true)}
|
||||
onChange={(e) => {
|
||||
setQuery(e.target.value);
|
||||
setOpen(true);
|
||||
setCreating(false);
|
||||
}}
|
||||
/>
|
||||
{open && query.trim() && query !== value?.name && !creating ? (
|
||||
<ul id={`${id}-list`} role="listbox" className="absolute inset-x-0 top-full z-20 mt-1 max-h-96 overflow-y-auto rounded-xl border border-border bg-card shadow-lg">
|
||||
{hits.map((h) => {
|
||||
const member = !!h.parentId && groupIds.has(h.parentId);
|
||||
return (
|
||||
<li key={h.id} role="option" aria-selected={value?.id === h.id}>
|
||||
<button
|
||||
type="button"
|
||||
className={cn("flex min-h-11 w-full items-center justify-between gap-2 px-4 text-left hover:bg-muted", member && "pl-8", h.group && "font-semibold")}
|
||||
onClick={() => pick(h)}
|
||||
>
|
||||
<span>
|
||||
{h.name}
|
||||
{h.group ? <span className="font-normal text-muted-foreground"> · {ti("anyKind")}</span> : null}
|
||||
</span>
|
||||
{h.group ? (
|
||||
<span className="text-xs font-normal text-muted-foreground">{ti("kinds", { n: h.kinds })}</span>
|
||||
) : h.own ? (
|
||||
<span className="text-xs text-muted-foreground">{ti("ownBadge")}</span>
|
||||
) : null}
|
||||
</button>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
{!hits.length && !offerCreate ? <li className="px-4 py-3 text-sm text-muted-foreground">{t("noHits")}</li> : null}
|
||||
{offerCreate ? (
|
||||
<li role="option" aria-selected={false} className="border-t border-border">
|
||||
<button type="button" className="flex min-h-11 w-full items-center gap-2 px-4 text-left font-semibold text-accent hover:bg-muted" onClick={() => setCreating(true)}>
|
||||
<Plus aria-hidden className="size-4" />
|
||||
{ti("create", { name: query.trim() })}
|
||||
</button>
|
||||
</li>
|
||||
) : null}
|
||||
</ul>
|
||||
) : null}
|
||||
{creating ? <CreateIngredient name={query.trim()} onCancel={() => setCreating(false)} onCreated={pick} /> : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function CreateIngredient({ name: initial, onCancel, onCreated }: { name: string; onCancel: () => void; onCreated: (p: Picked) => void }) {
|
||||
const t = useTranslations("ingredients");
|
||||
const id = useId();
|
||||
const [name, setName] = useState(initial);
|
||||
const [unit, setUnit] = useState<BaseUnit>("g");
|
||||
const [groups, setGroups] = useState<Hit[]>([]);
|
||||
const [parentId, setParentId] = useState("");
|
||||
const [category, setCategory] = useState<string>("pasta_rice");
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [error, setError] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
void fetch("/api/ingredients")
|
||||
.then((r) => (r.ok ? r.json() : []))
|
||||
.then(setGroups)
|
||||
.catch(() => undefined);
|
||||
}, []);
|
||||
|
||||
async function save() {
|
||||
setBusy(true);
|
||||
setError(false);
|
||||
const res = await fetch("/api/ingredients", {
|
||||
method: "POST",
|
||||
headers: { "content-type": "application/json" },
|
||||
body: JSON.stringify({ name, unit, parentId: parentId || null, category }),
|
||||
}).catch(() => null);
|
||||
setBusy(false);
|
||||
if (!res?.ok) return setError(true);
|
||||
onCreated(await res.json());
|
||||
}
|
||||
|
||||
return (
|
||||
<div role="group" aria-label={t("title")} className="mt-2 flex flex-col gap-3 rounded-2xl border border-border bg-card p-4">
|
||||
<p className="font-semibold">{t("title")}</p>
|
||||
<div className="flex flex-col gap-1">
|
||||
<Label htmlFor={`${id}-name`}>{t("name")}</Label>
|
||||
<Input id={`${id}-name`} value={name} maxLength={60} onChange={(e) => setName(e.target.value)} />
|
||||
</div>
|
||||
<div className="grid grid-cols-[6.5rem_minmax(0,1fr)] gap-3">
|
||||
<div className="flex flex-col gap-1">
|
||||
<Label htmlFor={`${id}-unit`}>{t("unit")}</Label>
|
||||
<select id={`${id}-unit`} value={unit} onChange={(e) => setUnit(e.target.value as BaseUnit)} className="min-h-11 rounded-xl border border-border bg-background px-3">
|
||||
<option value="g">g</option>
|
||||
<option value="ml">ml</option>
|
||||
<option value="piece">Stück</option>
|
||||
</select>
|
||||
</div>
|
||||
<div className="flex flex-col gap-1">
|
||||
<Label htmlFor={`${id}-group`}>{t("group")}</Label>
|
||||
<select id={`${id}-group`} value={parentId} onChange={(e) => setParentId(e.target.value)} className="min-h-11 rounded-xl border border-border bg-background px-3">
|
||||
<option value="">{t("noGroup")}</option>
|
||||
{groups.map((g) => (
|
||||
<option key={g.id} value={g.id}>
|
||||
{g.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{!parentId ? (
|
||||
<div className="flex flex-col gap-1">
|
||||
<Label htmlFor={`${id}-category`}>{t("category")}</Label>
|
||||
<select id={`${id}-category`} value={category} onChange={(e) => setCategory(e.target.value)} className="min-h-11 rounded-xl border border-border bg-background px-3">
|
||||
{CATEGORIES.map((c) => (
|
||||
<option key={c} value={c}>
|
||||
{t(`categories.${c}`)}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
) : null}
|
||||
{error ? <ErrorNotice>{t("error")}</ErrorNotice> : null}
|
||||
<div className="flex gap-2">
|
||||
<Button type="button" disabled={busy || !name.trim()} onClick={save}>
|
||||
{t("save")}
|
||||
</Button>
|
||||
<Button type="button" variant="ghost" onClick={onCancel}>
|
||||
{t("cancel")}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
"use client";
|
||||
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useId, useState } from "react";
|
||||
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";
|
||||
|
||||
// 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.
|
||||
export function PackSize({
|
||||
ingredient,
|
||||
kind,
|
||||
sizeText,
|
||||
onSaved,
|
||||
}: {
|
||||
ingredient: { id: string; unit: BaseUnit; packSize?: number | null };
|
||||
kind: PackKind;
|
||||
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 [busy, setBusy] = useState(false);
|
||||
const [error, setError] = useState(false);
|
||||
const unit = t(`units.${kind}`);
|
||||
|
||||
async function save() {
|
||||
const size = parseNumber(value);
|
||||
if (!size || size <= 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 }),
|
||||
}).catch(() => null);
|
||||
setBusy(false);
|
||||
if (!res?.ok) return setError(true);
|
||||
onSaved((await res.json()).size);
|
||||
setOpen(false);
|
||||
}
|
||||
|
||||
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>
|
||||
<Button type="button" variant="ghost" className="min-h-11" onClick={() => setOpen(true)}>
|
||||
{t("packChange")}
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
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}`) })}
|
||||
</Label>
|
||||
<div className="flex gap-2">
|
||||
<Input id={id} inputMode="decimal" value={value} onChange={(e) => setValue(e.target.value)} className="flex-1" />
|
||||
<Button type="button" disabled={busy} onClick={save}>
|
||||
{t("packSave")}
|
||||
</Button>
|
||||
</div>
|
||||
<p className="text-xs text-muted-foreground">{t("packHint")}</p>
|
||||
{error ? <ErrorNotice>{t("packError")}</ErrorNotice> : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,12 +1,13 @@
|
||||
"use client";
|
||||
|
||||
import { Minus, Plus, Timer } from "lucide-react";
|
||||
import { useLocale, useTranslations } from "next-intl";
|
||||
import { useTranslations } from "next-intl";
|
||||
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 { formatQuantity, scale, type BaseUnit } from "@/lib/units";
|
||||
import { scale, type BaseUnit, type KitchenUnit } from "@/lib/units";
|
||||
import { useKitchenAmount } from "@/lib/use-kitchen-amount";
|
||||
|
||||
type Ingredient = {
|
||||
ingredientId: string;
|
||||
@@ -17,6 +18,8 @@ type Ingredient = {
|
||||
note: string | null;
|
||||
isStaple: boolean;
|
||||
product?: { name: string } | null;
|
||||
displayUnit?: KitchenUnit | null;
|
||||
packSize?: number | null;
|
||||
};
|
||||
type Step = { section: Section; text: string; timerSeconds: number | null; ingredientIds: string[]; timerFrom?: string };
|
||||
|
||||
@@ -24,14 +27,11 @@ type Step = { section: Section; text: string; timerSeconds: number | null; ingre
|
||||
// rechnet lib/units.ts — gespeichert ist immer „pro Portion“.
|
||||
export function PortionScaler({ ingredients, steps, initialPortions }: { ingredients: Ingredient[]; steps: Step[]; initialPortions: number }) {
|
||||
const t = useTranslations("dishes.detail");
|
||||
const locale = useLocale();
|
||||
const kitchen = useKitchenAmount();
|
||||
const [portions, setPortions] = useState(initialPortions);
|
||||
const ts = useTranslations("dishes.sections");
|
||||
const byId = new Map(ingredients.map((i) => [i.ingredientId, i]));
|
||||
const amountOf = (i: Ingredient) => {
|
||||
const f = formatQuantity(scale(i.qtyPerPortion, portions), i.unit, locale);
|
||||
return `${f.amount}${f.unit ? ` ${f.unit}` : ""} ${labelFor(i, scale(i.qtyPerPortion, portions))}`;
|
||||
};
|
||||
const amountOf = (i: Ingredient) => `${kitchen.text(i, scale(i.qtyPerPortion, portions))} ${labelFor(i, scale(i.qtyPerPortion, portions))}`;
|
||||
// Durchgehend nummeriert, gegliedert nach Abschnitten (lib/recipe-style.ts).
|
||||
const numbered = steps.map((s, n) => ({ ...s, n: n + 1 }));
|
||||
|
||||
@@ -54,14 +54,12 @@ export function PortionScaler({ ingredients, steps, initialPortions }: { ingredi
|
||||
</div>
|
||||
<ul className="flex flex-col divide-y divide-border">
|
||||
{ingredients.map((i) => {
|
||||
const f = formatQuantity(scale(i.qtyPerPortion, portions), i.unit, locale);
|
||||
const f = kitchen.parts(i, scale(i.qtyPerPortion, portions));
|
||||
return (
|
||||
<li key={i.ingredientId} className="flex min-h-11 items-baseline gap-3 py-2">
|
||||
<span className="w-20 shrink-0 text-right font-semibold tabular-nums">
|
||||
{f.amount}
|
||||
{f.unit ? ` ${f.unit}` : ""}
|
||||
</span>
|
||||
<span className="w-20 shrink-0 text-right font-semibold tabular-nums">{f.main}</span>
|
||||
<span className="flex-1">
|
||||
{f.extra ? <span className="text-muted-foreground tabular-nums">({f.extra}) </span> : null}
|
||||
{labelFor(i, scale(i.qtyPerPortion, portions))}
|
||||
{i.note ? <span className="text-muted-foreground">, {i.note}</span> : null}
|
||||
{i.product ? <span className="block text-sm text-muted-foreground">{i.product.name}</span> : null}
|
||||
@@ -80,11 +78,11 @@ export function PortionScaler({ ingredients, steps, initialPortions }: { ingredi
|
||||
if (!list.length) return null;
|
||||
return (
|
||||
<div key={section} className="flex flex-col gap-3">
|
||||
<h3 className="font-serif text-xl">{ts(section)}</h3>
|
||||
<h3 className="font-semibold text-xl">{ts(section)}</h3>
|
||||
<ol className="flex flex-col gap-4">
|
||||
{list.map((s) => (
|
||||
<li key={s.n} className="flex gap-3">
|
||||
<span aria-hidden className="flex size-8 shrink-0 items-center justify-center rounded-full bg-secondary font-serif text-lg">
|
||||
<span aria-hidden className="flex size-8 shrink-0 items-center justify-center rounded-full bg-secondary font-semibold text-lg">
|
||||
{s.n}
|
||||
</span>
|
||||
<div className="flex min-w-0 flex-col gap-1 pt-1">
|
||||
|
||||
@@ -52,7 +52,7 @@ export function StarterPicker({ starters }: { starters: Starter[] }) {
|
||||
{on || s.inPool ? <Check className="size-4" strokeWidth={2.5} /> : null}
|
||||
</span>
|
||||
<span className="flex flex-1 flex-col">
|
||||
<span className="font-serif text-lg leading-snug">{s.title}</span>
|
||||
<span className="font-semibold text-lg leading-snug">{s.title}</span>
|
||||
<span className="text-xs text-muted-foreground">{s.inPool ? t("starters.inPool") : s.meta}</span>
|
||||
</span>
|
||||
</button>
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
"use client";
|
||||
|
||||
import { ImagePlus } from "lucide-react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useState } from "react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import { ErrorNotice } from "@/components/ui/notice";
|
||||
|
||||
// Widmung pflegen (nur Admin): Name, ein paar Sätze, ein Foto. Das Foto bleibt auf
|
||||
// der Box (/app/data), nicht im Code (Kai, 7.11.2026).
|
||||
export function DedicationForm({ name, text, hasPhoto }: { name: string; text: string; hasPhoto: boolean }) {
|
||||
const t = useTranslations("more.dedication");
|
||||
const router = useRouter();
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [error, setError] = useState(false);
|
||||
const [saved, setSaved] = useState(false);
|
||||
const [file, setFile] = useState<string | null>(null);
|
||||
|
||||
async function send(form: FormData) {
|
||||
setBusy(true);
|
||||
setError(false);
|
||||
setSaved(false);
|
||||
const res = await fetch("/api/household/dedication", { method: "PUT", body: form }).catch(() => null);
|
||||
setBusy(false);
|
||||
if (!res?.ok) return setError(true);
|
||||
setSaved(true);
|
||||
setFile(null);
|
||||
router.refresh();
|
||||
}
|
||||
|
||||
return (
|
||||
<form
|
||||
className="flex flex-col gap-3 rounded-2xl border border-border p-4"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
void send(new FormData(e.currentTarget));
|
||||
}}
|
||||
>
|
||||
<h3 className="font-semibold">{t("edit")}</h3>
|
||||
<div className="flex flex-col gap-2">
|
||||
<Label htmlFor="dedication-name">{t("name")}</Label>
|
||||
<Input id="dedication-name" name="name" maxLength={40} defaultValue={name} placeholder="Maike" />
|
||||
</div>
|
||||
<div className="flex flex-col gap-2">
|
||||
<Label htmlFor="dedication-text">{t("text")}</Label>
|
||||
<textarea
|
||||
id="dedication-text"
|
||||
name="text"
|
||||
maxLength={800}
|
||||
rows={4}
|
||||
defaultValue={text}
|
||||
placeholder={t("textPlaceholder")}
|
||||
className="rounded-xl border border-border bg-background px-3 py-2 text-base"
|
||||
/>
|
||||
</div>
|
||||
<div className="flex flex-col gap-2">
|
||||
{/* Eigener Knopf statt des Dateifelds: das zeigte die Beschriftung des Browsers („Choose File“). */}
|
||||
<input
|
||||
id="dedication-photo"
|
||||
name="photo"
|
||||
type="file"
|
||||
accept="image/jpeg,image/png,image/webp,image/heic,image/heif"
|
||||
className="peer sr-only"
|
||||
onChange={(e) => setFile(e.target.files?.[0]?.name ?? null)}
|
||||
/>
|
||||
<Label
|
||||
htmlFor="dedication-photo"
|
||||
className="inline-flex min-h-11 cursor-pointer items-center gap-2 self-start rounded-full border border-border px-5 font-semibold peer-focus-visible:ring-2 peer-focus-visible:ring-ring"
|
||||
>
|
||||
<ImagePlus aria-hidden className="size-5" />
|
||||
{hasPhoto ? t("newPhoto") : t("photo")}
|
||||
</Label>
|
||||
{file ? <p className="text-sm">{t("chosen", { name: file })}</p> : null}
|
||||
<p className="text-sm text-muted-foreground">{t("photoHint")}</p>
|
||||
</div>
|
||||
{error ? <ErrorNotice>{t("error")}</ErrorNotice> : null}
|
||||
{saved ? (
|
||||
<p role="status" className="text-sm">
|
||||
{t("saved")}
|
||||
</p>
|
||||
) : null}
|
||||
<div className="flex flex-wrap gap-2">
|
||||
<Button type="submit" disabled={busy}>
|
||||
{t("save")}
|
||||
</Button>
|
||||
{hasPhoto ? (
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
disabled={busy}
|
||||
onClick={() => {
|
||||
const form = new FormData();
|
||||
form.set("name", name);
|
||||
form.set("text", text);
|
||||
form.set("removePhoto", "1");
|
||||
void send(form);
|
||||
}}
|
||||
>
|
||||
{t("removePhoto")}
|
||||
</Button>
|
||||
) : null}
|
||||
</div>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
@@ -122,7 +122,7 @@ export function PlanBoard({
|
||||
|
||||
const reasonText = (r: Reason | null) => {
|
||||
if (!r) return null;
|
||||
return r.k === "wish" ? t("reason.wish", { names: r.n.join(", ") }) : t(`reason.${r.k}`);
|
||||
return r.k === "wish" || r.k === "mine" ? t(`reason.${r.k}`, { names: r.n.join(", ") }) : t(`reason.${r.k}`);
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -269,7 +269,7 @@ function SlotCard({
|
||||
</div>
|
||||
<div className="flex min-w-0 flex-1 flex-col gap-0.5">
|
||||
<p className="text-xs text-muted-foreground">{t("slot", { n: index + 1 })}</p>
|
||||
<h2 className="font-serif text-xl leading-snug">{slot.title ?? t("empty")}</h2>
|
||||
<h2 className="font-semibold text-xl leading-snug">{slot.title ?? t("empty")}</h2>
|
||||
{reason ? <p className="text-sm text-muted-foreground">{reason}</p> : null}
|
||||
{cost ? (
|
||||
<p className="flex flex-wrap items-center gap-2 text-sm text-muted-foreground">
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
"use client";
|
||||
|
||||
import { Check, Trash2 } from "lucide-react";
|
||||
import { AlertTriangle, Check, ChevronRight, Trash2, Undo2 } from "lucide-react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useLocale, useTranslations } from "next-intl";
|
||||
import { useState } from "react";
|
||||
import { useRef, useState } from "react";
|
||||
import { IngredientPicker, type Picked } from "@/components/dishes/dish-form";
|
||||
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 { pricePer, unitPrice } from "@/lib/receipt-read";
|
||||
import { parseNumber } from "@/lib/units";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
@@ -24,15 +25,23 @@ type Line = {
|
||||
packUnit: string | null;
|
||||
source: string | null;
|
||||
product: string | null;
|
||||
weighed: boolean;
|
||||
skipped: boolean;
|
||||
};
|
||||
type Receipt = { id: string; status: string; storeId: string | null; purchasedAt: string | null; lines: Line[]; stores: { id: string; name: string }[] };
|
||||
type Row = { line: Line; ingredient: Picked | null; pack: string; other: boolean };
|
||||
// open: Zutatenwahl offen, obwohl noch keine Zutat gewählt ist.
|
||||
type Row = { line: Line; ingredient: Picked | null; pack: string; skip: boolean; open: boolean };
|
||||
|
||||
const fmt = (n: number | null) => (n === null ? "" : String(Math.round(n * 1000) / 1000).replace(".", ","));
|
||||
|
||||
/** Vorgabe für die Packung: Stück 1, gewogene Ware 1000 (Preis je kg vom Bon). */
|
||||
const packFor = (line: Line, unit: Picked["unit"] | undefined) => (unit === "piece" ? "1" : line.weighed && unit ? "1000" : "");
|
||||
|
||||
// Bon bestätigen (Konzept: „erst gelernte Zuordnungen, dann KI-Vorschlag, dann
|
||||
// Bestätigung“). Je Zeile: Zutat und Packung prüfen, eine andere wählen oder
|
||||
// „Sonstiges“. Erst „Übernehmen“ schreibt ins Preisgedächtnis und lernt.
|
||||
// Bestätigung“). Oben, was zum Kochen zählt: Zutat und Packung prüfen, darunter der
|
||||
// Preis je 100 g, den Lunch sich merkt. Was nicht zum Kochen zählt (Toastbrot,
|
||||
// Klopapier), wischt man nach links oder tippt „Nicht zum Kochen“ — es wandert
|
||||
// zugeklappt ans Ende, Lunch merkt es sich für den nächsten Bon (26.11.33).
|
||||
export function ReceiptReview({ receipt }: { receipt: Receipt }) {
|
||||
const t = useTranslations("receipts");
|
||||
const locale = useLocale();
|
||||
@@ -40,18 +49,32 @@ export function ReceiptReview({ receipt }: { receipt: Receipt }) {
|
||||
const money = new Intl.NumberFormat(locale, { style: "currency", currency: "EUR" });
|
||||
const done = receipt.status === "done";
|
||||
const [rows, setRows] = useState<Row[]>(
|
||||
receipt.lines.map((l) => ({
|
||||
line: l,
|
||||
ingredient: l.ingredientId ? { id: l.ingredientId, name: l.ingredientName ?? "", unit: (l.ingredientUnit ?? "g") as Picked["unit"] } : null,
|
||||
pack: fmt(l.packQty),
|
||||
other: !l.ingredientId,
|
||||
})),
|
||||
receipt.lines.map((l) => {
|
||||
const unit = (l.ingredientUnit ?? undefined) as Picked["unit"] | undefined;
|
||||
return {
|
||||
line: l,
|
||||
ingredient: l.ingredientId ? { id: l.ingredientId, name: l.ingredientName ?? "", unit: unit ?? "g" } : null,
|
||||
pack: l.packQty !== null ? fmt(l.packQty) : packFor(l, unit),
|
||||
skip: l.skipped,
|
||||
open: false,
|
||||
};
|
||||
}),
|
||||
);
|
||||
const [storeId, setStoreId] = useState(receipt.storeId ?? "");
|
||||
const [date, setDate] = useState(receipt.purchasedAt ?? "");
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [error, setError] = useState(false);
|
||||
const update = (i: number, patch: Partial<Row>) => setRows((rs) => rs.map((r, n) => (n === i ? { ...r, ...patch } : r)));
|
||||
const [lastSkipped, setLastSkipped] = useState<string | null>(null);
|
||||
const touch = useRef<{ id: string; x: number; y: number } | null>(null);
|
||||
const update = (id: string, patch: Partial<Row>) => setRows((rs) => rs.map((r) => (r.line.id === id ? { ...r, ...patch } : r)));
|
||||
const skip = (id: string) => {
|
||||
update(id, { skip: true });
|
||||
setLastSkipped(id);
|
||||
};
|
||||
const unskip = (id: string) => {
|
||||
update(id, { skip: false });
|
||||
setLastSkipped(null);
|
||||
};
|
||||
|
||||
async function save() {
|
||||
setBusy(true);
|
||||
@@ -64,9 +87,10 @@ export function ReceiptReview({ receipt }: { receipt: Receipt }) {
|
||||
purchasedAt: date || null,
|
||||
decisions: rows.map((r) => ({
|
||||
lineId: r.line.id,
|
||||
ingredientId: r.other ? null : (r.ingredient?.id ?? null),
|
||||
packQty: r.other || !r.pack.trim() ? null : parseNumber(r.pack),
|
||||
packUnit: r.other || !r.ingredient ? null : r.ingredient.unit,
|
||||
skip: r.skip,
|
||||
ingredientId: r.skip ? null : (r.ingredient?.id ?? null),
|
||||
packQty: r.skip || !r.ingredient || !r.pack.trim() ? null : parseNumber(r.pack),
|
||||
packUnit: r.skip || !r.ingredient ? null : r.ingredient.unit,
|
||||
})),
|
||||
}),
|
||||
}).catch(() => null);
|
||||
@@ -83,6 +107,34 @@ export function ReceiptReview({ receipt }: { receipt: Receipt }) {
|
||||
router.refresh();
|
||||
}
|
||||
|
||||
const cooking = rows.filter((r) => !r.skip);
|
||||
const skipped = rows.filter((r) => r.skip);
|
||||
const undoRow = lastSkipped ? rows.find((r) => r.line.id === lastSkipped && r.skip) : undefined;
|
||||
|
||||
/** „= 2,20 € je 100 g · 800 g für 17,58 €“ oder die Warnung ohne Packung. */
|
||||
function priceNote(r: Row) {
|
||||
if (!r.ingredient || r.line.totalPrice === null) return null;
|
||||
const pack = r.pack.trim() ? parseNumber(r.pack) : null;
|
||||
const per = unitPrice(r.line.totalPrice, r.line.qty, pack);
|
||||
if (per === null) {
|
||||
return (
|
||||
<p className="flex items-start gap-2 text-sm">
|
||||
<AlertTriangle aria-hidden className="mt-0.5 size-4 shrink-0 text-accent" />
|
||||
{t("noPackWarning")}
|
||||
</p>
|
||||
);
|
||||
}
|
||||
const shown = pricePer(per, r.ingredient.unit);
|
||||
const amount = (r.line.qty && r.line.qty > 0 ? r.line.qty : 1) * (pack ?? 0);
|
||||
const many = (r.line.qty ?? 1) !== 1;
|
||||
return (
|
||||
<p className="text-sm text-muted-foreground" data-testid="unit-price">
|
||||
{t("perPrice", { price: money.format(shown.price), per: t(`per.${shown.per}`) })}
|
||||
{many ? ` · ${t("perDetail", { amount: fmt(amount), unit: t(`units.${r.ingredient.unit}`), total: money.format(r.line.totalPrice) })}` : ""}
|
||||
</p>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-5">
|
||||
<div className="grid grid-cols-2 gap-3">
|
||||
@@ -109,61 +161,122 @@ export function ReceiptReview({ receipt }: { receipt: Receipt }) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul className="flex flex-col gap-3">
|
||||
{rows.map((r, i) => (
|
||||
<li key={r.line.id} className={cn("flex flex-col gap-2 rounded-2xl p-3", r.other ? "border border-border" : "bg-muted")}>
|
||||
<div className="flex items-baseline justify-between gap-3">
|
||||
<span className="font-mono text-sm">
|
||||
{r.line.qty && r.line.qty !== 1 ? `${fmt(r.line.qty)} × ` : ""}
|
||||
{r.line.text}
|
||||
</span>
|
||||
<span className="shrink-0 tabular-nums">{r.line.totalPrice !== null ? money.format(r.line.totalPrice) : "–"}</span>
|
||||
</div>
|
||||
{r.other ? (
|
||||
<div className="flex items-center justify-between gap-2">
|
||||
<span className="text-sm text-muted-foreground">{t("otherLine")}</span>
|
||||
{!done ? (
|
||||
<Button type="button" variant="ghost" onClick={() => update(i, { other: false })}>
|
||||
{t("assign")}
|
||||
</Button>
|
||||
) : null}
|
||||
{!done && cooking.length ? <p className="text-sm text-muted-foreground">{t("swipeHint")}</p> : null}
|
||||
|
||||
<ul className="flex flex-col gap-3" aria-label={t("forCooking")}>
|
||||
{cooking.map((r) => {
|
||||
const id = r.line.id;
|
||||
const many = r.line.qty !== null && Number.isInteger(r.line.qty) && r.line.qty > 1;
|
||||
return (
|
||||
<li
|
||||
key={id}
|
||||
className={cn("flex flex-col gap-2 rounded-2xl p-3", r.ingredient ? "bg-muted" : "border border-border")}
|
||||
onTouchStart={(e) => {
|
||||
const p = e.touches[0];
|
||||
touch.current = p && !done ? { id, x: p.clientX, y: p.clientY } : null;
|
||||
}}
|
||||
onTouchEnd={(e) => {
|
||||
const start = touch.current;
|
||||
const end = e.changedTouches[0];
|
||||
touch.current = null;
|
||||
if (!start || !end || start.id !== id) return;
|
||||
const dx = end.clientX - start.x;
|
||||
if (dx < -80 && Math.abs(dx) > Math.abs(end.clientY - start.y)) skip(id); // nach links: nicht zum Kochen
|
||||
}}
|
||||
>
|
||||
<div className="flex items-baseline justify-between gap-3">
|
||||
<span className="font-mono text-sm">
|
||||
{r.line.qty && r.line.qty !== 1 ? `${fmt(r.line.qty)}${r.line.weighed ? " kg" : ""} × ` : ""}
|
||||
{r.line.text}
|
||||
</span>
|
||||
<span className="shrink-0 tabular-nums">{r.line.totalPrice !== null ? money.format(r.line.totalPrice) : "–"}</span>
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
{r.line.source && r.ingredient?.id === r.line.ingredientId ? (
|
||||
<p className="text-xs text-muted-foreground">{t(`source.${r.line.source}`, { product: r.line.product ?? "" })}</p>
|
||||
) : null}
|
||||
{done ? (
|
||||
<p>{r.ingredient?.name}</p>
|
||||
) : (
|
||||
<IngredientPicker value={r.ingredient} onPick={(p) => update(i, { ingredient: p, pack: p.unit === "piece" ? "1" : "" })} />
|
||||
)}
|
||||
<div className="flex items-end gap-2">
|
||||
<div className="flex flex-col gap-1">
|
||||
<Label htmlFor={`pack-${r.line.id}`} className="text-sm">
|
||||
{t("pack", { unit: t(`units.${r.ingredient?.unit ?? "g"}`) })}
|
||||
</Label>
|
||||
<Input
|
||||
id={`pack-${r.line.id}`}
|
||||
inputMode="decimal"
|
||||
className="w-32"
|
||||
disabled={done}
|
||||
value={r.pack}
|
||||
onChange={(e) => update(i, { pack: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
{!r.ingredient && !r.open ? (
|
||||
<div className="flex flex-wrap items-center justify-between gap-2">
|
||||
<span className="text-sm text-muted-foreground">{t("noIngredient")}</span>
|
||||
{!done ? (
|
||||
<Button type="button" variant="ghost" className="ml-auto" onClick={() => update(i, { other: true })}>
|
||||
{t("other")}
|
||||
</Button>
|
||||
<span className="flex gap-1">
|
||||
<Button type="button" variant="ghost" className="px-3" onClick={() => update(id, { open: true })}>
|
||||
{t("assign")}
|
||||
</Button>
|
||||
<Button type="button" variant="ghost" className="px-3" onClick={() => skip(id)}>
|
||||
{t("notCooking")}
|
||||
</Button>
|
||||
</span>
|
||||
) : null}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</li>
|
||||
))}
|
||||
) : (
|
||||
<>
|
||||
{r.line.source && r.line.source !== "skip" && r.ingredient?.id === r.line.ingredientId ? (
|
||||
<p className="text-xs text-muted-foreground">{t(`source.${r.line.source}`, { product: r.line.product ?? "" })}</p>
|
||||
) : null}
|
||||
{done ? (
|
||||
<p>{r.ingredient?.name}</p>
|
||||
) : (
|
||||
<IngredientPicker value={r.ingredient} onPick={(p) => update(id, { ingredient: p, pack: packFor(r.line, p.unit) })} />
|
||||
)}
|
||||
{r.ingredient ? (
|
||||
<div className="flex items-end gap-2">
|
||||
<div className="flex flex-col gap-1">
|
||||
<Label htmlFor={`pack-${id}`} className="text-sm">
|
||||
{t(many ? "packEach" : "pack", { unit: t(`units.${r.ingredient.unit}`) })}
|
||||
</Label>
|
||||
<Input id={`pack-${id}`} inputMode="decimal" className="w-32" disabled={done} value={r.pack} onChange={(e) => update(id, { pack: e.target.value })} />
|
||||
</div>
|
||||
{!done ? (
|
||||
<Button type="button" variant="ghost" className="ml-auto px-3" onClick={() => skip(id)}>
|
||||
{t("notCooking")}
|
||||
</Button>
|
||||
) : null}
|
||||
</div>
|
||||
) : !done ? (
|
||||
<Button type="button" variant="ghost" className="self-start px-3" onClick={() => skip(id)}>
|
||||
{t("notCooking")}
|
||||
</Button>
|
||||
) : null}
|
||||
{r.ingredient && r.line.weighed ? <p className="text-xs text-muted-foreground">{t("weighedHint")}</p> : null}
|
||||
{priceNote(r)}
|
||||
</>
|
||||
)}
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
|
||||
{undoRow ? (
|
||||
<p role="status" className="flex items-center justify-between gap-2 rounded-xl border border-border py-1 pl-4 pr-1 text-sm">
|
||||
<span className="min-w-0 truncate">{t("skippedOne", { text: undoRow.line.text })}</span>
|
||||
<Button type="button" variant="ghost" className="shrink-0 px-3" onClick={() => unskip(undoRow.line.id)}>
|
||||
<Undo2 aria-hidden />
|
||||
{t("undo")}
|
||||
</Button>
|
||||
</p>
|
||||
) : null}
|
||||
|
||||
{skipped.length ? (
|
||||
<details className="group rounded-2xl border border-border">
|
||||
<summary className="flex min-h-12 cursor-pointer list-none items-center justify-between gap-2 px-4 py-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">
|
||||
<span>{t("notCookingGroup", { n: skipped.length })}</span>
|
||||
<ChevronRight aria-hidden className="size-5 transition-transform group-open:rotate-90" />
|
||||
</summary>
|
||||
<ul className="flex flex-col divide-y divide-border border-t border-border">
|
||||
{skipped.map((r) => (
|
||||
<li key={r.line.id} className="flex min-h-12 items-center justify-between gap-3 py-1 pl-4 pr-1">
|
||||
<span className="min-w-0 font-mono text-sm">{r.line.text}</span>
|
||||
<span className="flex shrink-0 items-center gap-1">
|
||||
<span className="text-sm tabular-nums">{r.line.totalPrice !== null ? money.format(r.line.totalPrice) : "–"}</span>
|
||||
{!done ? (
|
||||
<Button type="button" variant="ghost" className="px-3" aria-label={t("assignLine", { text: r.line.text })} onClick={() => unskip(r.line.id)}>
|
||||
{t("assignShort")}
|
||||
</Button>
|
||||
) : null}
|
||||
</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</details>
|
||||
) : null}
|
||||
|
||||
{error ? <ErrorNotice>{t("saveError")}</ErrorNotice> : null}
|
||||
{done ? (
|
||||
<p className="text-sm text-muted-foreground">{t("doneText")}</p>
|
||||
|
||||
@@ -5,7 +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 { formatQuantity } from "@/lib/units";
|
||||
import { formatQuantity, type PackKind } from "@/lib/units";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export type Item = {
|
||||
@@ -16,6 +16,8 @@ export type Item = {
|
||||
unit: "g" | "ml" | "piece" | null;
|
||||
packCount: number | null;
|
||||
packSize: number | null;
|
||||
/** Gebinde („2 Dosen à 400 g“), seit 26.11.39. */
|
||||
packKind?: PackKind | null;
|
||||
dishes: string[];
|
||||
aislePosition: number | null;
|
||||
manual: boolean;
|
||||
@@ -46,6 +48,7 @@ function writeQueue(ops: Op[]) {
|
||||
// Warteschlange im Browser und gehen raus, sobald wieder Netz da ist.
|
||||
export function ShoppingList({ initial, aisles, me }: { initial: Item[]; aisles: Aisle[]; me: string }) {
|
||||
const t = useTranslations("shopping");
|
||||
const tm = useTranslations("measure");
|
||||
const locale = useLocale();
|
||||
const [items, setItems] = useState(initial);
|
||||
const [queue, setQueue] = useState<Op[]>([]);
|
||||
@@ -135,6 +138,7 @@ export function ShoppingList({ initial, aisles, me }: { initial: Item[]; aisles:
|
||||
if (i.unit === "piece") return t("pieces", { n: i.qty });
|
||||
if (i.packCount && i.packSize) {
|
||||
const f = formatQuantity(i.packSize, i.unit, locale);
|
||||
if (i.packKind) return t("packOf", { count: i.packCount, word: tm(i.packKind, { n: i.packCount }), size: `${f.amount} ${f.unit}` });
|
||||
return i.packCount > 1 ? `${i.packCount} × ${f.amount} ${f.unit}` : `${f.amount} ${f.unit}`;
|
||||
}
|
||||
const f = formatQuantity(i.qty, i.unit, locale);
|
||||
|
||||
@@ -61,12 +61,15 @@ export function SetupChecklist({ steps, finished }: { steps: SetupStep[]; finish
|
||||
{t(`${current.key}.cta`)}
|
||||
</Link>
|
||||
{current.key === "dishes" ? (
|
||||
<Link href="/gerichte/hinzufuegen" className={cn(buttonVariants({ variant: "outline" }))}>
|
||||
// Zweiter Weg leise, ohne eigene Fläche: In der Karte wirkt ein Rahmenknopf
|
||||
// (Seitenfläche auf Kartenfläche) im Dunkeln wie ein Loch (Kai, 7.11.2026).
|
||||
<Link href="/gerichte/hinzufuegen" className="flex min-h-11 items-center justify-center gap-1 rounded-xl font-semibold underline-offset-4 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">
|
||||
{t("dishes.moreLink")}
|
||||
<ChevronRight aria-hidden className="size-4" />
|
||||
</Link>
|
||||
) : null}
|
||||
{current.key === "family" ? (
|
||||
<Button type="button" variant="ghost" className="self-start" disabled={busy} onClick={() => act("skipFamily")}>
|
||||
<Button type="button" variant="ghost" className={cn("min-h-11", "self-start px-0 hover:bg-transparent hover:underline underline-offset-4")} disabled={busy} onClick={() => act("skipFamily")}>
|
||||
{t("family.skip")}
|
||||
</Button>
|
||||
) : null}
|
||||
@@ -97,7 +100,7 @@ export function SetupChecklist({ steps, finished }: { steps: SetupStep[]; finish
|
||||
</li>
|
||||
))}
|
||||
</ol>
|
||||
<Button type="button" variant="ghost" className="self-start text-sm" disabled={busy} onClick={() => act("hide")}>
|
||||
<Button type="button" variant="ghost" className={cn("text-sm text-muted-foreground", "self-start px-0 hover:bg-transparent hover:underline underline-offset-4")} disabled={busy} onClick={() => act("hide")}>
|
||||
{t("hide")}
|
||||
</Button>
|
||||
</section>
|
||||
|
||||
@@ -2,10 +2,13 @@ import { cn } from "@/lib/utils";
|
||||
|
||||
// TokenJar (Konzept, „Bausteine“): Jetons als Münzen. Volle Münze = noch frei.
|
||||
// Die Zahl steht immer daneben im Text — Farbe allein trägt nichts.
|
||||
// Mehr als fünf Münzen passen am Handy nicht in eine Zeile; dann trägt die Zahl allein.
|
||||
const MAX_COINS = 5;
|
||||
|
||||
export function TokenJar({ total, left, label, className }: { total: number; left: number; label: string; className?: string }) {
|
||||
return (
|
||||
<span className={cn("inline-flex items-center gap-2", className)}>
|
||||
<span aria-hidden className="flex gap-1">
|
||||
<span aria-hidden className={cn("flex gap-1", total > MAX_COINS && "hidden")}>
|
||||
{Array.from({ length: total }, (_, i) => (
|
||||
<span
|
||||
key={i}
|
||||
@@ -16,7 +19,7 @@ export function TokenJar({ total, left, label, className }: { total: number; lef
|
||||
/>
|
||||
))}
|
||||
</span>
|
||||
<span className="text-sm font-semibold">{label}</span>
|
||||
{label ? <span className="text-sm font-semibold">{label}</span> : null}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { Check, Crown, Ellipsis, Shuffle, ThumbsDown } from "lucide-react";
|
||||
import { Check, Crown, Ellipsis, Heart, ShieldCheck, Shuffle, ThumbsDown } from "lucide-react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useMemo, useRef, useState } from "react";
|
||||
@@ -29,6 +29,7 @@ export type Entry = {
|
||||
wantsToCook: boolean;
|
||||
isVeto: boolean;
|
||||
viaVeto?: boolean;
|
||||
isMine?: boolean;
|
||||
};
|
||||
type Budget = { tokens: number; tokensLeft: number; vetos: number; vetosLeft: number };
|
||||
|
||||
@@ -54,7 +55,9 @@ function applyFilter(tiles: Tile[], filter: Filter): Tile[] {
|
||||
}
|
||||
|
||||
// Wünschen (Konzept, „Wünschen“): ein Tipp auf die Kachel ist der Wunsch; „…“
|
||||
// öffnet Grund, „Ich koche das“ und das Veto. Gezählt wird auf dem Server.
|
||||
// öffnet Grund, „Ich koche das“, „Mein Gericht“ und das Veto. Gezählt wird auf
|
||||
// dem Server. Wer ein Veto eingelegt hat, steht nur bei Erwachsenen da — für
|
||||
// Kinder und Jugendliche kommt der Name leer an (lib/wishes.ts, roundWishes).
|
||||
export function WishBoard({
|
||||
tiles,
|
||||
entries,
|
||||
@@ -82,9 +85,19 @@ export function WishBoard({
|
||||
for (const e of entries) map.set(e.dishId, [...(map.get(e.dishId) ?? []), e]);
|
||||
return map;
|
||||
}, [entries]);
|
||||
const mine = (id: string) => byDish.get(id)?.find((e) => e.memberId === me);
|
||||
// Gerade Gespeichertes (Grund, „Ich koche das“) gilt sofort — auch wenn das Blatt
|
||||
// wieder aufgeht, bevor die Seite neu geladen ist.
|
||||
const [edits, setEdits] = useState<Record<string, { note: string | null; wantsToCook: boolean }>>({});
|
||||
const mine = (id: string) => {
|
||||
const own = byDish.get(id)?.find((e) => e.memberId === me);
|
||||
return own && edits[id] ? { ...own, ...edits[id] } : own;
|
||||
};
|
||||
const wishers = (id: string) => (byDish.get(id) ?? []).filter((e) => !e.isVeto);
|
||||
const vetoes = (id: string) => (byDish.get(id) ?? []).filter((e) => e.isVeto);
|
||||
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") {
|
||||
@@ -95,9 +108,10 @@ export function WishBoard({
|
||||
const data = await res.json().catch(() => ({}));
|
||||
setBusy(null);
|
||||
if (!res.ok) {
|
||||
setError(["noTokens", "noVetos", "noRound", "noTrial", "dish", "alternative"].includes(data.error) ? data.error : "unknown");
|
||||
setError(["noTokens", "noVetos", "noRound", "noTrial", "dish", "alternative", "protected", "repeat", "notWished"].includes(data.error) ? data.error : "unknown");
|
||||
return null;
|
||||
}
|
||||
if (method !== "PATCH") setEdits(({ [key]: _, ...rest }) => rest); // neuer oder zurückgenommener Wunsch: Server gilt
|
||||
if (method === "POST" && "vibrate" in navigator) navigator.vibrate?.(15);
|
||||
router.refresh();
|
||||
return data;
|
||||
@@ -122,12 +136,19 @@ export function WishBoard({
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-4">
|
||||
<div className="sticky top-0 z-10 -mx-4 flex flex-wrap items-center gap-x-4 gap-y-2 border-b border-border bg-background px-4 py-3">
|
||||
<TokenJar total={budget.tokens} left={budget.tokensLeft} label={t("tokensLeft", { n: budget.tokensLeft })} />
|
||||
{canVeto && budget.vetos > 0 ? <span className="text-sm text-muted-foreground">{t("vetosLeft", { n: budget.vetosLeft })}</span> : null}
|
||||
<Button type="button" variant="outline" className="ml-auto" disabled={!!busy || budget.tokensLeft < 1} onClick={joker}>
|
||||
{/* Eine Zeile, auch am kleinen iPhone (Kai, 7.11.2026): Jetons, darunter klein das Veto,
|
||||
rechts der Joker kompakt — Zeichen und Wort, damit er ohne Raten verständlich bleibt. */}
|
||||
<div className="sticky top-0 z-10 -mx-4 flex items-center gap-3 border-b border-border bg-background px-4 py-3">
|
||||
<div className="flex min-w-0 flex-1 items-center gap-2">
|
||||
<TokenJar total={budget.tokens} left={budget.tokensLeft} label="" className="shrink-0" />
|
||||
<span className="flex min-w-0 flex-col leading-tight">
|
||||
<span className="text-sm font-semibold">{t("tokensLeft", { n: budget.tokensLeft })}</span>
|
||||
{canVeto && budget.vetos > 0 ? <span className="text-xs text-muted-foreground">{t("vetosLeft", { n: budget.vetosLeft })}</span> : null}
|
||||
</span>
|
||||
</div>
|
||||
<Button type="button" variant="outline" className="shrink-0 px-4" aria-label={t("joker")} disabled={!!busy || budget.tokensLeft < 1} onClick={joker}>
|
||||
<Shuffle aria-hidden />
|
||||
{t("joker")}
|
||||
{t("jokerShort")}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -148,6 +169,18 @@ export function WishBoard({
|
||||
))}
|
||||
</div>
|
||||
|
||||
{myDishTitle ? (
|
||||
<p className="flex items-center gap-2 text-sm">
|
||||
<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 ? (
|
||||
<p role="status" className="rounded-xl border border-border px-4 py-3 text-sm">
|
||||
@@ -160,7 +193,10 @@ export function WishBoard({
|
||||
{shown.map((tile) => {
|
||||
const own = mine(tile.id);
|
||||
const names = wishers(tile.id).map((e) => (e.memberId === me ? t("you") : e.memberName));
|
||||
const vetoNames = vetoes(tile.id).map((e) => (e.memberId === me ? t("you") : e.memberName));
|
||||
const vetoList = vetoes(tile.id);
|
||||
const vetoNames = vetoList.map((e) => (e.memberId === me ? t("you") : e.memberName));
|
||||
const mineNames = mineOf(tile.id).map((e) => (e.memberId === me ? t("you") : e.memberName));
|
||||
const isMyDish = mineOf(tile.id).some((e) => e.memberId === me);
|
||||
const favorite = wishers(tile.id).length >= 2;
|
||||
return (
|
||||
<li key={tile.id} className="relative">
|
||||
@@ -182,6 +218,12 @@ 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" />
|
||||
@@ -190,13 +232,14 @@ export function WishBoard({
|
||||
) : null}
|
||||
</span>
|
||||
<span className="flex min-h-11 flex-col gap-0.5 p-3 pr-12">
|
||||
<span className="font-serif text-lg leading-snug">{tile.title}</span>
|
||||
<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}
|
||||
{names.length ? <span className="text-xs text-muted-foreground">{t("wishedBy", { names: names.join(", ") })}</span> : null}
|
||||
{vetoNames.length ? (
|
||||
{vetoList.length && !mineNames.length ? (
|
||||
<span className="inline-flex items-center gap-1 text-xs text-muted-foreground">
|
||||
<ThumbsDown aria-hidden className="size-3" />
|
||||
{t("vetoBy", { names: vetoNames.join(", ") })}
|
||||
{vetoNames.every(Boolean) ? t("vetoBy", { names: vetoNames.join(", ") }) : t("vetoCount", { n: vetoList.length })}
|
||||
</span>
|
||||
) : null}
|
||||
</span>
|
||||
@@ -232,10 +275,20 @@ export function WishBoard({
|
||||
own={mine(open.id)}
|
||||
budget={budget}
|
||||
canVeto={canVeto}
|
||||
protectedDish={mineOf(open.id).length > 0}
|
||||
mine={mineOf(open.id).some((e) => e.memberId === me)}
|
||||
onMine={async (on) => {
|
||||
const ok = await call("POST", "/api/wishes/mine", { dishId: open.id, mine: on }, open.id);
|
||||
if (ok) dialog.current?.close();
|
||||
}}
|
||||
alternatives={tiles.filter((x) => !x.isTrial && x.id !== open.id && !(byDish.get(x.id) ?? []).length)}
|
||||
busy={!!busy}
|
||||
onCall={async (method, body) => {
|
||||
const ok = await call(method, "/api/wishes", body, open.id);
|
||||
if (ok && method === "PATCH") {
|
||||
const b = body as { note: string | null; wantsToCook: boolean };
|
||||
setEdits((e) => ({ ...e, [open.id]: { note: b.note, wantsToCook: b.wantsToCook } }));
|
||||
}
|
||||
if (ok) dialog.current?.close();
|
||||
}}
|
||||
onClose={() => dialog.current?.close()}
|
||||
@@ -251,6 +304,9 @@ function WishOptions({
|
||||
own,
|
||||
budget,
|
||||
canVeto,
|
||||
protectedDish,
|
||||
mine,
|
||||
onMine,
|
||||
alternatives,
|
||||
busy,
|
||||
onCall,
|
||||
@@ -260,6 +316,9 @@ function WishOptions({
|
||||
own: Entry | undefined;
|
||||
budget: Budget;
|
||||
canVeto: boolean;
|
||||
protectedDish: boolean;
|
||||
mine: boolean;
|
||||
onMine: (on: boolean) => Promise<void>;
|
||||
alternatives: Tile[];
|
||||
busy: boolean;
|
||||
onCall: (method: string, body: object) => Promise<void>;
|
||||
@@ -338,10 +397,24 @@ function WishOptions({
|
||||
{wished ? t("saveWish") : t("wishWithToken")}
|
||||
</Button>
|
||||
{wished && own?.viaVeto ? <p className="text-sm text-muted-foreground">{t("viaVetoHint")}</p> : null}
|
||||
{wished && !own?.viaVeto ? (
|
||||
<div className="flex flex-col gap-1">
|
||||
<Button type="button" variant={mine ? "outline" : "secondary"} disabled={busy} onClick={() => onMine(!mine)}>
|
||||
<Heart aria-hidden className={cn(mine && "fill-accent text-accent")} />
|
||||
{mine ? t("mineUnset") : t("mineSet")}
|
||||
</Button>
|
||||
<p className="text-sm text-muted-foreground">{t("mineExplain")}</p>
|
||||
</div>
|
||||
) : null}
|
||||
{wished ? (
|
||||
<Button type="button" variant="outline" disabled={busy} onClick={() => onCall("DELETE", { dishId: tile.id })}>
|
||||
{t("unwish")}
|
||||
</Button>
|
||||
) : protectedDish ? (
|
||||
<p className="flex items-start gap-2 text-sm text-muted-foreground">
|
||||
<ShieldCheck aria-hidden className="size-4 shrink-0" />
|
||||
{t("protected")}
|
||||
</p>
|
||||
) : canVeto && budget.vetos > 0 ? (
|
||||
<Button type="button" variant="outline" disabled={busy || budget.vetosLeft < 1} onClick={() => setPicking(true)}>
|
||||
<ThumbsDown aria-hidden />
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
-- „Mein Gericht“ (Kai und Mike, 7.11.2026): Gegen Geschwisterdynamik — jede
|
||||
-- Person, die mitisst, markiert je Runde einen ihrer Wünsche als ihr Gericht.
|
||||
-- Kein Veto streicht es, der Plan setzt es zuerst. Wer in der Vorrunde leer
|
||||
-- ausging, hat Vorrang; dasselbe Gericht höchstens jede zweite Runde
|
||||
-- (lib/wishes.ts, lib/suggest.ts).
|
||||
|
||||
alter table wishes add column is_mine boolean not null default false;
|
||||
alter table wishes add constraint wishes_mine_not_veto check (not (is_mine and (is_veto or veto_id is not null)));
|
||||
create unique index wishes_one_mine on wishes (round_id, member_id) where is_mine;
|
||||
@@ -0,0 +1,14 @@
|
||||
-- Bons: „Nicht zum Kochen“ und Gewichtsware (Kai, 7.11.2026, 26.11.33).
|
||||
-- Ein gelernter Bontext ohne Zutat heißt: Das kaufen wir, aber nicht zum Kochen
|
||||
-- (Toastbrot, Klopapier). Beim nächsten Bon landet er gleich unten. Gewogene Ware
|
||||
-- („0,416 kg x 2,79 €/kg“) trägt die Menge in kg; ihr Preis gilt je 1000 g.
|
||||
|
||||
alter table ingredient_aliases alter column ingredient_id drop not null;
|
||||
alter table ingredient_aliases add constraint ingredient_aliases_skip_no_pack
|
||||
check (ingredient_id is not null or (pack_qty is null and pack_unit is null));
|
||||
|
||||
alter table receipt_lines drop constraint if exists receipt_lines_match_source_check;
|
||||
alter table receipt_lines add constraint receipt_lines_match_source_check
|
||||
check (match_source in ('alias', 'product', 'search', 'ai', 'skip'));
|
||||
alter table receipt_lines add column weighed boolean not null default false;
|
||||
alter table receipt_lines add column skipped boolean not null default false;
|
||||
@@ -0,0 +1,8 @@
|
||||
-- foodplanhero by Maike (Kai, 7.11.2026, 26.11.35): Die App ist Maike gewidmet.
|
||||
-- Je Haushalt ein Name, ein Foto (unter /app/data/fotos, nicht im Code) und ein
|
||||
-- paar Sätze. Das Foto erscheint auf dem Startbild, beim Anmelden und unter
|
||||
-- „Mehr“ › „Für Maike“. Ohne Foto bleibt alles wie vorher.
|
||||
|
||||
alter table households add column dedication_name text check (dedication_name is null or length(trim(dedication_name)) between 1 and 40);
|
||||
alter table households add column dedication_text text check (dedication_text is null or length(dedication_text) <= 800);
|
||||
alter table households add column dedication_photo text;
|
||||
@@ -0,0 +1,39 @@
|
||||
-- Produktgruppen und eigene Zutaten (Kai, 7.11.2026, 26.11.38).
|
||||
--
|
||||
-- Gruppen: Eine Zutat kann ein Oberbegriff sein (Pasta, Reis, Käse, Hülsenfrüchte)
|
||||
-- und selbst gewählt werden („Pasta, beliebige Sorte“); die Sorten zeigen mit
|
||||
-- parent_id auf ihn. Kommen aus db/seed wie alle globalen Zutaten.
|
||||
--
|
||||
-- Eigene Zutaten: Fehlt etwas im Katalog („Gnocchi“), legen Erwachsene es für
|
||||
-- ihren Haushalt an (household_id). Global bleibt household_id leer.
|
||||
--
|
||||
-- Lieblingsprodukt je Zutat oder Gruppe für den ganzen Haushalt („unsere Pasta
|
||||
-- ist Barilla Nr. 5“): household_products; ein Produkt am Gericht geht vor.
|
||||
|
||||
alter table ingredients add column is_group boolean not null default false;
|
||||
alter table ingredients add column parent_id uuid references ingredients (id);
|
||||
alter table ingredients add column household_id uuid references households (id) on delete cascade;
|
||||
create index ingredients_parent_idx on ingredients (parent_id) where parent_id is not null;
|
||||
create index ingredients_household_idx on ingredients (household_id) where household_id is not null;
|
||||
|
||||
drop policy ingredients_read on ingredients;
|
||||
create policy ingredients_read on ingredients for select
|
||||
using (household_id is null or household_id = app_household_id() or app_maintenance());
|
||||
create policy ingredients_own on ingredients for all
|
||||
using (household_id = app_household_id())
|
||||
with check (household_id = app_household_id() and not is_group);
|
||||
|
||||
create table household_products (
|
||||
household_id uuid not null references households (id) on delete cascade,
|
||||
ingredient_id uuid not null references ingredients (id) on delete cascade,
|
||||
product text not null check (length(trim(product)) between 1 and 80),
|
||||
product_pack numeric(12, 3) check (product_pack is null or product_pack > 0),
|
||||
cook_minutes integer check (cook_minutes is null or cook_minutes between 1 and 240),
|
||||
updated_at timestamptz not null default now(),
|
||||
primary key (household_id, ingredient_id)
|
||||
);
|
||||
alter table household_products enable row level security;
|
||||
alter table household_products force row level security;
|
||||
create policy household_products_household on household_products
|
||||
using (household_id = app_household_id())
|
||||
with check (household_id = app_household_id());
|
||||
@@ -0,0 +1,33 @@
|
||||
-- Löffel und Gebinde (Kai, 7.11.2026, 26.11.39).
|
||||
--
|
||||
-- Mengen bleiben in der Basiseinheit pro Portion gespeichert (CLAUDE.md, Regel 2).
|
||||
-- Dazu kommt, in welchem Küchenmaß sie eingegeben wurden (display_unit), damit
|
||||
-- das Rezept „2 EL (30 ml)“ zeigt statt nur „30 ml“, und „400 g (1 Dose)“.
|
||||
--
|
||||
-- An der Zutat: das übliche Küchenmaß (kitchen_unit, vorgewählt im Formular)
|
||||
-- und das übliche Gebinde mit Größe in der Basiseinheit (pack_kind, pack_size).
|
||||
-- Ein Haushalt kann die Größe ändern (household_pack_sizes); ein Produkt mit
|
||||
-- Packungsgröße am Gericht geht vor.
|
||||
|
||||
alter table ingredients add column kitchen_unit text
|
||||
check (kitchen_unit in ('tbsp', 'tsp', 'pinch', 'can', 'jar', 'pack', 'bunch'));
|
||||
alter table ingredients add column pack_kind text check (pack_kind in ('can', 'jar', 'pack', 'bunch'));
|
||||
alter table ingredients add column pack_size numeric(12, 3) check (pack_size is null or pack_size > 0);
|
||||
|
||||
alter table dish_ingredients add column display_unit text
|
||||
check (display_unit in ('tbsp', 'tsp', 'pinch', 'can', 'jar', 'pack', 'bunch'));
|
||||
|
||||
alter table shopping_items add column pack_kind text check (pack_kind in ('can', 'jar', 'pack', 'bunch'));
|
||||
|
||||
create table household_pack_sizes (
|
||||
household_id uuid not null references households (id) on delete cascade,
|
||||
ingredient_id uuid not null references ingredients (id) on delete cascade,
|
||||
pack_size numeric(12, 3) not null check (pack_size > 0),
|
||||
updated_at timestamptz not null default now(),
|
||||
primary key (household_id, ingredient_id)
|
||||
);
|
||||
alter table household_pack_sizes enable row level security;
|
||||
alter table household_pack_sizes force row level security;
|
||||
create policy household_pack_sizes_household on household_pack_sizes
|
||||
using (household_id = app_household_id())
|
||||
with check (household_id = app_household_id());
|
||||
+637
-138
File diff suppressed because it is too large.
Load diff
+92
-2
@@ -174,8 +174,8 @@ acht Paletten Variante H gewählt). Löst die Palette aus E-0002 ab; der Rest vo
|
||||
Hauptaktion je Ansicht.
|
||||
- **Etiketten und Links:** kleine Versalien in tiefem Lavendel (`.eyebrow`), etwa
|
||||
„HEUTE“, „ZUTATEN“. Pastell nie als Schriftfarbe auf heller Fläche.
|
||||
- **Schrift:** Überschriften `h1`/`h2` in Newsreader (Serifen, SIL OFL, lokal unter
|
||||
`app/fonts/`), Text in Geist.
|
||||
- **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`).
|
||||
- **Kontrast** jeder Schrift auf ihrer Fläche mindestens 4,5:1, hell und dunkel —
|
||||
@@ -211,3 +211,93 @@ Angemeldete Personen präsentieren aus jedem Gericht; auf dem Display beginnt es
|
||||
„Als Nächstes“ aus dem Plan. Blättern durch große Tipp-Flächen (linkes Drittel
|
||||
zurück, sonst weiter), Wischen und Knöpfe — Sprachsteuerung über Alexa nicht, weil
|
||||
das eine Verbindung zu Amazon bräuchte.
|
||||
|
||||
## E-0012 · Mein Gericht statt Währungsschlacht
|
||||
|
||||
*7.11.2026 · Kai und Mike („Geschwisterdynamik“), umgesetzt von Claude*
|
||||
|
||||
Wünscht sich ein Kind Pommes, legt das Geschwister ein Veto ein — nicht weil es
|
||||
Pommes nicht mag, sondern um zu ärgern. Erwogen wurde eine Währung, bei der man
|
||||
alles auf ein Gericht setzt. Verworfen: Eine Auktion gewinnen, die besser rechnen,
|
||||
und wer sich verzockt, steht leer da. Entschieden:
|
||||
|
||||
- **Jede Person, die mitisst**, macht je Runde einen Wunsch zu „Mein Gericht“. Kein
|
||||
Veto streicht es; der Plan setzt es zuerst.
|
||||
- **Zu wenig Plätze:** Wer in der Vorrunde leer ausging, ist zuerst dran.
|
||||
- **Höchstens jede zweite Runde** dasselbe eigene Gericht (wenn es in den Plan kam).
|
||||
- **Vetos ohne Namen** für Kinder und Jugendliche; Erwachsene sehen, von wem sie
|
||||
kommen. Ein Veto ohne Publikum lohnt sich zum Ärgern nicht.
|
||||
|
||||
Jetons und Veto bleiben für alles andere.
|
||||
|
||||
## E-0013 · foodplanhero, Maike gewidmet
|
||||
|
||||
*7.11.2026 · Kai*
|
||||
|
||||
Die App ist eine Danksagung an Maike. Sie heißt in der Oberfläche **foodplanhero** mit dem
|
||||
Slogan **„Plan. Cook. Smile.“** (Kais früherer Entwurf); technisch bleibt sie `lunch`.
|
||||
|
||||
- **Startbild ja, Wartezeit nein:** Maike erscheint auf dem iOS-Startbild, solange die
|
||||
Web-App lädt. Eine künstliche Pause wie bei Airbnb gibt es nicht — die App öffnet man
|
||||
vor dem Herd und im Laden mehrmals am Tag.
|
||||
- **Maike** zusätzlich beim Anmelden, bei der Einladung und unter „Mehr“ › „Für Maike“
|
||||
mit Kais Worten. Das Foto lädt ein Admin auf der Box hoch; es liegt nie im Repo.
|
||||
- **Slogan im Ablauf:** leise, mit dem Wort, das gerade passiert (Plan, Kochen, Bewerten).
|
||||
- **Gestaltung bleibt** (E-0009): Coral und Lavendel; neu ist nur das Grün von „hero“ als
|
||||
Token `--hero`, das auch Maikes Ring trägt.
|
||||
|
||||
## E-0014 · Eine Schrift: Poppins (löst die Serifen aus E-0009 ab)
|
||||
|
||||
*7.11.2026 · Kai („zu viele Schriftarten“)*
|
||||
|
||||
Mit foodplanhero standen vier Schriften auf der Startseite: Poppins (Logo), Caveat
|
||||
(„by Maike“), Newsreader (Überschriften) und Geist (Text). Entschieden: **Poppins für
|
||||
alles** — Logo, Überschriften (SemiBold), Text, Knöpfe —, wie in Kais Figma-Entwurf.
|
||||
**Caveat** bleibt, aber nur als Maikes Unterschrift „by Maike“, nirgends sonst.
|
||||
Newsreader und Geist sind entfernt. Farben, Flächen und Abstände aus E-0009 bleiben.
|
||||
|
||||
## E-0015 · Produktgruppen, eigene Zutaten, Lieblingsprodukt je Haushalt
|
||||
|
||||
*7.11.2026 · Kai („den Oberbegriff Pasta eigentlich besser … Oder Produktgruppen?“)*
|
||||
|
||||
**Gruppen.** Es gibt vier Oberbegriffe: Pasta, Reis, Käse sowie Linsen und Hülsenfrüchte.
|
||||
Jede Gruppe ist selbst eine Zutat (`is_group`) und lässt sich als „beliebige Sorte“ wählen.
|
||||
Die Sorten hängen über `parent_id` an ihrer Gruppe. Trifft die Suche eine Gruppe, auch über
|
||||
ein Synonym („Nudeln“), steht die Gruppe oben und alle ihre Sorten folgen. Gibt es keinen
|
||||
eigenen Bon-Preis für die Gruppe, ist ihr Preis der Durchschnitt der besten Preise ihrer
|
||||
Sorten.
|
||||
|
||||
**Eigene Zutaten.** Zutaten anlegen darf, wer Gerichte pflegt (Admin und Mitglied). Eine
|
||||
eigene Zutat gehört dem Haushalt (`household_id`). Die Zeilensicherheit zeigt sie nur
|
||||
diesem Haushalt, und Gruppen anlegen kann ein Haushalt nicht. Doppelte Namen werden
|
||||
abgewiesen. Eigene Zutaten gehen in die Sicherung.
|
||||
|
||||
**Lieblingsprodukt.** Es gilt je Zutat für den ganzen Haushalt (`household_products`) und
|
||||
wird mit dem Haken „Für alle Gerichte mit … merken“ gesetzt. Ein Produkt, das am Gericht
|
||||
selbst steht, geht immer vor.
|
||||
|
||||
## E-0016 · Löffel und Gebinde als Mengeneinheiten
|
||||
|
||||
*7.11.2026 · Kai („Teelöffel, Esslöffel … eine Dose als Einheit … natürlich muss auch die Grammzahl dort stehen“)*
|
||||
|
||||
**Gespeichert** wird weiter in der Basiseinheit pro Portion (Regel 2). Dazu hält
|
||||
`dish_ingredients.display_unit` fest, in welchem Maß die Menge eingegeben wurde:
|
||||
EL, TL, Prise, Dose, Glas, Packung oder Bund. Hochrechnen, Einkaufsliste und
|
||||
Preise rechnen also unverändert.
|
||||
|
||||
**Anzeige** (Kais Wahl):
|
||||
- Löffel stehen vorn, die Gramm in Klammern: „2 EL (30 ml)“. Die Prise hat keine Klammer.
|
||||
- Gebinde zeigen die Gramm zuerst: „400 g (1 Dose)“, hochgerechnet in Küchenbrüchen.
|
||||
- Weniger als eine Viertel Packung zeigt nur Gramm.
|
||||
- Ältere Gerichte und Vorlagen ohne Maß bekommen Löffel, wenn es ½ bis 8 sind, und
|
||||
ein Gebinde ab einer Viertel Packung. Prisen bekommen sie nie von selbst.
|
||||
|
||||
**An der Zutat:**
|
||||
- Das übliche Löffelmaß wird im Formular vorgewählt (Olivenöl in EL, Kreuzkümmel in TL, Salz in Prisen).
|
||||
- Das übliche Gebinde und seine Größe (gehackte Tomaten: Dose, 400 g) werden angeboten, mit der Größe in der Auswahl.
|
||||
- Ein Gebinde wird **nie vorgewählt**: Wer nach „Kokosmilch“ gleich „400“ tippt, meint Milliliter.
|
||||
|
||||
**Größe eines Gebindes:** Es gilt zuerst das Produkt am Gericht, dann das Lieblingsprodukt
|
||||
des Haushalts, dann die Haushaltsgröße (`household_pack_sizes`, ändern darf, wer Gerichte
|
||||
pflegt), zuletzt die Vorgabe. Beim Einlesen von Rezepten kommt die Größe aus der Zutat,
|
||||
nie aus dem Text oder einem Modell.
|
||||
+3
-3
@@ -68,13 +68,13 @@ test("an admin invites a member by a single-use link", async ({ browser }) => {
|
||||
await maike.page.getByRole("button", { name: "Passkey anlegen" }).click();
|
||||
await expect(maike.page).toHaveURL(/\/$/);
|
||||
// Neue Person: einmal „So funktioniert Lunch“, danach „Wo stehen wir?“.
|
||||
await expect(maike.page.getByText("So funktioniert Lunch · 1 von 3")).toBeVisible();
|
||||
await expect(maike.page.getByText("So funktioniert foodplanhero · 1 von 3")).toBeVisible();
|
||||
await maike.page.getByRole("button", { name: "Weiter" }).click();
|
||||
await maike.page.getByRole("button", { name: "Weiter" }).click();
|
||||
await maike.page.getByRole("button", { name: "Los geht's" }).click();
|
||||
await expect(maike.page.getByText(/So funktioniert Lunch/)).toHaveCount(0);
|
||||
await expect(maike.page.getByText(/So funktioniert foodplanhero/)).toHaveCount(0);
|
||||
await maike.page.reload();
|
||||
await expect(maike.page.getByText(/So funktioniert Lunch/)).toHaveCount(0);
|
||||
await expect(maike.page.getByText(/So funktioniert foodplanhero/)).toHaveCount(0);
|
||||
await expect(maike.page.getByText("Eine neue Runde eröffnen.")).toBeVisible(); // Mitglieder dürfen eröffnen
|
||||
await maike.page.goto("/mehr");
|
||||
await expect(maike.page.locator("#invite-name")).toHaveCount(0);
|
||||
|
||||
+36
-2
@@ -1,4 +1,4 @@
|
||||
import { expect, test, type Browser, type Page } from "@playwright/test";
|
||||
import { expect, test, type Locator, type Browser, type Page } from "@playwright/test";
|
||||
import sharp from "sharp";
|
||||
|
||||
// Einkaufsliste am iPhone (Paket 7): Hauptladen, Vorrats-Check, Abhaken,
|
||||
@@ -142,13 +142,47 @@ test.describe("receipts", () => {
|
||||
const pasta = page.locator("li", { hasText: "BARILLA SPAGH N5 500G" });
|
||||
await expect(pasta).toContainText("euer Produkt: Barilla Spaghetti Nr. 5");
|
||||
await expect(pasta.getByLabel("Packung in g")).toHaveValue("500");
|
||||
await expect(page.locator("li", { hasText: "KLOPAPIER 8ST" })).toContainText("Sonstiges");
|
||||
// Preis je 100 g, so wie Lunch ihn sich merkt; ohne Packung eine Warnung.
|
||||
await expect(pasta.getByTestId("unit-price")).toHaveText("= 0,36 € je 100 g");
|
||||
await pasta.getByLabel("Packung in g").fill("");
|
||||
await expect(pasta).toContainText("Ohne Packungsgröße merkt sich foodplanhero keinen Preis.");
|
||||
await pasta.getByLabel("Packung in g").fill("500");
|
||||
|
||||
// Klopapier gehört zu keinem Gericht: nach links wischen (26.11.33).
|
||||
const paper = page.getByRole("list", { name: "Zum Kochen" }).locator("li", { hasText: "KLOPAPIER 8ST" });
|
||||
await expect(paper).toContainText("Keine Zutat erkannt");
|
||||
await swipeLeft(paper);
|
||||
await expect(page.getByRole("status")).toContainText("KLOPAPIER 8ST: nicht zum Kochen");
|
||||
await expect(page.getByRole("list", { name: "Zum Kochen" }).locator("li", { hasText: "KLOPAPIER" })).toHaveCount(0);
|
||||
await expect(page.getByText("1 weiterer Artikel — nicht zum Kochen")).toBeVisible();
|
||||
await page.getByRole("button", { name: "Übernehmen" }).click();
|
||||
await expect(page.getByText("bestätigt")).toBeVisible();
|
||||
|
||||
// Der nächste Bon: Klopapier landet gleich unten, die Spaghetti sind gelernt.
|
||||
await page.locator("input[type=file]").setInputFiles({ name: "bon2.jpg", mimeType: "image/jpeg", buffer: jpg });
|
||||
await page.getByRole("link", { name: /2 Zeilen zu bestätigen/ }).click({ timeout: 20_000 });
|
||||
await expect(page.getByRole("list", { name: "Zum Kochen" }).locator("li")).toHaveCount(1);
|
||||
await expect(page.locator("li", { hasText: "BARILLA SPAGH N5 500G" })).toContainText("so schon einmal bestätigt");
|
||||
await page.getByText("1 weiterer Artikel — nicht zum Kochen").click();
|
||||
await page.getByRole("button", { name: "KLOPAPIER 8ST doch einer Zutat zuordnen" }).click();
|
||||
await expect(page.getByRole("list", { name: "Zum Kochen" }).locator("li")).toHaveCount(2);
|
||||
await page.getByRole("button", { name: "Bon löschen" }).click();
|
||||
await expect(page.getByRole("heading", { level: 1 })).toHaveText("Kassenbons");
|
||||
|
||||
// Der Bonpreis gilt jetzt am Gericht: 1,79 € für 500 g = 3,58 € je kg.
|
||||
await page.goto("/gerichte");
|
||||
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");
|
||||
});
|
||||
});
|
||||
|
||||
/** Nach links wischen wie am Handy (Chromium hat keine Wischgeste). */
|
||||
async function swipeLeft(target: Locator) {
|
||||
await target.evaluate((el) => {
|
||||
const r = el.getBoundingClientRect();
|
||||
const y = r.top + 20;
|
||||
const at = (x: number) => new Touch({ identifier: 1, target: el, clientX: x, clientY: y });
|
||||
el.dispatchEvent(new TouchEvent("touchstart", { bubbles: true, touches: [at(r.right - 20)], changedTouches: [at(r.right - 20)] }));
|
||||
el.dispatchEvent(new TouchEvent("touchend", { bubbles: true, touches: [], changedTouches: [at(r.left + 20)] }));
|
||||
});
|
||||
}
|
||||
+118
-7
@@ -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 Handvoll Glück"],
|
||||
recipeIngredient: ["250 g rote Linsen", "2 Zwiebeln", "1 Becher Sahne", "1 Schuss Milch", "1 Handvoll Glück"],
|
||||
recipeInstructions: [{ "@type": "HowToStep", text: "Zwiebeln anschwitzen." }, { "@type": "HowToStep", text: "Linsen dazu und weich kochen." }],
|
||||
},
|
||||
],
|
||||
@@ -195,14 +195,17 @@ test.describe("recipe link", () => {
|
||||
await expect(page.getByRole("note").filter({ hasText: "Nach Regeln in Abschnitte eingeordnet" })).toBeVisible();
|
||||
await expect(page.getByLabel("Abschnitt von Schritt 1")).toHaveValue("cook");
|
||||
const amounts = page.getByRole("textbox", { name: "Menge", exact: true });
|
||||
await expect(amounts).toHaveCount(3);
|
||||
await expect(amounts).toHaveCount(4);
|
||||
await expect(amounts.nth(0)).toHaveValue("250");
|
||||
await expect(amounts.nth(1)).toHaveValue("2");
|
||||
await expect(amounts.nth(2)).toHaveValue("");
|
||||
// Sahne im Becher: Menge fehlt — Speichern sagt es, statt die Zeile wegzulassen.
|
||||
// Becher ist das Gebinde der Sahne (26.11.39): 1 Packung zu 200 ml.
|
||||
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.
|
||||
await page.getByRole("button", { name: "Speichern" }).click();
|
||||
await expect(page.locator("main [role=alert]")).toContainText("fehlt die Menge");
|
||||
await amounts.nth(2).fill("200");
|
||||
await amounts.nth(3).fill("50");
|
||||
await page.getByRole("button", { name: "Speichern" }).click();
|
||||
await expect(page.getByRole("heading", { level: 1 })).toHaveText("Linsensuppe vom Blog");
|
||||
await expect(page.locator("main img").first()).toHaveAttribute("src", /\/api\/fotos\//);
|
||||
@@ -289,7 +292,7 @@ test.describe("cookbook photo and AI setting", () => {
|
||||
test("without an image model the photo page says how to set it up", async ({ page }) => {
|
||||
await page.goto("/gerichte/hinzufuegen");
|
||||
await page.getByRole("link", { name: /Kochbuch fotografieren/ }).click();
|
||||
await expect(page.getByText("braucht Lunch ein Bildmodell")).toBeVisible();
|
||||
await expect(page.getByText("braucht foodplanhero ein Bildmodell")).toBeVisible();
|
||||
await page.getByRole("link", { name: "AI einrichten" }).click();
|
||||
await expect(page).toHaveURL(/\/mehr\/ki$/);
|
||||
});
|
||||
@@ -322,7 +325,7 @@ test.describe("cookbook photo and AI setting", () => {
|
||||
await page.getByRole("button", { name: "Rezept lesen" }).click();
|
||||
await expect(page.locator("#title")).toHaveValue("Kartoffelsalat aus dem Kochbuch");
|
||||
await expect(page.getByRole("note").first()).toContainText("Von der AI gelesen");
|
||||
await expect(page.getByRole("note").filter({ hasText: "Von der AI in die Lunch-Form gebracht" })).toBeVisible();
|
||||
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.");
|
||||
await expect(page.getByLabel("Abschnitt von Schritt 3")).toHaveValue("serve");
|
||||
await fillMissingAmounts(page);
|
||||
@@ -356,3 +359,111 @@ test.describe("cookbook photo and AI setting", () => {
|
||||
await expect(page.getByRole("note").first()).toContainText("Von der AI gelesen");
|
||||
});
|
||||
});
|
||||
|
||||
// Produktgruppen und eigene Zutaten (26.11.38, Kai: „den Oberbegriff Pasta eigentlich besser“).
|
||||
test("a group term shows the group with its kinds; an own ingredient and a remembered product", async ({ page }) => {
|
||||
await page.goto("/gerichte/neu");
|
||||
await page.fill("#title", "Gnocchi in Salbeibutter");
|
||||
const search = page.getByRole("combobox", { name: "Zutat suchen" }).first();
|
||||
await search.fill("Nudeln");
|
||||
const options = page.getByRole("listbox").getByRole("option");
|
||||
await expect(options.first()).toContainText("Pasta · beliebige Sorte");
|
||||
await expect(page.getByRole("option", { name: "Spaghetti", exact: true })).toBeVisible();
|
||||
await expect(page.getByRole("option", { name: "Penne", exact: true })).toBeVisible();
|
||||
|
||||
await search.fill("Gnocchi Hausmacher");
|
||||
await page.getByRole("option", { name: "„Gnocchi Hausmacher“ als neue Zutat anlegen" }).click();
|
||||
const create = page.getByRole("group", { name: "Neue Zutat" });
|
||||
await create.getByLabel("Gehört zu").selectOption({ label: "Pasta" });
|
||||
await expect(create.getByLabel("Regal im Laden")).toHaveCount(0);
|
||||
await create.getByRole("button", { name: "Anlegen" }).click();
|
||||
await expect(search).toHaveValue("Gnocchi Hausmacher");
|
||||
await page.getByRole("textbox", { name: "Menge", exact: true }).first().fill("500");
|
||||
await page.getByRole("button", { name: "Produkt hinterlegen" }).click();
|
||||
await page.getByLabel("Produkt für Gnocchi Hausmacher").fill("Rana Gnocchi");
|
||||
await page.getByLabel("Für alle Gerichte mit Gnocchi Hausmacher merken").check();
|
||||
await page.getByLabel("Schritt 1", { exact: true }).fill("Gnocchi in Salzwasser garen.");
|
||||
await page.getByRole("button", { name: "Speichern" }).click();
|
||||
await expect(page.getByRole("heading", { level: 1 })).toHaveText("Gnocchi in Salbeibutter");
|
||||
|
||||
// Ein zweites Gericht bekommt das gemerkte Produkt gleich beim Wählen.
|
||||
await page.goto("/gerichte/neu");
|
||||
await page.fill("#title", "Gnocchi-Auflauf");
|
||||
await page.getByRole("combobox", { name: "Zutat suchen" }).first().fill("Gnocchi Haus");
|
||||
await page.getByRole("option", { name: /Gnocchi Hausmacher.*eigene/ }).click();
|
||||
await expect(page.getByText("Euer Produkt für alle Gerichte: Rana Gnocchi")).toBeVisible();
|
||||
await expect(page.getByRole("button", { name: "Anderes Produkt für dieses Gericht" })).toBeVisible();
|
||||
await page.getByRole("textbox", { name: "Menge", exact: true }).first().fill("400");
|
||||
await page.getByLabel("Schritt 1", { exact: true }).fill("Gnocchi in die Form geben.");
|
||||
await page.getByRole("button", { name: "Speichern" }).click();
|
||||
await expect(page.locator("main")).toContainText("Rana Gnocchi");
|
||||
|
||||
// Wieder aus dem Pool, damit der Plan danach denselben Bestand vorschlägt.
|
||||
for (const title of ["Gnocchi-Auflauf", "Gnocchi in Salbeibutter"]) {
|
||||
await page.goto("/gerichte");
|
||||
await page.getByRole("link", { name: new RegExp(title) }).click();
|
||||
await page.getByRole("button", { name: "Entfernen" }).click();
|
||||
await expect(page).toHaveURL(/entfernt=/);
|
||||
}
|
||||
});
|
||||
|
||||
// Löffel und Gebinde (26.11.39, Kai: „Teelöffel, Esslöffel … eine Dose als Einheit“).
|
||||
test("spoons and cans: the ingredient preselects its measure, the dish shows spoons and grams", async ({ page }) => {
|
||||
await page.goto("/gerichte/neu");
|
||||
await page.fill("#title", "Tomatensoße vom Blech");
|
||||
const search = page.getByRole("combobox", { name: "Zutat suchen" });
|
||||
const unit = page.getByRole("combobox", { name: "Einheit" });
|
||||
await search.first().fill("Olivenöl");
|
||||
await page.getByRole("option", { name: "Olivenöl", exact: true }).click();
|
||||
await expect(unit.first()).toHaveValue("tbsp");
|
||||
await page.getByRole("textbox", { name: "Menge", exact: true }).first().fill("2");
|
||||
|
||||
await page.getByRole("button", { name: "Zutaten" }).click();
|
||||
await search.nth(1).fill("gehackte Tomaten");
|
||||
await page.getByRole("option", { name: /Gehackte Tomaten/ }).first().click();
|
||||
// Die Dose wird angeboten, mit Größe, aber nicht vorgewählt.
|
||||
await expect(unit.nth(1)).toHaveValue("g");
|
||||
await unit.nth(1).selectOption("can");
|
||||
await expect(unit.nth(1).locator("option:checked")).toHaveText("Dose (400 g)");
|
||||
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.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");
|
||||
await page.getByLabel("Schritt 1", { exact: true }).fill("Tomaten mit Öl aufs Blech.");
|
||||
await page.getByRole("button", { name: "Speichern" }).click();
|
||||
await expect(page.getByRole("heading", { level: 1 })).toHaveText("Tomatensoße vom Blech");
|
||||
|
||||
// Auf vier Portionen: „2 EL (30 ml) Olivenöl“, „500 g (1 Dose) Gehackte Tomaten“.
|
||||
const list = page.locator("main ul").first();
|
||||
const portions = page.locator("output");
|
||||
for (let i = 0; i < 8 && !(await portions.innerText()).startsWith("4 "); i++) {
|
||||
const n = Number((await portions.innerText()).match(/\d+/)![0]);
|
||||
await page.getByRole("button", { name: n > 4 ? "Eine Portion weniger" : "Eine Portion mehr" }).click();
|
||||
}
|
||||
await expect(list.locator("li", { hasText: "Olivenöl" })).toContainText(/2 EL\s*\(30 ml\) Olivenöl/);
|
||||
await expect(list.locator("li", { hasText: "Gehackte Tomaten" })).toContainText(/500 g\s*\(1 Dose\) Gehackte Tomaten/);
|
||||
await page.getByRole("button", { name: "Eine Portion weniger" }).click();
|
||||
await page.getByRole("button", { name: "Eine Portion weniger" }).click();
|
||||
await expect(list.locator("li", { hasText: "Olivenöl" })).toContainText(/1 EL\s*\(15 ml\)/);
|
||||
await expect(list.locator("li", { hasText: "Gehackte Tomaten" })).toContainText(/250 g\s*\(½ Dose\)/);
|
||||
|
||||
// Bearbeiten zeigt die Mengen im eingegebenen Maß.
|
||||
await page.getByRole("link", { name: "Bearbeiten" }).click();
|
||||
await expect(unit.first()).toHaveValue("tbsp");
|
||||
await expect(page.getByRole("textbox", { name: "Menge", exact: true }).first()).toHaveValue("2");
|
||||
await expect(unit.nth(1)).toHaveValue("can");
|
||||
await expect(page.getByRole("textbox", { name: "Menge", exact: true }).nth(1)).toHaveValue("1");
|
||||
|
||||
// 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.getByRole("button", { name: "Übernehmen" }).click();
|
||||
await expect(page.getByText("1 Dose = 400 g")).toBeVisible();
|
||||
await page.goto("/gerichte");
|
||||
await page.getByRole("link", { name: /Tomatensoße vom Blech/ }).click();
|
||||
await page.getByRole("button", { name: "Entfernen" }).click();
|
||||
await expect(page).toHaveURL(/entfernt=/);
|
||||
});
|
||||
+18
-1
@@ -59,7 +59,9 @@ test("a child signs in with picture and PIN and sees only Today and Wish", async
|
||||
|
||||
test("a child wishes, makes a favourite, and has no veto", async () => {
|
||||
await tablet.goto("/wuenschen");
|
||||
await expect(tablet.getByText("Veto: Kai")).toBeVisible(); // Vetos der anderen sieht man
|
||||
// Vetos der anderen sieht Ben, aber nicht von wem (26.11.30: keine Bühne zum Ärgern).
|
||||
await expect(tablet.getByText("1 Veto", { exact: true })).toBeVisible();
|
||||
await expect(tablet.getByText("Veto: Kai")).toHaveCount(0);
|
||||
await expect(tablet.getByText(/Veto(s)? frei|Veto vergeben/)).toHaveCount(0); // ein eigenes hat Ben nicht
|
||||
await tablet.getByRole("button", { name: /^Wünschen: Spaghetti Bolognese/ }).click();
|
||||
await expect(tablet.getByRole("button", { name: /^Wunsch zurücknehmen: Spaghetti Bolognese/ })).toContainText("Favorit");
|
||||
@@ -68,6 +70,16 @@ test("a child wishes, makes a favourite, and has no veto", async () => {
|
||||
await tablet.keyboard.press("Escape");
|
||||
});
|
||||
|
||||
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("Dein Gericht: Spaghetti Bolognese — kommt sicher in den Plan.")).toBeVisible();
|
||||
await expect(tablet.getByRole("button", { name: /^Wunsch zurücknehmen: Spaghetti Bolognese/ })).toContainText("Mein Gericht");
|
||||
});
|
||||
|
||||
test("switching leads back to the pictures, and wrong PINs are slowed down", async () => {
|
||||
await tablet.getByRole("button", { name: "Wechseln" }).click();
|
||||
await expect(tablet).toHaveURL(/\/kinder$/);
|
||||
@@ -136,6 +148,11 @@ test("a teen joins with an own passkey and wishes, but does not plan", async ({
|
||||
await lena.getByRole("button", { name: "Optionen für Linseneintopf" }).click();
|
||||
await expect(lena.getByRole("dialog").getByRole("button", { name: /Veto/ })).toBeVisible();
|
||||
await lena.keyboard.press("Escape");
|
||||
// Gegen Bens Gericht gibt es kein Veto.
|
||||
await lena.getByRole("button", { name: "Optionen für Spaghetti Bolognese" }).click();
|
||||
await expect(lena.getByRole("dialog")).toContainText("Geschützt");
|
||||
await expect(lena.getByRole("dialog").getByRole("button", { name: /Veto/ })).toHaveCount(0);
|
||||
await lena.keyboard.press("Escape");
|
||||
|
||||
await page.goto("/mehr");
|
||||
await expect(page.locator("main")).toContainText(/Lena\s*Jugendlich/);
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
import { expect, test, type Page } from "@playwright/test";
|
||||
|
||||
// Die untere Leiste bleibt unten (26.11.32, Kai: „rutscht beim Scrollen mit nach
|
||||
// oben“). Chromium fährt keine Adressleiste ein und hat keine Tastatur; deshalb
|
||||
// täuscht der Test einen iPhone-Sichtbereich vor (visualViewport, Web-App vom
|
||||
// Home-Bildschirm) und bewegt ihn wie iOS beim Scrollen und nach dem Tippen.
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.addInitScript(() => {
|
||||
const vv = new EventTarget() as EventTarget & Record<string, unknown>;
|
||||
const w = window as unknown as { __vv: typeof vv; __extra: number; __top: number };
|
||||
w.__extra = 0;
|
||||
w.__top = 0;
|
||||
const props: Record<string, () => number> = {
|
||||
height: () => window.innerHeight + w.__extra,
|
||||
width: () => window.innerWidth,
|
||||
offsetTop: () => w.__top,
|
||||
offsetLeft: () => 0,
|
||||
pageTop: () => window.scrollY + w.__top,
|
||||
pageLeft: () => 0,
|
||||
scale: () => 1,
|
||||
};
|
||||
for (const [k, get] of Object.entries(props))
|
||||
Object.defineProperty(vv, k, { get });
|
||||
Object.defineProperty(window, "visualViewport", { get: () => vv, configurable: true });
|
||||
w.__vv = vv;
|
||||
const media = window.matchMedia.bind(window);
|
||||
window.matchMedia = (q: string) =>
|
||||
q.includes("standalone") ? ({ matches: true, media: q, onchange: null, addListener() {}, removeListener() {}, addEventListener() {}, removeEventListener() {}, dispatchEvent: () => false } as MediaQueryList) : media(q);
|
||||
});
|
||||
});
|
||||
|
||||
/** iOS bewegt den sichtbaren Bereich: um extra Pixel größer, um top verschoben. */
|
||||
async function moveViewport(page: Page, extra: number, top = 0) {
|
||||
await page.evaluate(
|
||||
({ extra, top }) => {
|
||||
const w = window as unknown as { __vv: EventTarget; __extra: number; __top: number };
|
||||
w.__extra = extra;
|
||||
w.__top = top;
|
||||
w.__vv.dispatchEvent(new Event("resize"));
|
||||
w.__vv.dispatchEvent(new Event("scroll"));
|
||||
},
|
||||
{ extra, top },
|
||||
);
|
||||
}
|
||||
|
||||
async function navAtBottom(page: Page) {
|
||||
const nav = page.getByRole("navigation", { name: "Navigation" });
|
||||
await expect(nav).toBeVisible();
|
||||
const { bottom, inner, transform } = await nav.evaluate((el) => ({
|
||||
bottom: Math.round(el.getBoundingClientRect().bottom),
|
||||
inner: window.innerHeight,
|
||||
transform: (el as HTMLElement).style.transform,
|
||||
}));
|
||||
expect(transform).toBe("");
|
||||
expect(bottom).toBe(inner);
|
||||
}
|
||||
|
||||
test("scrolling never moves the bar, even while the address bar comes and goes", async ({ page }) => {
|
||||
await page.goto("/mehr");
|
||||
await navAtBottom(page);
|
||||
const height = await page.evaluate(() => document.documentElement.scrollHeight);
|
||||
for (const [y, extra, top] of [
|
||||
[300, 80, 0], // Adressleiste fährt ein
|
||||
[900, 80, 0],
|
||||
[height, 120, 40], // Gummiband am Ende
|
||||
[400, 0, 0], // Adressleiste wieder da
|
||||
[0, 0, -30], // Gummiband oben
|
||||
]) {
|
||||
await page.mouse.wheel(0, y! - (await page.evaluate(() => window.scrollY)));
|
||||
await moveViewport(page, extra!, top!);
|
||||
await page.waitForTimeout(50);
|
||||
await navAtBottom(page);
|
||||
}
|
||||
});
|
||||
|
||||
test("after typing, a stale gap is bridged briefly and dropped at the first touch", 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 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 page.evaluate(() => window.dispatchEvent(new Event("touchstart")));
|
||||
await expect.poll(() => nav.evaluate((el) => (el as HTMLElement).style.transform)).toBe("");
|
||||
});
|
||||
|
||||
test("the bridge ends by itself after a second, and never starts without typing", 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("");
|
||||
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("");
|
||||
});
|
||||
+2
-2
@@ -2,7 +2,7 @@ import { expect, test, type Page } from "@playwright/test";
|
||||
|
||||
// Plan am iPhone (Paket 6): Vorschlag aus den Wünschen, nachjustieren,
|
||||
// freigeben; danach zeigt „Heute“ den Plan. Läuft nach „kinder“ mit Kais
|
||||
// Sitzung — Spaghetti haben Kai und Ben gewünscht, Flammkuchen hat ein Veto.
|
||||
// Sitzung — Spaghetti haben Kai und Ben gewünscht (Ben als sein Gericht), Flammkuchen hat ein Veto.
|
||||
test.describe.configure({ mode: "serial" });
|
||||
|
||||
const items = (page: Page) => page.locator("main ol > li");
|
||||
@@ -15,7 +15,7 @@ test("the suggestion starts with the wishes and says why", async ({ page }) => {
|
||||
await page.getByRole("button", { name: "Vorschlag erstellen" }).click();
|
||||
await expect(items(page)).toHaveCount(4);
|
||||
await expect(items(page).first()).toContainText("Spaghetti Bolognese");
|
||||
await expect(items(page).first()).toContainText("Wunsch von Kai, Ben");
|
||||
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(titles(page)).not.toContainText(["Flammkuchen"]);
|
||||
});
|
||||
|
||||
+43
-5
@@ -8,7 +8,7 @@ test("the manifest names the app and offers shortcuts", async ({ request }) => {
|
||||
const res = await request.get("/manifest.webmanifest");
|
||||
expect(res.ok()).toBe(true);
|
||||
const m = await res.json();
|
||||
expect(m).toMatchObject({ name: "Was gibt's?", display: "standalone", start_url: "/", id: "/" });
|
||||
expect(m).toMatchObject({ name: "foodplanhero", display: "standalone", start_url: "/", id: "/" });
|
||||
expect(m.shortcuts.map((s: { url: string }) => s.url)).toEqual(["/wuenschen", "/plan", "/einkauf"]);
|
||||
expect(m.icons.some((i: { purpose?: string }) => i.purpose === "maskable")).toBe(true);
|
||||
});
|
||||
@@ -30,16 +30,16 @@ test("offline: the shopping list opened before still works, other pages explain"
|
||||
await context.setOffline(false);
|
||||
});
|
||||
|
||||
test("Today offers to put Lunch on the home screen, and the hint can be hidden", async ({ page }) => {
|
||||
test("Today offers to put foodplanhero on the home screen, and the hint can be hidden", async ({ page }) => {
|
||||
await page.goto("/");
|
||||
const hint = page.getByRole("complementary", { name: "Lunch auf den Home-Bildschirm" });
|
||||
const hint = page.getByRole("complementary", { name: "foodplanhero auf den Home-Bildschirm" });
|
||||
await expect(hint).toContainText("Zum Home-Bildschirm");
|
||||
await hint.getByRole("button", { name: "Hinweis ausblenden" }).click();
|
||||
await expect(hint).toHaveCount(0);
|
||||
await page.reload();
|
||||
await expect(page.getByRole("complementary", { name: "Lunch auf den Home-Bildschirm" })).toHaveCount(0);
|
||||
await expect(page.getByRole("complementary", { name: "foodplanhero auf den Home-Bildschirm" })).toHaveCount(0);
|
||||
await page.goto("/mehr");
|
||||
await expect(page.getByRole("complementary", { name: "Lunch auf den Home-Bildschirm" })).toBeVisible(); // unter „Mehr“ bleibt er
|
||||
await expect(page.getByRole("complementary", { name: "foodplanhero auf den Home-Bildschirm" })).toBeVisible(); // unter „Mehr“ bleibt er
|
||||
});
|
||||
|
||||
test("the bottom bar steps aside while typing and comes back at the bottom", async ({ page }) => {
|
||||
@@ -76,3 +76,41 @@ test("buttons pinned to the bottom sit on the keyboard while typing, above the b
|
||||
const navTop = Math.round((await nav.boundingBox())!.y);
|
||||
await expect.poll(bottomOf).toBeLessThanOrEqual(navTop);
|
||||
});
|
||||
|
||||
// foodplanhero by Maike (26.11.35): Kai lädt Maikes Foto unter „Mehr“ hoch. Es
|
||||
// erscheint dort, beim Anmelden und auf dem Startbild der Web-App.
|
||||
test("the app is dedicated to Maike: photo, words, sign-in and start image", async ({ page, browser, request }) => {
|
||||
const { default: sharp } = await import("sharp");
|
||||
const jpg = await sharp({ create: { width: 800, height: 800, channels: 3, background: { r: 120, g: 160, b: 200 } } }).jpeg().toBuffer();
|
||||
await page.goto("/mehr");
|
||||
const section = page.locator("#widmung");
|
||||
await expect(section.getByRole("heading", { name: "Für Maike" })).toBeVisible();
|
||||
await section.getByLabel("Name").fill("Maike");
|
||||
await section.getByLabel("Ein paar Sätze").fill("Für Maike, die jeden Tag an alles denkt.");
|
||||
await section.getByLabel("Foto wählen").setInputFiles({ name: "maike.jpg", mimeType: "image/jpeg", buffer: jpg });
|
||||
await expect(section).toContainText("Gewählt: maike.jpg");
|
||||
await section.getByRole("button", { name: "Speichern" }).click();
|
||||
await expect(section.getByRole("status")).toHaveText("Gespeichert.");
|
||||
await expect(section.getByRole("img", { name: "Maike" })).toBeVisible();
|
||||
await expect(section).toContainText("by Maike");
|
||||
await expect(section).toContainText("Für Maike, die jeden Tag an alles denkt.");
|
||||
|
||||
// Beim Anmelden, ohne Sitzung.
|
||||
const context = await browser.newContext({ ...test.info().project.use, storageState: undefined });
|
||||
const signIn = await context.newPage();
|
||||
await signIn.goto("/anmelden");
|
||||
await expect(signIn.getByText("foodplanhero").first()).toBeVisible();
|
||||
await expect(signIn.getByText(/plan\. cook\. smile\./i)).toBeVisible();
|
||||
await expect(signIn.getByRole("img", { name: "Maike" })).toBeVisible();
|
||||
await context.close();
|
||||
|
||||
// Startbild für das iPhone 15: ein PNG in Bildschirmgröße; unbekannte Größen gibt es nicht.
|
||||
const image = await request.get("/startbild/1179x2556");
|
||||
expect(image.headers()["content-type"]).toBe("image/png");
|
||||
const meta = await sharp(Buffer.from(await image.body())).metadata();
|
||||
expect([meta.width, meta.height]).toEqual([1179, 2556]);
|
||||
expect((await request.get("/startbild/100x100")).status()).toBe(404);
|
||||
const html = await (await request.get("/anmelden")).text();
|
||||
expect(html).toContain('rel="apple-touch-startup-image"');
|
||||
expect(html).toContain("/startbild/1179x2556");
|
||||
});
|
||||
@@ -141,3 +141,22 @@ test("kitchen display: overview", async ({ page, browser }) => {
|
||||
await page.reload();
|
||||
await page.getByRole("button", { name: "Rundgang entfernen" }).click();
|
||||
});
|
||||
|
||||
test("signed out: the sign-in page is centred and its intro has no orphan line", async ({ browser }) => {
|
||||
const context = await browser.newContext({ ...test.info().project.use, storageState: undefined });
|
||||
const page = await context.newPage();
|
||||
await page.goto("/anmelden");
|
||||
const intro = page.getByText("Melde dich mit dem Passkey");
|
||||
const hint = page.getByText("Noch kein Passkey auf diesem Gerät?");
|
||||
for (const el of [intro, hint]) expect(await el.evaluate((e) => getComputedStyle(e).textAlign)).toBe("center");
|
||||
// Ausgeglichene Zeilen: die letzte Zeile der Einleitung ist kein einzelnes Wort.
|
||||
const widths = await intro.evaluate((e) => {
|
||||
const range = document.createRange();
|
||||
range.selectNodeContents(e);
|
||||
const lines = new Map<number, number>();
|
||||
for (const r of range.getClientRects()) lines.set(Math.round(r.top), (lines.get(Math.round(r.top)) ?? 0) + r.width);
|
||||
return [...lines.values()];
|
||||
});
|
||||
if (widths.length > 1) expect(widths.at(-1)!).toBeGreaterThan(widths[0]! / 4);
|
||||
await context.close();
|
||||
});
|
||||
@@ -15,6 +15,19 @@ test("Today offers to open a round, and the round opens", async ({ page }) => {
|
||||
await expect(page.locator("main article h2").first()).toHaveText("Du hast noch 2 Wünsche für den Einkauf am Samstag.");
|
||||
});
|
||||
|
||||
test("tokens, veto and the joker share one line, even on the iPhone", async ({ page }) => {
|
||||
await page.goto("/wuenschen");
|
||||
const joker = page.getByRole("button", { name: "Etwas Neues" });
|
||||
await expect(joker).toHaveText("Neues");
|
||||
const bar = await page.getByText("2 Jetons frei").boundingBox();
|
||||
const button = await joker.boundingBox();
|
||||
const width = page.viewportSize()!.width;
|
||||
// Gleiche Zeile: die Mitten liegen auf einer Höhe, und der Knopf endet am rechten Rand.
|
||||
expect(Math.abs(bar!.y + bar!.height / 2 - (button!.y + button!.height / 2))).toBeLessThan(16);
|
||||
expect(button!.x + button!.width).toBeLessThanOrEqual(width);
|
||||
await expect(page.getByText("1 Veto 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();
|
||||
|
||||
@@ -94,8 +94,10 @@ export function parseJsonReply(text: string): unknown {
|
||||
}
|
||||
}
|
||||
|
||||
/** Eine Frage an das Text- oder Bildmodell; die Antwort muss JSON sein. */
|
||||
export async function askJson(settings: AiSettings, kind: "text" | "vision", system: string, user: Content): Promise<unknown> {
|
||||
export type AskOptions = { maxTokens?: number; timeoutMs?: number };
|
||||
|
||||
/** Eine Frage an das Text- oder Bildmodell; gibt den Text der Antwort zurück. */
|
||||
export async function askText(settings: AiSettings, kind: "text" | "vision", system: string, user: Content, options: AskOptions = {}): Promise<string> {
|
||||
const model = kind === "vision" ? settings.visionModel : settings.textModel;
|
||||
if (!model) throw new AiNotConfigured(kind);
|
||||
let res: Response;
|
||||
@@ -103,12 +105,12 @@ export async function askJson(settings: AiSettings, kind: "text" | "vision", sys
|
||||
res = await fetch(`${base(settings.endpoint)}/chat/completions`, {
|
||||
method: "POST",
|
||||
headers: await headers(settings),
|
||||
signal: AbortSignal.timeout(120_000),
|
||||
signal: AbortSignal.timeout(options.timeoutMs ?? 120_000),
|
||||
body: JSON.stringify({
|
||||
model,
|
||||
temperature: 0,
|
||||
// Ein nachdenkendes Modell braucht Platz, sonst kommt nur das Nachdenken an (Rocket).
|
||||
max_tokens: 6000,
|
||||
max_tokens: options.maxTokens ?? 6000,
|
||||
messages: [
|
||||
{ role: "system", content: system },
|
||||
{ role: "user", content: user },
|
||||
@@ -120,7 +122,12 @@ export async function askJson(settings: AiSettings, kind: "text" | "vision", sys
|
||||
}
|
||||
if (!res.ok) throw new AiUnavailable(`status ${res.status}`);
|
||||
const data = (await res.json().catch(() => null)) as { choices?: { message?: { content?: string } }[] } | null;
|
||||
return parseJsonReply(data?.choices?.[0]?.message?.content ?? "");
|
||||
return data?.choices?.[0]?.message?.content ?? "";
|
||||
}
|
||||
|
||||
/** Wie askText, die Antwort muss JSON sein. */
|
||||
export async function askJson(settings: AiSettings, kind: "text" | "vision", system: string, user: Content, options: AskOptions = {}): Promise<unknown> {
|
||||
return parseJsonReply(await askText(settings, kind, system, user, options));
|
||||
}
|
||||
|
||||
/** Sprache zu Text: eine Aufnahme an `<endpunkt>/audio/transcriptions` (OpenAI-Form). */
|
||||
|
||||
+9
-2
@@ -22,6 +22,9 @@ export const TABLES = [
|
||||
"passkeys",
|
||||
"invitations",
|
||||
"kid_devices", // nur Hashes; nach dem Zurückspielen gilt das Tablet weiter
|
||||
"ingredients", // nur die eigenen des Haushalts (WHERE unten); die globalen kommen aus db/seed
|
||||
"household_products",
|
||||
"household_pack_sizes",
|
||||
"stores",
|
||||
"store_aisles",
|
||||
"dishes",
|
||||
@@ -45,13 +48,15 @@ export const TABLES = [
|
||||
"household_ai", // Schlüssel verschlüsselt: gehört mit tresor.key zusammen
|
||||
] as const;
|
||||
|
||||
/** Tabellen, die globale und eigene Zeilen mischen: nur die eigenen in den Abzug. */
|
||||
const ONLY_OWN: Record<string, string> = { ingredients: "where t.household_id is not null" };
|
||||
|
||||
/** Bewusst nicht im Abzug, je mit Grund. */
|
||||
export const EXCLUDED: Record<string, string> = {
|
||||
instance: "eigene Zeile im Abzug (box-weit, nicht je Haushalt)",
|
||||
sessions: "kurzlebig; nach dem Zurückspielen meldet sich jede Person mit ihrem Passkey neu an",
|
||||
auth_challenges: "lebt fünf Minuten",
|
||||
auth_attempts: "Bremse, lebt einen Tag",
|
||||
ingredients: "kommt aus db/seed mit festen Kennungen (scripts/seed.mjs), nicht aus dem Haushalt",
|
||||
schema_migrations: "gehört zur Datenbank, nicht zu den Daten",
|
||||
starter_dishes: "Vorlage aus db/seed, wird bei jedem Start eingespielt",
|
||||
starter_dish_ingredients: "Vorlage aus db/seed",
|
||||
@@ -92,7 +97,9 @@ export async function createBackup(): Promise<Backup> {
|
||||
const out: Record<string, Record<string, unknown>[]> = {};
|
||||
for (const table of TABLES) {
|
||||
// to_jsonb hält bytea als \x…-Text; jsonb_populate_recordset wandelt beim Zurückspielen zurück.
|
||||
const { rows } = await client.query(`select coalesce(jsonb_agg(to_jsonb(t) order by to_jsonb(t)::text), '[]'::jsonb) as rows from ${table} t`);
|
||||
const { rows } = await client.query(
|
||||
`select coalesce(jsonb_agg(to_jsonb(t) order by to_jsonb(t)::text), '[]'::jsonb) as rows from ${table} t ${ONLY_OWN[table] ?? ""}`,
|
||||
);
|
||||
out[table] = rows[0].rows;
|
||||
}
|
||||
return out;
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
+5
-2
@@ -1,6 +1,6 @@
|
||||
import "server-only";
|
||||
import type { PoolClient } from "pg";
|
||||
import { currentPrices, dishCost, priceClasses, type DishCost, type PriceClass, type PricePoint } from "./pricing";
|
||||
import { currentPrices, dishCost, priceClasses, withGroupPrices, type DishCost, type PriceClass, type PricePoint } from "./pricing";
|
||||
import { toBase, type BaseUnit, type InputUnit } from "./units";
|
||||
|
||||
// Preise und Kosten aus der Datenbank (Rechnen in lib/pricing.ts).
|
||||
@@ -25,7 +25,10 @@ export async function loadPrices(client: PoolClient, currency: string): Promise<
|
||||
from default_prices where currency = $1`,
|
||||
[currency],
|
||||
);
|
||||
return currentPrices(rows);
|
||||
const members = new Map<string, string[]>();
|
||||
for (const r of (await client.query("select id, parent_id from ingredients where parent_id is not null")).rows as { id: string; parent_id: string }[])
|
||||
members.set(r.parent_id, [...(members.get(r.parent_id) ?? []), r.id]);
|
||||
return withGroupPrices(currentPrices(rows), members);
|
||||
}
|
||||
|
||||
/** Kosten pro Portion je Gericht (alle oder die genannten). */
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
import "server-only";
|
||||
import type { PoolClient } from "pg";
|
||||
import { withAuth } from "./db";
|
||||
|
||||
// Widmung (26.11.35): „foodplanhero by Maike“. Name, Foto und Text je Haushalt;
|
||||
// das Foto liegt wie die Gerichtsfotos unter /app/data/fotos/<haushalt>/.
|
||||
|
||||
export type Dedication = { name: string | null; text: string | null; photo: string | null };
|
||||
|
||||
export async function getDedication(client: PoolClient): Promise<Dedication> {
|
||||
const { rows } = await client.query(
|
||||
`select dedication_name as name, dedication_text as text, dedication_photo as photo from households limit 1`,
|
||||
);
|
||||
return rows[0] ?? { name: null, text: null, photo: null };
|
||||
}
|
||||
|
||||
/**
|
||||
* Vor der Anmeldung (Anmelden, Startbild) kennt die App keinen Haushalt. Auf einer
|
||||
* Box gibt es in aller Regel genau einen; gezeigt wird der älteste.
|
||||
*/
|
||||
export async function publicDedication(): Promise<(Dedication & { householdId: string }) | null> {
|
||||
return withAuth(async (c) => {
|
||||
const { rows } = await c.query(
|
||||
`select id as "householdId", dedication_name as name, dedication_text as text, dedication_photo as photo
|
||||
from households order by created_at limit 1`,
|
||||
);
|
||||
return rows[0] ?? null;
|
||||
});
|
||||
}
|
||||
|
||||
/** Version des Fotos für die Adresse (?v=…), aus der Prüfsumme im Dateinamen. */
|
||||
export const photoVersion = (photo: string | null) => photo?.split("-").at(-1)?.replace(".webp", "") ?? "";
|
||||
+60
-18
@@ -5,14 +5,15 @@ 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 { toBase, type BaseUnit, type InputUnit } from "./units";
|
||||
import { impliedKitchenUnit, isKitchenUnit, isPackKind, toBase, type BaseUnit, 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(…).
|
||||
|
||||
export const INPUT_UNITS = ["g", "kg", "ml", "l", "piece", "tbsp", "tsp", "pinch"] as const;
|
||||
// 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;
|
||||
|
||||
export const dishInput = z.object({
|
||||
title: z.string().trim().min(1).max(120),
|
||||
@@ -37,6 +38,8 @@ export const dishInput = z.object({
|
||||
name: z.string().trim().min(1).max(80),
|
||||
pack: z.number().positive().max(100000).nullable().optional(),
|
||||
cookMinutes: z.number().int().min(1).max(240).nullable().optional(),
|
||||
// „Für alle Gerichte merken“ (26.11.38): gilt dann für den ganzen Haushalt.
|
||||
remember: z.boolean().optional(),
|
||||
})
|
||||
.nullable()
|
||||
.optional(),
|
||||
@@ -78,13 +81,19 @@ export type DishDetail = DishSummary & {
|
||||
note: string | null;
|
||||
isStaple: boolean;
|
||||
product: Product | null;
|
||||
/** Eingegebenes Küchenmaß („2 EL“, „1 Dose“), sonst null (26.11.39). */
|
||||
displayUnit: KitchenUnit | 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;
|
||||
}[];
|
||||
// timerFrom: Name des Produkts, wenn der Timer von seiner Packung stammt.
|
||||
steps: { section: Section; text: string; timerSeconds: number | null; ingredientIds: string[]; timerFrom?: string }[];
|
||||
};
|
||||
|
||||
/** Produkt an einer Zutat des Gerichts; pack in der Basiseinheit der Zutat. */
|
||||
export type Product = { name: string; pack: number | null; cookMinutes: number | null };
|
||||
export type Product = { name: string; pack: number | null; cookMinutes: number | null; fromHousehold?: boolean };
|
||||
|
||||
/** Alle Namen einer Zutat (jede Sprache, Einzahl, Synonyme) — für die Zuordnung zu Schritten. */
|
||||
export function stepIngredient(e: IngredientEntry): StepIngredient {
|
||||
@@ -104,11 +113,13 @@ export async function getDish(client: PoolClient, id: string, locale: string): P
|
||||
const dish = (await client.query(`select ${summaryColumns}, source_url as "sourceUrl" from dishes where id = $1 and archived_at is null`, [id]))
|
||||
.rows[0];
|
||||
if (!dish) return null;
|
||||
const entries = new Map((await allIngredients()).map((i) => [i.id, i]));
|
||||
const entries = new Map((await allIngredients(client)).map((i) => [i.id, i]));
|
||||
const ingredients = (
|
||||
await client.query(
|
||||
`select ingredient_id, qty_per_portion, unit, note, is_staple, product, product_pack::float as product_pack, product_cook_minutes
|
||||
from dish_ingredients where dish_id = $1 order by position`,
|
||||
`select di.ingredient_id, di.qty_per_portion, di.unit, di.note, di.is_staple, di.product, di.product_pack::float as product_pack, di.display_unit,
|
||||
di.product_cook_minutes, hp.product as house_product, hp.product_pack::float as house_pack, hp.cook_minutes as house_cook
|
||||
from dish_ingredients di left join household_products hp on hp.ingredient_id = di.ingredient_id
|
||||
where di.dish_id = $1 order by di.position`,
|
||||
[id],
|
||||
)
|
||||
).rows.map((r) => ({
|
||||
@@ -119,7 +130,20 @@ export async function getDish(client: PoolClient, id: string, locale: string): P
|
||||
unit: r.unit,
|
||||
note: r.note,
|
||||
isStaple: r.is_staple,
|
||||
product: r.product ? { name: r.product, pack: r.product_pack, cookMinutes: r.product_cook_minutes } : null,
|
||||
// Produkt am Gericht, sonst das Lieblingsprodukt des Haushalts für diese Zutat (26.11.38).
|
||||
product: r.product
|
||||
? { name: r.product, pack: r.product_pack, cookMinutes: r.product_cook_minutes }
|
||||
: 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,
|
||||
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,
|
||||
kitchenUnit: entries.get(r.ingredient_id)?.kitchenUnit ?? null,
|
||||
})).map((i) => ({
|
||||
...i,
|
||||
// Ohne eingegebenes Maß (ältere Gerichte, Vorlagen): Löffel oder Gebinde, wo es passt (26.11.39).
|
||||
displayUnit: i.displayUnit ?? impliedKitchenUnit(i.qtyPerPortion * 4, i.unit, i.kitchenUnit, i.packKind, i.packSize),
|
||||
}));
|
||||
const rows = (
|
||||
await client.query("select section, text, timer_seconds, ingredient_ids from dish_steps where dish_id = $1 order by position", [id])
|
||||
@@ -161,16 +185,26 @@ export class InvalidAmount extends Error {}
|
||||
|
||||
/** Legt an (id leer) oder ersetzt Inhalt, Zutaten und Schritte. Gibt die Kennung zurück. */
|
||||
export async function saveDish(client: PoolClient, householdId: string, memberId: string, input: DishInput, id?: string): Promise<string> {
|
||||
const all = await allIngredients();
|
||||
const units = new Map(all.map((i) => [i.id, i.unit]));
|
||||
const all = await allIngredients(client);
|
||||
const byId = new Map(all.map((i) => [i.id, i]));
|
||||
const house = new Map(
|
||||
(await client.query("select ingredient_id, product_pack::float as pack from household_products")).rows.map((r) => [r.ingredient_id as string, r.pack as number | null]),
|
||||
);
|
||||
const rows = input.ingredients.map((i, position) => {
|
||||
const base = units.get(i.ingredientId);
|
||||
if (!base) throw new InvalidAmount(i.ingredientId);
|
||||
const total = toBase(i.qty, i.unit as InputUnit, base);
|
||||
const entry = byId.get(i.ingredientId);
|
||||
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 total = toBase(i.qty, unit, base, size);
|
||||
if (total === null) throw new InvalidAmount(i.ingredientId);
|
||||
// Packung in der Einheit der Zeile → Basiseinheit („500 g“, „1 kg“ → 1000).
|
||||
const pack = i.product?.pack ? toBase(i.product.pack, i.unit as InputUnit, base) : null;
|
||||
return { ...i, base, perPortion: Math.round((total / input.portions) * 1000) / 1000, position, pack };
|
||||
const displayUnit = isKitchenUnit(unit) ? unit : null;
|
||||
return { ...i, base, perPortion: Math.round((total / input.portions) * 1000) / 1000, position, pack, displayUnit };
|
||||
});
|
||||
const values = [
|
||||
input.title,
|
||||
@@ -202,11 +236,19 @@ export async function saveDish(client: PoolClient, householdId: string, memberId
|
||||
for (const r of rows) {
|
||||
await client.query(
|
||||
`insert into dish_ingredients (household_id, dish_id, ingredient_id, qty_per_portion, unit, note, position,
|
||||
product, product_pack, product_cook_minutes)
|
||||
values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)`,
|
||||
product, product_pack, product_cook_minutes, display_unit)
|
||||
values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)`,
|
||||
[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.product?.name ?? null, r.product ? r.pack : null, r.product?.cookMinutes ?? null, r.displayUnit],
|
||||
);
|
||||
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)
|
||||
on conflict (household_id, ingredient_id) do update set product = excluded.product, product_pack = excluded.product_pack,
|
||||
cook_minutes = excluded.cook_minutes, updated_at = now()`,
|
||||
[householdId, r.ingredientId, r.product.name, r.pack, r.product.cookMinutes ?? null],
|
||||
);
|
||||
}
|
||||
}
|
||||
// Abschnitte: was das Formular sagt, sonst nach den Verben; Zutaten je Schritt aus dem Text.
|
||||
const own = all.filter((e) => input.ingredients.some((i) => i.ingredientId === e.id)).map(stepIngredient);
|
||||
|
||||
@@ -9,8 +9,16 @@ export type Nameable = { names: Record<string, string>; forms?: Forms | null; un
|
||||
/** Einzahl bis einschließlich 1 — also auch für ½ und ¼. */
|
||||
export const isOne = (qty: number) => qty > 0 && qty <= 1 + 1e-9;
|
||||
|
||||
// „Gehackte Tomaten (Dose)“ neben „400 g (1 Dose)“ wäre doppelt: Steht das Gebinde
|
||||
// schon in der Menge (26.11.39), fällt der Hinweis am Namen weg.
|
||||
const PACK_HINT = /\s*\((dose|glas|tin|can|jar|bocal|boîte|lata|tarro)\)$/i;
|
||||
|
||||
/** Für Anzeigen, die Name und Formen schon in der Sprache haben (Gerichtsseite, Kochmodus). */
|
||||
export function labelFor(i: { name: string; forms: { one: string; other: string } | null; unit: string }, qty: number): string {
|
||||
export function labelFor(
|
||||
i: { name: string; forms: { one: string; other: string } | null; unit: string; displayUnit?: string | null },
|
||||
qty: number,
|
||||
): string {
|
||||
if (i.displayUnit && ["can", "jar", "pack"].includes(i.displayUnit)) return i.name.replace(PACK_HINT, "");
|
||||
if (i.unit !== "piece" || !i.forms) return i.name;
|
||||
return isOne(qty) ? i.forms.one : i.forms.other;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// ohne Rücksicht auf Groß-/Kleinschreibung und Akzente („creme“ findet
|
||||
// „Crème fraîche“). Rein, ohne Datenbank — lib/ingredients.ts lädt die Liste.
|
||||
|
||||
import type { KitchenUnit, PackKind } from "./units";
|
||||
|
||||
export type IngredientEntry = {
|
||||
id: string;
|
||||
key: string;
|
||||
@@ -10,6 +12,17 @@ export type IngredientEntry = {
|
||||
names: Record<string, string>;
|
||||
synonyms: string[];
|
||||
forms?: Partial<Record<string, { one: string; other: string }>> | null;
|
||||
/** Oberbegriff (Pasta, Reis …), selbst wählbar als „beliebige Sorte“. */
|
||||
isGroup?: boolean;
|
||||
/** Sorte einer Gruppe („spaghetti“ → „pasta“). */
|
||||
parentId?: string | null;
|
||||
/** Eigene Zutat des Haushalts. */
|
||||
own?: boolean;
|
||||
/** Übliches Küchenmaß, vorgewählt im Formular (26.11.39). */
|
||||
kitchenUnit?: KitchenUnit | null;
|
||||
/** Übliches Gebinde und seine Größe in der Basiseinheit (Haushaltsgröße schon eingerechnet). */
|
||||
packKind?: PackKind | null;
|
||||
packSize?: number | null;
|
||||
};
|
||||
|
||||
export function normalize(text: string): string {
|
||||
@@ -37,10 +50,22 @@ export function searchIngredients(list: IngredientEntry[], query: string, locale
|
||||
else if (one.startsWith(q)) score = 75;
|
||||
else if (name.split(" ").some((w) => w.startsWith(q))) score = 60;
|
||||
else if (name.includes(q)) score = 40;
|
||||
// Ein Oberbegriff zählt mit seinen Synonymen wie mit seinem Namen: „Nudeln“ meint Pasta.
|
||||
else if (entry.isGroup && entry.synonyms.some((s) => normalize(s).startsWith(q))) score = 85;
|
||||
else if (entry.synonyms.some((s) => normalize(s).startsWith(q))) score = 30;
|
||||
else if (entry.synonyms.some((s) => normalize(s).includes(q))) score = 20;
|
||||
else if (Object.values(entry.names).some((n) => normalize(n).startsWith(q))) score = 10;
|
||||
if (score) scored.push({ entry, score: score - name.length / 100 });
|
||||
}
|
||||
return scored.sort((a, b) => b.score - a.score).slice(0, limit).map((s) => s.entry);
|
||||
const ranked = scored.sort((a, b) => b.score - a.score).map((s) => s.entry);
|
||||
// Produktgruppen (26.11.38): Trifft die Suche einen Oberbegriff („Nudeln“ → Pasta),
|
||||
// kommt er zuerst und gleich dahinter alle seine Sorten — auch Spaghetti und Penne,
|
||||
// die selbst nicht „Nudeln“ heißen. Danach der Rest.
|
||||
const group = ranked.find((e) => e.isGroup && ranked.indexOf(e) < 3);
|
||||
if (!group) return ranked.slice(0, limit);
|
||||
const members = list
|
||||
.filter((e) => e.parentId === group.id)
|
||||
.sort((a, b) => (a.names[locale] ?? a.names.en ?? "").localeCompare(b.names[locale] ?? b.names.en ?? "", locale));
|
||||
const seen = new Set([group.id, ...members.map((m) => m.id)]);
|
||||
return [group, ...members, ...ranked.filter((e) => !seen.has(e.id))].slice(0, Math.max(limit, members.length + 3));
|
||||
}
|
||||
+65
-5
@@ -1,14 +1,19 @@
|
||||
import "server-only";
|
||||
import type { PoolClient } from "pg";
|
||||
import { pool } from "@/lib/db";
|
||||
import type { IngredientEntry } from "./ingredient-search";
|
||||
|
||||
// Die kanonischen Zutaten sind global und ändern sich nur beim Einspielen
|
||||
// (Neustart). Einmal laden, im Speicher halten.
|
||||
// (Neustart). Einmal laden, im Speicher halten. Eigene Zutaten eines Haushalts
|
||||
// (26.11.38) kommen je Anfrage dazu — mit einem Client in seinem Kontext.
|
||||
let cache: Promise<IngredientEntry[]> | null = null;
|
||||
|
||||
export function allIngredients(): Promise<IngredientEntry[]> {
|
||||
const COLUMNS = `id, key, default_unit as unit, category, names, synonyms, forms, is_group as "isGroup", parent_id as "parentId",
|
||||
kitchen_unit as "kitchenUnit", pack_kind as "packKind", pack_size::float as "packSize"`;
|
||||
|
||||
function globalIngredients(): Promise<IngredientEntry[]> {
|
||||
cache ??= pool
|
||||
.query("select id, key, default_unit as unit, category, names, synonyms, forms from ingredients order by key")
|
||||
.query(`select ${COLUMNS} from ingredients where household_id is null order by key`)
|
||||
.then((r) => r.rows as IngredientEntry[])
|
||||
.catch((error) => {
|
||||
cache = null;
|
||||
@@ -17,7 +22,62 @@ export function allIngredients(): Promise<IngredientEntry[]> {
|
||||
return cache;
|
||||
}
|
||||
|
||||
export async function ingredientName(id: string, locale: string): Promise<string> {
|
||||
const entry = (await allIngredients()).find((i) => i.id === id);
|
||||
/**
|
||||
* Alle Zutaten; mit client (withHousehold) auch die eigenen des Haushalts und
|
||||
* seine Gebindegrößen (26.11.39: „bei uns hat die Dose 500 g“).
|
||||
*/
|
||||
export async function allIngredients(client?: PoolClient): Promise<IngredientEntry[]> {
|
||||
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]),
|
||||
);
|
||||
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;
|
||||
}
|
||||
|
||||
/** 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> {
|
||||
const entry = (await allIngredients(client)).find((i) => i.id === ingredientId);
|
||||
if (!entry?.packKind) 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],
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
export async function ingredientName(id: string, locale: string, client?: PoolClient): Promise<string> {
|
||||
const entry = (await allIngredients(client)).find((i) => i.id === id);
|
||||
return entry?.names[locale] ?? entry?.names.en ?? "";
|
||||
}
|
||||
|
||||
export class OwnIngredientRefused extends Error {}
|
||||
|
||||
/**
|
||||
* Eigene Zutat für den Haushalt anlegen (26.11.38). Gehört sie zu einer Gruppe,
|
||||
* steht sie im Regal der Gruppe; sonst im gewählten. Den Namen gibt es danach in
|
||||
* jeder Sprache gleich — der Haushalt hat ihn so geschrieben.
|
||||
*/
|
||||
export async function createOwnIngredient(
|
||||
client: PoolClient,
|
||||
householdId: string,
|
||||
input: { name: string; unit: "g" | "ml" | "piece"; parentId: string | null; category: string },
|
||||
): Promise<IngredientEntry> {
|
||||
const name = input.name.trim();
|
||||
const all = await allIngredients(client);
|
||||
const lower = name.toLocaleLowerCase("de");
|
||||
if (all.some((e) => Object.values(e.names).some((n) => n.toLocaleLowerCase("de") === lower))) throw new OwnIngredientRefused("exists");
|
||||
const parent = input.parentId ? all.find((e) => e.id === input.parentId && e.isGroup) : null;
|
||||
if (input.parentId && !parent) throw new OwnIngredientRefused("group");
|
||||
const names = { de: name, en: name, fr: name, es: name };
|
||||
const { rows } = await client.query(
|
||||
`insert into ingredients (key, category, default_unit, names, synonyms, household_id, parent_id)
|
||||
values ('own_' || replace(gen_random_uuid()::text, '-', ''), $1, $2, $3, '{}', $4, $5)
|
||||
returning ${COLUMNS}, true as own`,
|
||||
[parent?.category ?? input.category, input.unit, JSON.stringify(names), householdId, parent?.id ?? null],
|
||||
);
|
||||
return rows[0] as IngredientEntry;
|
||||
}
|
||||
+3
-1
@@ -3,6 +3,7 @@ import type { PoolClient } from "pg";
|
||||
import type { Round } from "./rounds";
|
||||
import { costOverview } from "./costs";
|
||||
import { freshnessOf, suggest, type Candidate, type Reason } from "./suggest";
|
||||
import { lastMine } from "./wishes";
|
||||
|
||||
// Der Plan einer Runde: Slots in Reihenfolge, je mit Gericht, Portionen, Koch
|
||||
// und Grund. Der Vorschlag kommt aus lib/suggest.ts; gesperrte Slots bleiben.
|
||||
@@ -66,7 +67,7 @@ export async function makeSuggestion(client: PoolClient, householdId: string, ro
|
||||
const wishes = (
|
||||
await client.query(
|
||||
`select w.dish_id as "dishId", w.member_id as "memberId", m.display_name as "memberName", w.is_veto as "isVeto",
|
||||
w.wants_to_cook as "wantsToCook"
|
||||
w.wants_to_cook as "wantsToCook", w.is_mine as "isMine"
|
||||
from wishes w join members m on m.id = w.member_id where w.round_id = $1 order by w.created_at`,
|
||||
[round.id],
|
||||
)
|
||||
@@ -86,6 +87,7 @@ export async function makeSuggestion(client: PoolClient, householdId: string, ro
|
||||
previousRound: new Set(previous),
|
||||
keep: kept.map((k) => k.dish_id).filter((d): d is string => !!d),
|
||||
expensivePerSlots: (await client.query("select expensive_per_slots as n from households")).rows[0]?.n ?? 4,
|
||||
owed: new Set((await lastMine(client, round.id)).filter((m) => !m.served).map((m) => m.memberId)),
|
||||
});
|
||||
const used = new Set(kept.map((k) => k.position));
|
||||
let position = 1;
|
||||
|
||||
@@ -41,6 +41,30 @@ export function currentPrices(points: PricePoint[]): Map<string, PricePoint> {
|
||||
return best;
|
||||
}
|
||||
|
||||
/**
|
||||
* Produktgruppen (26.11.38): Hat ein Oberbegriff („Pasta“) keinen besseren Preis als
|
||||
* seine Sorten, gilt der Schnitt der Sorten mit dem besten Rang (Bon vor Richtpreis),
|
||||
* in derselben Einheit. Wer Spaghetti per Bon kennt, kennt damit auch „Pasta“.
|
||||
*/
|
||||
export function withGroupPrices(prices: Map<string, PricePoint>, members: Map<string, string[]>): Map<string, PricePoint> {
|
||||
const out = new Map(prices);
|
||||
for (const [groupId, ids] of members) {
|
||||
const own = prices.get(groupId);
|
||||
const known = ids.map((id) => prices.get(id)).filter((p): p is PricePoint => !!p && (!own || p.unit === own.unit));
|
||||
if (!known.length) continue;
|
||||
const best = Math.max(...known.map(rank));
|
||||
if (own && rank(own) >= best) continue;
|
||||
const top = known.filter((p) => rank(p) === best);
|
||||
out.set(groupId, {
|
||||
...top[0]!,
|
||||
ingredientId: groupId,
|
||||
pricePerUnit: top.reduce((sum, p) => sum + p.pricePerUnit, 0) / top.length,
|
||||
observedAt: top.map((p) => p.observedAt).sort().at(-1)!,
|
||||
});
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
export function dishCost(lines: CostLine[], prices: Map<string, PricePoint>): DishCost {
|
||||
const own = lines.filter((l) => !l.staple);
|
||||
let sum = 0;
|
||||
|
||||
+116
-15
@@ -4,29 +4,75 @@
|
||||
// bestätigt. Datum: das Modell nennt es wie gedruckt, gerechnet wird hier.
|
||||
|
||||
export const RECEIPT_PROMPT = `You read a supermarket receipt photo. Answer with one JSON object only, no prose:
|
||||
{"store": string|null, "date": string|null, "total": number|null,
|
||||
"lines": [{"text": string, "qty": number|null, "unit_price": number|null, "total_price": number|null}]}
|
||||
Rules: copy each article line's text exactly as printed (abbreviations included). "qty" only if a quantity is printed
|
||||
(e.g. "2 x 1,29"), else null. Prices in the receipt's currency as numbers (1,29 → 1.29). Skip deposit returns, payment,
|
||||
change, tax and sum lines. "date" exactly as printed (e.g. "07.11.26"). Never invent a line, a price or a date.`;
|
||||
{"store": string|null, "date": string|null, "total": number|null, "lines": [[text, qty, unit_price, total_price], ...]}
|
||||
One short array per article, in printed order. text: the article text exactly as printed (abbreviations included),
|
||||
without its price and without the tax class after it. qty and unit_price only if a quantity or weight is printed, else null.
|
||||
total_price: the article's price. Prices as numbers in the receipt's currency (1,29 → 1.29).
|
||||
Some stores (Aldi, Lidl) print the quantity ABOVE its article: a line "2 x 1,49 €" or "0,416 kg x 2,79 €/kg" belongs to
|
||||
the next article line — put it into that article's qty and unit_price, never as a line of its own.
|
||||
Skip deposit lines (Pfand, Pfandwert, Leergut), payment, change, tax and sum lines. "total": the amount to pay.
|
||||
"date" exactly as printed (e.g. "07.11.26"), null if none is visible. Never invent a line, a price or a date.`;
|
||||
|
||||
export type ReadLine = { text: string; qty: number | null; unitPrice: number | null; totalPrice: number | null };
|
||||
export type ReadReceipt = { store: string | null; date: string | null; total: number | null; lines: ReadLine[] };
|
||||
/** weighed: Menge stammt aus einer Gewichtszeile („0,416 kg x 2,79 €/kg“), qty ist dann in kg. */
|
||||
export type ReadLine = { text: string; qty: number | null; unitPrice: number | null; totalPrice: number | null; weighed?: boolean };
|
||||
export type ReadReceipt = { store: string | null; date: string | null; total: number | null; lines: ReadLine[]; partial?: boolean };
|
||||
|
||||
const money = (v: unknown): number | null => (typeof v === "number" && Number.isFinite(v) && v >= 0 && v < 10000 ? Math.round(v * 100) / 100 : null);
|
||||
const amount = (v: unknown): number | null => (typeof v === "number" && v > 0 && v < 1000 ? v : null);
|
||||
const num = (t: string) => Number(t.replace(",", "."));
|
||||
|
||||
// Pfand ist kein Lebensmittel und Leergut kein Einkauf.
|
||||
const DEPOSIT = /\b(pfand\w*|leergut\w*|einweg|mehrweg)\b/i;
|
||||
// Eine Mengen- oder Gewichtszeile für sich: „2 x 1,49 €“, „0,416 kg x 2,79 €/kg“.
|
||||
const QTY_LINE = /^-?(\d+(?:[.,]\d+)?)\s*(?:kg|stk?)?\s*[x×*]\s*(\d+[.,]\d{2})\s*(?:€|eur)?\s*(?:\/\s*kg)?$/i;
|
||||
// Preis und Steuerklasse am Zeilenende, falls das Modell sie mit abschreibt: „… 2,98 € 1“.
|
||||
const TRAILING_PRICE = /\s+-?\d+[.,]\d{2}\s*(?:€|eur)?\s*[a-z0-9]?$/i;
|
||||
|
||||
function rawLine(raw: unknown): ReadLine | null {
|
||||
// Kurzform [text, qty, unit_price, total_price] oder die alte Objektform.
|
||||
const [t, q, u, p] = Array.isArray(raw)
|
||||
? raw
|
||||
: (() => {
|
||||
const l = (raw ?? {}) as Record<string, unknown>;
|
||||
return [l.text, l.qty, l.unit_price, l.total_price];
|
||||
})();
|
||||
const spaced = typeof t === "string" ? t.replace(/\s+/g, " ").trim() : "";
|
||||
// Eine Mengenzeile behält ihren Preis, sonst fällt der Stückpreis weg.
|
||||
const text = (QTY_LINE.test(spaced) ? spaced : spaced.replace(TRAILING_PRICE, "")).slice(0, 120);
|
||||
if (!text) return null;
|
||||
return { text, qty: amount(q), unitPrice: money(u), totalPrice: money(p) };
|
||||
}
|
||||
|
||||
/** Zeilen aufräumen: Mengenzeilen zum Artikel darunter, Pfand und Leergut weg. */
|
||||
export function tidyLines(lines: ReadLine[]): ReadLine[] {
|
||||
const out: ReadLine[] = [];
|
||||
let pending: { qty: number; unitPrice: number; weighed: boolean } | null = null;
|
||||
for (const line of lines) {
|
||||
const q = line.text.match(QTY_LINE);
|
||||
if (q) {
|
||||
const qty = num(q[1]!);
|
||||
pending = qty > 0 ? { qty, unitPrice: num(q[2]!), weighed: /kg\s*[x×*]/i.test(line.text) } : null; // „-41 x 0,25“ gehört zum Leergut
|
||||
continue;
|
||||
}
|
||||
if (DEPOSIT.test(line.text)) {
|
||||
pending = null;
|
||||
continue;
|
||||
}
|
||||
out.push(
|
||||
pending && line.qty === null
|
||||
? { ...line, qty: pending.qty, unitPrice: line.unitPrice ?? pending.unitPrice, ...(pending.weighed ? { weighed: true } : {}) }
|
||||
: line,
|
||||
);
|
||||
pending = null;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
/** Antwort des Bildmodells prüfen; ohne lesbare Zeile null. */
|
||||
export function fromReceiptReply(reply: unknown): ReadReceipt | null {
|
||||
const r = (reply ?? {}) as Record<string, unknown>;
|
||||
if (!Array.isArray(r.lines)) return null;
|
||||
const lines: ReadLine[] = [];
|
||||
for (const raw of r.lines.slice(0, 200)) {
|
||||
const l = (raw ?? {}) as Record<string, unknown>;
|
||||
const text = typeof l.text === "string" ? l.text.replace(/\s+/g, " ").trim().slice(0, 120) : "";
|
||||
if (!text) continue;
|
||||
const qty = typeof l.qty === "number" && l.qty > 0 && l.qty < 1000 ? l.qty : null;
|
||||
lines.push({ text, qty, unitPrice: money(l.unit_price), totalPrice: money(l.total_price) });
|
||||
}
|
||||
const lines = tidyLines(r.lines.slice(0, 300).map(rawLine).filter((l): l is ReadLine => !!l));
|
||||
if (!lines.length) return null;
|
||||
return {
|
||||
store: typeof r.store === "string" && r.store.trim() ? r.store.trim().slice(0, 80) : null,
|
||||
@@ -36,6 +82,45 @@ export function fromReceiptReply(reply: unknown): ReadReceipt | null {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Den Antworttext lesen. Ein langer Bon (Aldi, 50 Zeilen) kann das Modell über
|
||||
* sein Limit treiben; dann bricht das JSON mitten in den Zeilen ab. Statt „keine
|
||||
* Zeilen erkannt“ retten wir jede vollständige Zeile davor — der Mensch prüft ohnehin.
|
||||
*/
|
||||
export function receiptFromText(text: string): ReadReceipt | null {
|
||||
const cleaned = text.replace(/<think>[\s\S]*?<\/think>/g, "").replace(/```(?:json)?/g, "");
|
||||
const start = cleaned.indexOf("{");
|
||||
const end = cleaned.lastIndexOf("}");
|
||||
if (start >= 0 && end > start) {
|
||||
try {
|
||||
const whole = fromReceiptReply(JSON.parse(cleaned.slice(start, end + 1)));
|
||||
if (whole) return whole;
|
||||
} catch {}
|
||||
}
|
||||
const at = cleaned.search(/"lines"\s*:\s*\[/);
|
||||
if (at < 0) return null;
|
||||
const head = cleaned.slice(0, at);
|
||||
const field = (key: string) => head.match(new RegExp(`"${key}"\\s*:\\s*("(?:[^"\\\\]|\\\\.)*"|-?\\d+(?:\\.\\d+)?|null)`))?.[1];
|
||||
const value = (key: string) => {
|
||||
const v = field(key);
|
||||
try {
|
||||
return v ? JSON.parse(v) : null;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
const items: unknown[] = [];
|
||||
const body = cleaned.slice(at);
|
||||
const item = /\[\s*"(?:[^"\\]|\\.)*"\s*(?:,\s*(?:-?\d+(?:\.\d+)?|null)\s*){0,3}\]|\{[^{}]*"text"[^{}]*\}/g;
|
||||
for (const m of body.slice(body.indexOf("[") + 1).matchAll(item)) {
|
||||
try {
|
||||
items.push(JSON.parse(m[0]));
|
||||
} catch {}
|
||||
}
|
||||
const read = fromReceiptReply({ store: value("store"), date: value("date"), total: value("total"), lines: items });
|
||||
return read ? { ...read, partial: true } : null;
|
||||
}
|
||||
|
||||
/** „07.11.26“, „07.11.2026“, „2026-11-07“ → ISO-Datum; Unplausibles → null. */
|
||||
export function parseReceiptDate(text: string | null, today = new Date()): string | null {
|
||||
if (!text) return null;
|
||||
@@ -95,3 +180,19 @@ export function matchesProduct(line: string, product: string): boolean {
|
||||
const hits = ls.filter((l) => ps.some((p) => p.startsWith(l) || l.startsWith(p)));
|
||||
return hits.length >= 2 && hits.length / ls.length >= 0.6;
|
||||
}
|
||||
|
||||
/**
|
||||
* Preis je Grundeinheit (g, ml, Stück) einer Bonzeile: Zeilenpreis ÷ (Anzahl × Packung).
|
||||
* 2 × 400 g Hack für 17,58 € → 0,021975 € je g. Ohne Packung oder Preis: null — dann
|
||||
* merkt sich Lunch keinen Preis.
|
||||
*/
|
||||
export function unitPrice(total: number | null, qty: number | null, pack: number | null): number | null {
|
||||
if (total === null || !(total > 0) || pack === null || !(pack > 0)) return null;
|
||||
const amount = (qty && qty > 0 ? qty : 1) * pack;
|
||||
return amount > 0 ? total / amount : null;
|
||||
}
|
||||
|
||||
/** Zum Anzeigen: je 100 g / 100 ml, bei Stück je Stück. */
|
||||
export function pricePer(perUnit: number, unit: "g" | "ml" | "piece"): { price: number; per: "100g" | "100ml" | "piece" } {
|
||||
return unit === "piece" ? { price: perUnit, per: "piece" } : { price: perUnit * 100, per: unit === "g" ? "100g" : "100ml" };
|
||||
}
|
||||
+63
-31
@@ -3,13 +3,13 @@ import { mkdir, readFile, rm, writeFile } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import type { PoolClient } from "pg";
|
||||
import sharp from "sharp";
|
||||
import { AiNotConfigured, AiUnavailable, askJson } from "./ai";
|
||||
import { AiNotConfigured, AiUnavailable, askJson, askText } from "./ai";
|
||||
import { aiFor } from "./ai-settings";
|
||||
import { withHousehold } from "./db";
|
||||
import { searchIngredients, type IngredientEntry } from "./ingredient-search";
|
||||
import { allIngredients } from "./ingredients";
|
||||
import { PhotoRejected } from "./photos";
|
||||
import { fromReceiptReply, matchesProduct, normalizeLine, packFromText, RECEIPT_PROMPT, tokens } from "./receipt-read";
|
||||
import { matchesProduct, normalizeLine, packFromText, RECEIPT_PROMPT, receiptFromText, tokens, unitPrice } from "./receipt-read";
|
||||
|
||||
// Kassenbons (Konzept, „Bon-Pipeline, lokal“): Foto → Bildmodell liest Laden,
|
||||
// Datum, Zeilen → Zuordnung (gelernt, Produkt eines Gerichts, Suche, AI-Vorschlag)
|
||||
@@ -52,7 +52,7 @@ export async function createReceipt(client: PoolClient, householdId: string, mem
|
||||
return id;
|
||||
}
|
||||
|
||||
type Suggestion = { ingredientId: string | null; source: "alias" | "product" | "search" | "ai" | null; product: string | null; pack: { qty: number; unit: string } | null };
|
||||
type Suggestion = { ingredientId: string | null; source: "alias" | "product" | "search" | "ai" | "skip" | null; product: string | null; pack: { qty: number; unit: string } | null };
|
||||
|
||||
const MATCH_PROMPT = `You match supermarket receipt lines to ingredients. Answer with one JSON object only:
|
||||
{"matches": [{"line": number, "key": string|null}]}
|
||||
@@ -61,7 +61,7 @@ Never use a key that is not listed for that line.`;
|
||||
|
||||
/** Vorschläge je Zeile: gelernt → Produkt eines Gerichts → Suche → (gesammelt) AI. */
|
||||
export async function suggestLines(client: PoolClient, lines: string[], locale: string, ai: Awaited<ReturnType<typeof aiFor>>): Promise<Suggestion[]> {
|
||||
const list = await allIngredients();
|
||||
const list = await allIngredients(client);
|
||||
const byId = new Map(list.map((e) => [e.id, e]));
|
||||
const aliases = new Map(
|
||||
(await client.query("select raw_text_normalized as k, ingredient_id as i, pack_qty::float as q, pack_unit as u from ingredient_aliases")).rows.map((r) => [r.k as string, r]),
|
||||
@@ -73,7 +73,9 @@ export async function suggestLines(client: PoolClient, lines: string[], locale:
|
||||
const pack = packFromText(text);
|
||||
const alias = aliases.get(normalizeLine(text));
|
||||
if (alias) {
|
||||
out.push({ ingredientId: alias.i, source: "alias", product: null, pack: alias.q ? { qty: alias.q, unit: alias.u } : pack });
|
||||
// Ohne Zutat gelernt: „nicht zum Kochen“ (Toastbrot) — kein Vorschlag, kein Modell.
|
||||
if (!alias.i) out.push({ ingredientId: null, source: "skip", product: null, pack: null });
|
||||
else out.push({ ingredientId: alias.i, source: "alias", product: null, pack: alias.q ? { qty: alias.q, unit: alias.u } : pack });
|
||||
continue;
|
||||
}
|
||||
const prod = products.find((p) => matchesProduct(text, p.p));
|
||||
@@ -128,33 +130,45 @@ export async function processQueued(householdId: string, locale: string): Promis
|
||||
(
|
||||
await c.query(
|
||||
`update receipts set status = 'processing', attempts = attempts + 1
|
||||
where id = (select id from receipts where status = 'queued' and attempts < 3 order by created_at limit 1)
|
||||
returning id, photo_path`,
|
||||
where id = (select id from receipts where status = 'queued' and attempts < ${ATTEMPTS} order by created_at limit 1)
|
||||
returning id, photo_path, attempts`,
|
||||
)
|
||||
).rows[0] as { id: string; photo_path: string } | undefined,
|
||||
).rows[0] as { id: string; photo_path: string; attempts: number } | undefined,
|
||||
);
|
||||
if (!next) return;
|
||||
await readOne(householdId, next.id, next.photo_path, ai, locale);
|
||||
await readOne(householdId, next.id, next.photo_path, ai, locale, next.attempts);
|
||||
}
|
||||
} finally {
|
||||
running.delete(householdId);
|
||||
}
|
||||
}
|
||||
|
||||
async function readOne(householdId: string, id: string, photo: string, ai: NonNullable<Awaited<ReturnType<typeof aiFor>>>, locale: string) {
|
||||
// Ein langer Bon braucht Platz und Zeit: 50 Zeilen sind gut 2.000 Token Antwort,
|
||||
// dazu das Nachdenken; ein großes Bild liest das Modell auf der Box nicht in zwei Minuten.
|
||||
const READ = { maxTokens: 16_000, timeoutMs: 300_000 };
|
||||
const ATTEMPTS = 3;
|
||||
|
||||
async function readOne(householdId: string, id: string, photo: string, ai: NonNullable<Awaited<ReturnType<typeof aiFor>>>, locale: string, attempt: number) {
|
||||
const fail = (status: "queued" | "failed", error: string) =>
|
||||
withHousehold(householdId, (c) => c.query("update receipts set status = $2, error = $3 where id = $1", [id, status, error]));
|
||||
let read;
|
||||
try {
|
||||
const jpg = await readFile(path.join(root(), photo));
|
||||
read = fromReceiptReply(
|
||||
await askJson(ai, "vision", RECEIPT_PROMPT, [
|
||||
{ type: "text", text: "Read this receipt." },
|
||||
{ type: "image_url", image_url: { url: `data:image/jpeg;base64,${jpg.toString("base64")}` } },
|
||||
]),
|
||||
read = receiptFromText(
|
||||
await askText(
|
||||
ai,
|
||||
"vision",
|
||||
RECEIPT_PROMPT,
|
||||
[
|
||||
{ type: "text", text: "Read this receipt." },
|
||||
{ type: "image_url", image_url: { url: `data:image/jpeg;base64,${jpg.toString("base64")}` } },
|
||||
],
|
||||
READ,
|
||||
),
|
||||
);
|
||||
} catch (error) {
|
||||
if (error instanceof AiUnavailable || error instanceof AiNotConfigured) return fail("queued", "unavailable");
|
||||
// Nach dem letzten Versuch nicht ewig „wartet“: als fehlgeschlagen zeigen, mit „Nochmal“.
|
||||
if (error instanceof AiUnavailable || error instanceof AiNotConfigured) return fail(attempt >= ATTEMPTS ? "failed" : "queued", "unavailable");
|
||||
return fail("failed", "photo");
|
||||
}
|
||||
if (!read) return fail("failed", "unreadable");
|
||||
@@ -167,15 +181,20 @@ async function readOne(householdId: string, id: string, photo: string, ai: NonNu
|
||||
for (const [i, l] of read.lines.entries()) {
|
||||
const s = suggestions[i]!;
|
||||
await c.query(
|
||||
`insert into receipt_lines (household_id, receipt_id, position, raw_text, qty, unit_price, total_price, ingredient_id, pack_qty, pack_unit, match_source, product)
|
||||
values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)`,
|
||||
[householdId, id, i + 1, l.text, l.qty, l.unitPrice, l.totalPrice, s.ingredientId, s.pack?.qty ?? null, s.pack?.unit ?? null, s.source, s.product],
|
||||
`insert into receipt_lines (household_id, receipt_id, position, raw_text, qty, unit_price, total_price, ingredient_id, pack_qty, pack_unit, match_source, product, weighed, skipped)
|
||||
values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14)`,
|
||||
[
|
||||
householdId, id, i + 1, l.text, l.qty, l.unitPrice, l.totalPrice, s.ingredientId, s.pack?.qty ?? null, s.pack?.unit ?? null, s.source, s.product,
|
||||
// Gewogen: aus der Gewichtszeile, oder eine Menge mit Nachkommastellen (0,416 kg).
|
||||
!!l.weighed || (l.qty !== null && !Number.isInteger(l.qty)),
|
||||
s.source === "skip",
|
||||
],
|
||||
);
|
||||
}
|
||||
await c.query(
|
||||
`update receipts set status = 'review', error = null, store_name = $2, store_id = $3, total = $4,
|
||||
`update receipts set status = 'review', error = $6, store_name = $2, store_id = $3, total = $4,
|
||||
purchased_at = coalesce($5::date::timestamptz, created_at) where id = $1`,
|
||||
[id, read.store, store?.id ?? null, read.total, read.date],
|
||||
[id, read.store, store?.id ?? null, read.total, read.date, read.partial ? "partial" : null],
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -204,6 +223,8 @@ export type ReviewLine = {
|
||||
packUnit: string | null;
|
||||
source: string | null;
|
||||
product: string | null;
|
||||
weighed: boolean;
|
||||
skipped: boolean;
|
||||
};
|
||||
|
||||
export async function getReceipt(client: PoolClient, id: string, locale: string) {
|
||||
@@ -215,11 +236,11 @@ export async function getReceipt(client: PoolClient, id: string, locale: string)
|
||||
)
|
||||
).rows[0];
|
||||
if (!receipt) return null;
|
||||
const names = new Map((await allIngredients()).map((e) => [e.id, e]));
|
||||
const names = new Map((await allIngredients(client)).map((e) => [e.id, e]));
|
||||
const lines: ReviewLine[] = (
|
||||
await client.query(
|
||||
`select id, raw_text as text, qty::float, total_price::float as "totalPrice", ingredient_id as "ingredientId",
|
||||
pack_qty::float as "packQty", pack_unit as "packUnit", match_source as source, product
|
||||
pack_qty::float as "packQty", pack_unit as "packUnit", match_source as source, product, weighed, skipped
|
||||
from receipt_lines where receipt_id = $1 order by position`,
|
||||
[id],
|
||||
)
|
||||
@@ -231,7 +252,8 @@ export async function getReceipt(client: PoolClient, id: string, locale: string)
|
||||
return { ...receipt, lines, stores };
|
||||
}
|
||||
|
||||
export type Decision = { lineId: string; ingredientId: string | null; packQty: number | null; packUnit: "g" | "ml" | "piece" | null };
|
||||
/** skip: „nicht zum Kochen“ — Lunch merkt sich den Bontext ohne Zutat. */
|
||||
export type Decision = { lineId: string; ingredientId: string | null; packQty: number | null; packUnit: "g" | "ml" | "piece" | null; skip?: boolean };
|
||||
|
||||
export class ReceiptRefused extends Error {}
|
||||
|
||||
@@ -247,34 +269,44 @@ export async function confirmReceipt(
|
||||
): Promise<void> {
|
||||
const receipt = (await client.query("select status, photo_path, created_at from receipts where id = $1 for update", [id])).rows[0];
|
||||
if (!receipt || receipt.status !== "review") throw new ReceiptRefused("status");
|
||||
const units = new Map((await allIngredients()).map((e) => [e.id, e.unit]));
|
||||
const units = new Map((await allIngredients(client)).map((e) => [e.id, e.unit]));
|
||||
const when = input.purchasedAt ?? receipt.created_at.toISOString().slice(0, 10);
|
||||
await client.query("update receipts set store_id = $2, purchased_at = $3::date::timestamptz where id = $1", [id, input.storeId, when]);
|
||||
for (const d of input.decisions) {
|
||||
const line = (await client.query("select raw_text, qty::float, total_price::float as total from receipt_lines where id = $1 and receipt_id = $2", [d.lineId, id])).rows[0];
|
||||
if (!line) throw new ReceiptRefused("line");
|
||||
const unit = d.ingredientId ? units.get(d.ingredientId) : null;
|
||||
if (d.skip || !d.ingredientId) {
|
||||
await client.query("update receipt_lines set ingredient_id = null, pack_qty = null, pack_unit = null, skipped = $2, confirmed = true where id = $1", [d.lineId, !!d.skip]);
|
||||
// Nur, wer es selbst weggewischt hat, lehrt Lunch „nicht zum Kochen“; Unerkanntes bleibt offen.
|
||||
if (d.skip)
|
||||
await client.query(
|
||||
`insert into ingredient_aliases (household_id, raw_text_normalized, ingredient_id, pack_qty, pack_unit) values ($1, $2, null, null, null)
|
||||
on conflict (household_id, raw_text_normalized) do update set ingredient_id = null, pack_qty = null, pack_unit = null`,
|
||||
[householdId, normalizeLine(line.raw_text)],
|
||||
);
|
||||
continue;
|
||||
}
|
||||
const unit = units.get(d.ingredientId);
|
||||
if (d.ingredientId && !unit) throw new ReceiptRefused("ingredient");
|
||||
// Packung nur in der Einheit der Zutat (Gewicht zu Gewicht usw.).
|
||||
const pack = d.ingredientId && d.packQty && d.packQty > 0 && d.packUnit === unit ? d.packQty : null;
|
||||
await client.query("update receipt_lines set ingredient_id = $2, pack_qty = $3, pack_unit = $4, confirmed = true where id = $1", [
|
||||
await client.query("update receipt_lines set ingredient_id = $2, pack_qty = $3, pack_unit = $4, skipped = false, confirmed = true where id = $1", [
|
||||
d.lineId,
|
||||
d.ingredientId,
|
||||
pack,
|
||||
pack ? unit : null,
|
||||
]);
|
||||
if (!d.ingredientId) continue;
|
||||
await client.query(
|
||||
`insert into ingredient_aliases (household_id, raw_text_normalized, ingredient_id, pack_qty, pack_unit) values ($1, $2, $3, $4, $5)
|
||||
on conflict (household_id, raw_text_normalized) do update set ingredient_id = excluded.ingredient_id, pack_qty = excluded.pack_qty, pack_unit = excluded.pack_unit`,
|
||||
[householdId, normalizeLine(line.raw_text), d.ingredientId, pack, pack ? unit : null],
|
||||
);
|
||||
if (pack && line.total) {
|
||||
const amount = (line.qty ?? 1) * pack;
|
||||
const perUnit = unitPrice(line.total, line.qty, pack);
|
||||
if (perUnit !== null) {
|
||||
await client.query(
|
||||
`insert into price_points (household_id, ingredient_id, store_id, price_per_unit, unit, observed_at, source, receipt_id)
|
||||
values ($1, $2, $3, $4, $5, $6::date::timestamptz, 'receipt', $7)`,
|
||||
[householdId, d.ingredientId, input.storeId, line.total / amount, unit, when, id],
|
||||
[householdId, d.ingredientId, input.storeId, perUnit, unit, when, id],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+5
-3
@@ -2,6 +2,7 @@ import "server-only";
|
||||
import type { AiSettings } from "./ai";
|
||||
import { INPUT_UNITS, stepIngredient } from "./dishes";
|
||||
import { standardizeSteps } from "./recipe-standardize";
|
||||
import { withHousehold } from "./db";
|
||||
import { allIngredients } from "./ingredients";
|
||||
import { matchLines, type RawRecipe } from "./recipe-import";
|
||||
import { toBase } from "./units";
|
||||
@@ -11,9 +12,10 @@ import { toBase } from "./units";
|
||||
export async function draftFromRecipe(
|
||||
recipe: RawRecipe,
|
||||
locale: string,
|
||||
extra: { sourceUrl?: string | null; imageUrl?: string | null; ai?: AiSettings | null } = {},
|
||||
extra: { sourceUrl?: string | null; imageUrl?: string | null; ai?: AiSettings | null; householdId?: string } = {},
|
||||
) {
|
||||
const all = await allIngredients();
|
||||
// Mit Haushalt auch seine eigenen Zutaten (26.11.38).
|
||||
const all = extra.householdId ? await withHousehold(extra.householdId, (c) => allIngredients(c)) : await allIngredients();
|
||||
const lines = matchLines(recipe.ingredients, all, locale);
|
||||
// Schritte in die Hausform (Abschnitte, eine Handlung je Schritt, Timer aus der Quelle).
|
||||
const byId = new Map(all.map((e) => [e.id, e]));
|
||||
@@ -37,7 +39,7 @@ export async function draftFromRecipe(
|
||||
.map((l) => {
|
||||
// Maße, die das Formular nicht anbietet (cl, Tasse), gleich in die Basiseinheit.
|
||||
if (l.qty !== null && l.unit && !(INPUT_UNITS as readonly string[]).includes(l.unit)) {
|
||||
return { ingredient: l.ingredient, qty: toBase(l.qty, l.unit, l.ingredient!.unit), unit: l.ingredient!.unit, note: l.note };
|
||||
return { ingredient: l.ingredient, qty: toBase(l.qty, l.unit, l.ingredient!.unit, l.ingredient!.packSize), unit: l.ingredient!.unit, note: l.note };
|
||||
}
|
||||
return { ingredient: l.ingredient, qty: l.qty, unit: l.unit, note: l.note };
|
||||
}),
|
||||
|
||||
+27
-5
@@ -4,7 +4,7 @@
|
||||
// lib/fetch-safe.ts, das Zuordnen der Zutaten lib/ingredient-search.ts.
|
||||
|
||||
import { searchIngredients, type IngredientEntry } from "./ingredient-search";
|
||||
import { parseNumber, toBase, type InputUnit } from "./units";
|
||||
import { isPackKind, parseNumber, toBase, type InputUnit, type KitchenUnit, type PackKind } from "./units";
|
||||
|
||||
export type RawRecipe = {
|
||||
title: string;
|
||||
@@ -128,7 +128,12 @@ const UNIT_WORDS: [RegExp, InputUnit, number?][] = [
|
||||
[/^(cups?|tassen?|tazas?)$/i, "cup"],
|
||||
[/^(oz|ounces?)$/i, "g", 28.35],
|
||||
[/^(lbs?|pounds?)$/i, "g", 453.6],
|
||||
[/^(st(ü|ue)ck|stk\.?|pieces?|pi[eè]ces?|unidad(es)?|zehen?|cloves?|gousses?|dientes?|bund|bunch(es)?|bouquets?|manojos?|dosen?|cans?|tins?|bo[iî]tes?|latas?|scheiben?|slices?|tranches?|rebanadas?)$/i, "piece"],
|
||||
// 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"],
|
||||
[/^(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"],
|
||||
];
|
||||
|
||||
export type ParsedLine = { raw: string; qty: number | null; unit: InputUnit | null; factor: number; name: string };
|
||||
@@ -168,7 +173,14 @@ export function parseIngredientLine(raw: string): ParsedLine {
|
||||
|
||||
export type MatchedLine = {
|
||||
raw: string;
|
||||
ingredient: { id: string; name: string; unit: "g" | "ml" | "piece" } | null;
|
||||
ingredient: {
|
||||
id: string;
|
||||
name: string;
|
||||
unit: "g" | "ml" | "piece";
|
||||
kitchenUnit?: KitchenUnit | null;
|
||||
packKind?: PackKind | null;
|
||||
packSize?: number | null;
|
||||
} | null;
|
||||
qty: number | null;
|
||||
unit: InputUnit | null;
|
||||
note: string | null;
|
||||
@@ -183,10 +195,20 @@ export function matchLines(lines: string[], list: IngredientEntry[], locale: str
|
||||
const p = parseIngredientLine(raw);
|
||||
const hit = p.name ? searchIngredients(list, p.name, locale, 1)[0] ?? searchIngredients(list, p.name.split(" ").at(-1) ?? "", locale, 1)[0] : undefined;
|
||||
if (!hit) return { raw, ingredient: null, qty: null, unit: null, note: null };
|
||||
const ingredient = { id: hit.id, name: hit.names[locale] ?? hit.names.en ?? "", unit: hit.unit };
|
||||
const ingredient = {
|
||||
id: hit.id,
|
||||
name: hit.names[locale] ?? hit.names.en ?? "",
|
||||
unit: hit.unit,
|
||||
kitchenUnit: hit.kitchenUnit ?? null,
|
||||
packKind: hit.packKind ?? null,
|
||||
packSize: hit.packSize ?? null,
|
||||
};
|
||||
let qty = p.qty !== null ? p.qty * p.factor : null;
|
||||
let unit = p.unit;
|
||||
if (qty !== null && unit && toBase(qty, unit, hit.unit) === null) {
|
||||
// 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) {
|
||||
qty = null;
|
||||
unit = null;
|
||||
}
|
||||
|
||||
+16
-8
@@ -17,6 +17,7 @@ export type Item = {
|
||||
unit: "g" | "ml" | "piece" | null;
|
||||
packCount: number | null;
|
||||
packSize: number | null;
|
||||
packKind: "can" | "jar" | "pack" | "bunch" | null;
|
||||
dishes: string[];
|
||||
aislePosition: number | null;
|
||||
manual: boolean;
|
||||
@@ -54,14 +55,18 @@ export async function syncList(client: PoolClient, householdId: string, round: R
|
||||
const rows = (
|
||||
await client.query(
|
||||
`select s.id as slot, d.title, s.portions, di.ingredient_id, di.qty_per_portion::float as q, di.unit,
|
||||
i.category, i.pack_sizes::float[] as packs,
|
||||
i.category, i.pack_sizes::float[] as packs, i.pack_kind, hps.pack_size::float as house_size,
|
||||
(i.pantry_default or exists (select 1 from pantry_staples p where p.ingredient_id = i.id)) as pantry,
|
||||
coalesce(i.names ->> $2, i.names ->> 'de', i.key) as name,
|
||||
coalesce(i.forms -> $2, i.forms -> 'en') as form,
|
||||
di.product, di.product_pack::float as product_pack
|
||||
-- Produkt am Gericht, sonst das Lieblingsprodukt des Haushalts (26.11.38).
|
||||
coalesce(di.product, hp.product) as product,
|
||||
(case when di.product is not null then di.product_pack else hp.product_pack end)::float as product_pack
|
||||
from slots s join dishes d on d.id = s.dish_id
|
||||
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
|
||||
where s.round_id = $1 and s.cooked_at is null
|
||||
order by s.position`,
|
||||
[round.id, locale],
|
||||
@@ -70,6 +75,7 @@ export async function syncList(client: PoolClient, householdId: string, round: R
|
||||
const bySlot = new Map<string, PlanSlotInput>();
|
||||
const packs = new Map<string, number[]>();
|
||||
const forms = new Map<string, { one: string; other: string }>();
|
||||
const kinds = new Map<string, string>();
|
||||
// Produkte je Zutat aus den Gerichten der Runde: Name auf die Liste, Packung statt der Standardgrößen.
|
||||
const products = new Map<string, Set<string>>();
|
||||
const productPacks = new Map<string, number[]>();
|
||||
@@ -77,7 +83,9 @@ export async function syncList(client: PoolClient, householdId: string, round: R
|
||||
const slot: PlanSlotInput = bySlot.get(r.slot) ?? { dishTitle: r.title, portions: r.portions, ingredients: [] };
|
||||
slot.ingredients.push({ ingredientId: r.ingredient_id, name: r.name, unit: r.unit, qtyPerPortion: r.q, category: r.category, packs: r.packs, pantry: r.pantry });
|
||||
bySlot.set(r.slot, slot);
|
||||
packs.set(r.ingredient_id, r.packs ?? []);
|
||||
// Eigene Gebindegröße des Haushalts (26.11.39) statt der üblichen Packungen.
|
||||
packs.set(r.ingredient_id, r.house_size ? [r.house_size] : (r.packs ?? []));
|
||||
if (r.pack_kind) kinds.set(r.ingredient_id, r.pack_kind);
|
||||
if (r.form) forms.set(r.ingredient_id, r.form);
|
||||
if (r.product) {
|
||||
products.set(r.ingredient_id, (products.get(r.ingredient_id) ?? new Set()).add(r.product));
|
||||
@@ -89,15 +97,15 @@ export async function syncList(client: PoolClient, householdId: string, round: R
|
||||
for (const l of lines) {
|
||||
await client.query(
|
||||
`insert into shopping_items (household_id, round_id, ingredient_id, label, qty, needed, unit, pack_count, pack_size,
|
||||
dishes, aisle_position, pantry_state)
|
||||
values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)
|
||||
dishes, aisle_position, pantry_state, pack_kind)
|
||||
values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13)
|
||||
on conflict (round_id, ingredient_id) where not added_manually do update
|
||||
set label = excluded.label, qty = excluded.qty, needed = excluded.needed, unit = excluded.unit,
|
||||
pack_count = excluded.pack_count, pack_size = excluded.pack_size, dishes = excluded.dishes,
|
||||
pack_count = excluded.pack_count, pack_size = excluded.pack_size, pack_kind = excluded.pack_kind, dishes = excluded.dishes,
|
||||
aisle_position = excluded.aisle_position,
|
||||
pantry_state = case when excluded.pantry_state is null then null else coalesce(shopping_items.pantry_state, 'ask') end`,
|
||||
[householdId, round.id, l.ingredientId, label(l), l.qty, l.needed, l.unit, l.pack?.count ?? null, l.pack?.size ?? null,
|
||||
l.dishes, l.aislePosition, l.pantry ? "ask" : null],
|
||||
l.dishes, l.aislePosition, l.pantry ? "ask" : null, l.pack ? (kinds.get(l.ingredientId) ?? null) : null],
|
||||
);
|
||||
}
|
||||
await client.query(
|
||||
@@ -110,7 +118,7 @@ export async function syncList(client: PoolClient, householdId: string, round: R
|
||||
export async function listItems(client: PoolClient, roundId: string): Promise<Item[]> {
|
||||
const { rows } = await client.query(
|
||||
`select i.id, i.ingredient_id as "ingredientId", i.label, i.qty::float, i.needed::float, i.unit,
|
||||
i.pack_count as "packCount", i.pack_size::float as "packSize", i.dishes, i.aisle_position as "aislePosition",
|
||||
i.pack_count as "packCount", i.pack_size::float as "packSize", i.pack_kind as "packKind", i.dishes, i.aisle_position as "aislePosition",
|
||||
i.added_manually as manual, i.pantry_state as "pantryState", m.display_name as "checkedBy", i.checked_at::text as "checkedAt"
|
||||
from shopping_items i left join members m on m.id = i.checked_by
|
||||
where i.round_id = $1
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
// Startbilder der Web-App (26.11.35): je iPhone-Bildschirm ein Bild, sonst zeigt iOS keins.
|
||||
/** Die Bildschirme, für die iOS ein Startbild will (Pixel hochkant, CSS-Breite, -Höhe, Dichte). */
|
||||
export const STARTUP_SIZES: [number, number, number, number, number][] = [
|
||||
[1320, 2868, 440, 956, 3],
|
||||
[1290, 2796, 430, 932, 3],
|
||||
[1206, 2622, 402, 874, 3],
|
||||
[1179, 2556, 393, 852, 3],
|
||||
[1284, 2778, 428, 926, 3],
|
||||
[1170, 2532, 390, 844, 3],
|
||||
[1125, 2436, 375, 812, 3],
|
||||
[1242, 2688, 414, 896, 3],
|
||||
[828, 1792, 414, 896, 2],
|
||||
[750, 1334, 375, 667, 2],
|
||||
];
|
||||
|
||||
+24
-4
@@ -2,6 +2,8 @@
|
||||
// ohne Datenbank, damit jede Regel einzeln getestet ist. Regelbasiert und
|
||||
// nachvollziehbar: Jeder Slot trägt einen Grund.
|
||||
//
|
||||
// 0. „Mein Gericht“ jeder Person zuerst (26.11.30): kein Veto streicht es; wer
|
||||
// in der Vorrunde leer ausging, kommt bei zu wenig Slots zuerst dran.
|
||||
// 1. Alle Wünsche in die Slots, Favoriten der Runde zuerst.
|
||||
// 2. Vetos, kein Gericht der Vorrunde, nicht dieselbe Beilage zweimal hintereinander.
|
||||
// 3. Freie Slots mit „beliebt und lange nicht gehabt“ füllen.
|
||||
@@ -21,9 +23,9 @@ export type Candidate = {
|
||||
priceClass?: "cheap" | "normal" | "expensive" | null; // aus lib/pricing.ts, null ohne Preis
|
||||
};
|
||||
|
||||
export type WishInput = { dishId: string; memberId: string; memberName: string; isVeto: boolean; wantsToCook: boolean };
|
||||
export type WishInput = { dishId: string; memberId: string; memberName: string; isVeto: boolean; wantsToCook: boolean; isMine?: boolean };
|
||||
|
||||
export type Reason = { k: "wish"; n: string[] } | { k: "popular" } | { k: "longAgo" } | { k: "cheap" } | { k: "pool" } | { k: "locked" } | { k: "manual" };
|
||||
export type Reason = { k: "wish"; n: string[] } | { k: "mine"; n: string[] } | { k: "popular" } | { k: "longAgo" } | { k: "cheap" } | { k: "pool" } | { k: "locked" } | { k: "manual" };
|
||||
|
||||
export type Planned = { dishId: string; reason: Reason; cookMemberId: string | null };
|
||||
|
||||
@@ -66,21 +68,39 @@ export function suggest(input: {
|
||||
previousRound: Set<string>;
|
||||
keep?: string[]; // schon gesperrte Gerichte: zählen mit, kommen nicht doppelt
|
||||
expensivePerSlots?: number; // ein teures Gericht je so vielen Slots
|
||||
owed?: Set<string>; // Personen, deren „Mein Gericht“ in der Vorrunde nicht in den Plan kam
|
||||
now?: number;
|
||||
}): Planned[] {
|
||||
const now = input.now ?? Date.now();
|
||||
const byId = new Map(input.candidates.map((c) => [c.id, c]));
|
||||
const vetoed = new Set(input.wishes.filter((w) => w.isVeto).map((w) => w.dishId));
|
||||
const protectedDishes = new Set(input.wishes.filter((w) => w.isMine && !w.isVeto).map((w) => w.dishId));
|
||||
const vetoed = new Set(input.wishes.filter((w) => w.isVeto && !protectedDishes.has(w.dishId)).map((w) => w.dishId));
|
||||
const taken = new Set(input.keep ?? []);
|
||||
const free = input.slots - taken.size;
|
||||
if (free <= 0) return [];
|
||||
|
||||
const picked: (Planned & { c: Candidate })[] = [];
|
||||
const cookFor = (id: string) => input.wishes.find((w) => w.dishId === id && !w.isVeto && w.wantsToCook)?.memberId ?? null;
|
||||
|
||||
// 0. „Mein Gericht“: Wer leer ausging zuerst, sonst in Reihenfolge des Markierens.
|
||||
const owed = input.owed ?? new Set<string>();
|
||||
const mineBy = new Map<string, WishInput[]>();
|
||||
for (const w of input.wishes) if (w.isMine && !w.isVeto && byId.has(w.dishId)) mineBy.set(w.dishId, [...(mineBy.get(w.dishId) ?? []), w]);
|
||||
const mineOrder = [...mineBy]
|
||||
.filter(([id]) => !taken.has(id))
|
||||
.map(([id, ws], i) => ({ id, ws, i, first: ws.some((w) => owed.has(w.memberId)) ? 0 : 1 }))
|
||||
.sort((a, b) => a.first - b.first || a.i - b.i);
|
||||
for (const { id, ws } of mineOrder) {
|
||||
if (picked.length >= free) break;
|
||||
picked.push({ dishId: id, c: byId.get(id)!, reason: { k: "mine", n: ws.map((w) => w.memberName) }, cookMemberId: cookFor(id) });
|
||||
taken.add(id);
|
||||
}
|
||||
|
||||
// 1. Wünsche, nach Zahl der Wünschenden, bei Gleichstand in Reihenfolge des Wünschens.
|
||||
const wished = new Map<string, WishInput[]>();
|
||||
for (const w of input.wishes) if (!w.isVeto && byId.has(w.dishId)) wished.set(w.dishId, [...(wished.get(w.dishId) ?? []), w]);
|
||||
const wishOrder = [...wished].filter(([id]) => !vetoed.has(id) && !taken.has(id)).sort((a, b) => b[1].length - a[1].length);
|
||||
|
||||
const picked: (Planned & { c: Candidate })[] = [];
|
||||
for (const [id, ws] of wishOrder) {
|
||||
if (picked.length >= free) break;
|
||||
picked.push({
|
||||
|
||||
+87
-2
@@ -4,8 +4,19 @@
|
||||
|
||||
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;
|
||||
export type PackKind = (typeof PACK_KINDS)[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 type KitchenUnit = (typeof KITCHEN_UNITS)[number];
|
||||
|
||||
export const isPackKind = (u: string): u is PackKind => (PACK_KINDS as readonly string[]).includes(u);
|
||||
export const isKitchenUnit = (u: string): u is KitchenUnit => (KITCHEN_UNITS as readonly string[]).includes(u);
|
||||
|
||||
/** Maße, die man tippt oder in Rezepten liest. */
|
||||
export type InputUnit = BaseUnit | "kg" | "l" | "cl" | "tbsp" | "tsp" | "pinch" | "cup";
|
||||
export type InputUnit = BaseUnit | "kg" | "l" | "cl" | "tbsp" | "tsp" | "pinch" | "cup" | PackKind;
|
||||
|
||||
/** Hochrechnen: Menge pro Portion × Portionen. */
|
||||
export function scale(qtyPerPortion: number, portions: number): number {
|
||||
@@ -21,9 +32,11 @@ const SOLID_G: Partial<Record<InputUnit, number>> = { g: 1, kg: 1000, tbsp: 12,
|
||||
/**
|
||||
* Eingabe in die Basiseinheit der Zutat bringen. Gibt null zurück, wenn die
|
||||
* Maße nicht zusammenpassen (z. B. „200 g“ Eier) — dann fragt die Oberfläche nach.
|
||||
* Ein Gebinde braucht seine Größe in der Basiseinheit („1 Dose“ × 400 g).
|
||||
*/
|
||||
export function toBase(qty: number, unit: InputUnit, base: BaseUnit): number | null {
|
||||
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;
|
||||
if (base === "piece") return unit === "piece" ? qty : null;
|
||||
if (unit === "piece") return null;
|
||||
if (base === "ml") {
|
||||
@@ -77,6 +90,78 @@ export function formatQuantity(qty: number, unit: BaseUnit, locale = "de"): Form
|
||||
return { amount: nf(rounded, 1), unit };
|
||||
}
|
||||
|
||||
/** 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;
|
||||
const f = base === "ml" ? VOLUME_ML[unit] : base === "g" ? SOLID_G[unit] : undefined;
|
||||
return f ? qty / f : null;
|
||||
}
|
||||
|
||||
/** Löffel und Prisen in Küchenbrüchen; ein Löffel wird nicht genauer als ein halber. */
|
||||
function spoons(qty: number, locale: string): string {
|
||||
return pieces(qty < 0.5 ? qty : Math.round(qty * 2) / 2, locale);
|
||||
}
|
||||
|
||||
export type KitchenFormatted = {
|
||||
/** Vorn stehende Zahl mit Maß: „2 EL“, „400 g“, „6“. */
|
||||
main: string;
|
||||
/** In Klammern dahinter: „30 ml“, „1 Dose“ — leer, wenn nichts zu sagen ist. */
|
||||
extra: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Anzeige mit Küchenmaß (Kai, 26.11.39): Löffel vorn, Gramm in Klammern —
|
||||
* „2 EL (30 ml)“; Gebinde hinten, Gramm vorn — „400 g (1 Dose)“. Ohne Küchenmaß
|
||||
* oder ohne bekannte Gebindegröße wie bisher. `word` liefert das Wort in der
|
||||
* Sprache („Dose“/„Dosen“), `count` entscheidet über Einzahl oder Mehrzahl.
|
||||
*/
|
||||
export function formatKitchen(
|
||||
qty: number,
|
||||
base: BaseUnit,
|
||||
display: KitchenUnit | null | undefined,
|
||||
packSize: number | null | undefined,
|
||||
locale: string,
|
||||
word: (unit: KitchenUnit, count: number) => string,
|
||||
): KitchenFormatted {
|
||||
const plain = formatQuantity(qty, base, locale);
|
||||
const plainText = `${plain.amount}${plain.unit ? ` ${plain.unit}` : ""}`;
|
||||
if (!display) return { main: plainText, extra: "" };
|
||||
const n = fromBase(qty, display, base, packSize);
|
||||
if (n === null) return { main: plainText, extra: "" };
|
||||
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);
|
||||
// Eine Prise wiegt nichts, was man nachwiegen würde — ohne Klammer.
|
||||
return { main: `${count} ${word(display, n)}`, extra: display === "pinch" || base === "piece" ? "" : plainText };
|
||||
}
|
||||
|
||||
/**
|
||||
* Küchenmaß für Mengen ohne eingegebenes Maß (ältere Gerichte, Vorlagen): Gebinde,
|
||||
* wenn es mindestens ein Viertel ist; Löffel, wenn es ½ bis 8 Löffel sind. Prisen
|
||||
* nie von selbst. Entschieden für die Menge des ganzen Rezepts, nicht je Portion.
|
||||
*/
|
||||
export function impliedKitchenUnit(
|
||||
qty: number,
|
||||
base: BaseUnit,
|
||||
kitchenUnit: KitchenUnit | null | undefined,
|
||||
packKind: PackKind | null | undefined,
|
||||
packSize: number | null | undefined,
|
||||
): KitchenUnit | null {
|
||||
if (packKind && packSize) {
|
||||
const n = qty / packSize;
|
||||
if (n >= 0.25 - 1e-9) return packKind;
|
||||
}
|
||||
if (kitchenUnit === "tbsp" || kitchenUnit === "tsp") {
|
||||
const n = fromBase(qty, kitchenUnit, base);
|
||||
if (n !== null && n >= 0.5 - 1e-9 && n <= 8 + 1e-9) return kitchenUnit;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/** 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;
|
||||
|
||||
+55
-12
@@ -5,8 +5,28 @@ import { useEffect, useRef, useState } from "react";
|
||||
// iOS (Web-App vom Home-Bildschirm): Nach dem Schließen der Tastatur bleibt eine
|
||||
// feste Leiste oft dort stehen, wo die Tastatur endete — mitten im Bild (Kai,
|
||||
// 7.11.2026). Deshalb: Während getippt wird, ist die Leiste weg; danach richtet sie
|
||||
// sich am sichtbaren Bereich (visualViewport) aus statt am Layout, das iOS zu kurz
|
||||
// stehen lässt, und ein Scroll auf der Stelle stößt das Neuvermessen an.
|
||||
// sich kurz am sichtbaren Bereich (visualViewport) aus.
|
||||
//
|
||||
// Nur kurz (26.11.32): Bis 26.11.31 hing die Korrektur an jedem Scroll- und
|
||||
// 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.
|
||||
|
||||
/** Wie lange nach dem Schließen der Tastatur nachgemessen wird. */
|
||||
export const SETTLE_MS = 1000;
|
||||
|
||||
/** Web-App vom Home-Bildschirm? Nur dort trat der Fehler auf; in Safari ist eine Lücke die Adressleiste. */
|
||||
export const isStandalone = () =>
|
||||
window.matchMedia?.("(display-mode: standalone)").matches || (navigator as Navigator & { standalone?: boolean }).standalone === true;
|
||||
|
||||
/** Abstand zwischen Unterkante des sichtbaren Bereichs und der des Layouts; 0, wenn nichts zu tun ist. */
|
||||
export function keyboardGap(vv: { offsetTop: number; height: number; scale: number }, layoutHeight: number): number {
|
||||
if (vv.scale > 1.01) return 0; // gezoomt: nicht eingreifen
|
||||
const gap = Math.round(vv.offsetTop + vv.height - layoutHeight);
|
||||
return gap > 40 && gap < 800 ? gap : 0; // kleine Lücken sind Adressleiste oder Gummiband, keine Tastatur
|
||||
}
|
||||
|
||||
const EDITABLE =
|
||||
'input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="range"]):not([type="file"]), textarea, select, [contenteditable=""], [contenteditable="true"]';
|
||||
@@ -25,38 +45,61 @@ export function useKeyboardSafeNav<T extends HTMLElement>() {
|
||||
|
||||
useEffect(() => {
|
||||
const vv = window.visualViewport;
|
||||
// Abstand zwischen Unterkante des sichtbaren Bereichs und der des Layouts.
|
||||
let until = 0; // Ende des Fensters nach dem Schließen der Tastatur
|
||||
const clear = () => {
|
||||
until = 0;
|
||||
if (ref.current) ref.current.style.transform = "";
|
||||
};
|
||||
const pin = () => {
|
||||
const el = ref.current;
|
||||
if (!el || !vv) return;
|
||||
const gap = vv.scale > 1.01 ? 0 : Math.round(vv.offsetTop + vv.height - document.documentElement.clientHeight);
|
||||
el.style.transform = gap > 0 && gap < 800 ? `translateY(${gap}px)` : "";
|
||||
if (Date.now() > until || !isStandalone()) return clear();
|
||||
const gap = keyboardGap(vv, document.documentElement.clientHeight);
|
||||
el.style.transform = gap ? `translateY(${gap}px)` : "";
|
||||
};
|
||||
const onFocusIn = (e: FocusEvent) => {
|
||||
if (isEditable(e.target as Element)) setTyping(true);
|
||||
if (isEditable(e.target as Element)) {
|
||||
clear();
|
||||
setTyping(true);
|
||||
}
|
||||
};
|
||||
const onFocusOut = () => {
|
||||
// Erst prüfen, wenn der Fokus angekommen ist (Feld → Feld bleibt „tippen“).
|
||||
setTimeout(() => {
|
||||
if (isEditable(document.activeElement)) return;
|
||||
setTyping(false);
|
||||
window.scrollTo(window.scrollX, window.scrollY);
|
||||
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);
|
||||
}, 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);
|
||||
vv?.addEventListener("scroll", pin);
|
||||
window.addEventListener("orientationchange", pin);
|
||||
pin();
|
||||
window.addEventListener("touchstart", onUser, { passive: true });
|
||||
window.addEventListener("wheel", onUser, { passive: true });
|
||||
window.addEventListener("orientationchange", clear);
|
||||
return () => {
|
||||
document.removeEventListener("focusin", onFocusIn);
|
||||
document.removeEventListener("focusout", onFocusOut);
|
||||
vv?.removeEventListener("resize", pin);
|
||||
vv?.removeEventListener("scroll", pin);
|
||||
window.removeEventListener("orientationchange", pin);
|
||||
window.removeEventListener("touchstart", onUser);
|
||||
window.removeEventListener("wheel", onUser);
|
||||
window.removeEventListener("orientationchange", clear);
|
||||
};
|
||||
}, []);
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
"use client";
|
||||
|
||||
import { useLocale, useTranslations } from "next-intl";
|
||||
import { isOne } from "./ingredient-name";
|
||||
import { formatKitchen, type BaseUnit, type KitchenUnit } from "./units";
|
||||
|
||||
/** Was eine Zutat für die Mengenanzeige mitbringt (lib/dishes.ts, getDish). */
|
||||
export type Measured = {
|
||||
unit: BaseUnit;
|
||||
displayUnit?: KitchenUnit | null;
|
||||
packSize?: number | null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Menge mit Küchenmaß in der Sprache der Person (26.11.39): „2 EL (30 ml)“,
|
||||
* „400 g (1 Dose)“. Liefert Hauptteil und Klammer getrennt, damit Listen sie
|
||||
* verschieden setzen können; text() fügt beides zusammen.
|
||||
*/
|
||||
export function useKitchenAmount() {
|
||||
const locale = useLocale();
|
||||
const tm = useTranslations("measure");
|
||||
const word = (u: KitchenUnit, n: number) => tm(u, { n: isOne(n) ? 1 : 2 });
|
||||
const parts = (i: Measured, qty: number) => formatKitchen(qty, i.unit, i.displayUnit, i.packSize, locale, word);
|
||||
const text = (i: Measured, qty: number) => {
|
||||
const p = parts(i, qty);
|
||||
return p.extra ? `${p.main} (${p.extra})` : p.main;
|
||||
};
|
||||
return { parts, text };
|
||||
}
|
||||
+59
-5
@@ -20,13 +20,16 @@ export type WishEntry = {
|
||||
isVeto: boolean;
|
||||
/** Gegenvorschlag zu einem Veto: kostet keinen Jeton. */
|
||||
viaVeto: boolean;
|
||||
/** „Mein Gericht“: garantiert im Plan, kein Veto streicht es. */
|
||||
isMine: boolean;
|
||||
};
|
||||
|
||||
export async function budget(client: PoolClient, roundId: string, memberId: string): Promise<Budget> {
|
||||
const { rows } = await client.query(
|
||||
`select h.tokens_per_round as tokens, h.vetos_per_round as vetos,
|
||||
count(w.id) filter (where not w.is_veto and w.veto_id is null)::int as wished,
|
||||
count(w.id) filter (where w.is_veto)::int as vetoed
|
||||
count(w.id) filter (where w.is_veto and not exists (
|
||||
select 1 from wishes m where m.round_id = w.round_id and m.dish_id = w.dish_id and m.is_mine))::int as vetoed
|
||||
from households h
|
||||
left join wishes w on w.round_id = $1 and w.member_id = $2
|
||||
group by h.id`,
|
||||
@@ -36,17 +39,22 @@ export async function budget(client: PoolClient, roundId: string, memberId: stri
|
||||
return { tokens: r.tokens, tokensLeft: Math.max(0, r.tokens - r.wished), vetos: r.vetos, vetosLeft: Math.max(0, r.vetos - r.vetoed) };
|
||||
}
|
||||
|
||||
export async function roundWishes(client: PoolClient, roundId: string): Promise<WishEntry[]> {
|
||||
/**
|
||||
* Alle Wünsche und Vetos der Runde. Wer ein Veto eingelegt hat, sehen nur
|
||||
* Erwachsene (Kai, 7.11.2026): Ein Veto mit Namen ist eine Bühne zum Ärgern.
|
||||
*/
|
||||
export async function roundWishes(client: PoolClient, roundId: string, viewer?: { memberId: string; adult: boolean }): Promise<WishEntry[]> {
|
||||
const { rows } = await client.query(
|
||||
`select w.dish_id as "dishId", w.member_id as "memberId", m.display_name as "memberName", w.note,
|
||||
w.wants_to_cook as "wantsToCook", w.is_veto as "isVeto",
|
||||
w.veto_id is not null as "viaVeto"
|
||||
w.veto_id is not null as "viaVeto", w.is_mine as "isMine"
|
||||
from wishes w join members m on m.id = w.member_id
|
||||
where w.round_id = $1
|
||||
order by w.created_at`,
|
||||
[roundId],
|
||||
);
|
||||
return rows;
|
||||
if (!viewer || viewer.adult) return rows;
|
||||
return rows.map((e: WishEntry) => (e.isVeto && e.memberId !== viewer.memberId ? { ...e, memberId: "", memberName: "", note: null } : e));
|
||||
}
|
||||
|
||||
/** Gerichte, die mindestens zwei Personen gewünscht haben. */
|
||||
@@ -57,7 +65,7 @@ export function favorites(entries: WishEntry[]): Set<string> {
|
||||
}
|
||||
|
||||
export class WishRefused extends Error {
|
||||
constructor(public reason: "noRound" | "noTokens" | "noVetos" | "dish" | "already" | "alternative") {
|
||||
constructor(public reason: "noRound" | "noTokens" | "noVetos" | "dish" | "already" | "alternative" | "protected" | "repeat" | "notWished") {
|
||||
super(reason);
|
||||
}
|
||||
}
|
||||
@@ -71,6 +79,9 @@ export async function addWish(client: PoolClient, householdId: string, memberId:
|
||||
if (!round) throw new WishRefused("noRound");
|
||||
const dish = (await client.query("select id from dishes where id = $1 and archived_at is null", [dishId])).rows[0];
|
||||
if (!dish) throw new WishRefused("dish");
|
||||
// Gegen „Mein Gericht“ hilft kein Veto — es würde nur verbraucht.
|
||||
if (opts.veto && (await client.query("select 1 from wishes where round_id = $1 and dish_id = $2 and is_mine", [round.id, dishId])).rowCount)
|
||||
throw new WishRefused("protected");
|
||||
const b = await budget(client, round.id, memberId);
|
||||
if (opts.veto ? b.vetosLeft < 1 : b.tokensLeft < 1) throw new WishRefused(opts.veto ? "noVetos" : "noTokens");
|
||||
// Veto nur mit Gegenvorschlag: ein Gericht aus dem Pool, das in dieser Runde noch niemand nennt.
|
||||
@@ -102,6 +113,49 @@ export async function addWish(client: PoolClient, householdId: string, memberId:
|
||||
}
|
||||
}
|
||||
|
||||
/** Die Runde vor dieser (nach Anlage), oder null. */
|
||||
async function previousRoundId(client: PoolClient, roundId: string): Promise<string | null> {
|
||||
const { rows } = await client.query(
|
||||
`select id from rounds where id <> $1 and created_at < (select created_at from rounds where id = $1) order by created_at desc limit 1`,
|
||||
[roundId],
|
||||
);
|
||||
return rows[0]?.id ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* „Mein Gericht“ der Vorrunde: je Person das Gericht und ob es in den Plan kam.
|
||||
* Wer leer ausging, hat diesmal Vorrang; wer es bekam, wählt diesmal ein anderes.
|
||||
*/
|
||||
export async function lastMine(client: PoolClient, roundId: string): Promise<{ memberId: string; dishId: string; served: boolean }[]> {
|
||||
const previous = await previousRoundId(client, roundId);
|
||||
if (!previous) return [];
|
||||
const { rows } = await client.query(
|
||||
`select w.member_id as "memberId", w.dish_id as "dishId",
|
||||
exists (select 1 from slots s where s.round_id = w.round_id and s.dish_id = w.dish_id) as served
|
||||
from wishes w where w.round_id = $1 and w.is_mine`,
|
||||
[previous],
|
||||
);
|
||||
return rows;
|
||||
}
|
||||
|
||||
/** 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> {
|
||||
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");
|
||||
if (!on) {
|
||||
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];
|
||||
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]);
|
||||
await client.query("update wishes set is_mine = true where id = $1", [own.id]);
|
||||
}
|
||||
|
||||
/** Gerichte, die als Gegenvorschlag zu einem Veto taugen: Pool, in der Runde noch von niemandem genannt. */
|
||||
export async function alternatives(client: PoolClient, roundId: string): Promise<{ id: string; title: string }[]> {
|
||||
const { rows } = await client.query(
|
||||
|
||||
+147
-34
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"app": {
|
||||
"name": "Was gibt's?",
|
||||
"name": "foodplanhero",
|
||||
"tagline": "Gemeinsam entscheiden, was es gibt — die Einkaufsliste entsteht von selbst."
|
||||
},
|
||||
"today": {
|
||||
@@ -29,7 +29,8 @@
|
||||
"editPlan": "Bearbeiten",
|
||||
"startCooking": "Kochen",
|
||||
"readAlong": "Mitlesen",
|
||||
"thanks": "Für {title}: {up, plural, =0 {noch kein Daumen hoch} one {1 Daumen hoch} other {# Daumen hoch}}{kudos, plural, =0 {} one { und 1 Dankeschön} other { und # Dankeschöns}}."
|
||||
"thanks": "Für {title}: {up, plural, =0 {noch kein Daumen hoch} one {1 Daumen hoch} other {# Daumen hoch}}{kudos, plural, =0 {} one { und 1 Dankeschön} other { und # Dankeschöns}}.",
|
||||
"mineDish": "Gericht einer Person, kommt sicher in den Plan"
|
||||
},
|
||||
"auth": {
|
||||
"setup": {
|
||||
@@ -46,7 +47,7 @@
|
||||
"title": "Anmelden",
|
||||
"intro": "Melde dich mit dem Passkey auf diesem Gerät an.",
|
||||
"submit": "Mit Passkey anmelden",
|
||||
"noPasskey": "Noch kein Passkey auf diesem Gerät? Lass dir im Haushalt unter Mehr › Gerät hinzufügen einen Link geben.",
|
||||
"noPasskey": "Noch kein Passkey auf diesem Gerät? Lass dir im Haushalt unter Mehr › Gerät hinzufügen einen Link geben.",
|
||||
"lost": "Zugang verloren?",
|
||||
"kids": "Kinder melden sich hier an"
|
||||
},
|
||||
@@ -129,7 +130,7 @@
|
||||
},
|
||||
"ai": {
|
||||
"title": "AI",
|
||||
"intro": "Lunch fragt ein Sprachmodell auf deiner Box. Nichts geht in eine Cloud, die du hier nicht selbst einträgst.",
|
||||
"intro": "foodplanhero fragt ein Sprachmodell auf deiner Box. Nichts geht in eine Cloud, die du hier nicht selbst einträgst.",
|
||||
"ready": "Eingerichtet",
|
||||
"notReady": "Nicht eingerichtet",
|
||||
"summary": "Für Kochbuchfotos und Rezeptseiten ohne Rezeptdaten.",
|
||||
@@ -157,7 +158,7 @@
|
||||
"key": "Der Schlüssel wurde abgelehnt.",
|
||||
"status": "Der Dienst hat mit einem Fehler geantwortet.",
|
||||
"aiNotConfigured": "Bitte zuerst speichern.",
|
||||
"login": "Statt des Dienstes hat eine Anmeldeseite geantwortet. Lunch braucht die Adresse für „Apps in Olares“."
|
||||
"login": "Statt des Dienstes hat eine Anmeldeseite geantwortet. foodplanhero braucht die Adresse für „Apps in Olares“."
|
||||
},
|
||||
"routerUse": "Olares Router verwenden",
|
||||
"routerChecking": "Prüft den Router …",
|
||||
@@ -166,9 +167,9 @@
|
||||
"sourceRouter": "Olares Router",
|
||||
"sourceManual": "Eigener Endpunkt",
|
||||
"routerFound": "Router erkannt · Modell: {model}",
|
||||
"routerManages": "Endpunkt, Modell und Schlüssel verwaltet der Router. Lunch nimmt das Standardmodell für Text und Fotos.",
|
||||
"routerManages": "Endpunkt, Modell und Schlüssel verwaltet der Router. foodplanhero nimmt das Standardmodell für Text und Fotos.",
|
||||
"routerAddress": "Router-Adresse",
|
||||
"noRouter": "Lunch läuft nicht unter einer Olares-Adresse, deshalb gibt es keinen Router. Trag einen eigenen Endpunkt ein.",
|
||||
"noRouter": "foodplanhero läuft nicht unter einer Olares-Adresse, deshalb gibt es keinen Router. Trag einen eigenen Endpunkt ein.",
|
||||
"speechModel": "Sprachmodell (Sprache zu Text)",
|
||||
"speechHint": "Für „Gericht einsprechen“, etwa ein Whisper. Optional."
|
||||
},
|
||||
@@ -233,6 +234,21 @@
|
||||
"devicePending": "Link offen, noch nicht freigeschaltet",
|
||||
"removeDevice": "{label} entfernen",
|
||||
"remove": "Entfernen"
|
||||
},
|
||||
"dedication": {
|
||||
"title": "Für {name}",
|
||||
"edit": "Widmung bearbeiten",
|
||||
"name": "Name",
|
||||
"text": "Ein paar Sätze",
|
||||
"textPlaceholder": "Warum es diese App gibt …",
|
||||
"photo": "Foto wählen",
|
||||
"newPhoto": "Neues Foto wählen",
|
||||
"photoHint": "Das Foto bleibt auf eurer Box. Es erscheint beim Öffnen der App, beim Anmelden und hier.",
|
||||
"save": "Speichern",
|
||||
"removePhoto": "Foto entfernen",
|
||||
"saved": "Gespeichert.",
|
||||
"error": "Das hat nicht geklappt. Nimm ein JPEG, PNG oder HEIC bis 15 MB.",
|
||||
"chosen": "Gewählt: {name}"
|
||||
}
|
||||
},
|
||||
"nav": {
|
||||
@@ -349,7 +365,11 @@
|
||||
"piece": "Stück",
|
||||
"tbsp": "EL",
|
||||
"tsp": "TL",
|
||||
"pinch": "Prise"
|
||||
"pinch": "Prise",
|
||||
"can": "Dose",
|
||||
"jar": "Glas",
|
||||
"pack": "Packung",
|
||||
"bunch": "Bund"
|
||||
},
|
||||
"errors": {
|
||||
"invalid": "Bitte gib einen Titel an und prüfe die Mengen.",
|
||||
@@ -360,8 +380,8 @@
|
||||
"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.",
|
||||
"restyle": "Einheitlich formulieren",
|
||||
"restyleHint": "Bringt die Schritte in die Lunch-Form: Vorbereiten, Kochen, Anrichten; eine Handlung je Schritt, Zeiten als Timer. Du prüfst und speicherst.",
|
||||
"styledByAi": "Von der AI in die Lunch-Form gebracht. Zeiten und Temperaturen stammen aus dem Rezept — bitte kurz prüfen.",
|
||||
"restyleHint": "Bringt die Schritte in die foodplanhero-Form: Vorbereiten, Kochen, Anrichten; eine Handlung je Schritt, Zeiten als Timer. Du prüfst und speicherst.",
|
||||
"styledByAi": "Von der AI in die foodplanhero-Form gebracht. Zeiten und Temperaturen stammen aus dem Rezept — bitte kurz prüfen.",
|
||||
"styledByRules": "Nach Regeln in Abschnitte eingeordnet, Wortlaut unverändert. Mit eingerichteter AI werden die Schritte auch umformuliert.",
|
||||
"styleFailed": "Das hat nicht geklappt. Die Schritte sind unverändert.",
|
||||
"section": "Abschnitt von Schritt {n}",
|
||||
@@ -371,7 +391,17 @@
|
||||
"productPack": "Packung in {unit}",
|
||||
"productCook": "Kochzeit (Min.)",
|
||||
"productHint": "Die Kochzeit wird zum Timer im Schritt, der die Zutat kocht; Name und Packung stehen auf der Einkaufsliste.",
|
||||
"addProduct": "Produkt hinterlegen"
|
||||
"addProduct": "Produkt hinterlegen",
|
||||
"rememberProduct": "Für alle Gerichte mit {name} merken",
|
||||
"inheritedProduct": "Euer Produkt für alle Gerichte: {product}",
|
||||
"otherProduct": "Anderes Produkt für dieses Gericht",
|
||||
"unitWithSize": "{unit} ({size})",
|
||||
"packSize": "1 {unit} = {size}",
|
||||
"packChange": "Größe ändern",
|
||||
"packSizeLabel": "Größe einer {unit} in {base}",
|
||||
"packSave": "Übernehmen",
|
||||
"packHint": "Gilt für alle Gerichte eures Haushalts.",
|
||||
"packError": "Die Größe ließ sich nicht speichern."
|
||||
},
|
||||
"addLinkText": "Wir lesen Zutaten und Schritte von der Rezeptseite.",
|
||||
"link": {
|
||||
@@ -398,7 +428,7 @@
|
||||
"read": "Rezept lesen",
|
||||
"reading": "Die AI liest …",
|
||||
"readingHint": "Das kann eine Minute dauern.",
|
||||
"notConfigured": "Für Fotos braucht Lunch ein Bildmodell. Das richtet ein Admin unter „Mehr“ ein.",
|
||||
"notConfigured": "Für Fotos braucht foodplanhero ein Bildmodell. Das richtet ein Admin unter „Mehr“ ein.",
|
||||
"setUp": "AI einrichten",
|
||||
"askAdmin": "Bitte frag einen Admin im Haushalt.",
|
||||
"errors": {
|
||||
@@ -429,23 +459,23 @@
|
||||
"error": "Das hat nicht geklappt."
|
||||
},
|
||||
"addVoice": "Einsprechen",
|
||||
"addVoiceText": "Ein Lieblingsgericht frei erzählen — Lunch macht ein Rezept daraus.",
|
||||
"addVoiceText": "Ein Lieblingsgericht frei erzählen — foodplanhero macht ein Rezept daraus.",
|
||||
"voice": {
|
||||
"title": "Gericht einsprechen",
|
||||
"intro": "Erzähl einfach: wie viele Portionen, was reinkommt, wie es geht. Lunch schreibt mit und macht einen Entwurf, den du prüfst.",
|
||||
"intro": "Erzähl einfach: wie viele Portionen, was reinkommt, wie es geht. foodplanhero schreibt mit und macht einen Entwurf, den du prüfst.",
|
||||
"record": "Aufnahme starten",
|
||||
"stop": "Aufnahme beenden",
|
||||
"recording": "Nimmt auf … {time}",
|
||||
"recordHint": "Tippen und erzählen. Du kannst mehrmals aufnehmen.",
|
||||
"transcribing": "Schreibt mit …",
|
||||
"noSpeech": "Für Aufnahmen braucht Lunch ein Sprachmodell (beim Olares Router dabei). Du kannst aber unten mit der Diktierfunktion deines Handys sprechen.",
|
||||
"noSpeech": "Für Aufnahmen braucht foodplanhero ein Sprachmodell (beim Olares Router dabei). Du kannst aber unten mit der Diktierfunktion deines Handys sprechen.",
|
||||
"text": "Was du erzählt hast",
|
||||
"placeholder": "z. B. Bolognese für vier: 500 Gramm Hackfleisch, eine Zwiebel …",
|
||||
"textHint": "Hier kannst du korrigieren, ergänzen oder mit dem Mikrofon der Tastatur diktieren.",
|
||||
"draft": "Rezept daraus machen",
|
||||
"drafting": "Macht ein Rezept daraus …",
|
||||
"check": "Bitte prüf den Entwurf. Mengen stehen nur da, wo du sie gesagt hast.",
|
||||
"noAi": "Dafür braucht Lunch ein Sprachmodell. Ein Admin richtet es unter Mehr › AI ein.",
|
||||
"noAi": "Dafür braucht foodplanhero ein Sprachmodell. Ein Admin richtet es unter Mehr › AI ein.",
|
||||
"errors": {
|
||||
"mic": "Das Mikrofon ist nicht freigegeben. Erlaube es in den Einstellungen oder nutz das Textfeld.",
|
||||
"noSpeech": "Kein Sprachmodell eingerichtet. Nutz das Textfeld.",
|
||||
@@ -521,7 +551,10 @@
|
||||
"noTrial": "Unter „Ausprobieren“ ist nichts Neues mehr.",
|
||||
"dish": "Dieses Gericht gibt es nicht mehr.",
|
||||
"unknown": "Das hat nicht geklappt. Bitte versuch es noch einmal.",
|
||||
"alternative": "Bitte wähl ein anderes Gericht aus dem Pool, das noch niemand gewünscht hat."
|
||||
"alternative": "Bitte wähl ein anderes Gericht aus dem Pool, das noch niemand gewünscht hat.",
|
||||
"protected": "Das ist das Gericht von jemandem — dagegen gibt es kein Veto.",
|
||||
"repeat": "Das war letzte Runde schon dein Gericht. Such dir diesmal ein anderes aus.",
|
||||
"notWished": "Wünsch dir das Gericht zuerst, dann kannst du es zu deinem machen."
|
||||
},
|
||||
"wishAction": "Wünschen:",
|
||||
"unwishAction": "Wunsch zurücknehmen:",
|
||||
@@ -530,7 +563,17 @@
|
||||
"vetoInsteadHint": "Ein Veto geht nur mit einem Gegenvorschlag aus dem Pool. Er zählt als dein Wunsch und kostet keinen Jeton.",
|
||||
"vetoNoAlternative": "Gerade ist kein Gericht aus dem Pool frei, das noch niemand gewünscht hat. Ohne Gegenvorschlag gibt es kein Veto.",
|
||||
"back": "Zurück",
|
||||
"viaVetoHint": "Dein Gegenvorschlag zu einem Veto. Nimmst du ihn zurück, endet auch das Veto."
|
||||
"viaVetoHint": "Dein Gegenvorschlag zu einem Veto. Nimmst du ihn zurück, endet auch das Veto.",
|
||||
"mine": "Mein Gericht",
|
||||
"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.",
|
||||
"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"
|
||||
},
|
||||
"kids": {
|
||||
"title": "Wer bist du?",
|
||||
@@ -543,7 +586,7 @@
|
||||
"deleteDigit": "Ziffer löschen",
|
||||
"adults": "Erwachsene: mit Passkey anmelden",
|
||||
"noDeviceTitle": "Kein Kindergerät",
|
||||
"noDeviceText": "Kinder melden sich nur auf einem Gerät an, das ein Admin freigeschaltet hat. Den Link dafür gibt es unter „Mehr“ › „Kindergeräte“.",
|
||||
"noDeviceText": "Kinder melden sich nur auf einem Gerät an, das ein Admin freigeschaltet hat. Den Link dafür gibt es unter „Mehr“ › „Kindergeräte“.",
|
||||
"unlockTitle": "„{label}“ freischalten",
|
||||
"unlockText": "Danach können sich die Kinder von {household} auf diesem Gerät mit Bild und PIN anmelden. Nur auf einem Gerät der Familie freischalten.",
|
||||
"unlock": "Dieses Gerät freischalten",
|
||||
@@ -601,7 +644,8 @@
|
||||
"pool": "aus dem Pool",
|
||||
"manual": "von Hand gewählt",
|
||||
"locked": "gesperrt",
|
||||
"cheap": "günstig"
|
||||
"cheap": "günstig",
|
||||
"mine": "Gericht von {names} (sicher)"
|
||||
},
|
||||
"errors": {
|
||||
"empty": "Erst braucht der Plan mindestens ein Gericht.",
|
||||
@@ -637,7 +681,8 @@
|
||||
"addPlaceholder": "z. B. Klopapier",
|
||||
"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.}}"
|
||||
"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}"
|
||||
},
|
||||
"cooking": {
|
||||
"eyebrow": "Kochen",
|
||||
@@ -679,8 +724,8 @@
|
||||
}
|
||||
},
|
||||
"install": {
|
||||
"title": "Lunch auf den Home-Bildschirm",
|
||||
"ios": "In Safari auf das Teilen-Symbol tippen, dann „Zum Home-Bildschirm“. Danach öffnet sich Lunch wie eine App.",
|
||||
"title": "foodplanhero auf den Home-Bildschirm",
|
||||
"ios": "In Safari auf das Teilen-Symbol tippen, dann „Zum Home-Bildschirm“. Danach öffnet sich foodplanhero wie eine App.",
|
||||
"install": "App installieren",
|
||||
"dismiss": "Hinweis ausblenden"
|
||||
},
|
||||
@@ -753,8 +798,8 @@
|
||||
"receipts": {
|
||||
"eyebrow": "Einkauf",
|
||||
"title": "Kassenbons",
|
||||
"intro": "Bon fotografieren, weiter einkaufen. Lunch liest ihn auf der Box und merkt sich die Preise, sobald du bestätigst. Das Foto wird danach gelöscht.",
|
||||
"noAi": "Zum Lesen braucht Lunch ein Bildmodell (beim Olares Router dabei). Bons warten so lange.",
|
||||
"intro": "Bon fotografieren, weiter einkaufen. foodplanhero liest ihn auf der Box und merkt sich die Preise, sobald du bestätigst. Das Foto wird danach gelöscht.",
|
||||
"noAi": "Zum Lesen braucht foodplanhero ein Bildmodell (beim Olares Router dabei). Bons warten so lange.",
|
||||
"scan": "Bon fotografieren",
|
||||
"uploading": "Lädt hoch …",
|
||||
"uploadError": "Das Foto ließ sich nicht lesen. Nimm ein JPEG, PNG oder HEIC bis 15 MB.",
|
||||
@@ -771,7 +816,8 @@
|
||||
"errors": {
|
||||
"unavailable": "AI gerade nicht erreichbar",
|
||||
"unreadable": "keine Zeilen erkannt",
|
||||
"photo": "Foto nicht lesbar"
|
||||
"photo": "Foto nicht lesbar",
|
||||
"partial": "nur teilweise gelesen"
|
||||
},
|
||||
"reviewTitle": "Bon prüfen",
|
||||
"doneTitle": "Bon",
|
||||
@@ -779,9 +825,7 @@
|
||||
"store": "Laden",
|
||||
"noStore": "unbekannt",
|
||||
"date": "Datum",
|
||||
"otherLine": "Sonstiges – zählt zu keinem Gericht",
|
||||
"assign": "Zutat zuordnen",
|
||||
"other": "Sonstiges",
|
||||
"pack": "Packung in {unit}",
|
||||
"source": {
|
||||
"alias": "so schon einmal bestätigt",
|
||||
@@ -798,7 +842,27 @@
|
||||
"delete": "Bon löschen",
|
||||
"saveError": "Das hat nicht geklappt.",
|
||||
"doneText": "Die Preise sind im Preisgedächtnis, die Zuordnungen gelernt. Das Foto ist gelöscht.",
|
||||
"link": "Bon fotografieren"
|
||||
"link": "Bon fotografieren",
|
||||
"partialHint": "Der Bon war lang; die AI hat ihn nur bis zu einer Stelle gelesen. Prüf die Zeilen hier — den Rest fotografierst du als eigenen Bon (nur die untere Hälfte).",
|
||||
"notCooking": "Nicht zum Kochen",
|
||||
"notCookingGroup": "{n, plural, one {1 weiterer Artikel} other {# weitere Artikel}} — nicht zum Kochen",
|
||||
"skippedOne": "{text}: nicht zum Kochen",
|
||||
"undo": "Rückgängig",
|
||||
"assignShort": "Zuordnen",
|
||||
"assignLine": "{text} doch einer Zutat zuordnen",
|
||||
"noIngredient": "Keine Zutat erkannt",
|
||||
"forCooking": "Zum Kochen",
|
||||
"swipeHint": "Was nicht zum Kochen gehört, nach links wischen — foodplanhero merkt es sich für den nächsten Bon.",
|
||||
"packEach": "Packung je Stück in {unit}",
|
||||
"perPrice": "= {price} {per}",
|
||||
"perDetail": "{amount} {unit} für {total}",
|
||||
"per": {
|
||||
"100g": "je 100 g",
|
||||
"100ml": "je 100 ml",
|
||||
"piece": "je Stück"
|
||||
},
|
||||
"noPackWarning": "Ohne Packungsgröße merkt sich foodplanhero keinen Preis.",
|
||||
"weighedHint": "Gewogen: 1000 heißt, der Preis gilt je kg wie auf dem Bon."
|
||||
},
|
||||
"setup": {
|
||||
"title": "Los geht's",
|
||||
@@ -808,7 +872,7 @@
|
||||
"laterSr": "später:",
|
||||
"skipped": "übersprungen",
|
||||
"hide": "Liste ausblenden",
|
||||
"finishedTitle": "Fertig – Lunch läuft",
|
||||
"finishedTitle": "Fertig – foodplanhero läuft",
|
||||
"finishedText": "Gerichte, Laden, Familie und die erste Runde stehen. Ab jetzt zeigt dir „Wo stehen wir?“, was dran ist.",
|
||||
"finishedOk": "Alles klar",
|
||||
"dishes": {
|
||||
@@ -816,7 +880,7 @@
|
||||
"title": "Füll den Pool mit fünf Gerichten",
|
||||
"text": "Damit es etwas zu wünschen gibt. Am schnellsten: Klassiker mit einem Tipp übernehmen. Gerade sind es {n} von {of}.",
|
||||
"cta": "Klassiker übernehmen",
|
||||
"moreLink": "Eigene: Link, Kochbuchfoto, einsprechen"
|
||||
"moreLink": "Eigenes Gericht hinzufügen"
|
||||
},
|
||||
"store": {
|
||||
"short": "Hauptladen",
|
||||
@@ -829,7 +893,7 @@
|
||||
"title": "Hol die Familie dazu",
|
||||
"text": "Erwachsene und Jugendliche per Link aufs eigene Handy, Kinder mit Bild und PIN auf einem Tablet.",
|
||||
"cta": "Einladen",
|
||||
"skip": "Ich nutze Lunch erst mal allein"
|
||||
"skip": "Ich nutze foodplanhero erst mal allein"
|
||||
},
|
||||
"round": {
|
||||
"short": "Erste Runde",
|
||||
@@ -876,7 +940,7 @@
|
||||
},
|
||||
"intro": {
|
||||
"roledesc": "Einführung",
|
||||
"eyebrow": "So funktioniert Lunch · {n} von {of}",
|
||||
"eyebrow": "So funktioniert foodplanhero · {n} von {of}",
|
||||
"next": "Weiter",
|
||||
"skip": "Überspringen",
|
||||
"done": "Los geht's",
|
||||
@@ -919,6 +983,55 @@
|
||||
"unlockTitle": "„{label}“ als Küchendisplay freischalten",
|
||||
"unlockText": "Danach zeigt dieses Gerät die Rezepte und den Plan von {household} — groß, zum Ablesen beim Kochen. Ändern kann man hier nichts.",
|
||||
"linkExpiredTitle": "Link abgelaufen",
|
||||
"linkExpiredText": "Dieser Link gilt nicht mehr. Ein Admin kann unter „Mehr“ › „Küchendisplay“ einen neuen erstellen."
|
||||
"linkExpiredText": "Dieser Link gilt nicht mehr. Ein Admin kann unter „Mehr“ › „Küchendisplay“ einen neuen erstellen."
|
||||
},
|
||||
"ingredients": {
|
||||
"categories": {
|
||||
"vegetables": "Gemüse",
|
||||
"fruit": "Obst",
|
||||
"herbs": "Kräuter",
|
||||
"bakery": "Brot & Backwaren",
|
||||
"meat": "Fleisch",
|
||||
"poultry": "Geflügel",
|
||||
"sausage": "Wurst & Aufschnitt",
|
||||
"fish": "Fisch",
|
||||
"dairy": "Milchprodukte",
|
||||
"cheese": "Käse",
|
||||
"eggs": "Eier",
|
||||
"chilled": "Kühlregal",
|
||||
"frozen": "Tiefkühl",
|
||||
"pasta_rice": "Nudeln, Reis & Hülsenfrüchte",
|
||||
"canned": "Konserven & Gläser",
|
||||
"sauces": "Saucen & Würzpasten",
|
||||
"spices": "Gewürze",
|
||||
"oil_vinegar": "Öl & Essig",
|
||||
"baking": "Backen",
|
||||
"breakfast": "Frühstück",
|
||||
"nuts": "Nüsse & Trockenobst",
|
||||
"sweets": "Süßes & Snacks",
|
||||
"drinks": "Getränke"
|
||||
},
|
||||
"title": "Neue Zutat",
|
||||
"create": "„{name}“ als neue Zutat anlegen",
|
||||
"name": "Name",
|
||||
"unit": "Einheit",
|
||||
"group": "Gehört zu",
|
||||
"noGroup": "keiner Gruppe",
|
||||
"category": "Regal im Laden",
|
||||
"save": "Anlegen",
|
||||
"cancel": "Abbrechen",
|
||||
"error": "Das hat nicht geklappt. Gibt es die Zutat schon?",
|
||||
"anyKind": "beliebige Sorte",
|
||||
"kinds": "{n, plural, one {1 Sorte} other {# Sorten}}",
|
||||
"ownBadge": "eigene"
|
||||
},
|
||||
"measure": {
|
||||
"tbsp": "{n, plural, one {EL} other {EL}}",
|
||||
"tsp": "{n, plural, one {TL} other {TL}}",
|
||||
"pinch": "{n, plural, one {Prise} other {Prisen}}",
|
||||
"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}}"
|
||||
}
|
||||
}
|
||||
+142
-29
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"app": {
|
||||
"name": "What's cooking?",
|
||||
"name": "foodplanhero",
|
||||
"tagline": "Decide together what's for dinner — the shopping list writes itself."
|
||||
},
|
||||
"today": {
|
||||
@@ -29,7 +29,8 @@
|
||||
"editPlan": "Edit",
|
||||
"startCooking": "Cook",
|
||||
"readAlong": "Read along",
|
||||
"thanks": "For {title}: {up, plural, =0 {no thumbs up yet} one {1 thumbs up} other {# thumbs up}}{kudos, plural, =0 {} one { and 1 thank-you} other { and # thank-yous}}."
|
||||
"thanks": "For {title}: {up, plural, =0 {no thumbs up yet} one {1 thumbs up} other {# thumbs up}}{kudos, plural, =0 {} one { and 1 thank-you} other { and # thank-yous}}.",
|
||||
"mineDish": "Someone's dish, sure to be in the plan"
|
||||
},
|
||||
"auth": {
|
||||
"setup": {
|
||||
@@ -46,7 +47,7 @@
|
||||
"title": "Sign in",
|
||||
"intro": "Sign in with the passkey on this device.",
|
||||
"submit": "Sign in with passkey",
|
||||
"noPasskey": "No passkey on this device yet? Ask someone in your household for a link under More › Add device.",
|
||||
"noPasskey": "No passkey on this device yet? Ask someone in your household for a link under More › Add device.",
|
||||
"lost": "Lost access?",
|
||||
"kids": "Children sign in here"
|
||||
},
|
||||
@@ -129,7 +130,7 @@
|
||||
},
|
||||
"ai": {
|
||||
"title": "AI",
|
||||
"intro": "Lunch asks a language model on your box. Nothing goes to a cloud you don't enter here yourself.",
|
||||
"intro": "foodplanhero asks a language model on your box. Nothing goes to a cloud you don't enter here yourself.",
|
||||
"ready": "Set up",
|
||||
"notReady": "Not set up",
|
||||
"summary": "For cookbook photos and recipe pages without recipe data.",
|
||||
@@ -157,7 +158,7 @@
|
||||
"key": "The key was refused.",
|
||||
"status": "The service answered with an error.",
|
||||
"aiNotConfigured": "Please save first.",
|
||||
"login": "A sign-in page answered instead of the service. Lunch needs the address for “Apps in Olares”."
|
||||
"login": "A sign-in page answered instead of the service. foodplanhero needs the address for “Apps in Olares”."
|
||||
},
|
||||
"routerUse": "Use the Olares Router",
|
||||
"routerChecking": "Checking the Router …",
|
||||
@@ -166,9 +167,9 @@
|
||||
"sourceRouter": "Olares Router",
|
||||
"sourceManual": "Custom endpoint",
|
||||
"routerFound": "Router found · model: {model}",
|
||||
"routerManages": "The Router manages endpoint, model and key. Lunch uses the default model for text and photos.",
|
||||
"routerManages": "The Router manages endpoint, model and key. foodplanhero uses the default model for text and photos.",
|
||||
"routerAddress": "Router address",
|
||||
"noRouter": "Lunch isn't running under an Olares address, so there is no Router. Enter a custom endpoint.",
|
||||
"noRouter": "foodplanhero isn't running under an Olares address, so there is no Router. Enter a custom endpoint.",
|
||||
"speechModel": "Speech model (speech to text)",
|
||||
"speechHint": "For \"Speak a dish\", e.g. a Whisper. Optional."
|
||||
},
|
||||
@@ -233,6 +234,21 @@
|
||||
"devicePending": "Link open, not yet unlocked",
|
||||
"removeDevice": "Remove {label}",
|
||||
"remove": "Remove"
|
||||
},
|
||||
"dedication": {
|
||||
"title": "For {name}",
|
||||
"edit": "Edit dedication",
|
||||
"name": "Name",
|
||||
"text": "A few sentences",
|
||||
"textPlaceholder": "Why this app exists …",
|
||||
"photo": "Choose photo",
|
||||
"newPhoto": "Choose new photo",
|
||||
"photoHint": "The photo stays on your box. It appears when the app opens, at sign-in and here.",
|
||||
"save": "Save",
|
||||
"removePhoto": "Remove photo",
|
||||
"saved": "Saved.",
|
||||
"error": "That did not work. Use a JPEG, PNG or HEIC up to 15 MB.",
|
||||
"chosen": "Chosen: {name}"
|
||||
}
|
||||
},
|
||||
"nav": {
|
||||
@@ -349,7 +365,11 @@
|
||||
"piece": "pcs",
|
||||
"tbsp": "tbsp",
|
||||
"tsp": "tsp",
|
||||
"pinch": "pinch"
|
||||
"pinch": "pinch",
|
||||
"can": "Can",
|
||||
"jar": "Jar",
|
||||
"pack": "Pack",
|
||||
"bunch": "Bunch"
|
||||
},
|
||||
"errors": {
|
||||
"invalid": "Please give a title and check the amounts.",
|
||||
@@ -360,8 +380,8 @@
|
||||
"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.",
|
||||
"restyle": "Put into house style",
|
||||
"restyleHint": "Brings the steps into the Lunch form: prepare, cook, serve; one action per step, times as timers. You check and save.",
|
||||
"styledByAi": "Put into the Lunch form by the AI. Times and temperatures come from the recipe — please check briefly.",
|
||||
"restyleHint": "Brings the steps into the foodplanhero form: prepare, cook, serve; one action per step, times as timers. You check and save.",
|
||||
"styledByAi": "Put into the foodplanhero form by the AI. Times and temperatures come from the recipe — please check briefly.",
|
||||
"styledByRules": "Sorted into sections by rules, wording unchanged. With an AI set up, the steps are rewritten too.",
|
||||
"styleFailed": "That didn't work. The steps are unchanged.",
|
||||
"section": "Section of step {n}",
|
||||
@@ -371,7 +391,17 @@
|
||||
"productPack": "Pack in {unit}",
|
||||
"productCook": "Cooking time (min)",
|
||||
"productHint": "The cooking time becomes the timer of the step that cooks this ingredient; name and pack go on the shopping list.",
|
||||
"addProduct": "Add product"
|
||||
"addProduct": "Add product",
|
||||
"rememberProduct": "Remember for every dish with {name}",
|
||||
"inheritedProduct": "Your product for every dish: {product}",
|
||||
"otherProduct": "Different product for this dish",
|
||||
"unitWithSize": "{unit} ({size})",
|
||||
"packSize": "1 {unit} = {size}",
|
||||
"packChange": "Change size",
|
||||
"packSizeLabel": "Size of one {unit} in {base}",
|
||||
"packSave": "Apply",
|
||||
"packHint": "Applies to all dishes of your household.",
|
||||
"packError": "The size could not be saved."
|
||||
},
|
||||
"addLinkText": "We read ingredients and steps from the recipe page.",
|
||||
"link": {
|
||||
@@ -429,10 +459,10 @@
|
||||
"error": "That didn't work."
|
||||
},
|
||||
"addVoice": "Speak it",
|
||||
"addVoiceText": "Tell a favourite dish in your own words — Lunch turns it into a recipe.",
|
||||
"addVoiceText": "Tell a favourite dish in your own words — foodplanhero turns it into a recipe.",
|
||||
"voice": {
|
||||
"title": "Speak a dish",
|
||||
"intro": "Just talk: how many portions, what goes in, how it's done. Lunch writes along and makes a draft for you to check.",
|
||||
"intro": "Just talk: how many portions, what goes in, how it's done. foodplanhero writes along and makes a draft for you to check.",
|
||||
"record": "Start recording",
|
||||
"stop": "Stop recording",
|
||||
"recording": "Recording … {time}",
|
||||
@@ -445,7 +475,7 @@
|
||||
"draft": "Make a recipe",
|
||||
"drafting": "Making a recipe …",
|
||||
"check": "Please check the draft. Amounts only appear where you said them.",
|
||||
"noAi": "This needs a language model. An admin sets it up under More › AI.",
|
||||
"noAi": "This needs a language model. An admin sets it up under More › AI.",
|
||||
"errors": {
|
||||
"mic": "The microphone isn't allowed. Allow it in settings or use the text field.",
|
||||
"noSpeech": "No speech model set up. Use the text field.",
|
||||
@@ -521,7 +551,10 @@
|
||||
"noTrial": "Nothing new left under “To try”.",
|
||||
"dish": "This dish no longer exists.",
|
||||
"unknown": "That did not work. Please try again.",
|
||||
"alternative": "Please pick another pool dish nobody has wished for yet."
|
||||
"alternative": "Please pick another pool dish nobody has wished for yet.",
|
||||
"protected": "This is someone's dish — there is no veto against it.",
|
||||
"repeat": "That was already your dish last round. Pick a different one this time.",
|
||||
"notWished": "Wish for the dish first, then you can make it yours."
|
||||
},
|
||||
"wishAction": "Wish:",
|
||||
"unwishAction": "Take back wish:",
|
||||
@@ -530,7 +563,17 @@
|
||||
"vetoInsteadHint": "A veto needs a counter-suggestion from the pool. It counts as your wish and costs no token.",
|
||||
"vetoNoAlternative": "No pool dish is free right now that nobody has wished for. Without a counter-suggestion there is no veto.",
|
||||
"back": "Back",
|
||||
"viaVetoHint": "Your counter-suggestion to a veto. Taking it back ends the veto too."
|
||||
"viaVetoHint": "Your counter-suggestion to a veto. Taking it back ends the veto too.",
|
||||
"mine": "My dish",
|
||||
"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.",
|
||||
"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"
|
||||
},
|
||||
"kids": {
|
||||
"title": "Who are you?",
|
||||
@@ -601,7 +644,8 @@
|
||||
"pool": "from the pool",
|
||||
"manual": "picked by hand",
|
||||
"locked": "locked",
|
||||
"cheap": "cheap"
|
||||
"cheap": "cheap",
|
||||
"mine": "{names}'s dish (guaranteed)"
|
||||
},
|
||||
"errors": {
|
||||
"empty": "The plan needs at least one dish first.",
|
||||
@@ -637,7 +681,8 @@
|
||||
"addPlaceholder": "e.g. toilet paper",
|
||||
"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.}}"
|
||||
"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}"
|
||||
},
|
||||
"cooking": {
|
||||
"eyebrow": "Cooking",
|
||||
@@ -679,8 +724,8 @@
|
||||
}
|
||||
},
|
||||
"install": {
|
||||
"title": "Put Lunch on your home screen",
|
||||
"ios": "In Safari, tap the share icon, then “Add to Home Screen”. Lunch then opens like an app.",
|
||||
"title": "Put foodplanhero on your home screen",
|
||||
"ios": "In Safari, tap the share icon, then “Add to Home Screen”. foodplanhero then opens like an app.",
|
||||
"install": "Install app",
|
||||
"dismiss": "Hide hint"
|
||||
},
|
||||
@@ -753,7 +798,7 @@
|
||||
"receipts": {
|
||||
"eyebrow": "Shopping",
|
||||
"title": "Receipts",
|
||||
"intro": "Snap the receipt and carry on. Lunch reads it on your box and remembers the prices once you confirm. The photo is deleted afterwards.",
|
||||
"intro": "Snap the receipt and carry on. foodplanhero reads it on your box and remembers the prices once you confirm. The photo is deleted afterwards.",
|
||||
"noAi": "Reading needs an image model (included with the Olares Router). Receipts wait until then.",
|
||||
"scan": "Photograph receipt",
|
||||
"uploading": "Uploading …",
|
||||
@@ -771,7 +816,8 @@
|
||||
"errors": {
|
||||
"unavailable": "AI not reachable right now",
|
||||
"unreadable": "no lines found",
|
||||
"photo": "photo unreadable"
|
||||
"photo": "photo unreadable",
|
||||
"partial": "only partly read"
|
||||
},
|
||||
"reviewTitle": "Check receipt",
|
||||
"doneTitle": "Receipt",
|
||||
@@ -779,9 +825,7 @@
|
||||
"store": "Store",
|
||||
"noStore": "unknown",
|
||||
"date": "Date",
|
||||
"otherLine": "Other – not part of any dish",
|
||||
"assign": "Assign ingredient",
|
||||
"other": "Other",
|
||||
"pack": "Pack in {unit}",
|
||||
"source": {
|
||||
"alias": "confirmed like this before",
|
||||
@@ -798,7 +842,27 @@
|
||||
"delete": "Delete receipt",
|
||||
"saveError": "That didn't work.",
|
||||
"doneText": "Prices are in the price memory and the matches are learned. The photo is deleted.",
|
||||
"link": "Photograph receipt"
|
||||
"link": "Photograph receipt",
|
||||
"partialHint": "The receipt was long; the AI read it only up to a point. Check the lines here — photograph the rest as a receipt of its own (just the lower half).",
|
||||
"notCooking": "Not for cooking",
|
||||
"notCookingGroup": "{n, plural, one {1 more item} other {# more items}} — not for cooking",
|
||||
"skippedOne": "{text}: not for cooking",
|
||||
"undo": "Undo",
|
||||
"assignShort": "Assign",
|
||||
"assignLine": "Assign {text} to an ingredient after all",
|
||||
"noIngredient": "No ingredient recognised",
|
||||
"forCooking": "For cooking",
|
||||
"swipeHint": "Swipe left what is not for cooking — foodplanhero remembers it for the next receipt.",
|
||||
"packEach": "Pack per item in {unit}",
|
||||
"perPrice": "= {price} {per}",
|
||||
"perDetail": "{amount} {unit} for {total}",
|
||||
"per": {
|
||||
"100g": "per 100 g",
|
||||
"100ml": "per 100 ml",
|
||||
"piece": "per item"
|
||||
},
|
||||
"noPackWarning": "Without a pack size foodplanhero keeps no price.",
|
||||
"weighedHint": "Weighed: 1000 means the price is per kg as on the receipt."
|
||||
},
|
||||
"setup": {
|
||||
"title": "Getting started",
|
||||
@@ -808,7 +872,7 @@
|
||||
"laterSr": "later:",
|
||||
"skipped": "skipped",
|
||||
"hide": "Hide list",
|
||||
"finishedTitle": "Done – Lunch is running",
|
||||
"finishedTitle": "Done – foodplanhero is running",
|
||||
"finishedText": "Dishes, store, family and the first round are set. From now on, “Where are we?” shows what's next.",
|
||||
"finishedOk": "Got it",
|
||||
"dishes": {
|
||||
@@ -816,7 +880,7 @@
|
||||
"title": "Fill the pool with five dishes",
|
||||
"text": "So there is something to wish for. Quickest: adopt classics with one tap. Right now: {n} of {of}.",
|
||||
"cta": "Adopt classics",
|
||||
"moreLink": "Your own: link, cookbook photo, speak it"
|
||||
"moreLink": "Add your own dish"
|
||||
},
|
||||
"store": {
|
||||
"short": "Main store",
|
||||
@@ -829,7 +893,7 @@
|
||||
"title": "Bring the family in",
|
||||
"text": "Adults and teens via a link on their own phone, children with picture and PIN on a tablet.",
|
||||
"cta": "Invite",
|
||||
"skip": "I'll use Lunch on my own for now"
|
||||
"skip": "I'll use foodplanhero on my own for now"
|
||||
},
|
||||
"round": {
|
||||
"short": "First round",
|
||||
@@ -876,7 +940,7 @@
|
||||
},
|
||||
"intro": {
|
||||
"roledesc": "Introduction",
|
||||
"eyebrow": "How Lunch works · {n} of {of}",
|
||||
"eyebrow": "How foodplanhero works · {n} of {of}",
|
||||
"next": "Next",
|
||||
"skip": "Skip",
|
||||
"done": "Let's go",
|
||||
@@ -920,5 +984,54 @@
|
||||
"unlockText": "This device will then show the recipes and plan of {household} — large, for reading while cooking. Nothing can be changed here.",
|
||||
"linkExpiredTitle": "Link expired",
|
||||
"linkExpiredText": "This link is no longer valid. An admin can create a new one under “More” › “Kitchen display”."
|
||||
},
|
||||
"ingredients": {
|
||||
"categories": {
|
||||
"vegetables": "Vegetables",
|
||||
"fruit": "Fruit",
|
||||
"herbs": "Herbs",
|
||||
"bakery": "Bread & bakery",
|
||||
"meat": "Meat",
|
||||
"poultry": "Poultry",
|
||||
"sausage": "Sausage & cold cuts",
|
||||
"fish": "Fish",
|
||||
"dairy": "Dairy",
|
||||
"cheese": "Cheese",
|
||||
"eggs": "Eggs",
|
||||
"chilled": "Chilled",
|
||||
"frozen": "Frozen",
|
||||
"pasta_rice": "Pasta, rice & pulses",
|
||||
"canned": "Tins & jars",
|
||||
"sauces": "Sauces & pastes",
|
||||
"spices": "Spices",
|
||||
"oil_vinegar": "Oil & vinegar",
|
||||
"baking": "Baking",
|
||||
"breakfast": "Breakfast",
|
||||
"nuts": "Nuts & dried fruit",
|
||||
"sweets": "Sweets & snacks",
|
||||
"drinks": "Drinks"
|
||||
},
|
||||
"title": "New ingredient",
|
||||
"create": "Add “{name}” as a new ingredient",
|
||||
"name": "Name",
|
||||
"unit": "Unit",
|
||||
"group": "Belongs to",
|
||||
"noGroup": "no group",
|
||||
"category": "Shelf in the store",
|
||||
"save": "Add",
|
||||
"cancel": "Cancel",
|
||||
"error": "That did not work. Does the ingredient exist already?",
|
||||
"anyKind": "any kind",
|
||||
"kinds": "{n, plural, one {1 kind} other {# kinds}}",
|
||||
"ownBadge": "own"
|
||||
},
|
||||
"measure": {
|
||||
"tbsp": "{n, plural, one {tbsp} other {tbsp}}",
|
||||
"tsp": "{n, plural, one {tsp} other {tsp}}",
|
||||
"pinch": "{n, plural, one {pinch} other {pinches}}",
|
||||
"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}}"
|
||||
}
|
||||
}
|
||||
+142
-29
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"app": {
|
||||
"name": "¿Qué comemos?",
|
||||
"name": "foodplanhero",
|
||||
"tagline": "Decide together what's for dinner — the shopping list writes itself."
|
||||
},
|
||||
"today": {
|
||||
@@ -29,7 +29,8 @@
|
||||
"editPlan": "Edit",
|
||||
"startCooking": "Cook",
|
||||
"readAlong": "Read along",
|
||||
"thanks": "For {title}: {up, plural, =0 {no thumbs up yet} one {1 thumbs up} other {# thumbs up}}{kudos, plural, =0 {} one { and 1 thank-you} other { and # thank-yous}}."
|
||||
"thanks": "For {title}: {up, plural, =0 {no thumbs up yet} one {1 thumbs up} other {# thumbs up}}{kudos, plural, =0 {} one { and 1 thank-you} other { and # thank-yous}}.",
|
||||
"mineDish": "Someone's dish, sure to be in the plan"
|
||||
},
|
||||
"auth": {
|
||||
"setup": {
|
||||
@@ -46,7 +47,7 @@
|
||||
"title": "Sign in",
|
||||
"intro": "Sign in with the passkey on this device.",
|
||||
"submit": "Sign in with passkey",
|
||||
"noPasskey": "No passkey on this device yet? Ask someone in your household for a link under More › Add device.",
|
||||
"noPasskey": "No passkey on this device yet? Ask someone in your household for a link under More › Add device.",
|
||||
"lost": "Lost access?",
|
||||
"kids": "Children sign in here"
|
||||
},
|
||||
@@ -129,7 +130,7 @@
|
||||
},
|
||||
"ai": {
|
||||
"title": "AI",
|
||||
"intro": "Lunch consulta un modelo de lenguaje en tu box. Nada va a una nube que no hayas puesto aquí tú.",
|
||||
"intro": "foodplanhero consulta un modelo de lenguaje en tu box. Nada va a una nube que no hayas puesto aquí tú.",
|
||||
"ready": "Set up",
|
||||
"notReady": "Not set up",
|
||||
"summary": "For cookbook photos and recipe pages without recipe data.",
|
||||
@@ -157,7 +158,7 @@
|
||||
"key": "The key was refused.",
|
||||
"status": "The service answered with an error.",
|
||||
"aiNotConfigured": "Please save first.",
|
||||
"login": "A sign-in page answered instead of the service. Lunch needs the address for “Apps in Olares”."
|
||||
"login": "A sign-in page answered instead of the service. foodplanhero needs the address for “Apps in Olares”."
|
||||
},
|
||||
"routerUse": "Usar el Router de Olares",
|
||||
"routerChecking": "Comprobando el Router …",
|
||||
@@ -166,9 +167,9 @@
|
||||
"sourceRouter": "Olares Router",
|
||||
"sourceManual": "Endpoint propio",
|
||||
"routerFound": "Router detectado · modelo: {model}",
|
||||
"routerManages": "El Router gestiona dirección, modelo y clave. Lunch usa el modelo predeterminado para texto y fotos.",
|
||||
"routerManages": "El Router gestiona dirección, modelo y clave. foodplanhero usa el modelo predeterminado para texto y fotos.",
|
||||
"routerAddress": "Dirección del Router",
|
||||
"noRouter": "Lunch no funciona bajo una dirección de Olares, así que no hay Router. Pon un endpoint propio.",
|
||||
"noRouter": "foodplanhero no funciona bajo una dirección de Olares, así que no hay Router. Pon un endpoint propio.",
|
||||
"speechModel": "Modelo de voz (voz a texto)",
|
||||
"speechHint": "Para «Dictar un plato», p. ej. un Whisper. Opcional."
|
||||
},
|
||||
@@ -233,6 +234,21 @@
|
||||
"devicePending": "Link open, not yet unlocked",
|
||||
"removeDevice": "Remove {label}",
|
||||
"remove": "Remove"
|
||||
},
|
||||
"dedication": {
|
||||
"title": "For {name}",
|
||||
"edit": "Edit dedication",
|
||||
"name": "Name",
|
||||
"text": "A few sentences",
|
||||
"textPlaceholder": "Why this app exists …",
|
||||
"photo": "Choose photo",
|
||||
"newPhoto": "Choose new photo",
|
||||
"photoHint": "The photo stays on your box. It appears when the app opens, at sign-in and here.",
|
||||
"save": "Save",
|
||||
"removePhoto": "Remove photo",
|
||||
"saved": "Saved.",
|
||||
"error": "That did not work. Use a JPEG, PNG or HEIC up to 15 MB.",
|
||||
"chosen": "Chosen: {name}"
|
||||
}
|
||||
},
|
||||
"nav": {
|
||||
@@ -349,7 +365,11 @@
|
||||
"piece": "pcs",
|
||||
"tbsp": "tbsp",
|
||||
"tsp": "tsp",
|
||||
"pinch": "pinch"
|
||||
"pinch": "pinch",
|
||||
"can": "Lata",
|
||||
"jar": "Tarro",
|
||||
"pack": "Paquete",
|
||||
"bunch": "Manojo"
|
||||
},
|
||||
"errors": {
|
||||
"invalid": "Please give a title and check the amounts.",
|
||||
@@ -360,8 +380,8 @@
|
||||
"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.",
|
||||
"restyle": "Unificar formato",
|
||||
"restyleHint": "Pone los pasos en la forma de Lunch: preparar, cocinar, servir; una acción por paso, tiempos como temporizadores. Tú revisas y guardas.",
|
||||
"styledByAi": "Puesto en la forma de Lunch por la AI. Tiempos y temperaturas vienen de la receta — revísalo un momento.",
|
||||
"restyleHint": "Pone los pasos en la forma de foodplanhero: preparar, cocinar, servir; una acción por paso, tiempos como temporizadores. Tú revisas y guardas.",
|
||||
"styledByAi": "Puesto en la forma de foodplanhero por la AI. Tiempos y temperaturas vienen de la receta — revísalo un momento.",
|
||||
"styledByRules": "Ordenado en secciones por reglas, texto sin cambios. Con una AI configurada, los pasos también se reformulan.",
|
||||
"styleFailed": "No ha funcionado. Los pasos no han cambiado.",
|
||||
"section": "Sección del paso {n}",
|
||||
@@ -371,7 +391,17 @@
|
||||
"productPack": "Paquete en {unit}",
|
||||
"productCook": "Cocción (min)",
|
||||
"productHint": "El tiempo de cocción pasa a ser el temporizador del paso que cuece el ingrediente; nombre y paquete van a la lista de la compra.",
|
||||
"addProduct": "Indicar producto"
|
||||
"addProduct": "Indicar producto",
|
||||
"rememberProduct": "Remember for every dish with {name}",
|
||||
"inheritedProduct": "Your product for every dish: {product}",
|
||||
"otherProduct": "Different product for this dish",
|
||||
"unitWithSize": "{unit} ({size})",
|
||||
"packSize": "1 {unit} = {size}",
|
||||
"packChange": "Cambiar tamaño",
|
||||
"packSizeLabel": "Tamaño de un(a) {unit} en {base}",
|
||||
"packSave": "Aplicar",
|
||||
"packHint": "Vale para todos los platos de tu hogar.",
|
||||
"packError": "No se pudo guardar el tamaño."
|
||||
},
|
||||
"addLinkText": "Leemos los ingredientes y los pasos de la página de la receta.",
|
||||
"link": {
|
||||
@@ -429,10 +459,10 @@
|
||||
"error": "No ha funcionado."
|
||||
},
|
||||
"addVoice": "Dictar",
|
||||
"addVoiceText": "Cuenta un plato favorito — Lunch lo convierte en receta.",
|
||||
"addVoiceText": "Cuenta un plato favorito — foodplanhero lo convierte en receta.",
|
||||
"voice": {
|
||||
"title": "Dictar un plato",
|
||||
"intro": "Cuéntalo sin más: cuántas raciones, qué lleva, cómo se hace. Lunch lo anota y prepara un borrador para revisar.",
|
||||
"intro": "Cuéntalo sin más: cuántas raciones, qué lleva, cómo se hace. foodplanhero lo anota y prepara un borrador para revisar.",
|
||||
"record": "Empezar a grabar",
|
||||
"stop": "Parar la grabación",
|
||||
"recording": "Grabando … {time}",
|
||||
@@ -445,7 +475,7 @@
|
||||
"draft": "Convertir en receta",
|
||||
"drafting": "Preparando la receta …",
|
||||
"check": "Revisa el borrador. Las cantidades solo aparecen donde las dijiste.",
|
||||
"noAi": "Hace falta un modelo de lenguaje. Un admin lo configura en Más › AI.",
|
||||
"noAi": "Hace falta un modelo de lenguaje. Un admin lo configura en Más › AI.",
|
||||
"errors": {
|
||||
"mic": "El micrófono no está permitido. Permítelo o usa el campo de texto.",
|
||||
"noSpeech": "No hay modelo de voz. Usa el campo de texto.",
|
||||
@@ -521,7 +551,10 @@
|
||||
"noTrial": "Nothing new left under “To try”.",
|
||||
"dish": "This dish no longer exists.",
|
||||
"unknown": "That did not work. Please try again.",
|
||||
"alternative": "Elige otro plato del pool que nadie haya deseado aún."
|
||||
"alternative": "Elige otro plato del pool que nadie haya deseado aún.",
|
||||
"protected": "This is someone's dish — there is no veto against it.",
|
||||
"repeat": "That was already your dish last round. Pick a different one this time.",
|
||||
"notWished": "Wish for the dish first, then you can make it yours."
|
||||
},
|
||||
"wishAction": "Wish:",
|
||||
"unwishAction": "Take back wish:",
|
||||
@@ -530,7 +563,17 @@
|
||||
"vetoInsteadHint": "Un veto solo vale con una contrapropuesta del pool. Cuenta como tu deseo y no cuesta ficha.",
|
||||
"vetoNoAlternative": "Ahora no hay ningún plato del pool libre. Sin contrapropuesta no hay veto.",
|
||||
"back": "Atrás",
|
||||
"viaVetoHint": "Tu contrapropuesta a un veto. Si la retiras, también termina el veto."
|
||||
"viaVetoHint": "Tu contrapropuesta a un veto. Si la retiras, también termina el veto.",
|
||||
"mine": "My dish",
|
||||
"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.",
|
||||
"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"
|
||||
},
|
||||
"kids": {
|
||||
"title": "Who are you?",
|
||||
@@ -601,7 +644,8 @@
|
||||
"pool": "from the pool",
|
||||
"manual": "picked by hand",
|
||||
"locked": "locked",
|
||||
"cheap": "barato"
|
||||
"cheap": "barato",
|
||||
"mine": "{names}'s dish (guaranteed)"
|
||||
},
|
||||
"errors": {
|
||||
"empty": "The plan needs at least one dish first.",
|
||||
@@ -637,7 +681,8 @@
|
||||
"addPlaceholder": "e.g. toilet paper",
|
||||
"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.}}"
|
||||
"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}"
|
||||
},
|
||||
"cooking": {
|
||||
"eyebrow": "Cooking",
|
||||
@@ -679,8 +724,8 @@
|
||||
}
|
||||
},
|
||||
"install": {
|
||||
"title": "Put Lunch on your home screen",
|
||||
"ios": "In Safari, tap the share icon, then “Add to Home Screen”. Lunch then opens like an app.",
|
||||
"title": "Put foodplanhero on your home screen",
|
||||
"ios": "In Safari, tap the share icon, then “Add to Home Screen”. foodplanhero then opens like an app.",
|
||||
"install": "Install app",
|
||||
"dismiss": "Hide hint"
|
||||
},
|
||||
@@ -753,7 +798,7 @@
|
||||
"receipts": {
|
||||
"eyebrow": "Compra",
|
||||
"title": "Tickets",
|
||||
"intro": "Fotografía el ticket y sigue. Lunch lo lee en tu box y recuerda los precios cuando confirmas. Después se borra la foto.",
|
||||
"intro": "Fotografía el ticket y sigue. foodplanhero lo lee en tu box y recuerda los precios cuando confirmas. Después se borra la foto.",
|
||||
"noAi": "Para leer hace falta un modelo de imagen (incluido en el Router de Olares). Los tickets esperan hasta entonces.",
|
||||
"scan": "Fotografiar ticket",
|
||||
"uploading": "Subiendo …",
|
||||
@@ -771,7 +816,8 @@
|
||||
"errors": {
|
||||
"unavailable": "AI no disponible ahora",
|
||||
"unreadable": "no se encontraron líneas",
|
||||
"photo": "foto ilegible"
|
||||
"photo": "foto ilegible",
|
||||
"partial": "only partly read"
|
||||
},
|
||||
"reviewTitle": "Revisar ticket",
|
||||
"doneTitle": "Ticket",
|
||||
@@ -779,9 +825,7 @@
|
||||
"store": "Tienda",
|
||||
"noStore": "desconocida",
|
||||
"date": "Fecha",
|
||||
"otherLine": "Otros – no cuenta para ningún plato",
|
||||
"assign": "Asignar ingrediente",
|
||||
"other": "Otros",
|
||||
"pack": "Paquete en {unit}",
|
||||
"source": {
|
||||
"alias": "confirmado así antes",
|
||||
@@ -798,7 +842,27 @@
|
||||
"delete": "Borrar ticket",
|
||||
"saveError": "No ha funcionado.",
|
||||
"doneText": "Los precios están guardados y las asignaciones aprendidas. La foto se ha borrado.",
|
||||
"link": "Fotografiar ticket"
|
||||
"link": "Fotografiar ticket",
|
||||
"partialHint": "The receipt was long; the AI read it only up to a point. Check the lines here — photograph the rest as a receipt of its own (just the lower half).",
|
||||
"notCooking": "Not for cooking",
|
||||
"notCookingGroup": "{n, plural, one {1 more item} other {# more items}} — not for cooking",
|
||||
"skippedOne": "{text}: not for cooking",
|
||||
"undo": "Undo",
|
||||
"assignShort": "Assign",
|
||||
"assignLine": "Assign {text} to an ingredient after all",
|
||||
"noIngredient": "No ingredient recognised",
|
||||
"forCooking": "For cooking",
|
||||
"swipeHint": "Swipe left what is not for cooking — foodplanhero remembers it for the next receipt.",
|
||||
"packEach": "Pack per item in {unit}",
|
||||
"perPrice": "= {price} {per}",
|
||||
"perDetail": "{amount} {unit} for {total}",
|
||||
"per": {
|
||||
"100g": "per 100 g",
|
||||
"100ml": "per 100 ml",
|
||||
"piece": "per item"
|
||||
},
|
||||
"noPackWarning": "Without a pack size foodplanhero keeps no price.",
|
||||
"weighedHint": "Weighed: 1000 means the price is per kg as on the receipt."
|
||||
},
|
||||
"setup": {
|
||||
"title": "Primeros pasos",
|
||||
@@ -808,7 +872,7 @@
|
||||
"laterSr": "después:",
|
||||
"skipped": "omitido",
|
||||
"hide": "Ocultar lista",
|
||||
"finishedTitle": "Listo – Lunch está en marcha",
|
||||
"finishedTitle": "Listo – foodplanhero está en marcha",
|
||||
"finishedText": "Platos, tienda, familia y la primera ronda están listos. Desde ahora, «¿Dónde estamos?» muestra lo siguiente.",
|
||||
"finishedOk": "Entendido",
|
||||
"dishes": {
|
||||
@@ -816,7 +880,7 @@
|
||||
"title": "Llena el pool con cinco platos",
|
||||
"text": "Para que haya algo que desear. Lo más rápido: adoptar clásicos con un toque. Ahora mismo: {n} de {of}.",
|
||||
"cta": "Adoptar clásicos",
|
||||
"moreLink": "Los tuyos: enlace, foto, dictar"
|
||||
"moreLink": "Add your own dish"
|
||||
},
|
||||
"store": {
|
||||
"short": "Tienda principal",
|
||||
@@ -829,7 +893,7 @@
|
||||
"title": "Trae a la familia",
|
||||
"text": "Adultos y adolescentes con un enlace en su móvil, niños con imagen y PIN en una tablet.",
|
||||
"cta": "Invitar",
|
||||
"skip": "De momento uso Lunch solo"
|
||||
"skip": "De momento uso foodplanhero solo"
|
||||
},
|
||||
"round": {
|
||||
"short": "Primera ronda",
|
||||
@@ -876,7 +940,7 @@
|
||||
},
|
||||
"intro": {
|
||||
"roledesc": "Introducción",
|
||||
"eyebrow": "Así funciona Lunch · {n} de {of}",
|
||||
"eyebrow": "Así funciona foodplanhero · {n} de {of}",
|
||||
"next": "Siguiente",
|
||||
"skip": "Omitir",
|
||||
"done": "Vamos",
|
||||
@@ -920,5 +984,54 @@
|
||||
"unlockText": "This device will then show the recipes and plan of {household} — large, for reading while cooking. Nothing can be changed here.",
|
||||
"linkExpiredTitle": "Link expired",
|
||||
"linkExpiredText": "This link is no longer valid. An admin can create a new one under “More” › “Kitchen display”."
|
||||
},
|
||||
"ingredients": {
|
||||
"categories": {
|
||||
"vegetables": "Vegetables",
|
||||
"fruit": "Fruit",
|
||||
"herbs": "Herbs",
|
||||
"bakery": "Bread & bakery",
|
||||
"meat": "Meat",
|
||||
"poultry": "Poultry",
|
||||
"sausage": "Sausage & cold cuts",
|
||||
"fish": "Fish",
|
||||
"dairy": "Dairy",
|
||||
"cheese": "Cheese",
|
||||
"eggs": "Eggs",
|
||||
"chilled": "Chilled",
|
||||
"frozen": "Frozen",
|
||||
"pasta_rice": "Pasta, rice & pulses",
|
||||
"canned": "Tins & jars",
|
||||
"sauces": "Sauces & pastes",
|
||||
"spices": "Spices",
|
||||
"oil_vinegar": "Oil & vinegar",
|
||||
"baking": "Baking",
|
||||
"breakfast": "Breakfast",
|
||||
"nuts": "Nuts & dried fruit",
|
||||
"sweets": "Sweets & snacks",
|
||||
"drinks": "Drinks"
|
||||
},
|
||||
"title": "New ingredient",
|
||||
"create": "Add “{name}” as a new ingredient",
|
||||
"name": "Name",
|
||||
"unit": "Unit",
|
||||
"group": "Belongs to",
|
||||
"noGroup": "no group",
|
||||
"category": "Shelf in the store",
|
||||
"save": "Add",
|
||||
"cancel": "Cancel",
|
||||
"error": "That did not work. Does the ingredient exist already?",
|
||||
"anyKind": "any kind",
|
||||
"kinds": "{n, plural, one {1 kind} other {# kinds}}",
|
||||
"ownBadge": "own"
|
||||
},
|
||||
"measure": {
|
||||
"tbsp": "{n, plural, one {cda.} other {cdas.}}",
|
||||
"tsp": "{n, plural, one {cdta.} other {cdtas.}}",
|
||||
"pinch": "{n, plural, one {pizca} other {pizcas}}",
|
||||
"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}}"
|
||||
}
|
||||
}
|
||||
+141
-28
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"app": {
|
||||
"name": "On mange quoi ?",
|
||||
"name": "foodplanhero",
|
||||
"tagline": "Decide together what's for dinner — the shopping list writes itself."
|
||||
},
|
||||
"today": {
|
||||
@@ -29,7 +29,8 @@
|
||||
"editPlan": "Edit",
|
||||
"startCooking": "Cook",
|
||||
"readAlong": "Read along",
|
||||
"thanks": "For {title}: {up, plural, =0 {no thumbs up yet} one {1 thumbs up} other {# thumbs up}}{kudos, plural, =0 {} one { and 1 thank-you} other { and # thank-yous}}."
|
||||
"thanks": "For {title}: {up, plural, =0 {no thumbs up yet} one {1 thumbs up} other {# thumbs up}}{kudos, plural, =0 {} one { and 1 thank-you} other { and # thank-yous}}.",
|
||||
"mineDish": "Someone's dish, sure to be in the plan"
|
||||
},
|
||||
"auth": {
|
||||
"setup": {
|
||||
@@ -46,7 +47,7 @@
|
||||
"title": "Sign in",
|
||||
"intro": "Sign in with the passkey on this device.",
|
||||
"submit": "Sign in with passkey",
|
||||
"noPasskey": "No passkey on this device yet? Ask someone in your household for a link under More › Add device.",
|
||||
"noPasskey": "No passkey on this device yet? Ask someone in your household for a link under More › Add device.",
|
||||
"lost": "Lost access?",
|
||||
"kids": "Children sign in here"
|
||||
},
|
||||
@@ -129,7 +130,7 @@
|
||||
},
|
||||
"ai": {
|
||||
"title": "AI",
|
||||
"intro": "Lunch interroge un modèle de langage sur ta box. Rien ne part dans un cloud que tu n'aurais pas saisi ici.",
|
||||
"intro": "foodplanhero interroge un modèle de langage sur ta box. Rien ne part dans un cloud que tu n'aurais pas saisi ici.",
|
||||
"ready": "Set up",
|
||||
"notReady": "Not set up",
|
||||
"summary": "For cookbook photos and recipe pages without recipe data.",
|
||||
@@ -157,7 +158,7 @@
|
||||
"key": "The key was refused.",
|
||||
"status": "The service answered with an error.",
|
||||
"aiNotConfigured": "Please save first.",
|
||||
"login": "A sign-in page answered instead of the service. Lunch needs the address for “Apps in Olares”."
|
||||
"login": "A sign-in page answered instead of the service. foodplanhero needs the address for “Apps in Olares”."
|
||||
},
|
||||
"routerUse": "Utiliser le Router d'Olares",
|
||||
"routerChecking": "Vérification du Router …",
|
||||
@@ -166,9 +167,9 @@
|
||||
"sourceRouter": "Olares Router",
|
||||
"sourceManual": "Point d'accès perso",
|
||||
"routerFound": "Router détecté · modèle : {model}",
|
||||
"routerManages": "Le Router gère l'adresse, le modèle et la clé. Lunch utilise le modèle par défaut pour le texte et les photos.",
|
||||
"routerManages": "Le Router gère l'adresse, le modèle et la clé. foodplanhero utilise le modèle par défaut pour le texte et les photos.",
|
||||
"routerAddress": "Adresse du Router",
|
||||
"noRouter": "Lunch ne tourne pas sous une adresse Olares, il n'y a donc pas de Router. Saisis un point d'accès.",
|
||||
"noRouter": "foodplanhero ne tourne pas sous une adresse Olares, il n'y a donc pas de Router. Saisis un point d'accès.",
|
||||
"speechModel": "Modèle vocal (parole en texte)",
|
||||
"speechHint": "Pour « Dicter un plat », p. ex. un Whisper. Facultatif."
|
||||
},
|
||||
@@ -233,6 +234,21 @@
|
||||
"devicePending": "Link open, not yet unlocked",
|
||||
"removeDevice": "Remove {label}",
|
||||
"remove": "Remove"
|
||||
},
|
||||
"dedication": {
|
||||
"title": "For {name}",
|
||||
"edit": "Edit dedication",
|
||||
"name": "Name",
|
||||
"text": "A few sentences",
|
||||
"textPlaceholder": "Why this app exists …",
|
||||
"photo": "Choose photo",
|
||||
"newPhoto": "Choose new photo",
|
||||
"photoHint": "The photo stays on your box. It appears when the app opens, at sign-in and here.",
|
||||
"save": "Save",
|
||||
"removePhoto": "Remove photo",
|
||||
"saved": "Saved.",
|
||||
"error": "That did not work. Use a JPEG, PNG or HEIC up to 15 MB.",
|
||||
"chosen": "Chosen: {name}"
|
||||
}
|
||||
},
|
||||
"nav": {
|
||||
@@ -349,7 +365,11 @@
|
||||
"piece": "pcs",
|
||||
"tbsp": "tbsp",
|
||||
"tsp": "tsp",
|
||||
"pinch": "pinch"
|
||||
"pinch": "pinch",
|
||||
"can": "Boîte",
|
||||
"jar": "Bocal",
|
||||
"pack": "Paquet",
|
||||
"bunch": "Botte"
|
||||
},
|
||||
"errors": {
|
||||
"invalid": "Please give a title and check the amounts.",
|
||||
@@ -360,7 +380,7 @@
|
||||
"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.",
|
||||
"restyle": "Uniformiser",
|
||||
"restyleHint": "Met les étapes dans la forme Lunch : préparer, cuire, servir ; une action par étape, durées en minuteurs. Tu vérifies et enregistres.",
|
||||
"restyleHint": "Met les étapes dans la forme foodplanhero : préparer, cuire, servir ; une action par étape, durées en minuteurs. Tu vérifies et enregistres.",
|
||||
"styledByAi": "Mis en forme par l'AI. Durées et températures viennent de la recette — vérifie rapidement.",
|
||||
"styledByRules": "Classé en sections par règles, texte inchangé. Avec une AI configurée, les étapes sont aussi reformulées.",
|
||||
"styleFailed": "Ça n'a pas marché. Les étapes sont inchangées.",
|
||||
@@ -371,7 +391,17 @@
|
||||
"productPack": "Paquet en {unit}",
|
||||
"productCook": "Cuisson (min)",
|
||||
"productHint": "Le temps de cuisson devient le minuteur de l'étape qui cuit l'ingrédient ; nom et paquet vont sur la liste de courses.",
|
||||
"addProduct": "Indiquer un produit"
|
||||
"addProduct": "Indiquer un produit",
|
||||
"rememberProduct": "Remember for every dish with {name}",
|
||||
"inheritedProduct": "Your product for every dish: {product}",
|
||||
"otherProduct": "Different product for this dish",
|
||||
"unitWithSize": "{unit} ({size})",
|
||||
"packSize": "1 {unit} = {size}",
|
||||
"packChange": "Modifier la taille",
|
||||
"packSizeLabel": "Taille d’un(e) {unit} en {base}",
|
||||
"packSave": "Appliquer",
|
||||
"packHint": "Vaut pour tous les plats de votre foyer.",
|
||||
"packError": "Impossible d’enregistrer la taille."
|
||||
},
|
||||
"addLinkText": "Nous lisons les ingrédients et les étapes sur la page de la recette.",
|
||||
"link": {
|
||||
@@ -429,10 +459,10 @@
|
||||
"error": "Ça n'a pas marché."
|
||||
},
|
||||
"addVoice": "Dicter",
|
||||
"addVoiceText": "Raconte un plat préféré — Lunch en fait une recette.",
|
||||
"addVoiceText": "Raconte un plat préféré — foodplanhero en fait une recette.",
|
||||
"voice": {
|
||||
"title": "Dicter un plat",
|
||||
"intro": "Raconte simplement : combien de portions, ce qu'il faut, comment faire. Lunch note et prépare un brouillon à vérifier.",
|
||||
"intro": "Raconte simplement : combien de portions, ce qu'il faut, comment faire. foodplanhero note et prépare un brouillon à vérifier.",
|
||||
"record": "Démarrer l'enregistrement",
|
||||
"stop": "Arrêter l'enregistrement",
|
||||
"recording": "Enregistrement … {time}",
|
||||
@@ -445,7 +475,7 @@
|
||||
"draft": "En faire une recette",
|
||||
"drafting": "Préparation de la recette …",
|
||||
"check": "Vérifie le brouillon. Les quantités n'apparaissent que là où tu les as dites.",
|
||||
"noAi": "Il faut un modèle de langage. Un admin le configure dans Plus › AI.",
|
||||
"noAi": "Il faut un modèle de langage. Un admin le configure dans Plus › AI.",
|
||||
"errors": {
|
||||
"mic": "Le micro n'est pas autorisé. Autorise-le ou utilise le champ de texte.",
|
||||
"noSpeech": "Aucun modèle vocal configuré. Utilise le champ de texte.",
|
||||
@@ -521,7 +551,10 @@
|
||||
"noTrial": "Nothing new left under “To try”.",
|
||||
"dish": "This dish no longer exists.",
|
||||
"unknown": "That did not work. Please try again.",
|
||||
"alternative": "Choisis un autre plat du pool que personne n'a encore souhaité."
|
||||
"alternative": "Choisis un autre plat du pool que personne n'a encore souhaité.",
|
||||
"protected": "This is someone's dish — there is no veto against it.",
|
||||
"repeat": "That was already your dish last round. Pick a different one this time.",
|
||||
"notWished": "Wish for the dish first, then you can make it yours."
|
||||
},
|
||||
"wishAction": "Wish:",
|
||||
"unwishAction": "Take back wish:",
|
||||
@@ -530,7 +563,17 @@
|
||||
"vetoInsteadHint": "Un veto n'est possible qu'avec une contre-proposition du pool. Elle compte comme ton souhait et ne coûte pas de jeton.",
|
||||
"vetoNoAlternative": "Aucun plat du pool n'est libre pour l'instant. Sans contre-proposition, pas de veto.",
|
||||
"back": "Retour",
|
||||
"viaVetoHint": "Ta contre-proposition à un veto. La retirer met aussi fin au veto."
|
||||
"viaVetoHint": "Ta contre-proposition à un veto. La retirer met aussi fin au veto.",
|
||||
"mine": "My dish",
|
||||
"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.",
|
||||
"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"
|
||||
},
|
||||
"kids": {
|
||||
"title": "Who are you?",
|
||||
@@ -601,7 +644,8 @@
|
||||
"pool": "from the pool",
|
||||
"manual": "picked by hand",
|
||||
"locked": "locked",
|
||||
"cheap": "bon marché"
|
||||
"cheap": "bon marché",
|
||||
"mine": "{names}'s dish (guaranteed)"
|
||||
},
|
||||
"errors": {
|
||||
"empty": "The plan needs at least one dish first.",
|
||||
@@ -637,7 +681,8 @@
|
||||
"addPlaceholder": "e.g. toilet paper",
|
||||
"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.}}"
|
||||
"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}"
|
||||
},
|
||||
"cooking": {
|
||||
"eyebrow": "Cooking",
|
||||
@@ -679,8 +724,8 @@
|
||||
}
|
||||
},
|
||||
"install": {
|
||||
"title": "Put Lunch on your home screen",
|
||||
"ios": "In Safari, tap the share icon, then “Add to Home Screen”. Lunch then opens like an app.",
|
||||
"title": "Put foodplanhero on your home screen",
|
||||
"ios": "In Safari, tap the share icon, then “Add to Home Screen”. foodplanhero then opens like an app.",
|
||||
"install": "Install app",
|
||||
"dismiss": "Hide hint"
|
||||
},
|
||||
@@ -753,7 +798,7 @@
|
||||
"receipts": {
|
||||
"eyebrow": "Courses",
|
||||
"title": "Tickets de caisse",
|
||||
"intro": "Photographie le ticket et continue. Lunch le lit sur ta box et retient les prix dès que tu confirmes. La photo est ensuite supprimée.",
|
||||
"intro": "Photographie le ticket et continue. foodplanhero le lit sur ta box et retient les prix dès que tu confirmes. La photo est ensuite supprimée.",
|
||||
"noAi": "La lecture nécessite un modèle d'image (inclus dans le Router d'Olares). Les tickets attendent jusque-là.",
|
||||
"scan": "Photographier le ticket",
|
||||
"uploading": "Envoi …",
|
||||
@@ -771,7 +816,8 @@
|
||||
"errors": {
|
||||
"unavailable": "AI injoignable pour l'instant",
|
||||
"unreadable": "aucune ligne trouvée",
|
||||
"photo": "photo illisible"
|
||||
"photo": "photo illisible",
|
||||
"partial": "only partly read"
|
||||
},
|
||||
"reviewTitle": "Vérifier le ticket",
|
||||
"doneTitle": "Ticket",
|
||||
@@ -779,9 +825,7 @@
|
||||
"store": "Magasin",
|
||||
"noStore": "inconnu",
|
||||
"date": "Date",
|
||||
"otherLine": "Divers – ne compte pour aucun plat",
|
||||
"assign": "Associer un ingrédient",
|
||||
"other": "Divers",
|
||||
"pack": "Paquet en {unit}",
|
||||
"source": {
|
||||
"alias": "déjà confirmé ainsi",
|
||||
@@ -798,7 +842,27 @@
|
||||
"delete": "Supprimer le ticket",
|
||||
"saveError": "Ça n'a pas marché.",
|
||||
"doneText": "Les prix sont mémorisés et les associations apprises. La photo est supprimée.",
|
||||
"link": "Photographier le ticket"
|
||||
"link": "Photographier le ticket",
|
||||
"partialHint": "The receipt was long; the AI read it only up to a point. Check the lines here — photograph the rest as a receipt of its own (just the lower half).",
|
||||
"notCooking": "Not for cooking",
|
||||
"notCookingGroup": "{n, plural, one {1 more item} other {# more items}} — not for cooking",
|
||||
"skippedOne": "{text}: not for cooking",
|
||||
"undo": "Undo",
|
||||
"assignShort": "Assign",
|
||||
"assignLine": "Assign {text} to an ingredient after all",
|
||||
"noIngredient": "No ingredient recognised",
|
||||
"forCooking": "For cooking",
|
||||
"swipeHint": "Swipe left what is not for cooking — foodplanhero remembers it for the next receipt.",
|
||||
"packEach": "Pack per item in {unit}",
|
||||
"perPrice": "= {price} {per}",
|
||||
"perDetail": "{amount} {unit} for {total}",
|
||||
"per": {
|
||||
"100g": "per 100 g",
|
||||
"100ml": "per 100 ml",
|
||||
"piece": "per item"
|
||||
},
|
||||
"noPackWarning": "Without a pack size foodplanhero keeps no price.",
|
||||
"weighedHint": "Weighed: 1000 means the price is per kg as on the receipt."
|
||||
},
|
||||
"setup": {
|
||||
"title": "C'est parti",
|
||||
@@ -808,7 +872,7 @@
|
||||
"laterSr": "plus tard :",
|
||||
"skipped": "ignoré",
|
||||
"hide": "Masquer la liste",
|
||||
"finishedTitle": "Terminé – Lunch tourne",
|
||||
"finishedTitle": "Terminé – foodplanhero tourne",
|
||||
"finishedText": "Plats, magasin, famille et première tournée sont prêts. Désormais, « Où en est-on ? » montre la suite.",
|
||||
"finishedOk": "Compris",
|
||||
"dishes": {
|
||||
@@ -816,7 +880,7 @@
|
||||
"title": "Remplis le pool avec cinq plats",
|
||||
"text": "Pour qu'il y ait de quoi souhaiter. Le plus rapide : reprendre des classiques d'un geste. Pour l'instant : {n} sur {of}.",
|
||||
"cta": "Reprendre des classiques",
|
||||
"moreLink": "Les tiens : lien, photo, dicter"
|
||||
"moreLink": "Add your own dish"
|
||||
},
|
||||
"store": {
|
||||
"short": "Magasin principal",
|
||||
@@ -829,7 +893,7 @@
|
||||
"title": "Fais venir la famille",
|
||||
"text": "Adultes et ados par lien sur leur téléphone, enfants avec image et PIN sur une tablette.",
|
||||
"cta": "Inviter",
|
||||
"skip": "J'utilise Lunch seul pour l'instant"
|
||||
"skip": "J'utilise foodplanhero seul pour l'instant"
|
||||
},
|
||||
"round": {
|
||||
"short": "Première tournée",
|
||||
@@ -876,7 +940,7 @@
|
||||
},
|
||||
"intro": {
|
||||
"roledesc": "Introduction",
|
||||
"eyebrow": "Comment marche Lunch · {n} sur {of}",
|
||||
"eyebrow": "Comment marche foodplanhero · {n} sur {of}",
|
||||
"next": "Suivant",
|
||||
"skip": "Passer",
|
||||
"done": "C'est parti",
|
||||
@@ -920,5 +984,54 @@
|
||||
"unlockText": "This device will then show the recipes and plan of {household} — large, for reading while cooking. Nothing can be changed here.",
|
||||
"linkExpiredTitle": "Link expired",
|
||||
"linkExpiredText": "This link is no longer valid. An admin can create a new one under “More” › “Kitchen display”."
|
||||
},
|
||||
"ingredients": {
|
||||
"categories": {
|
||||
"vegetables": "Vegetables",
|
||||
"fruit": "Fruit",
|
||||
"herbs": "Herbs",
|
||||
"bakery": "Bread & bakery",
|
||||
"meat": "Meat",
|
||||
"poultry": "Poultry",
|
||||
"sausage": "Sausage & cold cuts",
|
||||
"fish": "Fish",
|
||||
"dairy": "Dairy",
|
||||
"cheese": "Cheese",
|
||||
"eggs": "Eggs",
|
||||
"chilled": "Chilled",
|
||||
"frozen": "Frozen",
|
||||
"pasta_rice": "Pasta, rice & pulses",
|
||||
"canned": "Tins & jars",
|
||||
"sauces": "Sauces & pastes",
|
||||
"spices": "Spices",
|
||||
"oil_vinegar": "Oil & vinegar",
|
||||
"baking": "Baking",
|
||||
"breakfast": "Breakfast",
|
||||
"nuts": "Nuts & dried fruit",
|
||||
"sweets": "Sweets & snacks",
|
||||
"drinks": "Drinks"
|
||||
},
|
||||
"title": "New ingredient",
|
||||
"create": "Add “{name}” as a new ingredient",
|
||||
"name": "Name",
|
||||
"unit": "Unit",
|
||||
"group": "Belongs to",
|
||||
"noGroup": "no group",
|
||||
"category": "Shelf in the store",
|
||||
"save": "Add",
|
||||
"cancel": "Cancel",
|
||||
"error": "That did not work. Does the ingredient exist already?",
|
||||
"anyKind": "any kind",
|
||||
"kinds": "{n, plural, one {1 kind} other {# kinds}}",
|
||||
"ownBadge": "own"
|
||||
},
|
||||
"measure": {
|
||||
"tbsp": "{n, plural, one {c. à s.} other {c. à s.}}",
|
||||
"tsp": "{n, plural, one {c. à c.} other {c. à c.}}",
|
||||
"pinch": "{n, plural, one {pincée} other {pincées}}",
|
||||
"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}}"
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,9 @@ const nextConfig: NextConfig = {
|
||||
// pg lädt optionale Module dynamisch; nicht bündeln, sondern als Paket
|
||||
// mitnehmen (standalone verfolgt es dann selbst).
|
||||
serverExternalPackages: ["pg"],
|
||||
// Das Startbild (app/startbild) liest Poppins und Caveat zur Laufzeit von der
|
||||
// Platte; standalone nimmt sie nur mit, wenn sie hier stehen.
|
||||
outputFileTracingIncludes: { "/startbild/[size]": ["./lib/brand-fonts/*.woff"] },
|
||||
poweredByHeader: false,
|
||||
// Kein X-Frame-Options/frame-ancestors: Olares zeigt Apps im eigenen
|
||||
// Fenster der Oberfläche. Passkeys sind in fremden Rahmen ohnehin gesperrt.
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
apiVersion: v2
|
||||
name: lunch
|
||||
description: Was gibt's? — die Familie entscheidet gemeinsam, was es gibt; aus dem Plan entsteht die Einkaufsliste
|
||||
description: foodplanhero (Plan. Cook. Smile.) — die Familie entscheidet gemeinsam, was es gibt; aus dem Plan entsteht die Einkaufsliste
|
||||
type: application
|
||||
version: 26.11.28 # YY.M.<n> wie im AImighty-Markt — bei jeder Chart-Änderung erhöhen
|
||||
appVersion: "26.11.28" # MUSS gleich version sein: der Linter prüft es, und der Image-Tag hängt daran
|
||||
version: 26.11.39 # YY.M.<n> wie im AImighty-Markt — bei jeder Chart-Änderung erhöhen
|
||||
appVersion: "26.11.39" # MUSS gleich version sein: der Linter prüft es, und der Image-Tag hängt daran
|
||||
Loaded 100 of 134 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user