Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f95956205b | ||
|
|
06a0cb9cf4 |
No files matched your search
@@ -7,7 +7,7 @@
|
||||
> **Plattform:** Olares One (Kubernetes), Repo und CI auf Gitea — kein Supabase,
|
||||
> kein Vercel (E-0001). Eigene Gestaltung, nicht AImighty (E-0002).
|
||||
> Verteilung über den Markt, Repo öffentlich (E-0005).
|
||||
> **Status:** 26.11.50 — alle neun Arbeitspakete aus `docs/PROJEKTSTART.md` sind gebaut:
|
||||
> **Status:** 26.11.52 — 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
|
||||
@@ -22,7 +22,7 @@
|
||||
> (26.11.39, E-0016), Anmelden per Mail-Link über Resend (26.11.40, E-0017; nur
|
||||
> anmelden, keine Geräte oder Passkeys aus einer Mail-Sitzung), Leiste bleibt nach der
|
||||
> Tastatur unten (26.11.41), Icon Kochmütze mit Herz (26.11.42), Fotos aus der Mediathek (26.11.43), gleich große Karten (26.11.44), Runde beenden/löschen/ändern,
|
||||
> Tage je Gericht von Hand und Kalender-Abo je Haushalt (26.11.45, E-0018), Einkaufsliste einsprechen (26.11.46), Herz für „Mein Gericht“ auf jeder Wunschkarte (26.11.47), Kochbuch mit bis zu sechs Seiten (26.11.48), Portionen rechnen beim Bearbeiten mit und mehr Maße (26.11.49), ml und l bei jeder Zutat (26.11.50). Offen: Kai trägt
|
||||
> Tage je Gericht von Hand und Kalender-Abo je Haushalt (26.11.45, E-0018), Einkaufsliste einsprechen (26.11.46), Herz für „Mein Gericht“ auf jeder Wunschkarte (26.11.47), Kochbuch mit bis zu sechs Seiten (26.11.48), Portionen rechnen beim Bearbeiten mit und mehr Maße (26.11.49), ml und l bei jeder Zutat (26.11.50), Fehlendes im Formular am Feld markiert und gezählt (26.11.51), Desktop zeigt die Handy-Spalte (26.11.52). Offen: Kai trägt
|
||||
> den Resend-Schlüssel unter Mehr › Mails verschicken ein und abonniert den Kalender-Link einmal auf dem iPhone.
|
||||
> **Letzte Aktualisierung:** 8. November 2026
|
||||
|
||||
|
||||
+2
-2
@@ -21,7 +21,7 @@ metadata:
|
||||
title: foodplanhero
|
||||
description: Plan. Cook. Smile. The family decides together what's for dinner — and the shopping list writes itself. Runs entirely on your own box.
|
||||
icon: https://git.aimighty.olares.de/aimighty/bilder/raw/branch/main/lunch/icon.png
|
||||
version: 26.11.50
|
||||
version: 26.11.52
|
||||
categories:
|
||||
- Applications
|
||||
|
||||
@@ -61,7 +61,7 @@ permission:
|
||||
appData: true
|
||||
|
||||
spec:
|
||||
versionName: '26.11.50'
|
||||
versionName: '26.11.52'
|
||||
|
||||
featuredImage: https://git.aimighty.olares.de/aimighty/bilder/raw/branch/main/lunch/icon.png
|
||||
promoteImage:
|
||||
|
||||
@@ -51,7 +51,7 @@ export default async function DishPage({ params }: { params: Promise<{ id: strin
|
||||
.join(" · ");
|
||||
|
||||
return (
|
||||
<main className="mx-auto flex max-w-2xl flex-col gap-5 pb-6">
|
||||
<main className="mx-auto flex max-w-md flex-col gap-5 pb-6">
|
||||
<div className="relative aspect-[4/3] overflow-hidden sm:mx-4 sm:mt-4 sm:rounded-2xl">
|
||||
<DishPhoto dishId={dish.id} photo={dish.photo} />
|
||||
<Link
|
||||
|
||||
@@ -47,7 +47,7 @@ export default async function DishesPage({ searchParams }: { searchParams: Promi
|
||||
[d.effortMinutes ? t("minutes", { n: d.effortMinutes }) : null, d.base ? t(`bases.${d.base}`) : null, cost(d.id)].filter(Boolean).join(" · ");
|
||||
|
||||
return (
|
||||
<main className="mx-auto flex max-w-2xl flex-col gap-5 px-4 py-6">
|
||||
<main className="mx-auto flex max-w-md flex-col gap-5 px-4 py-6">
|
||||
<header className="flex items-end justify-between gap-3">
|
||||
<div className="flex flex-col gap-1">
|
||||
<p className="eyebrow">{t("eyebrow")}</p>
|
||||
@@ -83,7 +83,7 @@ export default async function DishesPage({ searchParams }: { searchParams: Promi
|
||||
</nav>
|
||||
|
||||
{dishes.length ? (
|
||||
<ul className="grid grid-cols-2 gap-3 sm:grid-cols-3">
|
||||
<ul className="grid grid-cols-2 gap-3">
|
||||
{dishes.map((d) => (
|
||||
<li key={d.id} className="h-full">
|
||||
<DishTile id={d.id} title={d.title} photo={d.photo} meta={meta(d)} />
|
||||
@@ -107,7 +107,7 @@ export default async function DishesPage({ searchParams }: { searchParams: Promi
|
||||
href="/gerichte/hinzufuegen"
|
||||
className={cn(
|
||||
buttonVariants({ size: "lg" }),
|
||||
"kb-shift fixed bottom-[calc(4.5rem+env(safe-area-inset-bottom))] right-4 z-10 shadow-lg",
|
||||
"kb-shift fixed bottom-[calc(4.5rem+env(safe-area-inset-bottom))] right-[max(1rem,calc((100vw-28rem)/2+1rem))] z-10 shadow-lg",
|
||||
)}
|
||||
>
|
||||
<Plus aria-hidden />
|
||||
|
||||
@@ -4,6 +4,8 @@ import { requireSession } from "@/lib/auth/session";
|
||||
// Alles hier drin verlangt eine Sitzung. Die Prüfung steht im Layout und
|
||||
// zusätzlich in jeder Seite, die Daten liest (requireSession) — Layouts
|
||||
// werden beim Navigieren nicht jedes Mal neu ausgeführt.
|
||||
// Jede Seite steht in einer Spalte wie am Handy, auch am Desktop (max-w-md; Kai,
|
||||
// 9.11.2026). Nur Küchendisplay, Präsentation und Kochmodus im Querformat sind breiter.
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export default async function AppLayout({ children }: { children: React.ReactNode }) {
|
||||
|
||||
@@ -20,7 +20,7 @@ export default async function WishPage() {
|
||||
return { round, tiles: await wishTiles(c), entries: await roundWishes(c, round.id, { memberId: session.memberId, adult }), budget: await budget(c, round.id, session.memberId) };
|
||||
});
|
||||
return (
|
||||
<main className="mx-auto flex max-w-2xl flex-col gap-4 px-4 py-6">
|
||||
<main className="mx-auto flex max-w-md flex-col gap-4 px-4 py-6">
|
||||
<header className="flex flex-col gap-1">
|
||||
<p className="eyebrow">{t("eyebrow")}</p>
|
||||
<h1 className="text-4xl leading-tight">{t("title")}</h1>
|
||||
|
||||
@@ -16,7 +16,8 @@ export async function PUT(request: Request, { params }: { params: Promise<{ id:
|
||||
await withHousehold(session.householdId, (c) => saveDish(c, session.householdId, session.memberId, body.data, id));
|
||||
return json({ id });
|
||||
} catch (error) {
|
||||
if (error instanceof InvalidAmount) return fail("amount", 400);
|
||||
// Welche Zutat nicht passt, sagt die Antwort mit — das Formular markiert die Zeile (26.11.51).
|
||||
if (error instanceof InvalidAmount) return json({ error: "amount", ingredientId: error.message }, 400);
|
||||
if (error instanceof Error && error.message === "not found") return fail("notFound", 404);
|
||||
throw error;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,8 @@ export async function POST(request: Request) {
|
||||
if (body.data.imageUrl) await attachImage(session.householdId, id, session.memberId, body.data.imageUrl);
|
||||
return json({ id }, 201);
|
||||
} catch (error) {
|
||||
if (error instanceof InvalidAmount) return fail("amount", 400);
|
||||
// Welche Zutat nicht passt, sagt die Antwort mit — das Formular markiert die Zeile (26.11.51).
|
||||
if (error instanceof InvalidAmount) return json({ error: "amount", ingredientId: error.message }, 400);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
+116
-26
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { ArrowDown, ArrowUp, Plus, Sparkles, X, Package, Wand2 } from "lucide-react";
|
||||
import { ArrowDown, ArrowUp, CircleAlert, Plus, Sparkles, X, Package, Wand2 } from "lucide-react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useLocale, useTranslations } from "next-intl";
|
||||
import { useEffect, useId, useRef, useState } from "react";
|
||||
@@ -70,8 +70,6 @@ const knownSize = (p: Picked | null, unit: string) => (p && needsSize(unit, p.un
|
||||
*/
|
||||
const preferredUnit = (p: Picked) => (p.kitchenUnit && !isPackKind(p.kitchenUnit) && unitsFor(p).includes(p.kitchenUnit) ? p.kitchenUnit : p.unit);
|
||||
|
||||
let counter = 0;
|
||||
const next = () => ++counter;
|
||||
|
||||
const formatQty = (n: number) => String(Math.round(n * 100) / 100).replace(".", ",");
|
||||
|
||||
@@ -86,6 +84,10 @@ export function DishForm({ initial }: { initial?: DishFormValue }) {
|
||||
return `${f.amount}${f.unit ? ` ${f.unit}` : ""}`;
|
||||
};
|
||||
const router = useRouter();
|
||||
// Schlüssel der Zeilen je Formular, auf Server und Gerät gleich — sie stecken in den
|
||||
// Feld-Kennungen (qty-…, size-…), an denen die Fehlersätze hängen (26.11.51).
|
||||
const counter = useRef(0);
|
||||
const next = () => ++counter.current;
|
||||
const [title, setTitle] = useState(initial?.title ?? "");
|
||||
const [portions, setPortions] = useState(String(initial?.portions ?? 4));
|
||||
const [base, setBase] = useState(initial?.base ?? "");
|
||||
@@ -145,6 +147,46 @@ export function DishForm({ initial }: { initial?: DishFormValue }) {
|
||||
}
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [checked, setChecked] = useState(false);
|
||||
// Vom Server abgelehnte Menge (26.11.51): gilt, bis sich Zutat, Menge oder Maß der Zeile ändern.
|
||||
const [rejected, setRejected] = useState<{ key: number; ingredientId: string; qty: string; unit: string } | null>(null);
|
||||
|
||||
// Alles, was vor dem Speichern fehlt — auf einmal, am Feld, und live nach dem ersten Versuch (Kai, 8.11.2026).
|
||||
type Problem = { id: string; rowKey?: number; text: string };
|
||||
function findProblems(): Problem[] {
|
||||
const out: Problem[] = [];
|
||||
if (!title.trim()) out.push({ id: "title", text: t("form.problem.titleMissing") });
|
||||
const n = parseNumber(portions);
|
||||
if (!n || n < 1 || n > 30) out.push({ id: "portions", text: t("form.problem.portions") });
|
||||
for (const r of rows) {
|
||||
if (!r.ingredient) continue;
|
||||
const q = r.qty.trim();
|
||||
if (!q) out.push({ id: `qty-${r.key}`, rowKey: r.key, text: t("form.problem.amountMissing") });
|
||||
else if (!((parseNumber(q) ?? 0) > 0)) out.push({ id: `qty-${r.key}`, rowKey: r.key, text: t("form.problem.amountInvalid") });
|
||||
else if (rejected && rejected.key === r.key && rejected.ingredientId === r.ingredient.id && rejected.qty === r.qty && rejected.unit === r.unit)
|
||||
out.push({ id: `unit-${r.key}`, rowKey: r.key, text: t("form.problem.amountServer") });
|
||||
if (needsSize(r.unit, r.ingredient.unit) && knownSize(r.ingredient, r.unit) === null && !((parseNumber(r.size ?? "") ?? 0) > 0))
|
||||
out.push({ id: `size-${r.key}`, rowKey: r.key, text: t("form.problem.sizeMissing") });
|
||||
}
|
||||
return out;
|
||||
}
|
||||
const problems = checked ? findProblems() : [];
|
||||
const problemAt = (id: string) => problems.find((p) => p.id === id);
|
||||
const invalid = (id: string) => (problemAt(id) ? true : undefined);
|
||||
const describedBy = (id: string) => (problemAt(id) ? `${id}-error` : undefined);
|
||||
function goTo(p: Problem | undefined) {
|
||||
const el = p ? document.getElementById(p.id) : null;
|
||||
if (!el) return;
|
||||
shown.current = p!.id;
|
||||
el.scrollIntoView({ block: "center", behavior: "smooth" });
|
||||
el.focus({ preventScroll: true });
|
||||
}
|
||||
// „Zeigen“: zum nächsten fehlenden Feld nach dem, in dem man gerade steht.
|
||||
// Beim Tippen auf den Knopf liegt der Fokus auf ihm — deshalb das zuletzt gezeigte merken.
|
||||
const shown = useRef<string | null>(null);
|
||||
function showNext() {
|
||||
const at = problems.findIndex((p) => p.id === shown.current);
|
||||
goTo(problems[(at + 1) % problems.length]);
|
||||
}
|
||||
const [busy, setBusy] = useState(false);
|
||||
|
||||
// Portionen umstellen rechnet die Mengen mit (Kai, 8.11.2026, 26.11.49) — immer vom
|
||||
@@ -183,15 +225,12 @@ export function DishForm({ initial }: { initial?: DishFormValue }) {
|
||||
event.preventDefault();
|
||||
const n = parseNumber(portions);
|
||||
setChecked(true);
|
||||
// Eine gewählte Zutat ohne Menge fällt nicht still weg: Die Person ergänzt sie oder entfernt die Zeile.
|
||||
if (rows.some((r) => r.ingredient && !r.qty.trim())) {
|
||||
setError("missingAmount");
|
||||
return;
|
||||
}
|
||||
// Ein Zählmaß ohne bekannte Größe braucht sie, sonst lässt sich nicht rechnen (26.11.49).
|
||||
const sizeMissing = (r: Row) => !!r.ingredient && needsSize(r.unit, r.ingredient.unit) && knownSize(r.ingredient, r.unit) === null && !(parseNumber(r.size ?? "") ?? 0);
|
||||
if (rows.some(sizeMissing)) {
|
||||
setError("missingSize");
|
||||
setError(null);
|
||||
// Eine gewählte Zutat ohne Menge fällt nicht still weg, ein Zählmaß braucht seine Größe:
|
||||
// Alles Fehlende ist am Feld markiert, der Fokus springt zum ersten (26.11.51).
|
||||
const open = findProblems();
|
||||
if (open.length) {
|
||||
goTo(open[0]);
|
||||
return;
|
||||
}
|
||||
const ingredients = rows
|
||||
@@ -243,7 +282,11 @@ export function DishForm({ initial }: { initial?: DishFormValue }) {
|
||||
const data = await res.json().catch(() => ({}));
|
||||
setBusy(false);
|
||||
if (res.ok) router.push(`/gerichte/${data.id}`);
|
||||
else setError(["invalid", "amount"].includes(data.error) ? data.error : "unknown");
|
||||
else if (data.error === "amount" && rows.some((r) => r.ingredient?.id === data.ingredientId)) {
|
||||
const row = rows.find((r) => r.ingredient?.id === data.ingredientId)!;
|
||||
setRejected({ key: row.key, ingredientId: data.ingredientId, qty: row.qty, unit: row.unit });
|
||||
requestAnimationFrame(() => goTo({ id: `unit-${row.key}`, text: "" }));
|
||||
} else setError(["invalid", "amount"].includes(data.error) ? data.error : "unknown");
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -257,7 +300,16 @@ export function DishForm({ initial }: { initial?: DishFormValue }) {
|
||||
<section className="flex flex-col gap-4">
|
||||
<div className="flex flex-col gap-2">
|
||||
<Label htmlFor="title">{t("form.title")}</Label>
|
||||
<Input id="title" value={title} onChange={(e) => setTitle(e.target.value)} maxLength={120} required placeholder={t("form.titlePlaceholder")} />
|
||||
<Input
|
||||
id="title"
|
||||
value={title}
|
||||
onChange={(e) => setTitle(e.target.value)}
|
||||
maxLength={120}
|
||||
aria-invalid={invalid("title")}
|
||||
aria-describedby={describedBy("title")}
|
||||
placeholder={t("form.titlePlaceholder")}
|
||||
/>
|
||||
<FieldProblem id="title" problem={problemAt("title")} />
|
||||
</div>
|
||||
<div className="feldreihe grid grid-cols-2 gap-3">
|
||||
<div className="flex flex-col gap-2">
|
||||
@@ -320,7 +372,8 @@ export function DishForm({ initial }: { initial?: DishFormValue }) {
|
||||
<Input
|
||||
id="portions"
|
||||
inputMode="numeric"
|
||||
aria-describedby="portions-hint"
|
||||
aria-describedby={["portions-hint", describedBy("portions")].filter(Boolean).join(" ")}
|
||||
aria-invalid={invalid("portions")}
|
||||
className="w-20 text-center"
|
||||
value={portions}
|
||||
onFocus={rememberAmounts}
|
||||
@@ -330,6 +383,7 @@ export function DishForm({ initial }: { initial?: DishFormValue }) {
|
||||
<p id="portions-hint" className="-mt-1 text-sm text-muted-foreground">
|
||||
{t("form.portionsHint")}
|
||||
</p>
|
||||
<FieldProblem id="portions" problem={problemAt("portions")} />
|
||||
{initial?.unmatched?.length ? (
|
||||
<div role="note" className="flex flex-col gap-2 rounded-2xl border border-border p-4 text-sm">
|
||||
<p className="font-medium">{t("form.unmatched")}</p>
|
||||
@@ -342,7 +396,7 @@ export function DishForm({ initial }: { initial?: DishFormValue }) {
|
||||
) : null}
|
||||
<ul className="flex flex-col gap-4">
|
||||
{rows.map((row) => (
|
||||
<li key={row.key} className="flex flex-col gap-2 rounded-2xl bg-muted p-3">
|
||||
<li key={row.key} className={cn("flex flex-col gap-2 rounded-2xl bg-muted p-3", problems.some((p) => p.rowKey === row.key) && "ring-2 ring-over")}>
|
||||
<div className="flex items-start gap-2">
|
||||
<IngredientPicker canCreate value={row.ingredient} onPick={(p) => update(row.key, { ingredient: p, unit: preferredUnit(p), inherited: row.product ? row.inherited : (p.product ?? null) })} />
|
||||
<Button
|
||||
@@ -357,18 +411,23 @@ export function DishForm({ initial }: { initial?: DishFormValue }) {
|
||||
</div>
|
||||
<div className="grid grid-cols-[1fr_auto] gap-2">
|
||||
<Input
|
||||
id={`qty-${row.key}`}
|
||||
aria-label={t("form.amount")}
|
||||
aria-invalid={checked && !!row.ingredient && !row.qty.trim() ? true : undefined}
|
||||
aria-invalid={invalid(`qty-${row.key}`)}
|
||||
aria-describedby={describedBy(`qty-${row.key}`)}
|
||||
inputMode="decimal"
|
||||
placeholder={t("form.amount")}
|
||||
value={row.qty}
|
||||
onChange={(e) => update(row.key, { qty: e.target.value })}
|
||||
/>
|
||||
<select
|
||||
id={`unit-${row.key}`}
|
||||
aria-label={t("form.unit")}
|
||||
aria-invalid={invalid(`unit-${row.key}`)}
|
||||
aria-describedby={describedBy(`unit-${row.key}`)}
|
||||
value={row.unit}
|
||||
onChange={(e) => update(row.key, { unit: e.target.value })}
|
||||
className="min-h-11 rounded-xl border border-border bg-background px-3 text-base"
|
||||
className="min-h-11 rounded-xl border border-border bg-background px-3 text-base aria-[invalid=true]:border-2 aria-[invalid=true]:border-over"
|
||||
>
|
||||
{unitGroups(row.ingredient).map((group, g) =>
|
||||
group.length ? (
|
||||
@@ -389,6 +448,8 @@ export function DishForm({ initial }: { initial?: DishFormValue }) {
|
||||
)}
|
||||
</select>
|
||||
</div>
|
||||
<FieldProblem id={`qty-${row.key}`} problem={problemAt(`qty-${row.key}`)} />
|
||||
<FieldProblem id={`unit-${row.key}`} problem={problemAt(`unit-${row.key}`)} />
|
||||
{row.ingredient && needsSize(row.unit, row.ingredient.unit) ? (
|
||||
knownSize(row.ingredient, row.unit) !== null ? (
|
||||
<PackSize
|
||||
@@ -425,13 +486,17 @@ export function DishForm({ initial }: { initial?: DishFormValue }) {
|
||||
id={`size-${row.key}`}
|
||||
inputMode="decimal"
|
||||
className="w-24 text-center"
|
||||
aria-invalid={checked && !(parseNumber(row.size ?? "") ?? 0) ? true : undefined}
|
||||
aria-invalid={invalid(`size-${row.key}`)}
|
||||
aria-describedby={describedBy(`size-${row.key}`)}
|
||||
value={row.size ?? ""}
|
||||
onChange={(e) => update(row.key, { size: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
) : null}
|
||||
{row.ingredient && needsSize(row.unit, row.ingredient.unit) && knownSize(row.ingredient, row.unit) === null ? (
|
||||
<FieldProblem id={`size-${row.key}`} problem={problemAt(`size-${row.key}`)} />
|
||||
) : null}
|
||||
<Input
|
||||
aria-label={t("form.note")}
|
||||
placeholder={t("form.notePlaceholder")}
|
||||
@@ -576,13 +641,27 @@ export function DishForm({ initial }: { initial?: DishFormValue }) {
|
||||
</section>
|
||||
|
||||
{error ? <ErrorNotice>{t(`form.errors.${error}`)}</ErrorNotice> : null}
|
||||
<div className="kb-shift sticky bottom-[var(--nav-space)] z-10 flex gap-2 bg-background py-2">
|
||||
<Button type="button" variant="outline" onClick={() => router.back()}>
|
||||
{t("form.cancel")}
|
||||
</Button>
|
||||
<Button type="submit" size="lg" className="flex-1" disabled={busy}>
|
||||
{busy ? t("form.saving") : t("form.save")}
|
||||
</Button>
|
||||
<div className="kb-shift sticky bottom-[var(--nav-space)] z-10 flex flex-col gap-2 bg-background py-2">
|
||||
{/* Solange etwas fehlt: wie viel, und ein Knopf, der hinführt (26.11.51). */}
|
||||
{problems.length ? (
|
||||
<div role="status" className="flex items-center justify-between gap-2 rounded-xl border-2 border-over px-3">
|
||||
<span className="flex items-center gap-1.5 text-sm font-medium">
|
||||
<CircleAlert aria-hidden className="size-4 shrink-0 text-over" />
|
||||
{t("form.problemsLeft", { n: problems.length })}
|
||||
</span>
|
||||
<Button type="button" variant="ghost" className="min-h-11 px-3" onClick={showNext}>
|
||||
{t("form.problemsShow")}
|
||||
</Button>
|
||||
</div>
|
||||
) : null}
|
||||
<div className="flex gap-2">
|
||||
<Button type="button" variant="outline" onClick={() => router.back()}>
|
||||
{t("form.cancel")}
|
||||
</Button>
|
||||
<Button type="submit" size="lg" className="flex-1" disabled={busy}>
|
||||
{busy ? t("form.saving") : t("form.save")}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
);
|
||||
@@ -590,3 +669,14 @@ 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.
|
||||
|
||||
/** Satz am Feld, wenn dort etwas fehlt — mit Zeichen, Farbe trägt nie allein (26.11.51). */
|
||||
function FieldProblem({ id, problem }: { id: string; problem?: { text: string } }) {
|
||||
if (!problem) return null;
|
||||
return (
|
||||
<p id={`${id}-error`} className="-mt-1 flex items-center gap-1.5 text-sm font-medium">
|
||||
<CircleAlert aria-hidden className="size-4 shrink-0 text-over" />
|
||||
{problem.text}
|
||||
</p>
|
||||
);
|
||||
}
|
||||
@@ -8,6 +8,8 @@ export const Input = React.forwardRef<HTMLInputElement, React.InputHTMLAttribute
|
||||
ref={ref}
|
||||
className={cn(
|
||||
"flex min-h-11 w-full rounded-xl border border-border bg-background px-4 py-2 text-base text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",
|
||||
// Fehlt etwas, sieht man es (26.11.51): rote, breitere Kante — dazu immer ein Satz am Feld.
|
||||
"aria-[invalid=true]:border-2 aria-[invalid=true]:border-over",
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
|
||||
@@ -188,7 +188,7 @@ export function WishBoard({
|
||||
) : null}
|
||||
|
||||
{shown.length ? (
|
||||
<ul className="grid grid-cols-2 gap-3 sm:grid-cols-3">
|
||||
<ul className="grid grid-cols-2 gap-3">
|
||||
{shown.map((tile) => {
|
||||
const own = mine(tile.id);
|
||||
const names = wishers(tile.id).map((e) => (e.memberId === me ? t("you") : e.memberName));
|
||||
|
||||
+39
-2
@@ -204,7 +204,9 @@ test.describe("recipe link", () => {
|
||||
await expect(amounts.nth(3)).toHaveValue("");
|
||||
// Eier in Esslöffeln passen nicht: Menge fehlt — Speichern sagt es, statt die Zeile wegzulassen.
|
||||
await page.getByRole("button", { name: "Speichern" }).click();
|
||||
await expect(page.locator("main [role=alert]")).toContainText("fehlt die Menge");
|
||||
await expect(page.getByRole("status").filter({ hasText: "1 Angabe fehlt noch" })).toBeVisible();
|
||||
await expect(amounts.nth(3)).toBeFocused();
|
||||
await expect(page.getByText("Menge fehlt.")).toBeVisible();
|
||||
await amounts.nth(3).fill("2");
|
||||
await page.getByRole("button", { name: "Speichern" }).click();
|
||||
await expect(page.getByRole("heading", { level: 1 })).toHaveText("Linsensuppe vom Blog");
|
||||
@@ -497,7 +499,8 @@ test("portions are remembered and scale the amounts; a pack and cloves for any i
|
||||
await units.nth(0).selectOption("pack");
|
||||
// Hackfleisch hat keine Packungsgröße: Speichern fragt danach, statt still zu rechnen.
|
||||
await page.getByRole("button", { name: "Speichern" }).click();
|
||||
await expect(page.locator("main [role=alert]")).toContainText("1 Packung = 500 g");
|
||||
await expect(page.getByText("Größe fehlt – bitte eintragen.")).toBeVisible();
|
||||
await expect(page.getByLabel("Wie viel ist 1 Packung? (in g)")).toBeFocused();
|
||||
await page.getByLabel("Wie viel ist 1 Packung? (in g)").fill("500");
|
||||
await page.getByRole("button", { name: "Zutaten" }).click();
|
||||
await page.getByRole("combobox", { name: "Zutat suchen" }).nth(1).fill("Knoblauchz");
|
||||
@@ -555,6 +558,40 @@ test("millilitres for a piece ingredient: stock cubes in ml with the size per pi
|
||||
await expect(page).toHaveURL(/entfernt=/);
|
||||
});
|
||||
|
||||
test("what is missing is marked at the field, counted below and shown on tap (26.11.51)", async ({ page }) => {
|
||||
await page.goto("/gerichte/neu");
|
||||
const amounts = page.getByRole("textbox", { name: "Menge", exact: true });
|
||||
const units = page.getByRole("combobox", { name: "Einheit" });
|
||||
await page.getByRole("combobox", { name: "Zutat suchen" }).first().fill("Zwieb");
|
||||
await page.getByRole("option", { name: "Zwiebeln", exact: true }).click();
|
||||
await page.getByRole("button", { name: "Zutaten" }).click();
|
||||
await page.getByRole("combobox", { name: "Zutat suchen" }).nth(1).fill("Eier");
|
||||
await page.getByRole("option", { name: "Eier", exact: true }).click();
|
||||
await amounts.nth(1).fill("100");
|
||||
await units.nth(1).selectOption("ml");
|
||||
// Ohne Titel, ohne Menge bei den Zwiebeln, ohne Größe für Eier in ml.
|
||||
await page.getByRole("button", { name: "Speichern" }).click();
|
||||
const left = page.getByRole("status").filter({ hasText: "fehlen noch" });
|
||||
await expect(left).toHaveText(/3 Angaben fehlen noch/);
|
||||
const title = page.locator("#title");
|
||||
await expect(title).toBeFocused();
|
||||
await expect(title).toHaveAttribute("aria-invalid", "true");
|
||||
expect(await title.evaluate((e) => getComputedStyle(e).borderTopWidth)).toBe("2px");
|
||||
await expect(page.getByText("Titel fehlt.")).toBeVisible();
|
||||
// „Zeigen“ führt zum nächsten.
|
||||
await left.getByRole("button", { name: "Zeigen" }).click();
|
||||
await expect(amounts.nth(0)).toBeFocused();
|
||||
await amounts.nth(0).fill("2");
|
||||
await expect(left).toHaveText(/2 Angaben fehlen noch/);
|
||||
await title.fill("Zwiebelkuchen");
|
||||
await page.getByLabel("Wie viel ml ist 1 Stück?").fill("50");
|
||||
await expect(left).toHaveCount(0);
|
||||
await page.getByRole("button", { name: "Speichern" }).click();
|
||||
await expect(page.getByRole("heading", { level: 1 })).toHaveText("Zwiebelkuchen");
|
||||
await page.getByRole("button", { name: "Entfernen" }).click();
|
||||
await expect(page).toHaveURL(/entfernt=/);
|
||||
});
|
||||
|
||||
test("a dish to try says so, links to its tab and moves to the pool with one tap", async ({ page }) => {
|
||||
await page.goto("/gerichte/neu");
|
||||
await page.fill("#title", "Probe-Auflauf");
|
||||
|
||||
+2
-1
@@ -65,7 +65,8 @@ test("buttons pinned to the bottom sit on the keyboard while typing, above the b
|
||||
const height = page.viewportSize()!.height;
|
||||
const nav = page.getByRole("navigation", { name: "Navigation" });
|
||||
const bottomOf = async () => {
|
||||
const box = (await save.locator("xpath=..").boundingBox())!;
|
||||
// Die feste Leiste: seit 26.11.51 mit Zeile „… fehlen noch“ über den Knöpfen, deshalb zwei Ebenen.
|
||||
const box = (await save.locator("xpath=../..").boundingBox())!;
|
||||
return Math.round(box.y + box.height);
|
||||
};
|
||||
await page.locator("#title").focus();
|
||||
|
||||
@@ -162,3 +162,22 @@ test("signed out: the sign-in page is centred and its intro has no orphan line",
|
||||
if (widths.length > 1) expect(widths.at(-1)!).toBeGreaterThan(widths[0]! / 4);
|
||||
await context.close();
|
||||
});
|
||||
|
||||
// Am Desktop dieselbe Ansicht wie am Handy (Kai, 9.11.2026): eine Spalte, zwei Karten
|
||||
// je Reihe, „Gericht hinzufügen“ an der Spalte statt am Bildschirmrand.
|
||||
test("the desktop shows the phone column", async ({ page }) => {
|
||||
test.skip(test.info().project.name !== "desktop", "nur am Desktop");
|
||||
for (const path of ["/gerichte", "/wuenschen", "/plan", "/mehr"]) {
|
||||
await page.goto(path);
|
||||
const width = (await page.locator("main").boundingBox())!.width;
|
||||
expect(width, path).toBeLessThanOrEqual(448);
|
||||
}
|
||||
await page.goto("/gerichte");
|
||||
const main = (await page.locator("main").boundingBox())!;
|
||||
const cards = page.locator("main ul > li");
|
||||
const tops = await cards.evaluateAll((els) => els.slice(0, 3).map((e) => Math.round(e.getBoundingClientRect().top)));
|
||||
expect(tops[0]).toBe(tops[1]);
|
||||
expect(tops[2]).toBeGreaterThan(tops[0]!);
|
||||
const add = (await page.getByRole("link", { name: "Gericht hinzufügen" }).boundingBox())!;
|
||||
expect(add.x + add.width).toBeLessThanOrEqual(main.x + main.width + 1);
|
||||
});
|
||||
+11
-1
@@ -499,7 +499,17 @@
|
||||
},
|
||||
"sizeAsk": "Wie viel ist 1 {unit}? (in {base})",
|
||||
"portionsHint": "Die Mengen rechnen mit, wenn du die Portionen änderst.",
|
||||
"sizeAskPerPiece": "Wie viel {base} ist 1 Stück?"
|
||||
"sizeAskPerPiece": "Wie viel {base} ist 1 Stück?",
|
||||
"problem": {
|
||||
"titleMissing": "Titel fehlt.",
|
||||
"portions": "Portionen: bitte eine Zahl von 1 bis 30.",
|
||||
"amountMissing": "Menge fehlt.",
|
||||
"amountInvalid": "Menge muss eine Zahl über 0 sein.",
|
||||
"sizeMissing": "Größe fehlt – bitte eintragen.",
|
||||
"amountServer": "Diese Menge passt nicht zur Zutat – bitte ein anderes Maß wählen."
|
||||
},
|
||||
"problemsLeft": "{n, plural, one {1 Angabe fehlt noch} other {# Angaben fehlen noch}}",
|
||||
"problemsShow": "Zeigen"
|
||||
},
|
||||
"addLinkText": "Wir lesen Zutaten und Schritte von der Rezeptseite.",
|
||||
"link": {
|
||||
|
||||
+11
-1
@@ -499,7 +499,17 @@
|
||||
},
|
||||
"sizeAsk": "How much is 1 {unit}? (in {base})",
|
||||
"portionsHint": "The amounts change along when you change the portions.",
|
||||
"sizeAskPerPiece": "How many {base} is 1 piece?"
|
||||
"sizeAskPerPiece": "How many {base} is 1 piece?",
|
||||
"problem": {
|
||||
"titleMissing": "Title missing.",
|
||||
"portions": "Portions: a number from 1 to 30, please.",
|
||||
"amountMissing": "Amount missing.",
|
||||
"amountInvalid": "The amount must be a number above 0.",
|
||||
"sizeMissing": "Size missing – please fill it in.",
|
||||
"amountServer": "This amount does not fit the ingredient – please choose another measure."
|
||||
},
|
||||
"problemsLeft": "{n, plural, one {1 thing still missing} other {# things still missing}}",
|
||||
"problemsShow": "Show"
|
||||
},
|
||||
"addLinkText": "We read ingredients and steps from the recipe page.",
|
||||
"link": {
|
||||
|
||||
+11
-1
@@ -499,7 +499,17 @@
|
||||
},
|
||||
"sizeAsk": "¿Cuánto es 1 {unit}? (en {base})",
|
||||
"portionsHint": "Las cantidades cambian contigo cuando cambias las raciones.",
|
||||
"sizeAskPerPiece": "¿Cuántos {base} es 1 pieza?"
|
||||
"sizeAskPerPiece": "¿Cuántos {base} es 1 pieza?",
|
||||
"problem": {
|
||||
"titleMissing": "Falta el título.",
|
||||
"portions": "Raciones: un número de 1 a 30, por favor.",
|
||||
"amountMissing": "Falta la cantidad.",
|
||||
"amountInvalid": "La cantidad debe ser un número mayor que 0.",
|
||||
"sizeMissing": "Falta el tamaño – escríbelo, por favor.",
|
||||
"amountServer": "Esta cantidad no encaja con el ingrediente – elige otra medida."
|
||||
},
|
||||
"problemsLeft": "{n, plural, one {Falta 1 dato} other {Faltan # datos}}",
|
||||
"problemsShow": "Mostrar"
|
||||
},
|
||||
"addLinkText": "Leemos los ingredientes y los pasos de la página de la receta.",
|
||||
"link": {
|
||||
|
||||
+11
-1
@@ -499,7 +499,17 @@
|
||||
},
|
||||
"sizeAsk": "Combien fait 1 {unit} ? (en {base})",
|
||||
"portionsHint": "Les quantités suivent quand tu changes les portions.",
|
||||
"sizeAskPerPiece": "Combien de {base} fait 1 pièce ?"
|
||||
"sizeAskPerPiece": "Combien de {base} fait 1 pièce ?",
|
||||
"problem": {
|
||||
"titleMissing": "Il manque le titre.",
|
||||
"portions": "Portions : un nombre de 1 à 30, s’il te plaît.",
|
||||
"amountMissing": "Il manque la quantité.",
|
||||
"amountInvalid": "La quantité doit être un nombre supérieur à 0.",
|
||||
"sizeMissing": "Il manque la taille – merci de la saisir.",
|
||||
"amountServer": "Cette quantité ne convient pas à l’ingrédient – choisis une autre mesure."
|
||||
},
|
||||
"problemsLeft": "{n, plural, one {Il manque encore 1 information} other {Il manque encore # informations}}",
|
||||
"problemsShow": "Montrer"
|
||||
},
|
||||
"addLinkText": "Nous lisons les ingrédients et les étapes sur la page de la recette.",
|
||||
"link": {
|
||||
|
||||
+2
-2
@@ -2,5 +2,5 @@ apiVersion: v2
|
||||
name: lunch
|
||||
description: foodplanhero (Plan. Cook. Smile.) — die Familie entscheidet gemeinsam, was es gibt; aus dem Plan entsteht die Einkaufsliste
|
||||
type: application
|
||||
version: 26.11.50 # YY.M.<n> wie im AImighty-Markt — bei jeder Chart-Änderung erhöhen
|
||||
appVersion: "26.11.50" # MUSS gleich version sein: der Linter prüft es, und der Image-Tag hängt daran
|
||||
version: 26.11.52 # YY.M.<n> wie im AImighty-Markt — bei jeder Chart-Änderung erhöhen
|
||||
appVersion: "26.11.52" # MUSS gleich version sein: der Linter prüft es, und der Image-Tag hängt daran
|
||||
@@ -21,7 +21,7 @@ metadata:
|
||||
title: foodplanhero
|
||||
description: Plan. Cook. Smile. The family decides together what's for dinner — and the shopping list writes itself. Runs entirely on your own box.
|
||||
icon: https://git.aimighty.olares.de/aimighty/bilder/raw/branch/main/lunch/icon.png
|
||||
version: 26.11.50
|
||||
version: 26.11.52
|
||||
categories:
|
||||
- Applications
|
||||
|
||||
@@ -61,7 +61,7 @@ permission:
|
||||
appData: true
|
||||
|
||||
spec:
|
||||
versionName: '26.11.50'
|
||||
versionName: '26.11.52'
|
||||
|
||||
featuredImage: https://git.aimighty.olares.de/aimighty/bilder/raw/branch/main/lunch/icon.png
|
||||
promoteImage:
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
# Missing details are easy to find
|
||||
v26.11.51: When a dish cannot be saved yet, every missing detail is now marked right at its field with a red edge and a short sentence, the ingredient card gets a red frame, and the bar at the bottom says how many things are still missing. "Show" jumps to them one by one; saving jumps to the first. What you fix disappears at once.
|
||||
|
||||
## Deutsch
|
||||
v26.11.51: Lässt sich ein Gericht noch nicht speichern, ist jetzt jede fehlende Angabe direkt am Feld markiert – mit roter Kante und einem kurzen Satz –, die Zutatenkarte bekommt einen roten Rahmen, und die Leiste unten sagt, wie viele Angaben noch fehlen. „Zeigen“ springt der Reihe nach hin, Speichern springt zur ersten. Was du behebst, verschwindet sofort.
|
||||
@@ -0,0 +1,5 @@
|
||||
# The desktop looks like the phone
|
||||
v26.11.52: On a computer, every page now shows the same single column as on the phone: dishes and wishes two to a row, and "Add dish" sits at the bottom right of that column instead of at the edge of the screen.
|
||||
|
||||
## Deutsch
|
||||
v26.11.52: Am Computer zeigt jetzt jede Seite dieselbe Spalte wie am Handy: Gerichte und Wünsche zwei pro Reihe, und „Gericht hinzufügen“ sitzt unten rechts an dieser Spalte statt am Bildschirmrand.
|
||||
Reference in new issue
Block a user