Compare commits

...
2 Commits
Author SHA1 Message Date
kai 06a0cb9cf4 26.11.51: Fehlendes am Feld markiert (#52)
release / which version (push) Successful in 2s
release / olares chart · sanity (push) Successful in 4s
release / app (push) Successful in 1m14s
release / tag and release (push) Successful in 3s
2026-11-08 18:20:01 +00:00
kai 10831c7f65 26.11.50: ml und l bei jeder Zutat (#51)
release / which version (push) Successful in 3s
release / olares chart · sanity (push) Successful in 4s
release / app (push) Successful in 1m15s
release / tag and release (push) Successful in 5s
2026-11-08 17:44:20 +00:00
29 changed files with 380 additions and 75 deletions

No files matched your search

+2 -2
View File
@@ -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.49 — alle neun Arbeitspakete aus `docs/PROJEKTSTART.md` sind gebaut:
> **Status:** 26.11.51 — 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). 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). 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
View File
@@ -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.49
version: 26.11.51
categories:
- Applications
@@ -61,7 +61,7 @@ permission:
appData: true
spec:
versionName: '26.11.49'
versionName: '26.11.51'
featuredImage: https://git.aimighty.olares.de/aimighty/bilder/raw/branch/main/lunch/icon.png
promoteImage:
+2 -2
View File
@@ -4,7 +4,7 @@ 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, niceQty, type BaseUnit, type KitchenUnit } from "@/lib/units";
import { fromBase, niceQty, type BaseUnit, type DisplayUnit } from "@/lib/units";
export const dynamic = "force-dynamic";
@@ -12,7 +12,7 @@ export const dynamic = "force-dynamic";
// (26.11.49); ältere Gerichte für vier. Gerundet, wie man es tippen würde.
const OLDER = 4;
function amountIn(qty: number, unit: BaseUnit, display: KitchenUnit | null, packSize: number | null) {
function amountIn(qty: number, unit: BaseUnit, display: DisplayUnit | null, packSize: number | null) {
const n = display ? fromBase(qty, display, unit, packSize) : null;
return n === null ? { qty: niceQty(qty, unit), unit } : { qty: niceQty(n, display!), unit: display as string };
}
+2 -1
View File
@@ -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;
}
+2 -1
View File
@@ -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;
}
}
+1 -1
View File
@@ -8,7 +8,7 @@ import { COUNT_UNITS } from "@/lib/units";
export const dynamic = "force-dynamic";
const body = z.object({ size: z.number().positive().max(100000), unit: z.enum(COUNT_UNITS).optional() });
const body = z.object({ size: z.number().positive().max(100000), unit: z.enum([...COUNT_UNITS, "g", "ml"]).optional() });
// Gebindegröße für den Haushalt (26.11.39): „bei uns hat die Dose 500 g“ — gilt für
// alle Gerichte des Haushalts; ein Produkt mit Packung am Gericht geht vor.
+2 -2
View File
@@ -7,7 +7,7 @@ import { Button } from "@/components/ui/button";
import { labelFor } from "@/lib/ingredient-name";
import type { Section } from "@/lib/recipe-style";
import { timerFromText } from "@/lib/timer";
import { type BaseUnit, type KitchenUnit } from "@/lib/units";
import { type BaseUnit, type DisplayUnit } from "@/lib/units";
import { useKitchenAmount } from "@/lib/use-kitchen-amount";
import { cn } from "@/lib/utils";
@@ -21,7 +21,7 @@ export type Ingredient = {
qtyPerPortion: number;
unit: BaseUnit;
note: string | null;
displayUnit?: KitchenUnit | null;
displayUnit?: DisplayUnit | null;
packSize?: number | null;
};
export type Step = { section: Section; text: string; timerSeconds: number | null; ingredientIds: string[]; timerFrom?: string };
+126 -32
View File
@@ -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";
@@ -9,7 +9,7 @@ import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { ErrorNotice } from "@/components/ui/notice";
import { BASES, TAGS } from "@/lib/categories";
import { COUNT_UNITS, FIXED_UNITS, formatQuantity, isPackKind, needsSize, niceQty, parseNumber, sizeOf, type BaseUnit, type CountUnit } from "@/lib/units";
import { COUNT_UNITS, FIXED_UNITS, formatQuantity, isMetric, isPackKind, needsSize, niceQty, parseNumber, sizeKey, sizeOf, type BaseUnit, type CountUnit } from "@/lib/units";
import { cn } from "@/lib/utils";
import { SECTIONS, type Section } from "@/lib/recipe-style";
@@ -55,8 +55,9 @@ export type DishFormValue = {
*/
const unitGroups = (p: Picked | null): [string[], string[], string[]] => {
const base = p?.unit ?? "g";
if (base === "piece") return [["piece"], [], COUNT_UNITS.filter((u) => u !== "piece")];
return [base === "g" ? ["g", "kg"] : ["ml", "l"], [...FIXED_UNITS], [...COUNT_UNITS]];
// ml und l überall, auch bei Stück-Zutaten (26.11.50): dann mit Größe je Stück.
if (base === "piece") return [["piece", "g", "kg", "ml", "l"], [], COUNT_UNITS.filter((u) => u !== "piece")];
return [base === "g" ? ["g", "kg", "ml", "l"] : ["ml", "l", "g", "kg"], [...FIXED_UNITS], [...COUNT_UNITS]];
};
const unitsFor = (p: Picked | null) => unitGroups(p).flat();
/** Bekannte Größe eines Zählmaßes für diese Zutat, sonst null. */
@@ -69,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(".", ",");
@@ -85,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 ?? "");
@@ -144,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
@@ -182,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
@@ -242,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 (
@@ -256,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">
@@ -319,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}
@@ -329,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>
@@ -341,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
@@ -356,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 ? (
@@ -388,11 +448,14 @@ 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
ingredient={row.ingredient}
kind={row.unit as CountUnit}
kind={sizeKey(row.unit) as CountUnit | "g" | "ml"}
perPiece={isMetric(row.unit)}
size={knownSize(row.ingredient, row.unit)!}
sizeText={sizeText}
onSaved={(size) =>
@@ -403,7 +466,7 @@ export function DishForm({ initial }: { initial?: DishFormValue }) {
...r,
ingredient: {
...r.ingredient!,
sizes: { ...r.ingredient!.sizes, [row.unit]: size },
sizes: { ...r.ingredient!.sizes, [sizeKey(row.unit)]: size },
packSize: r.ingredient!.packKind === row.unit ? size : r.ingredient!.packSize,
},
}
@@ -415,19 +478,25 @@ export function DishForm({ initial }: { initial?: DishFormValue }) {
) : (
<div className="flex items-center gap-2">
<Label htmlFor={`size-${row.key}`} className="flex-1 text-sm">
{t("form.sizeAsk", { unit: t(`form.units.${row.unit}`), base: t(`form.units.${row.ingredient.unit}`) })}
{isMetric(row.unit)
? t("form.sizeAskPerPiece", { base: sizeKey(row.unit) })
: t("form.sizeAsk", { unit: t(`form.units.${row.unit}`), base: t(`form.units.${row.ingredient.unit}`) })}
</Label>
<Input
id={`size-${row.key}`}
inputMode="decimal"
className="w-24 text-center"
aria-invalid={checked && !(parseNumber(row.size ?? "") ?? 0) ? true : undefined}
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")}
@@ -572,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>
);
@@ -586,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 -4
View File
@@ -13,12 +13,15 @@ import { parseNumber, type BaseUnit, type CountUnit } from "@/lib/units";
export function PackSize({
ingredient,
kind,
perPiece = false,
size,
sizeText,
onSaved,
}: {
ingredient: { id: string; unit: BaseUnit };
kind: CountUnit;
/** Zählmaß, oder g/ml je Stück einer Stück-Zutat (perPiece, 26.11.50: „1 Stück = 500 ml“). */
kind: CountUnit | "g" | "ml";
perPiece?: boolean;
size: number;
sizeText: (size: number, unit: BaseUnit) => string;
onSaved: (size: number) => void;
@@ -29,7 +32,8 @@ export function PackSize({
const [value, setValue] = useState(String(size));
const [busy, setBusy] = useState(false);
const [error, setError] = useState(false);
const unit = t(`units.${kind}`);
const unit = t(`units.${perPiece ? "piece" : kind}`);
const base: BaseUnit = perPiece ? (kind as BaseUnit) : ingredient.unit;
async function save() {
const next = parseNumber(value);
@@ -50,7 +54,7 @@ export function PackSize({
if (!open) {
return (
<div className="flex flex-wrap items-center gap-x-3 text-sm text-muted-foreground">
<span>{t("packSize", { unit, size: sizeText(size, ingredient.unit) })}</span>
<span>{t("packSize", { unit, size: sizeText(size, base) })}</span>
<Button type="button" variant="ghost" className="min-h-11" onClick={() => setOpen(true)}>
{t("packChange")}
</Button>
@@ -60,7 +64,7 @@ export function PackSize({
return (
<div className="flex flex-col gap-2 rounded-xl border border-border p-3">
<Label htmlFor={id} className="text-sm">
{t("packSizeLabel", { unit, base: t(`units.${ingredient.unit}`) })}
{t("packSizeLabel", { unit, base: t(`units.${base}`) })}
</Label>
<div className="flex gap-2">
<Input id={id} inputMode="decimal" value={value} onChange={(e) => setValue(e.target.value)} className="flex-1" />
+2 -2
View File
@@ -6,7 +6,7 @@ import { useState } from "react";
import { Button } from "@/components/ui/button";
import { labelFor } from "@/lib/ingredient-name";
import { SECTIONS, type Section } from "@/lib/recipe-style";
import { scale, type BaseUnit, type KitchenUnit } from "@/lib/units";
import { scale, type BaseUnit, type DisplayUnit } from "@/lib/units";
import { useKitchenAmount } from "@/lib/use-kitchen-amount";
type Ingredient = {
@@ -18,7 +18,7 @@ type Ingredient = {
note: string | null;
isStaple: boolean;
product?: { name: string } | null;
displayUnit?: KitchenUnit | null;
displayUnit?: DisplayUnit | null;
packSize?: number | null;
};
type Step = { section: Section; text: string; timerSeconds: number | null; ingredientIds: string[]; timerFrom?: string };
+2
View File
@@ -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}
+13
View File
@@ -0,0 +1,13 @@
-- Milliliter und Liter überall (Kai, 8.11.2026, 26.11.50): auch bei Stück-Zutaten
-- („750 ml Brühe“ aus Brühwürfeln). Die Größe steht dann als ml bzw. g je Stück
-- unter dem Maß „ml“ bzw. „g“; kg und l nutzen sie mit. Das Rezept merkt sich das
-- eingegebene Maß auch, wenn es Gewicht oder Volumen ist („200 ml“ Joghurt).
alter table household_pack_sizes drop constraint household_pack_sizes_unit_check;
alter table household_pack_sizes add constraint household_pack_sizes_unit_check check (unit in
('can', 'jar', 'pack', 'tub', 'bunch', 'piece', 'cube', 'clove', 'slice', 'g', 'ml'));
alter table dish_ingredients drop constraint dish_ingredients_display_unit_check;
alter table dish_ingredients add constraint dish_ingredients_display_unit_check check (display_unit in
('tbsp', 'tsp', 'pinch', 'cup', 'dash', 'knifepoint', 'can', 'jar', 'pack', 'tub', 'bunch', 'piece', 'cube', 'clove', 'slice',
'g', 'kg', 'ml', 'l'));
+7
View File
@@ -404,3 +404,10 @@ und Portionen kann ich nicht sauber eingeben“):
- Die Migration nimmt FORCE für die Dauer des Daten-Updates von
`household_pack_sizes` und `ingredients`. Abzüge von vorher bekommen beim
Zurückspielen das Maß aus dem Gebinde der Zutat.
**Nachtrag 26.11.50 · Milliliter und Liter überall** (Kai, 8.11.2026, „auch bei
Stück-Zutaten“): Gramm-Zutaten nehmen auch ml und l, Flüssiges auch g und kg (1 zu 1,
wie beim Löffel). Stück-Zutaten nehmen g, kg, ml und l mit einer Größe je Stück
(„1 Brühwürfel = 500 ml“), gespeichert unter dem Maß `g` bzw. `ml` in
`household_pack_sizes` (Migration 0027). Das Rezept zeigt das eingegebene Maß
(„750 ml (1½ Stück)“), die Einkaufsliste weiter Stück.
+63 -4
View File
@@ -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", "200 g Eier", "1 Handvoll Glück"],
recipeIngredient: ["250 g rote Linsen", "2 Zwiebeln", "1 Becher Sahne", "2 EL Eier", "1 Handvoll Glück"],
recipeInstructions: [{ "@type": "HowToStep", text: "Zwiebeln anschwitzen." }, { "@type": "HowToStep", text: "Linsen dazu und weich kochen." }],
},
],
@@ -202,9 +202,11 @@ test.describe("recipe link", () => {
await expect(amounts.nth(2)).toHaveValue("1");
await expect(page.getByRole("combobox", { name: "Einheit" }).nth(2).locator("option:checked")).toHaveText("Packung (200 ml)");
await expect(amounts.nth(3)).toHaveValue("");
// Eier in Gramm passen nicht: Menge fehlt — Speichern sagt es, statt die Zeile wegzulassen.
// Eier in Esslöffeln passen nicht: Menge fehlt — Speichern sagt es, statt die Zeile wegzulassen.
await page.getByRole("button", { name: "Speichern" }).click();
await expect(page.locator("main [role=alert]")).toContainText("fehlt die Menge");
await 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");
@@ -533,6 +536,62 @@ test("portions are remembered and scale the amounts; a pack and cloves for any i
await expect(page).toHaveURL(/entfernt=/);
});
test("millilitres for a piece ingredient: stock cubes in ml with the size per piece (26.11.50)", async ({ page }) => {
await page.goto("/gerichte/neu");
await page.fill("#title", "Brühnudeln");
await page.getByRole("combobox", { name: "Zutat suchen" }).first().fill("Brühwürf");
await page.getByRole("option", { name: "Brühwürfel", exact: true }).click();
const amounts = page.getByRole("textbox", { name: "Menge", exact: true });
const units = page.getByRole("combobox", { name: "Einheit" });
await amounts.nth(0).fill("750");
await units.nth(0).selectOption("ml");
await page.getByLabel("Wie viel ml ist 1 Stück?").fill("500");
await page.getByRole("button", { name: "Speichern" }).click();
await expect(page.getByRole("heading", { level: 1 })).toHaveText("Brühnudeln");
await page.getByRole("link", { name: "Bearbeiten" }).click();
await expect(amounts.nth(0)).toHaveValue("750");
await expect(units.nth(0)).toHaveValue("ml");
await expect(page.getByText("1 Stück = 500 ml")).toBeVisible();
await page.goto("/gerichte");
await page.getByRole("link", { name: /Brühnudeln/ }).click();
await page.getByRole("button", { name: "Entfernen" }).click();
await expect(page).toHaveURL(/entfernt=/);
});
test("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
View File
@@ -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();
+8 -5
View File
@@ -5,7 +5,7 @@ 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 { COUNT_UNITS, FIXED_UNITS, impliedKitchenUnit, isKitchenUnit, isPackKind, needsSize, sizeOf, toBase, type BaseUnit, type InputUnit, type KitchenUnit, type PackKind } from "./units";
import { COUNT_UNITS, FIXED_UNITS, impliedKitchenUnit, isKitchenUnit, isMetric, isPackKind, needsSize, sizeKey, sizeOf, toBase, type BaseUnit, type DisplayUnit, type InputUnit, type KitchenUnit, type PackKind } from "./units";
// Gerichte des Haushalts lesen und schreiben. Mengen kommen so, wie man sie
// für das ganze Rezept eintippt (z. B. „500 g für 4 Portionen“), und werden
@@ -87,7 +87,7 @@ export type DishDetail = DishSummary & {
isStaple: boolean;
product: Product | null;
/** Eingegebenes Küchenmaß („2 EL“, „1 Dose“), sonst null (26.11.39). */
displayUnit: KitchenUnit | null;
displayUnit: DisplayUnit | null;
/** Gebinde der Zutat und seine Größe in der Basiseinheit: Produkt, sonst Haushalt, sonst Vorgabe. */
packKind: PackKind | null;
packSize: number | null;
@@ -143,7 +143,7 @@ export async function getDish(client: PoolClient, id: string, locale: string): P
: r.house_product
? { name: r.house_product, pack: r.house_pack, cookMinutes: r.house_cook, fromHousehold: true }
: null,
displayUnit: r.display_unit as KitchenUnit | null,
displayUnit: r.display_unit as DisplayUnit | null,
packKind: entries.get(r.ingredient_id)?.packKind ?? null,
// Größe zum eingegebenen Maß (26.11.49): beim Gebinde Produkt, sonst Haushalt bzw. Zutat.
packSize: sizeForDisplay(r, entries.get(r.ingredient_id)),
@@ -226,8 +226,11 @@ export async function saveDish(client: PoolClient, householdId: string, memberId
const size = known ?? (counted ? (i.size ?? null) : null);
const total = toBase(i.qty, unit, base, size);
if (total === null) throw new InvalidAmount(i.ingredientId);
const displayUnit = unit !== base && isKitchenUnit(unit) ? unit : null;
const rememberSize = counted && known === null && size ? { unit, size } : null;
// Eingegebenes Maß merken: Küchenmaße, und Gewicht/Volumen einer anderen Familie
// („200 ml“ Joghurt, „750 ml“ Brühwürfel, 26.11.50); kg bei g und l bei ml nicht.
const family = (u: string) => (u === "g" || u === "kg" ? "g" : u === "ml" || u === "l" ? "ml" : u);
const displayUnit = (unit !== base && isKitchenUnit(unit)) || (isMetric(unit) && family(unit) !== base) ? (unit as DisplayUnit) : null;
const rememberSize = counted && known === null && size ? { unit: sizeKey(unit), size } : null;
return { ...i, base, perPortion: Math.round((total / input.portions) * 1000) / 1000, position, pack, displayUnit, rememberSize };
});
const values = [
+4 -1
View File
@@ -4,6 +4,9 @@ import { pool } from "@/lib/db";
import type { IngredientEntry } from "./ingredient-search";
import { needsSize, type CountUnit } from "./units";
/** Maß einer Haushaltsgröße: ein Zählmaß, oder g/ml je Stück einer Stück-Zutat (26.11.50). */
export type SizeUnit = CountUnit | "g" | "ml";
// Die kanonischen Zutaten sind global und ändern sich nur beim Einspielen
// (Neustart). Einmal laden, im Speicher halten. Eigene Zutaten eines Haushalts
// (26.11.38) kommen je Anfrage dazu — mit einem Client in seinem Kontext.
@@ -47,7 +50,7 @@ export async function allIngredients(client?: PoolClient): Promise<IngredientEnt
}
/** Größe eines Zählmaßes für den Haushalt setzen (wer Gerichte pflegt). Ohne Maß: das Gebinde der Zutat. */
export async function setPackSize(client: PoolClient, householdId: string, ingredientId: string, size: number, unit?: CountUnit): Promise<boolean> {
export async function setPackSize(client: PoolClient, householdId: string, ingredientId: string, size: number, unit?: SizeUnit): Promise<boolean> {
const entry = (await allIngredients(client)).find((i) => i.id === ingredientId);
const kind = unit ?? entry?.packKind;
if (!entry || !kind || !needsSize(kind, entry.unit)) return false;
+32 -5
View File
@@ -29,11 +29,28 @@ export const isCountUnit = (u: string): u is CountUnit => (COUNT_UNITS as readon
export const isFixedUnit = (u: string): u is FixedUnit => (FIXED_UNITS as readonly string[]).includes(u);
export const isKitchenUnit = (u: string): u is KitchenUnit => (KITCHEN_UNITS as readonly string[]).includes(u);
/** Gewicht und Volumen (26.11.50, Kai: „Milliliter und Liter“ überall, auch bei Stück-Zutaten). */
export const METRIC = ["g", "kg", "ml", "l"] as const;
export type Metric = (typeof METRIC)[number];
export const isMetric = (u: string): u is Metric => (METRIC as readonly string[]).includes(u);
const METRIC_FACTOR: Record<Metric, number> = { g: 1, kg: 1000, ml: 1, l: 1000 };
/** Maß, in dem ein Rezept eine Menge zeigt, wie sie eingegeben wurde. */
export type DisplayUnit = KitchenUnit | Metric;
/** Maße, die man tippt oder in Rezepten liest. */
export type InputUnit = BaseUnit | "kg" | "l" | "cl" | KitchenUnit;
/** Ein Maß, das in dieser Basiseinheit eine Größe je Zutat braucht („Stück“ bei Stück-Zutaten ist keins). */
export const needsSize = (unit: string, base: BaseUnit): boolean => isCountUnit(unit) && !(unit === "piece" && base === "piece");
/**
* Ein Maß, das in dieser Basiseinheit eine Größe je Zutat braucht: Zählmaße („Stück“
* bei Stück-Zutaten ist keins) und Gewicht oder Volumen bei Stück-Zutaten
* („750 ml Brühe“ bei Brühwürfeln: 1 Stück = 500 ml).
*/
export const needsSize = (unit: string, base: BaseUnit): boolean =>
(isCountUnit(unit) && !(unit === "piece" && base === "piece")) || (base === "piece" && isMetric(unit));
/** Unter welchem Maß eine Größe steht: kg und l teilen sich die von g und ml (je Stück). */
export const sizeKey = (unit: string): string => (unit === "kg" ? "g" : unit === "l" ? "ml" : unit);
/** Ohne Angabe: Würfel, Zehe, Scheibe einer Stück-Zutat sind je ein Stück. */
export function defaultSize(unit: string, base: BaseUnit): number | null {
@@ -46,7 +63,7 @@ export function sizeOf(
base: BaseUnit,
entry: { packKind?: string | null; packSize?: number | null; sizes?: Partial<Record<string, number>> | null },
): number | null {
return entry.sizes?.[unit] ?? (entry.packKind === unit ? (entry.packSize ?? null) : null) ?? defaultSize(unit, base);
return entry.sizes?.[sizeKey(unit)] ?? (entry.packKind === unit ? (entry.packSize ?? null) : null) ?? defaultSize(unit, base);
}
/** Hochrechnen: Menge pro Portion × Portionen. */
@@ -67,6 +84,8 @@ const SOLID_G: Partial<Record<InputUnit, number>> = { g: 1, kg: 1000, tbsp: 12,
*/
export function toBase(qty: number, unit: InputUnit, base: BaseUnit, packSize?: number | null): number | null {
if (!Number.isFinite(qty) || qty < 0) return null;
// Stück-Zutat in Gewicht oder Volumen: Größe ist ml bzw. g je Stück.
if (base === "piece" && isMetric(unit)) return packSize && packSize > 0 ? (qty * METRIC_FACTOR[unit]) / packSize : null;
if (needsSize(unit, base)) {
const size = packSize ?? defaultSize(unit, base);
return size && size > 0 ? qty * size : null;
@@ -125,7 +144,9 @@ export function formatQuantity(qty: number, unit: BaseUnit, locale = "de"): Form
}
/** Menge in Basiseinheit zurück in das Küchenmaß, in dem sie eingegeben wurde (fürs Bearbeiten). */
export function fromBase(qty: number, unit: KitchenUnit, base: BaseUnit, packSize?: number | null): number | null {
export function fromBase(qty: number, unit: DisplayUnit, base: BaseUnit, packSize?: number | null): number | null {
if (base === "piece" && isMetric(unit)) return packSize && packSize > 0 ? (qty * packSize) / METRIC_FACTOR[unit] : null;
if (isMetric(unit)) return qty / METRIC_FACTOR[unit]; // g ↔ ml wie beim Löffel: 1 zu 1
if (needsSize(unit, base)) {
const size = packSize ?? defaultSize(unit, base);
return size && size > 0 ? qty / size : null;
@@ -155,7 +176,7 @@ export type KitchenFormatted = {
export function formatKitchen(
qty: number,
base: BaseUnit,
display: KitchenUnit | null | undefined,
display: DisplayUnit | null | undefined,
packSize: number | null | undefined,
locale: string,
word: (unit: KitchenUnit, count: number) => string,
@@ -165,6 +186,12 @@ export function formatKitchen(
if (!display) return { main: plainText, extra: "" };
const n = fromBase(qty, display, base, packSize);
if (n === null) return { main: plainText, extra: "" };
if (isMetric(display)) {
// Im eingegebenen Maß („750 ml“, „1,5 l“); bei Stück-Zutaten die Stück dahinter (26.11.50).
const family = display === "g" || display === "kg" ? "g" : "ml";
const f = formatQuantity(n * METRIC_FACTOR[display], family, locale);
return { main: `${f.amount} ${f.unit}`, extra: base === "piece" ? `${pieces(qty, locale)} ${word("piece", qty)}` : "" };
}
if (isPackKind(display)) {
// Ein Achtel Packung Butter hilft niemandem — dann nur Gramm.
if (n < 0.25 - 1e-9) return { main: plainText, extra: "" };
+2 -2
View File
@@ -2,12 +2,12 @@
import { useLocale, useTranslations } from "next-intl";
import { isOne } from "./ingredient-name";
import { formatKitchen, type BaseUnit, type KitchenUnit } from "./units";
import { formatKitchen, type BaseUnit, type DisplayUnit, type KitchenUnit } from "./units";
/** Was eine Zutat für die Mengenanzeige mitbringt (lib/dishes.ts, getDish). */
export type Measured = {
unit: BaseUnit;
displayUnit?: KitchenUnit | null;
displayUnit?: DisplayUnit | null;
packSize?: number | null;
};
+12 -1
View File
@@ -498,7 +498,18 @@
"count": "Stück & Gebinde"
},
"sizeAsk": "Wie viel ist 1 {unit}? (in {base})",
"portionsHint": "Die Mengen rechnen mit, wenn du die Portionen änderst."
"portionsHint": "Die Mengen rechnen mit, wenn du die Portionen änderst.",
"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": {
+12 -1
View File
@@ -498,7 +498,18 @@
"count": "Pieces & packs"
},
"sizeAsk": "How much is 1 {unit}? (in {base})",
"portionsHint": "The amounts change along when you change the portions."
"portionsHint": "The amounts change along when you change the portions.",
"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": {
+12 -1
View File
@@ -498,7 +498,18 @@
"count": "Piezas y envases"
},
"sizeAsk": "¿Cuánto es 1 {unit}? (en {base})",
"portionsHint": "Las cantidades cambian contigo cuando cambias las raciones."
"portionsHint": "Las cantidades cambian contigo cuando cambias las raciones.",
"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": {
+12 -1
View File
@@ -498,7 +498,18 @@
"count": "Pièces & emballages"
},
"sizeAsk": "Combien fait 1 {unit} ? (en {base})",
"portionsHint": "Les quantités suivent quand tu changes les portions."
"portionsHint": "Les quantités suivent quand tu changes les portions.",
"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
View File
@@ -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.49 # YY.M.<n> wie im AImighty-Markt — bei jeder Chart-Änderung erhöhen
appVersion: "26.11.49" # MUSS gleich version sein: der Linter prüft es, und der Image-Tag hängt daran
version: 26.11.51 # YY.M.<n> wie im AImighty-Markt — bei jeder Chart-Änderung erhöhen
appVersion: "26.11.51" # MUSS gleich version sein: der Linter prüft es, und der Image-Tag hängt daran
+2 -2
View File
@@ -21,7 +21,7 @@ metadata:
title: 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.49
version: 26.11.51
categories:
- Applications
@@ -61,7 +61,7 @@ permission:
appData: true
spec:
versionName: '26.11.49'
versionName: '26.11.51'
featuredImage: https://git.aimighty.olares.de/aimighty/bilder/raw/branch/main/lunch/icon.png
promoteImage:
+5
View File
@@ -0,0 +1,5 @@
# Millilitres and litres for every ingredient
v26.11.50: Every ingredient can now be entered in millilitres and litres as well as grams and kilos — also ingredients counted in pieces, such as stock cubes: the first time, the app asks how many millilitres one piece makes (for example 1 cube = 500 ml) and remembers it. The recipe shows "750 ml (1½ pieces)"; the shopping list still counts pieces.
## Deutsch
v26.11.50: Jede Zutat lässt sich jetzt auch in Millilitern und Litern eintragen, ebenso in Gramm und Kilo — auch Zutaten, die man in Stück zählt, wie Brühwürfel: Beim ersten Mal fragt die App, wie viel ml ein Stück ergibt (etwa 1 Würfel = 500 ml), und merkt es sich. Das Rezept zeigt „750 ml (1½ Stück)“, die Einkaufsliste zählt weiter Stück.
+5
View File
@@ -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.
+15
View File
@@ -100,6 +100,21 @@ describe.skipIf(!url)("kitchen units", () => {
expect(got!.ingredients[1]).toMatchObject({ displayUnit: null, unit: "piece", qtyPerPortion: 0.75 });
});
it("stock cubes in millilitres and yoghurt in millilitres (26.11.50)", async () => {
const [stock, yoghurt] = (await client.query("select id from ingredients where key in ('stock_cube', 'yogurt') order by key")).rows.map((r) => r.id as string);
const got = await db.withHousehold(a, async (c) => {
const id = await dishes.saveDish(c, a, member, dish([
{ ingredientId: stock!, qty: 750, unit: "ml", size: 500 },
{ ingredientId: yoghurt!, qty: 200, unit: "ml" },
], 2));
return dishes.getDish(c, id, "de");
});
expect(got!.ingredients[0]).toMatchObject({ displayUnit: "ml", unit: "piece", qtyPerPortion: 0.75, packSize: 500 });
expect(got!.ingredients[1]).toMatchObject({ displayUnit: "ml", unit: "g", qtyPerPortion: 100 });
const mine = await db.withHousehold(a, (c) => ingredients.allIngredients(c));
expect(mine.find((i) => i.id === stock)!.sizes).toMatchObject({ ml: 500 });
});
it("an old dish without a typed unit shows spoons where they fit", async () => {
const got = await db.withHousehold(a, async (c) => {
const id = await dishes.saveDish(c, a, member, dish([{ ingredientId: ing.olive_oil!, qty: 30, unit: "ml" }]));
+21
View File
@@ -131,3 +131,24 @@ describe("more measures (26.11.49)", () => {
expect(niceQty(0.1, "tbsp")).toBe(0.25);
});
});
describe("millilitres and litres everywhere (26.11.50)", () => {
const word = (u: KitchenUnit, n: number) => (u === "piece" ? "Stück" : u) + (n > 1 ? "" : "");
it("a piece ingredient in ml takes the size per piece", () => {
expect(toBase(750, "ml", "piece", 500)).toBe(1.5);
expect(toBase(1, "l", "piece", 500)).toBe(2);
expect(toBase(750, "ml", "piece")).toBeNull();
expect(fromBase(1.5, "ml", "piece", 500)).toBe(750);
expect(sizeOf("l", "piece", { sizes: { ml: 500 } })).toBe(500);
});
it("grams and millilitres are one to one", () => {
expect(toBase(200, "ml", "g")).toBe(200);
expect(toBase(1, "kg", "ml")).toBe(1000);
expect(fromBase(200, "ml", "g")).toBe(200);
});
it("shows the typed measure, with the pieces of a piece ingredient", () => {
expect(formatKitchen(1.5, "piece", "ml", 500, "de", word)).toEqual({ main: "750 ml", extra: "1½ Stück" });
expect(formatKitchen(1500, "ml", "l", null, "de", word).main).toBe("1,5 l");
expect(formatKitchen(200, "g", "ml", null, "de", word)).toEqual({ main: "200 ml", extra: "" });
});
});