Compare commits

...
1 Commits
Author SHA1 Message Date
kai afdbf34b89 26.11.47: Mein Gericht per Herz (#48)
release / which version (push) Successful in 2s
release / olares chart · sanity (push) Successful in 4s
release / app (push) Successful in 1m15s
release / tag and release (push) Successful in 3s
2026-11-08 07:32:29 +00:00
16 changed files with 122 additions and 36 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.46 — alle neun Arbeitspakete aus `docs/PROJEKTSTART.md` sind gebaut:
> **Status:** 26.11.47 — 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). 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). 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.46
version: 26.11.47
categories:
- Applications
@@ -61,7 +61,7 @@ permission:
appData: true
spec:
versionName: '26.11.46'
versionName: '26.11.47'
featuredImage: https://git.aimighty.olares.de/aimighty/bilder/raw/branch/main/lunch/icon.png
promoteImage:
+2 -2
View File
@@ -10,10 +10,10 @@ export const dynamic = "force-dynamic";
export async function POST(request: Request) {
const session = await guardWrite(request, [...WISHERS]);
if (isResponse(session)) return session;
const body = z.object({ dishId: z.string().uuid(), mine: z.boolean() }).safeParse(await readJson(request));
const body = z.object({ dishId: z.string().uuid(), mine: z.boolean(), wish: z.boolean().optional() }).safeParse(await readJson(request));
if (!body.success) return fail("invalid", 400);
try {
await withHousehold(session.householdId, (c) => setMine(c, session.memberId, body.data.dishId, body.data.mine));
await withHousehold(session.householdId, (c) => setMine(c, session.memberId, body.data.dishId, body.data.mine, body.data.wish ? { wishIn: session.householdId } : {}));
return json({ ok: true });
} catch (error) {
if (error instanceof WishRefused) return fail(error.reason, 409);
+24 -10
View File
@@ -97,7 +97,6 @@ export function WishBoard({
const mineOf = (id: string) => (byDish.get(id) ?? []).filter((e) => e.isMine);
const myDish = entries.find((e) => e.memberId === me && e.isMine);
const myDishTitle = myDish ? tiles.find((x) => x.id === myDish.dishId)?.title : null;
const wishedSomething = entries.some((e) => e.memberId === me && !e.isVeto);
const shown = applyFilter(tiles, filter);
async function call(method: string, url: string, body?: object, key = "x") {
@@ -174,12 +173,12 @@ export function WishBoard({
<Heart aria-hidden className="size-4 shrink-0 fill-accent text-accent" />
{t("mineChosen", { title: myDishTitle })}
</p>
) : wishedSomething ? (
) : (
<p className="flex items-center gap-2 text-sm text-muted-foreground">
<Heart aria-hidden className="size-4 shrink-0" />
{t("mineHint")}
</p>
) : null}
)}
{error ? <ErrorNotice>{t(`errors.${error}`)}</ErrorNotice> : null}
{message ? (
@@ -218,12 +217,6 @@ export function WishBoard({
<Check aria-hidden className="size-5" />
</span>
) : null}
{mineNames.length ? (
<span aria-hidden className="absolute right-2 top-2 inline-flex items-center gap-1 rounded-full bg-background/90 px-2 py-1 text-xs font-semibold">
<Heart aria-hidden className={cn("size-4 text-accent", isMyDish && "fill-accent")} />
{isMyDish ? t("mine") : t("mineOf", { names: mineNames.filter((n) => n !== t("you")).join(", ") })}
</span>
) : null}
{favorite ? (
<span aria-hidden className="absolute bottom-2 left-2 inline-flex items-center gap-1 rounded-full bg-background/90 px-2 py-1 text-xs font-semibold">
<Crown aria-hidden className="size-4 text-accent" />
@@ -234,7 +227,12 @@ export function WishBoard({
<span className="flex min-h-11 flex-col gap-0.5 p-3 pr-12">
<span className="font-semibold text-lg leading-snug">{tile.title}</span>
{favorite ? <span className="sr-only">{t("favorite")}</span> : null}
{mineNames.length ? <span className="sr-only">{isMyDish ? t("mine") : t("mineOf", { names: mineNames.join(", ") })}</span> : null}
{mineNames.length ? (
<span className="inline-flex items-center gap-1 text-xs font-semibold">
<Heart aria-hidden className={cn("size-3.5 shrink-0 text-accent", isMyDish && "fill-accent")} />
{isMyDish ? t("mine") : t("mineOf", { names: mineNames.filter((n) => n !== t("you")).join(", ") })}
</span>
) : null}
{names.length ? <span className="text-xs text-muted-foreground">{t("wishedBy", { names: names.join(", ") })}</span> : null}
{vetoList.length && !mineNames.length ? (
<span className="inline-flex items-center gap-1 text-xs text-muted-foreground">
@@ -244,6 +242,22 @@ export function WishBoard({
) : null}
</span>
</button>
{/* Herz (Kai, 8.11.2026, 26.11.47): ein Tipp macht das Gericht zu meinem —
noch nicht gewünscht, wird es dabei gewünscht (ein Jeton). */}
{own?.isVeto || own?.viaVeto ? null : (
<button
type="button"
aria-pressed={isMyDish}
aria-label={isMyDish ? t("mineUntoggle", { title: tile.title }) : t("mineToggle", { title: tile.title })}
disabled={!!busy}
onClick={() => call("POST", "/api/wishes/mine", isMyDish ? { dishId: tile.id, mine: false } : { dishId: tile.id, mine: true, wish: true }, tile.id)}
className="absolute right-1 top-1 flex size-11 items-center justify-center rounded-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
>
<span className="flex size-9 items-center justify-center rounded-full bg-background/90 shadow-sm">
<Heart aria-hidden className={cn("size-5", isMyDish ? "fill-accent text-accent" : "text-foreground")} />
</span>
</button>
)}
<Button
type="button"
variant="ghost"
+9
View File
@@ -377,3 +377,12 @@ eingerichtet ist (dasselbe wie bei „Gericht einsprechen“). Die Abschrift zer
Füllwörter wie „wir brauchen noch“, „bitte“ fallen weg). Die Person prüft und
ändert die Posten, erst dann kommen sie unter „Sonstiges“ auf die Liste. Die
Aufnahme wird nicht gespeichert.
**Nachtrag 26.11.47 · „Mein Gericht“ per Herz** (Kai, 8.11.2026, „Jede Karte“):
Jede Wunschkarte trägt oben rechts ein Herz — Herz, nicht Stern, weil das Herz
schon „Mein Gericht“ heißt und ein Stern nach Bewertung aussähe. Ein Tipp aufs
leere Herz wünscht das Gericht (ein Jeton) und macht es zu meinem, in einer
Transaktion (`setMine` mit `wishIn`): ohne Jeton entsteht nichts. Gefüllt
nimmt ein Tipp es zurück, der Wunsch bleibt. Eins pro Runde, ein neues ersetzt
das alte. Kein Herz an eigenen Vetos und an Wünschen aus einem Veto. Der Weg
über „…“ bleibt.
+3 -4
View File
@@ -72,10 +72,9 @@ test("a child wishes, makes a favourite, and has no veto", async () => {
test("a child makes a wish their own dish, sure to be in the plan", async () => {
await tablet.goto("/wuenschen");
await expect(tablet.getByText("Mach einen Wunsch zu deinem Gericht")).toBeVisible();
await tablet.getByRole("button", { name: "Optionen für Spaghetti Bolognese" }).click();
await tablet.getByRole("dialog").getByRole("button", { name: "Als mein Gericht" }).click();
await expect(tablet.getByRole("dialog")).toBeHidden();
await expect(tablet.getByText("Tipp aufs Herz")).toBeVisible();
await tablet.getByRole("button", { name: "Spaghetti Bolognese als mein Gericht" }).click();
await expect(tablet.getByRole("button", { name: "Spaghetti Bolognese nicht mehr mein Gericht" })).toHaveAttribute("aria-pressed", "true");
await expect(tablet.getByText("Dein Gericht: Spaghetti Bolognese — kommt sicher in den Plan.")).toBeVisible();
await expect(tablet.getByRole("button", { name: /^Wunsch zurücknehmen: Spaghetti Bolognese/ })).toContainText("Mein Gericht");
});
+24
View File
@@ -28,6 +28,30 @@ test("tokens, veto and the joker share one line, even on the iPhone", async ({ p
await expect(page.getByText("1 Veto frei")).toBeVisible();
});
test("the heart makes a dish my dish in one tap, and takes it back (26.11.47)", async ({ page }) => {
await page.goto("/wuenschen");
await expect(page.getByText("Tipp aufs Herz")).toBeVisible();
await page.getByRole("button", { name: "Linseneintopf als mein Gericht" }).click();
const heart = page.getByRole("button", { name: "Linseneintopf nicht mehr mein Gericht" });
await expect(heart).toHaveAttribute("aria-pressed", "true");
await expect(page.getByRole("button", { name: /^Wunsch zurücknehmen: Linseneintopf/ })).toHaveAttribute("aria-pressed", "true");
await expect(page.getByText("1 Jeton frei")).toBeVisible();
await expect(page.getByText("Dein Gericht: Linseneintopf — kommt sicher in den Plan.")).toBeVisible();
// Zurück: das Herz ist leer, der Wunsch bleibt.
await heart.click();
await expect(page.getByRole("button", { name: "Linseneintopf als mein Gericht" })).toHaveAttribute("aria-pressed", "false");
await expect(page.getByText("1 Jeton frei")).toBeVisible();
// Der Weg über das Blatt geht weiter.
await page.getByRole("button", { name: "Optionen für Linseneintopf" }).click();
await page.getByRole("dialog").getByRole("button", { name: "Als mein Gericht" }).click();
await expect(page.getByRole("dialog")).toBeHidden();
await expect(page.getByRole("button", { name: "Linseneintopf nicht mehr mein Gericht" })).toHaveAttribute("aria-pressed", "true");
await page.getByRole("button", { name: "Linseneintopf nicht mehr mein Gericht" }).click();
await expect(page.getByRole("button", { name: "Linseneintopf als mein Gericht" })).toBeVisible();
await page.getByRole("button", { name: /^Wunsch zurücknehmen: Linseneintopf/ }).click();
await expect(page.getByText("2 Jetons frei")).toBeVisible();
});
test("each tap spends a token, and the server says when they are gone", async ({ page }) => {
await page.goto("/");
await page.getByRole("link", { name: "Wünschen" }).click();
+14 -4
View File
@@ -139,7 +139,9 @@ export async function lastMine(client: PoolClient, roundId: string): Promise<{ m
}
/** Einen eigenen Wunsch zu „Mein Gericht“ machen (ein anderes verliert es) oder es zurücknehmen. */
export async function setMine(client: PoolClient, memberId: string, dishId: string, on: boolean): Promise<void> {
// Mit `wishIn` (26.11.47, Herz auf der Karte) wünscht ein Tipp das Gericht zuerst
// (ein Jeton) — in derselben Transaktion, also ganz oder gar nicht.
export async function setMine(client: PoolClient, memberId: string, dishId: string, on: boolean, opts: { wishIn?: string } = {}): Promise<void> {
await client.query("select pg_advisory_xact_lock(hashtext('wish:' || $1))", [memberId]);
const round = (await client.query("select id from rounds where status = 'open' order by created_at desc limit 1")).rows[0];
if (!round) throw new WishRefused("noRound");
@@ -147,9 +149,17 @@ export async function setMine(client: PoolClient, memberId: string, dishId: stri
await client.query("update wishes set is_mine = false where round_id = $1 and member_id = $2 and dish_id = $3", [round.id, memberId, dishId]);
return;
}
const own = (
await client.query("select id from wishes where round_id = $1 and member_id = $2 and dish_id = $3 and not is_veto and veto_id is null", [round.id, memberId, dishId])
).rows[0];
const ownWish = () =>
client.query("select id from wishes where round_id = $1 and member_id = $2 and dish_id = $3 and not is_veto and veto_id is null", [round.id, memberId, dishId]);
let own = (await ownWish()).rows[0];
if (!own && opts.wishIn) {
// Ein eigenes Veto oder ein Wunsch aus einem Veto wird nicht still umgedeutet.
const other = await client.query("select 1 from wishes where round_id = $1 and member_id = $2 and dish_id = $3", [round.id, memberId, dishId]);
if (other.rowCount) throw new WishRefused("notWished");
if ((await lastMine(client, round.id)).some((m) => m.memberId === memberId && m.dishId === dishId && m.served)) throw new WishRefused("repeat");
await addWish(client, opts.wishIn, memberId, dishId);
own = (await ownWish()).rows[0];
}
if (!own) throw new WishRefused("notWished");
if ((await lastMine(client, round.id)).some((m) => m.memberId === memberId && m.dishId === dishId && m.served)) throw new WishRefused("repeat");
await client.query("update wishes set is_mine = false where round_id = $1 and member_id = $2 and is_mine", [round.id, memberId]);
+4 -2
View File
@@ -651,12 +651,14 @@
"mineOf": "Gericht von {names}",
"mineSet": "Als mein Gericht",
"mineUnset": "Nicht mehr mein Gericht",
"mineHint": "Mach einen Wunsch zu deinem Gericht: Das kommt sicher in den Plan, kein Veto streicht es.",
"mineHint": "Tipp aufs Herz: Dein Gericht kommt sicher in den Plan, kein Veto streicht es.",
"mineChosen": "Dein Gericht: {title} — kommt sicher in den Plan.",
"mineExplain": "Eins pro Runde. Kein Veto streicht es, und der Plan setzt es zuerst.",
"protected": "Geschützt: Das ist das Gericht von jemandem. Dagegen gibt es kein Veto.",
"vetoCount": "{n, plural, one {1 Veto} other {# Vetos}}",
"jokerShort": "Neues"
"jokerShort": "Neues",
"mineToggle": "{title} als mein Gericht",
"mineUntoggle": "{title} nicht mehr mein Gericht"
},
"kids": {
"title": "Wer bist du?",
+4 -2
View File
@@ -651,12 +651,14 @@
"mineOf": "{names}'s dish",
"mineSet": "Make it my dish",
"mineUnset": "No longer my dish",
"mineHint": "Make one wish your dish: it is sure to be in the plan, and no veto removes it.",
"mineHint": "Tap the heart: your dish is sure to make the plan, no veto can strike it.",
"mineChosen": "Your dish: {title} — sure to be in the plan.",
"mineExplain": "One per round. No veto removes it, and the plan puts it first.",
"protected": "Protected: this is someone's dish. There is no veto against it.",
"vetoCount": "{n, plural, one {1 veto} other {# vetoes}}",
"jokerShort": "Something new"
"jokerShort": "Something new",
"mineToggle": "{title} as my dish",
"mineUntoggle": "{title} no longer my dish"
},
"kids": {
"title": "Who are you?",
+4 -2
View File
@@ -651,12 +651,14 @@
"mineOf": "{names}'s dish",
"mineSet": "Make it my dish",
"mineUnset": "No longer my dish",
"mineHint": "Make one wish your dish: it is sure to be in the plan, and no veto removes it.",
"mineHint": "Toca el corazón: tu plato entra seguro en el plan, ningún veto lo quita.",
"mineChosen": "Your dish: {title} — sure to be in the plan.",
"mineExplain": "One per round. No veto removes it, and the plan puts it first.",
"protected": "Protected: this is someone's dish. There is no veto against it.",
"vetoCount": "{n, plural, one {1 veto} other {# vetoes}}",
"jokerShort": "Something new"
"jokerShort": "Something new",
"mineToggle": "{title} como mi plato",
"mineUntoggle": "{title} ya no es mi plato"
},
"kids": {
"title": "Who are you?",
+4 -2
View File
@@ -651,12 +651,14 @@
"mineOf": "{names}'s dish",
"mineSet": "Make it my dish",
"mineUnset": "No longer my dish",
"mineHint": "Make one wish your dish: it is sure to be in the plan, and no veto removes it.",
"mineHint": "Touche le cœur : ton plat entre à coup sûr dans le plan, aucun veto ne le retire.",
"mineChosen": "Your dish: {title} — sure to be in the plan.",
"mineExplain": "One per round. No veto removes it, and the plan puts it first.",
"protected": "Protected: this is someone's dish. There is no veto against it.",
"vetoCount": "{n, plural, one {1 veto} other {# vetoes}}",
"jokerShort": "Something new"
"jokerShort": "Something new",
"mineToggle": "{title} comme mon plat",
"mineUntoggle": "{title} n’est plus mon plat"
},
"kids": {
"title": "Who are you?",
+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.46 # YY.M.<n> wie im AImighty-Markt — bei jeder Chart-Änderung erhöhen
appVersion: "26.11.46" # MUSS gleich version sein: der Linter prüft es, und der Image-Tag hängt daran
version: 26.11.47 # YY.M.<n> wie im AImighty-Markt — bei jeder Chart-Änderung erhöhen
appVersion: "26.11.47" # 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.46
version: 26.11.47
categories:
- Applications
@@ -61,7 +61,7 @@ permission:
appData: true
spec:
versionName: '26.11.46'
versionName: '26.11.47'
featuredImage: https://git.aimighty.olares.de/aimighty/bilder/raw/branch/main/lunch/icon.png
promoteImage:
+5
View File
@@ -0,0 +1,5 @@
# My dish with one tap on the heart
v26.11.47: Every dish card under Wishes now has a heart in the top corner. One tap makes the dish your dish — it is wished at the same time if it was not yet (one token) and is then sure to make the plan, no veto can strike it. A filled heart shows your dish; tap again to take it back, the wish stays. One per round; a new one replaces the old.
## Deutsch
v26.11.47: Jede Gerichtskarte unter „Wünschen“ hat jetzt oben ein Herz. Ein Tipp macht das Gericht zu deinem Gericht — war es noch nicht gewünscht, wird es dabei gewünscht (ein Jeton), und es kommt sicher in den Plan, kein Veto streicht es. Ein gefülltes Herz zeigt dein Gericht; nochmal tippen nimmt es zurück, der Wunsch bleibt. Eins pro Runde; ein neues ersetzt das alte.
+17
View File
@@ -62,6 +62,23 @@ describe.skipIf(!url)("my dish", () => {
expect((await entries()).filter((e) => e.isMine).map((e) => e.dishId)).toEqual([d.Pommes]);
});
it("the heart wishes and makes it my dish in one step, all or nothing (26.11.47)", async () => {
const before = (await as((c) => wishes.budget(c, roundId, lea))).tokensLeft;
await as((c) => wishes.setMine(c, lea, d.Nudeln!, true, { wishIn: h }));
expect((await entries()).find((e) => e.memberId === lea && e.dishId === d.Nudeln)).toMatchObject({ isMine: true, isVeto: false });
expect((await as((c) => wishes.budget(c, roundId, lea))).tokensLeft).toBe(before - 1);
// Zurück: nicht mehr mein Gericht, der Wunsch bleibt.
await as((c) => wishes.setMine(c, lea, d.Nudeln!, false));
expect((await entries()).find((e) => e.memberId === lea && e.dishId === d.Nudeln)).toMatchObject({ isMine: false });
await as((c) => wishes.removeWish(c, lea, d.Nudeln!));
// Ohne Jeton: nichts entsteht.
for (const x of [d.Suppe!, d.Pommes!, d.Nudeln!]) await as((c) => wishes.addWish(c, h, lea, x));
expect((await as((c) => wishes.budget(c, roundId, lea))).tokensLeft).toBe(0);
await expect(as((c) => wishes.setMine(c, lea, d.Pizza!, true, { wishIn: h }))).rejects.toMatchObject({ reason: "noTokens" });
expect((await entries()).some((e) => e.memberId === lea && e.dishId === d.Pizza)).toBe(false);
for (const x of [d.Suppe!, d.Pommes!, d.Nudeln!]) await as((c) => wishes.removeWish(c, lea, x));
});
it("last round's own dish that made it into the plan cannot be chosen again", async () => {
await as((c) => wishes.addWish(c, h, ben, d.Pizza!));
await expect(as((c) => wishes.setMine(c, ben, d.Pizza!, true))).rejects.toMatchObject({ reason: "repeat" });