diff --git a/CLAUDE.md b/CLAUDE.md
index 5962667..177209a 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -7,11 +7,12 @@
> **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.17 — alle neun Arbeitspakete aus `docs/PROJEKTSTART.md` sind gebaut:
+> **Status:** 26.11.19 — 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
-> (V2a, 26.11.16), Olares Router als Standard (26.11.17). Offen sind V2b (Kassenbons)
+> (V2a, 26.11.16), Olares Router als Standard (26.11.17), untere Leiste am iPhone (26.11.18),
+> Rolle „Jugendlich“ (26.11.19). Offen sind V2b (Kassenbons)
> und der Magic Link.
> **Letzte Aktualisierung:** 7. November 2026
@@ -323,6 +324,17 @@ Vorlagen ersetzt. `tests/seed.test.ts` prüft die Dateien. Ein Haushalt
`gerichte`, `mehr`, `runde`. Schreibende Routen lassen Kinder nur beim Wünschen
zu (`WISHERS`), ein Veto nie.
+## Rollen
+
+- `admin`, `member`, `teen` (seit 26.11.19), `child`, `guest`. Wer was darf, steht nur
+ in `lib/auth/roles.ts` als Erlaubnisliste (`PLANNERS`, `SHOPPERS`, `COOKS`,
+ `WITH_PASSKEY`; `WISHERS` in `lib/wishes.ts`) — eine neue Rolle darf nichts, bis sie
+ dort steht. Jugendliche: Passkey auf dem eigenen Handy (Einladung mit Rolle
+ „Jugendlich“), wünschen mit Veto, einkaufen, kochen, bewerten; nicht planen
+ (`requirePlanner`), keine Gerichte pflegen, nichts verwalten.
+- Kinderbilder (`lib/avatars.ts`): Tiere „für Kleine“, Hobbys und `initials` „für
+ Größere“; Bild und PIN lassen sich in „Mehr“ ändern.
+
## Untere Leiste am iPhone
- iOS lässt eine feste Leiste nach dem Schließen der Tastatur oft dort stehen, wo die
diff --git a/OlaresManifest.yaml b/OlaresManifest.yaml
index 00f6c82..bf4104b 100644
--- a/OlaresManifest.yaml
+++ b/OlaresManifest.yaml
@@ -21,7 +21,7 @@ metadata:
title: What's cooking?
description: The family decides together what's for dinner — and the shopping list writes itself. Runs entirely on your own box.
icon: https://git.aimighty.olares.de/aimighty/bilder/raw/branch/main/lunch/icon.png
- version: 26.11.18
+ version: 26.11.19
categories:
- Applications
@@ -61,7 +61,7 @@ permission:
appData: true
spec:
- versionName: '26.11.18'
+ versionName: '26.11.19'
featuredImage: https://git.aimighty.olares.de/aimighty/bilder/raw/branch/main/lunch/icon.png
promoteImage:
diff --git a/app/(app)/kochen/[id]/page.tsx b/app/(app)/kochen/[id]/page.tsx
index 73816ac..9b91ca8 100644
--- a/app/(app)/kochen/[id]/page.tsx
+++ b/app/(app)/kochen/[id]/page.tsx
@@ -1,3 +1,4 @@
+import { can, COOKS } from "@/lib/auth/roles";
import { notFound, redirect } from "next/navigation";
import { getLocale, getTranslations } from "next-intl/server";
import { CookingMode } from "@/components/cooking/cooking-mode";
@@ -31,7 +32,7 @@ export default async function CookingPage({ params }: { params: Promise<{ id: st
portions={slot.portions}
ingredients={slot.dish.ingredients}
steps={slot.dish.steps}
- canFinish={session.role === "admin" || session.role === "member"}
+ canFinish={can(COOKS, session.role)}
/>
)}
diff --git a/app/(app)/layout.tsx b/app/(app)/layout.tsx
index 4de2e74..c1c4b86 100644
--- a/app/(app)/layout.tsx
+++ b/app/(app)/layout.tsx
@@ -11,7 +11,7 @@ export default async function AppLayout({ children }: { children: React.ReactNod
return (
<>
{children}
-
+
>
);
}
diff --git a/app/(app)/page.tsx b/app/(app)/page.tsx
index ba14a21..314db73 100644
--- a/app/(app)/page.tsx
+++ b/app/(app)/page.tsx
@@ -1,3 +1,4 @@
+import { can, COOKS, PLANNERS } from "@/lib/auth/roles";
import { ChefHat, CookingPot, Crown, Heart } from "lucide-react";
import { RateCard } from "@/components/cooking/rate-card";
import { InstallHint } from "@/components/install-hint";
@@ -38,7 +39,8 @@ export default async function TodayPage() {
);
return { round, entries, titles, budget: await budget(c, round.id, session.memberId) };
});
- const adult = session.role === "admin" || session.role === "member";
+ const adult = can(PLANNERS, session.role);
+ const cook = can(COOKS, session.role);
const day = data.round?.shoppingDate
? new Intl.DateTimeFormat(locale, { weekday: "long" }).format(new Date(`${data.round.shoppingDate}T12:00:00`))
: null;
@@ -64,7 +66,7 @@ export default async function TodayPage() {
))}
{"slots" in data && data.slots ? (
-
+
) : "budget" in data && data.budget ? (
<>
@@ -139,7 +141,7 @@ async function FamilyWishes({
);
}
-async function PlanToday({ slots, adult }: { slots: Awaited>; adult: boolean }) {
+async function PlanToday({ slots, adult, cook }: { slots: Awaited>; adult: boolean; cook: boolean }) {
const t = await getTranslations("today");
const next = slots.find((s) => s.dishId && !s.cookedAt);
return (
@@ -157,7 +159,7 @@ async function PlanToday({ slots, adult }: { slots: Awaited
- {adult ? t("startCooking") : t("readAlong")}
+ {cook ? t("startCooking") : t("readAlong")}
diff --git a/app/(app)/plan/layout.tsx b/app/(app)/plan/layout.tsx
index 6b6e02f..cffa636 100644
--- a/app/(app)/plan/layout.tsx
+++ b/app/(app)/plan/layout.tsx
@@ -1,7 +1,7 @@
-import { requireAdult } from "@/lib/auth/session";
+import { requirePlanner } from "@/lib/auth/session";
-// Kinder sehen nur „Heute“ und „Wünschen“ (Konzept, „Kindermodus“).
+// Planen nur Erwachsene; Kinder und Jugendliche sehen den Plan auf „Heute“.
export default async function AdultsOnly({ children }: { children: React.ReactNode }) {
- await requireAdult();
+ await requirePlanner();
return children;
}
diff --git a/app/(app)/plan/page.tsx b/app/(app)/plan/page.tsx
index ce32137..28f53b8 100644
--- a/app/(app)/plan/page.tsx
+++ b/app/(app)/plan/page.tsx
@@ -3,7 +3,7 @@ import { getLocale, getTranslations } from "next-intl/server";
import { buttonVariants } from "@/components/ui/button";
import { PlanBoard, type SlotCost } from "@/components/plan/plan-board";
import { costOverview } from "@/lib/costs";
-import { requireAdult } from "@/lib/auth/session";
+import { requirePlanner } from "@/lib/auth/session";
import { withHousehold } from "@/lib/db";
import { listDishes } from "@/lib/dishes";
import { planSlots } from "@/lib/plan";
@@ -13,7 +13,7 @@ import { cn } from "@/lib/utils";
export const dynamic = "force-dynamic";
export default async function PlanPage() {
- const session = await requireAdult();
+ const session = await requirePlanner();
const t = await getTranslations("plan");
const locale = await getLocale();
const data = await withHousehold(session.householdId, async (c) => {
diff --git a/app/(app)/runde/layout.tsx b/app/(app)/runde/layout.tsx
index 6b6e02f..5bcd40b 100644
--- a/app/(app)/runde/layout.tsx
+++ b/app/(app)/runde/layout.tsx
@@ -1,7 +1,7 @@
-import { requireAdult } from "@/lib/auth/session";
+import { requirePlanner } from "@/lib/auth/session";
// Kinder sehen nur „Heute“ und „Wünschen“ (Konzept, „Kindermodus“).
export default async function AdultsOnly({ children }: { children: React.ReactNode }) {
- await requireAdult();
+ await requirePlanner();
return children;
}
diff --git a/app/api/auth/invite/verify/route.ts b/app/api/auth/invite/verify/route.ts
index f99bb26..3bc993d 100644
--- a/app/api/auth/invite/verify/route.ts
+++ b/app/api/auth/invite/verify/route.ts
@@ -15,7 +15,7 @@ type InviteContext = {
isNew: boolean;
name: string;
householdId: string;
- role: "admin" | "member";
+ role: "admin" | "member" | "teen";
};
// Einladung annehmen, Schritt 2: Passkey prüfen, die Einladung verbrauchen
@@ -47,7 +47,7 @@ export async function POST(request: Request) {
ctx.memberId,
ctx.householdId,
ctx.name,
- ctx.role === "admin" ? "admin" : "member",
+ ctx.role === "admin" || ctx.role === "teen" ? ctx.role : "member",
resolveLocale((await cookies()).get(LOCALE_COOKIE)?.value, request.headers.get("accept-language")),
]);
}
diff --git a/app/api/household/invitations/route.ts b/app/api/household/invitations/route.ts
index 37b0fb2..32b39b4 100644
--- a/app/api/household/invitations/route.ts
+++ b/app/api/household/invitations/route.ts
@@ -1,3 +1,4 @@
+import { can, WITH_PASSKEY } from "@/lib/auth/roles";
import { withAuth, withHousehold } from "@/lib/db";
import { fail, json, readJson, sameOrigin } from "@/lib/auth/http";
import { createInvitationBody } from "@/lib/auth/schemas";
@@ -20,7 +21,7 @@ export async function POST(request: Request) {
const body = createInvitationBody.safeParse(await readJson(request));
if (!body.success) return fail("invalid", 400);
if (body.data.kind === "person" && session.role !== "admin") return fail("forbidden", 403);
- if (session.role === "child" || session.role === "guest") return fail("forbidden", 403);
+ if (!can(WITH_PASSKEY, session.role)) return fail("forbidden", 403);
const token = randomToken();
const data = body.data;
diff --git a/app/api/shopping/events/route.ts b/app/api/shopping/events/route.ts
index be81db1..d768bca 100644
--- a/app/api/shopping/events/route.ts
+++ b/app/api/shopping/events/route.ts
@@ -1,3 +1,4 @@
+import { can, SHOPPERS } from "@/lib/auth/roles";
import { guardRead, isResponse } from "@/lib/auth/guard";
import { fail } from "@/lib/auth/http";
import { subscribe } from "@/lib/shopping-events";
@@ -9,7 +10,7 @@ export const dynamic = "force-dynamic";
export async function GET(request: Request) {
const session = await guardRead();
if (isResponse(session)) return session;
- if (session.role === "child" || session.role === "guest") return fail("forbidden", 403);
+ if (!can(SHOPPERS, session.role)) return fail("forbidden", 403);
const encoder = new TextEncoder();
let cleanup = () => {};
const stream = new ReadableStream({
diff --git a/app/api/shopping/route.ts b/app/api/shopping/route.ts
index c9d6e3b..ef93f5b 100644
--- a/app/api/shopping/route.ts
+++ b/app/api/shopping/route.ts
@@ -1,3 +1,4 @@
+import { can, SHOPPERS } from "@/lib/auth/roles";
import { getLocale } from "next-intl/server";
import { guardRead, isResponse } from "@/lib/auth/guard";
import { fail, json } from "@/lib/auth/http";
@@ -11,7 +12,7 @@ export const dynamic = "force-dynamic";
export async function GET() {
const session = await guardRead();
if (isResponse(session)) return session;
- if (session.role === "child" || session.role === "guest") return fail("forbidden", 403);
+ if (!can(SHOPPERS, session.role)) return fail("forbidden", 403);
const locale = await getLocale();
return withHousehold(session.householdId, async (c) => {
const round = await currentRound(c);
diff --git a/app/api/slots/[id]/cooked/route.ts b/app/api/slots/[id]/cooked/route.ts
index 7700cd1..11e9100 100644
--- a/app/api/slots/[id]/cooked/route.ts
+++ b/app/api/slots/[id]/cooked/route.ts
@@ -1,3 +1,4 @@
+import { COOKS } from "@/lib/auth/roles";
import { guardWrite, isResponse } from "@/lib/auth/guard";
import { fail, json } from "@/lib/auth/http";
import { markCooked } from "@/lib/cooking";
@@ -8,7 +9,7 @@ export const dynamic = "force-dynamic";
// „Fertig“ im Kochmodus: Slot gekocht, Bewertung kann beginnen.
export async function POST(request: Request, { params }: { params: Promise<{ id: string }> }) {
- const session = await guardWrite(request);
+ const session = await guardWrite(request, [...COOKS]);
if (isResponse(session)) return session;
const { id } = await params;
if (!/^[0-9a-f-]{36}$/.test(id)) return fail("invalid", 400);
diff --git a/components/app-nav.tsx b/components/app-nav.tsx
index b4d8e57..16fcf71 100644
--- a/components/app-nav.tsx
+++ b/components/app-nav.tsx
@@ -18,17 +18,27 @@ const ITEMS = [
{ href: "/mehr", key: "more", icon: Ellipsis },
] as const;
+// Jugendliche: wünschen statt planen, dazu Einkauf, Gerichte (lesen) und Mehr.
+const TEEN_ITEMS = [
+ { href: "/", key: "today", icon: Sun },
+ { href: "/wuenschen", key: "wish", icon: Coins },
+ { href: "/einkauf", key: "shopping", icon: ShoppingCart },
+ { href: "/gerichte", key: "dishes", icon: UtensilsCrossed },
+ { href: "/mehr", key: "more", icon: Ellipsis },
+] as const;
+
// Kinder: „Heute“, „Wünschen“ und „Wechseln“ (zurück zur Bildauswahl am Kindergerät).
const CHILD_ITEMS = [
{ href: "/", key: "today", icon: Sun },
{ href: "/wuenschen", key: "wish", icon: Coins },
] as const;
-export function AppNav({ child = false }: { child?: boolean }) {
+export function AppNav({ variant = "adult" }: { variant?: "adult" | "teen" | "child" }) {
+ const child = variant === "child";
const t = useTranslations("nav");
const path = usePathname();
const router = useRouter();
- const items = child ? CHILD_ITEMS : ITEMS;
+ const items = child ? CHILD_ITEMS : variant === "teen" ? TEEN_ITEMS : ITEMS;
// Beim Tippen weg, danach unten am sichtbaren Bereich (iOS, lib/use-keyboard-nav.ts).
const { ref, typing } = useKeyboardSafeNav();
return (
diff --git a/components/avatar.tsx b/components/avatar.tsx
index dbc6754..dacab2f 100644
--- a/components/avatar.tsx
+++ b/components/avatar.tsx
@@ -1,9 +1,62 @@
-import { Bird, Cat, Dog, Fish, Rabbit, Snail, Squirrel, Turtle, UserRound } from "lucide-react";
+import {
+ Bike,
+ Bird,
+ Camera,
+ Cat,
+ Dog,
+ Fish,
+ Flame,
+ Gamepad2,
+ Guitar,
+ Headphones,
+ Mountain,
+ Palette,
+ Rabbit,
+ Rocket,
+ Snail,
+ Squirrel,
+ Trophy,
+ Turtle,
+ UserRound,
+ Volleyball,
+} from "lucide-react";
+import { initials } from "@/lib/avatars";
import { cn } from "@/lib/utils";
-const ICONS = { cat: Cat, dog: Dog, rabbit: Rabbit, bird: Bird, fish: Fish, turtle: Turtle, squirrel: Squirrel, snail: Snail };
+const ICONS = {
+ cat: Cat,
+ dog: Dog,
+ rabbit: Rabbit,
+ bird: Bird,
+ fish: Fish,
+ turtle: Turtle,
+ squirrel: Squirrel,
+ snail: Snail,
+ gamepad: Gamepad2,
+ headphones: Headphones,
+ guitar: Guitar,
+ volleyball: Volleyball,
+ bike: Bike,
+ camera: Camera,
+ palette: Palette,
+ rocket: Rocket,
+ mountain: Mountain,
+ trophy: Trophy,
+ flame: Flame,
+};
-export function AvatarIcon({ avatar, className }: { avatar: string | null; className?: string }) {
+/** Bild einer Person; „initials“ zeigt die Anfangsbuchstaben (ohne Namen: „Aa“ als Muster). */
+export function AvatarIcon({ avatar, name, className }: { avatar: string | null; name?: string; className?: string }) {
+ if (avatar === "initials") {
+ return (
+
+
+ 1 ? 15 : 18} fontWeight="600" fill="currentColor">
+ {name ? initials(name) || "?" : "Aa"}
+
+
+ );
+ }
const Icon = (avatar && ICONS[avatar as keyof typeof ICONS]) || UserRound;
return ;
}
diff --git a/components/kids/kid-picker.tsx b/components/kids/kid-picker.tsx
index 454f17f..8669860 100644
--- a/components/kids/kid-picker.tsx
+++ b/components/kids/kid-picker.tsx
@@ -55,7 +55,7 @@ export function KidPicker({ kids }: { kids: Child[] }) {
className="flex w-full flex-col items-center gap-3 rounded-3xl bg-muted p-5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
>
-
+
{k.name}
@@ -68,7 +68,7 @@ export function KidPicker({ kids }: { kids: Child[] }) {
return (
-
+
{t("hello", { name: chosen.name })}
diff --git a/components/more/invite-panel.tsx b/components/more/invite-panel.tsx
index 2e4dd8e..20c8650 100644
--- a/components/more/invite-panel.tsx
+++ b/components/more/invite-panel.tsx
@@ -76,7 +76,7 @@ export function InvitePerson() {
{t("inviteRole")}
- {(["member", "admin"] as const).map((role) => (
+ {(["member", "teen", "admin"] as const).map((role) => (
diff --git a/components/more/kids-admin.tsx b/components/more/kids-admin.tsx
index c4ec0e9..5784a0f 100644
--- a/components/more/kids-admin.tsx
+++ b/components/more/kids-admin.tsx
@@ -8,19 +8,40 @@ import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { ErrorNotice } from "@/components/ui/notice";
-import { AVATARS } from "@/lib/avatars";
+import { BIG_AVATARS, SMALL_AVATARS } from "@/lib/avatars";
import { cn } from "@/lib/utils";
import { LinkResult } from "./invite-panel";
type Child = { id: string; name: string; avatar: string | null };
-type Device = { id: string; label: string; active: boolean; lastUsed: string | null };
+type Device = {
+ id: string;
+ label: string;
+ active: boolean;
+ lastUsed: string | null;
+};
async function send(method: string, url: string, body: object) {
- const res = await fetch(url, { method, headers: { "content-type": "application/json" }, body: JSON.stringify(body) });
+ const res = await fetch(url, {
+ method,
+ headers: { "content-type": "application/json" },
+ body: JSON.stringify(body),
+ });
return { ok: res.ok, data: await res.json().catch(() => ({})) };
}
-function PinInput({ id, value, onChange, label }: { id: string; value: string; onChange: (v: string) => void; label: string }) {
+function PinInput({
+ id,
+ value,
+ onChange,
+ label,
+ optional = false,
+}: {
+ id: string;
+ value: string;
+ onChange: (v: string) => void;
+ label: string;
+ optional?: boolean;
+}) {
return (
{label}
@@ -31,36 +52,68 @@ function PinInput({ id, value, onChange, label }: { id: string; value: string; o
autoComplete="new-password"
pattern="\d{4}"
maxLength={4}
- required
+ required={!optional}
value={value}
- onChange={(e) => onChange(e.target.value.replace(/\D/g, "").slice(0, 4))}
+ onChange={(e) =>
+ onChange(e.target.value.replace(/\D/g, "").slice(0, 4))
+ }
className="w-32 text-center tracking-[0.5em]"
/>
);
}
-function AvatarChoice({ value, onChange }: { value: string; onChange: (v: string) => void }) {
+function AvatarChoice({
+ value,
+ onChange,
+ name,
+ group,
+}: {
+ value: string;
+ onChange: (v: string) => void;
+ name: string;
+ group: string;
+}) {
const t = useTranslations("more.kids");
return (
{t("avatar")}
-
+ {(
+ [
+ ["big", BIG_AVATARS],
+ ["small", SMALL_AVATARS],
+ ] as const
+ ).map(([k, list]) => (
+
+
+ {t(`avatarGroups.${k}`)}
+
+
+
+ ))}
);
}
@@ -70,7 +123,8 @@ export function KidsAdmin({ kids }: { kids: Child[] }) {
const t = useTranslations("more.kids");
const router = useRouter();
const [name, setName] = useState("");
- const [avatar, setAvatar] = useState(AVATARS[0]);
+ const [avatar, setAvatar] = useState("initials");
+ const [newAvatar, setNewAvatar] = useState("initials");
const [pin, setPin] = useState("");
const [error, setError] = useState(false);
const [editing, setEditing] = useState(null);
@@ -86,30 +140,61 @@ export function KidsAdmin({ kids }: { kids: Child[] }) {
-
+
{k.name}
-
setEditing(editing === k.id ? null : k.id)}>
- {t("changePin")}
+ {
+ setEditing(editing === k.id ? null : k.id);
+ setNewAvatar(k.avatar ?? "initials");
+ setNewPin("");
+ }}
+ >
+ {t("change")}
{editing === k.id ? (
) : null}
@@ -125,7 +210,11 @@ export function KidsAdmin({ kids }: { kids: Child[] }) {
className="flex flex-col gap-4 rounded-2xl border border-border p-4"
onSubmit={async (e) => {
e.preventDefault();
- const r = await send("POST", "/api/household/children", { name, avatar, pin });
+ const r = await send("POST", "/api/household/children", {
+ name,
+ avatar,
+ pin,
+ });
setError(!r.ok);
if (r.ok) {
setStatus(t("added", { name }));
@@ -138,9 +227,20 @@ export function KidsAdmin({ kids }: { kids: Child[] }) {
{t("add")}
{t("name")}
- setName(e.target.value)} />
+ setName(e.target.value)}
+ />
-
+
{t("pinHint")}
{error ? {t("error")} : null}
@@ -157,24 +257,35 @@ export function KidDevices({ devices }: { devices: Device[] }) {
const t = useTranslations("more.kids");
const router = useRouter();
const [label, setLabel] = useState("");
- const [created, setCreated] = useState<{ url: string; days: number } | null>(null);
+ const [created, setCreated] = useState<{ url: string; days: number } | null>(
+ null,
+ );
return (
{t("devicesHint")}
{devices.length ? (
{devices.map((d) => (
-
+
{d.label}
- {d.active ? t("deviceActive") : t("devicePending")}
+
+ {d.active ? t("deviceActive") : t("devicePending")}
+
{
- await fetch("/api/household/kid-devices", { method: "DELETE", headers: { "content-type": "application/json" }, body: JSON.stringify({ id: d.id }) });
+ await fetch("/api/household/kid-devices", {
+ method: "DELETE",
+ headers: { "content-type": "application/json" },
+ body: JSON.stringify({ id: d.id }),
+ });
router.refresh();
}}
>
@@ -198,7 +309,14 @@ export function KidDevices({ devices }: { devices: Device[] }) {
>
{t("deviceLabel")}
- setLabel(e.target.value)} />
+ setLabel(e.target.value)}
+ />
{t("unlockDevice")}
diff --git a/db/migrations/0010_teen_role.sql b/db/migrations/0010_teen_role.sql
new file mode 100644
index 0000000..f7bc176
--- /dev/null
+++ b/db/migrations/0010_teen_role.sql
@@ -0,0 +1,7 @@
+-- Rolle „Jugendlich“ (Kai, 7.11.2026): eigenes Handy mit Passkey wie Erwachsene,
+-- Rechte wie Kinder plus Veto, Einkaufsliste abhaken und kochen; nicht planen,
+-- keine Gerichte pflegen, nichts verwalten (lib/auth/roles.ts).
+alter table members drop constraint members_role_check;
+alter table members add constraint members_role_check check (role in ('admin', 'member', 'teen', 'child', 'guest'));
+alter table invitations drop constraint invitations_role_check;
+alter table invitations add constraint invitations_role_check check (role in ('admin', 'member', 'teen'));
diff --git a/e2e/kinder.spec.ts b/e2e/kinder.spec.ts
index 809ef81..2a7f478 100644
--- a/e2e/kinder.spec.ts
+++ b/e2e/kinder.spec.ts
@@ -1,4 +1,5 @@
import { expect, test, type Browser, type Page } from "@playwright/test";
+import { passkey } from "./hilfen";
// Kinderkonten (Paket 5b): Kai legt Ben an und schaltet ein Tablet frei. Auf
// dem Tablet meldet sich Ben mit Bild und PIN an, sieht nur Heute und Wünschen.
@@ -93,3 +94,46 @@ test("removing the device ends it", async ({ page }) => {
await tablet.goto("/kinder");
await expect(tablet.getByRole("heading", { level: 1 })).toHaveText("Kein Kindergerät");
});
+
+test("older children get pictures and initials instead of animals", async ({ page }) => {
+ await page.goto("/mehr");
+ await page.getByRole("button", { name: "Bild oder PIN von Ben ändern" }).click();
+ const ben = page.locator("form").filter({ hasText: "Neue PIN für Ben" });
+ await ben.getByRole("radio", { name: "Initialen" }).check({ force: true });
+ await ben.getByRole("button", { name: "Speichern" }).click();
+ await expect(page.getByRole("status")).toHaveText("Ben ist geändert.");
+ await expect(page.locator("li", { hasText: "Ben" }).locator("svg text")).toHaveText("B");
+});
+
+test("a teen joins with an own passkey and wishes, but does not plan", async ({ page, browser }) => {
+ await page.goto("/mehr");
+ await page.fill("#invite-name", "Lena");
+ await page.getByRole("radio", { name: /Jugendlich/ }).check();
+ await page.getByRole("button", { name: "Link erstellen" }).first().click();
+ const link = await page.locator("input[readonly]").inputValue();
+
+ const context = await browser.newContext({ ...test.info().project.use, storageState: undefined });
+ const lena = await context.newPage();
+ await passkey(context, lena);
+ await lena.goto(link);
+ await lena.getByRole("button", { name: "Passkey anlegen" }).click();
+ await expect(lena.getByRole("heading", { level: 1 })).toHaveText("Hallo Lena");
+ const nav = lena.getByRole("navigation", { name: "Navigation" });
+ await expect(nav.getByRole("link")).toHaveText(["Heute", "Wünschen", "Einkauf", "Gerichte", "Mehr"]);
+ for (const path of ["/plan", "/runde/neu"]) {
+ await lena.goto(path);
+ await expect(lena).toHaveURL(/\/$/);
+ }
+ await lena.goto("/gerichte/neu");
+ await expect(lena).toHaveURL(/\/gerichte$/);
+
+ // Jugendliche haben ein Veto (Kinder nicht) — hier nur angeboten, nicht vergeben.
+ await lena.goto("/wuenschen");
+ await lena.getByRole("button", { name: "Optionen für Linseneintopf" }).click();
+ await expect(lena.getByRole("dialog").getByRole("button", { name: /Veto/ })).toBeVisible();
+ await lena.keyboard.press("Escape");
+
+ await page.goto("/mehr");
+ await expect(page.locator("main")).toContainText(/Lena\s*Jugendlich/);
+ await context.close();
+});
diff --git a/lib/auth/invitations.ts b/lib/auth/invitations.ts
index a2eb03f..9eb1062 100644
--- a/lib/auth/invitations.ts
+++ b/lib/auth/invitations.ts
@@ -9,7 +9,7 @@ export type OpenInvitation = {
memberId: string | null;
displayName: string | null;
memberName: string | null;
- role: "admin" | "member";
+ role: "admin" | "member" | "teen";
};
/** Die gültige, unbenutzte Einladung zum Link — oder null. In withAuth. */
diff --git a/lib/auth/roles.ts b/lib/auth/roles.ts
new file mode 100644
index 0000000..63bfe45
--- /dev/null
+++ b/lib/auth/roles.ts
@@ -0,0 +1,14 @@
+// Wer darf was (Kai, 7.11.2026, Rolle „Jugendlich“). Immer Erlaubnislisten, nie
+// „alle außer“: Eine neue Rolle darf nichts, bis sie hier steht.
+export type Role = "admin" | "member" | "teen" | "child" | "guest";
+
+/** Runde eröffnen, Plan, Gerichte anlegen und ändern, Preise. */
+export const PLANNERS = ["admin", "member"] as const satisfies readonly Role[];
+/** Einkaufsliste sehen und abhaken. */
+export const SHOPPERS = ["admin", "member", "teen"] as const satisfies readonly Role[];
+/** Im Kochmodus „Fertig“ melden. */
+export const COOKS = ["admin", "member", "teen"] as const satisfies readonly Role[];
+/** Mit Passkey angemeldet, eigene Geräte und „Mehr“. */
+export const WITH_PASSKEY = ["admin", "member", "teen"] as const satisfies readonly Role[];
+
+export const can = (list: readonly Role[], role: Role) => (list as readonly string[]).includes(role);
diff --git a/lib/auth/schemas.ts b/lib/auth/schemas.ts
index 787e9d7..d3a4e14 100644
--- a/lib/auth/schemas.ts
+++ b/lib/auth/schemas.ts
@@ -19,6 +19,6 @@ export const inviteOptionsBody = z.object({
});
export const createInvitationBody = z.discriminatedUnion("kind", [
- z.object({ kind: z.literal("person"), name, role: z.enum(["member", "admin"]).default("member") }),
+ z.object({ kind: z.literal("person"), name, role: z.enum(["member", "admin", "teen"]).default("member") }),
z.object({ kind: z.literal("device") }),
]);
diff --git a/lib/auth/session.ts b/lib/auth/session.ts
index 8c5f292..c45616e 100644
--- a/lib/auth/session.ts
+++ b/lib/auth/session.ts
@@ -1,3 +1,4 @@
+import type { Role } from "./roles";
import "server-only";
import type { PoolClient } from "pg";
import { cookies } from "next/headers";
@@ -19,7 +20,7 @@ export type Session = {
memberId: string;
householdId: string;
displayName: string;
- role: "admin" | "member" | "child" | "guest";
+ role: Role;
householdName: string;
};
@@ -105,6 +106,13 @@ export async function requireAdult(): Promise {
return session;
}
+/** Für Seiten zum Planen (Plan, Runde): nur Erwachsene, sonst zurück zu „Heute“. */
+export async function requirePlanner(): Promise {
+ const session = await requireSession();
+ if (session.role !== "admin" && session.role !== "member") redirect("/");
+ return session;
+}
+
export async function endSession(): Promise {
const jar = await cookies();
const token = jar.get(SESSION_COOKIE)?.value;
diff --git a/lib/avatars.ts b/lib/avatars.ts
index 2c1168b..1fabbe8 100644
--- a/lib/avatars.ts
+++ b/lib/avatars.ts
@@ -1,4 +1,18 @@
-// Bilder für Kinderkonten: Tiere statt Fotos (Konzept, „Kindermodus“: Bilder statt Text).
-export const AVATARS = ["cat", "dog", "rabbit", "bird", "fish", "turtle", "squirrel", "snail"] as const;
+// Bilder für Kinderkonten. Tiere für die Kleinen, Hobbys für Größere, oder die
+// Initialen in einer Farbe (Kai, 7.11.2026: Tiere wirken für Jugendliche zu klein).
+export const SMALL_AVATARS = ["cat", "dog", "rabbit", "bird", "fish", "turtle", "squirrel", "snail"] as const;
+export const BIG_AVATARS = ["initials", "gamepad", "headphones", "guitar", "volleyball", "bike", "camera", "palette", "rocket", "mountain", "trophy", "flame"] as const;
+export const AVATARS = [...SMALL_AVATARS, ...BIG_AVATARS] as const;
export type Avatar = (typeof AVATARS)[number];
export const isAvatar = (v: unknown): v is Avatar => typeof v === "string" && (AVATARS as readonly string[]).includes(v);
+
+/** Bis zu zwei Initialen: „Lena Marie“ → „LM“, „Ben“ → „B“. */
+export function initials(name: string): string {
+ return name
+ .trim()
+ .split(/[\s-]+/)
+ .filter(Boolean)
+ .slice(0, 2)
+ .map((w) => w[0]!.toLocaleUpperCase("de"))
+ .join("");
+}
diff --git a/lib/shopping-route.ts b/lib/shopping-route.ts
index 96681b3..6b60e76 100644
--- a/lib/shopping-route.ts
+++ b/lib/shopping-route.ts
@@ -1,16 +1,17 @@
import "server-only";
import type { PoolClient } from "pg";
import { guardWrite, isResponse } from "@/lib/auth/guard";
+import { SHOPPERS } from "@/lib/auth/roles";
import { fail } from "@/lib/auth/http";
import type { Session } from "@/lib/auth/session";
import { withHousehold } from "@/lib/db";
import { currentRound, type Round } from "@/lib/rounds";
import { notifyShopping } from "@/lib/shopping";
-// Rahmen der schreibenden Einkaufs-Routen: Erwachsene, Runde nach der Freigabe,
+// Rahmen der schreibenden Einkaufs-Routen: Erwachsene und Jugendliche, Runde nach der Freigabe,
// nach jeder Änderung eine Meldung an alle offenen Listen.
export async function withShopping(request: Request, fn: (c: PoolClient, round: Round, session: Session) => Promise) {
- const session = await guardWrite(request);
+ const session = await guardWrite(request, [...SHOPPERS]);
if (isResponse(session)) return session;
return withHousehold(session.householdId, async (c) => {
const round = await currentRound(c);
diff --git a/lib/wishes.ts b/lib/wishes.ts
index 1953401..fec33b3 100644
--- a/lib/wishes.ts
+++ b/lib/wishes.ts
@@ -6,8 +6,8 @@ import type { PoolClient } from "pg";
// ist ein Wunsch; zweimal gewünscht heißt „Favorit der Runde“. Gezählt wird
// hier, nie in der Oberfläche.
-/** Wünschen darf jede Person im Haushalt, die mitisst — auch Kinder (Paket 5b), keine Gäste. */
-export const WISHERS = ["admin", "member", "child"] as const;
+/** Wünschen darf jede Person im Haushalt, die mitisst — auch Kinder (Paket 5b) und Jugendliche, keine Gäste. */
+export const WISHERS = ["admin", "member", "teen", "child"] as const;
export type Budget = { tokens: number; tokensLeft: number; vetos: number; vetosLeft: number };
diff --git a/messages/de.json b/messages/de.json
index cc4199a..eb9134b 100644
--- a/messages/de.json
+++ b/messages/de.json
@@ -102,7 +102,8 @@
"admin": "Admin",
"member": "Mitglied",
"child": "Kind",
- "guest": "Gast"
+ "guest": "Gast",
+ "teen": "Jugendlich"
},
"invitePerson": "Person einladen",
"inviteName": "Name",
@@ -123,7 +124,8 @@
"inviteRole": "Rolle",
"roleHints": {
"member": "wünschen, kochen, einkaufen, bewerten",
- "admin": "dazu Runden planen und freigeben, Gerichte und Läden pflegen, einladen"
+ "admin": "dazu Runden planen und freigeben, Gerichte und Läden pflegen, einladen",
+ "teen": "eigenes Handy; wünschen mit Veto, einkaufen, kochen, bewerten – nicht planen und keine Gerichte pflegen"
},
"ai": {
"title": "AI",
@@ -178,9 +180,7 @@
"pinHint": "Das Kind meldet sich nur auf einem freigeschalteten Kindergerät an, mit Bild und PIN.",
"addSubmit": "Kind hinzufügen",
"added": "{name} ist dabei.",
- "changePin": "PIN ändern",
- "newPin": "Neue PIN für {name}",
- "pinChanged": "Die PIN von {name} ist geändert.",
+ "newPin": "Neue PIN für {name} (leer lassen, um sie zu behalten)",
"save": "Speichern",
"error": "Bitte prüf Name und PIN (genau 4 Ziffern).",
"devicesHint": "Ein Tablet oder Kinderhandy freischalten: Link erstellen und auf dem Gerät öffnen. Nur dort können sich Kinder anmelden.",
@@ -199,7 +199,26 @@
"fish": "Fisch",
"turtle": "Schildkröte",
"squirrel": "Eichhörnchen",
- "snail": "Schnecke"
+ "snail": "Schnecke",
+ "initials": "Initialen",
+ "gamepad": "Controller",
+ "headphones": "Kopfhörer",
+ "guitar": "Gitarre",
+ "volleyball": "Ball",
+ "bike": "Fahrrad",
+ "camera": "Kamera",
+ "palette": "Farbpalette",
+ "rocket": "Rakete",
+ "mountain": "Berg",
+ "trophy": "Pokal",
+ "flame": "Flamme"
+ },
+ "change": "Ändern",
+ "changeFor": "Bild oder PIN von {name} ändern",
+ "changed": "{name} ist geändert.",
+ "avatarGroups": {
+ "big": "Für Größere",
+ "small": "Für Kleine"
}
}
},
diff --git a/messages/en.json b/messages/en.json
index b6c8dfa..c924fa1 100644
--- a/messages/en.json
+++ b/messages/en.json
@@ -102,7 +102,8 @@
"admin": "Admin",
"member": "Member",
"child": "Child",
- "guest": "Guest"
+ "guest": "Guest",
+ "teen": "Teen"
},
"invitePerson": "Invite someone",
"inviteName": "Name",
@@ -123,7 +124,8 @@
"inviteRole": "Role",
"roleHints": {
"member": "wish, cook, shop, rate",
- "admin": "also plan and approve rounds, manage dishes and stores, invite"
+ "admin": "also plan and approve rounds, manage dishes and stores, invite",
+ "teen": "own phone; wish with veto, shop, cook, rate – no planning, no editing dishes"
},
"ai": {
"title": "AI",
@@ -178,9 +180,7 @@
"pinHint": "The child signs in only on an unlocked children's device, with picture and PIN.",
"addSubmit": "Add child",
"added": "{name} has been added.",
- "changePin": "Change PIN",
- "newPin": "New PIN for {name}",
- "pinChanged": "{name}'s PIN has been changed.",
+ "newPin": "New PIN for {name} (leave empty to keep it)",
"save": "Save",
"error": "Please check name and PIN (exactly 4 digits).",
"devicesHint": "Unlock a tablet or a child's phone: create a link and open it on the device. Children can only sign in there.",
@@ -199,7 +199,26 @@
"fish": "Fish",
"turtle": "Turtle",
"squirrel": "Squirrel",
- "snail": "Snail"
+ "snail": "Snail",
+ "initials": "Initials",
+ "gamepad": "Controller",
+ "headphones": "Headphones",
+ "guitar": "Guitar",
+ "volleyball": "Ball",
+ "bike": "Bike",
+ "camera": "Camera",
+ "palette": "Palette",
+ "rocket": "Rocket",
+ "mountain": "Mountain",
+ "trophy": "Trophy",
+ "flame": "Flame"
+ },
+ "change": "Change",
+ "changeFor": "Change picture or PIN of {name}",
+ "changed": "{name} is updated.",
+ "avatarGroups": {
+ "big": "For older kids",
+ "small": "For little ones"
}
}
},
diff --git a/messages/es.json b/messages/es.json
index 12f6040..1775497 100644
--- a/messages/es.json
+++ b/messages/es.json
@@ -102,7 +102,8 @@
"admin": "Admin",
"member": "Member",
"child": "Child",
- "guest": "Guest"
+ "guest": "Guest",
+ "teen": "Adolescente"
},
"invitePerson": "Invite someone",
"inviteName": "Name",
@@ -123,7 +124,8 @@
"inviteRole": "Role",
"roleHints": {
"member": "wish, cook, shop, rate",
- "admin": "also plan and approve rounds, manage dishes and stores, invite"
+ "admin": "also plan and approve rounds, manage dishes and stores, invite",
+ "teen": "móvil propio; desear con veto, comprar, cocinar, valorar – sin planificar ni editar platos"
},
"ai": {
"title": "AI",
@@ -178,9 +180,7 @@
"pinHint": "The child signs in only on an unlocked children's device, with picture and PIN.",
"addSubmit": "Add child",
"added": "{name} has been added.",
- "changePin": "Change PIN",
- "newPin": "New PIN for {name}",
- "pinChanged": "{name}'s PIN has been changed.",
+ "newPin": "Nuevo PIN para {name} (déjalo vacío para mantenerlo)",
"save": "Save",
"error": "Please check name and PIN (exactly 4 digits).",
"devicesHint": "Unlock a tablet or a child's phone: create a link and open it on the device. Children can only sign in there.",
@@ -199,7 +199,26 @@
"fish": "Fish",
"turtle": "Turtle",
"squirrel": "Squirrel",
- "snail": "Snail"
+ "snail": "Snail",
+ "initials": "Iniciales",
+ "gamepad": "Mando",
+ "headphones": "Auriculares",
+ "guitar": "Guitarra",
+ "volleyball": "Balón",
+ "bike": "Bici",
+ "camera": "Cámara",
+ "palette": "Paleta",
+ "rocket": "Cohete",
+ "mountain": "Montaña",
+ "trophy": "Trofeo",
+ "flame": "Llama"
+ },
+ "change": "Cambiar",
+ "changeFor": "Cambiar imagen o PIN de {name}",
+ "changed": "{name} está actualizado.",
+ "avatarGroups": {
+ "big": "Para mayores",
+ "small": "Para peques"
}
}
},
diff --git a/messages/fr.json b/messages/fr.json
index 1d51fec..abe7edf 100644
--- a/messages/fr.json
+++ b/messages/fr.json
@@ -102,7 +102,8 @@
"admin": "Admin",
"member": "Member",
"child": "Child",
- "guest": "Guest"
+ "guest": "Guest",
+ "teen": "Ado"
},
"invitePerson": "Invite someone",
"inviteName": "Name",
@@ -123,7 +124,8 @@
"inviteRole": "Role",
"roleHints": {
"member": "wish, cook, shop, rate",
- "admin": "also plan and approve rounds, manage dishes and stores, invite"
+ "admin": "also plan and approve rounds, manage dishes and stores, invite",
+ "teen": "son propre téléphone ; souhaiter avec veto, faire les courses, cuisiner, noter – pas de planification ni de gestion des plats"
},
"ai": {
"title": "AI",
@@ -178,9 +180,7 @@
"pinHint": "The child signs in only on an unlocked children's device, with picture and PIN.",
"addSubmit": "Add child",
"added": "{name} has been added.",
- "changePin": "Change PIN",
- "newPin": "New PIN for {name}",
- "pinChanged": "{name}'s PIN has been changed.",
+ "newPin": "Nouveau PIN pour {name} (laisser vide pour le garder)",
"save": "Save",
"error": "Please check name and PIN (exactly 4 digits).",
"devicesHint": "Unlock a tablet or a child's phone: create a link and open it on the device. Children can only sign in there.",
@@ -199,7 +199,26 @@
"fish": "Fish",
"turtle": "Turtle",
"squirrel": "Squirrel",
- "snail": "Snail"
+ "snail": "Snail",
+ "initials": "Initiales",
+ "gamepad": "Manette",
+ "headphones": "Casque",
+ "guitar": "Guitare",
+ "volleyball": "Ballon",
+ "bike": "Vélo",
+ "camera": "Appareil photo",
+ "palette": "Palette",
+ "rocket": "Fusée",
+ "mountain": "Montagne",
+ "trophy": "Trophée",
+ "flame": "Flamme"
+ },
+ "change": "Modifier",
+ "changeFor": "Modifier l'image ou le PIN de {name}",
+ "changed": "{name} est modifié.",
+ "avatarGroups": {
+ "big": "Pour les grands",
+ "small": "Pour les petits"
}
}
},
diff --git a/olares/Chart.yaml b/olares/Chart.yaml
index 764db99..72824d1 100644
--- a/olares/Chart.yaml
+++ b/olares/Chart.yaml
@@ -2,5 +2,5 @@ apiVersion: v2
name: lunch
description: Was gibt's? — die Familie entscheidet gemeinsam, was es gibt; aus dem Plan entsteht die Einkaufsliste
type: application
-version: 26.11.18 # YY.M. wie im AImighty-Markt — bei jeder Chart-Änderung erhöhen
-appVersion: "26.11.18" # MUSS gleich version sein: der Linter prüft es, und der Image-Tag hängt daran
+version: 26.11.19 # YY.M. wie im AImighty-Markt — bei jeder Chart-Änderung erhöhen
+appVersion: "26.11.19" # MUSS gleich version sein: der Linter prüft es, und der Image-Tag hängt daran
diff --git a/olares/OlaresManifest.yaml b/olares/OlaresManifest.yaml
index 00f6c82..bf4104b 100644
--- a/olares/OlaresManifest.yaml
+++ b/olares/OlaresManifest.yaml
@@ -21,7 +21,7 @@ metadata:
title: What's cooking?
description: The family decides together what's for dinner — and the shopping list writes itself. Runs entirely on your own box.
icon: https://git.aimighty.olares.de/aimighty/bilder/raw/branch/main/lunch/icon.png
- version: 26.11.18
+ version: 26.11.19
categories:
- Applications
@@ -61,7 +61,7 @@ permission:
appData: true
spec:
- versionName: '26.11.18'
+ versionName: '26.11.19'
featuredImage: https://git.aimighty.olares.de/aimighty/bilder/raw/branch/main/lunch/icon.png
promoteImage:
diff --git a/olares/markt/26.11.19.md b/olares/markt/26.11.19.md
new file mode 100644
index 0000000..d4410bd
--- /dev/null
+++ b/olares/markt/26.11.19.md
@@ -0,0 +1,5 @@
+# Teens get their own account
+v26.11.19: A new role for teenagers: they sign in with a passkey on their own phone like adults and can wish (with a veto), shop, cook and rate — but not plan or edit dishes. Children's pictures now include a set for older kids (controller, headphones, guitar …) and initials; picture and PIN of a child can be changed later.
+
+## Deutsch
+v26.11.19: Eine neue Rolle für Jugendliche: Sie melden sich wie Erwachsene mit Passkey auf dem eigenen Handy an und können wünschen (mit Veto), einkaufen, kochen und bewerten — aber nicht planen und keine Gerichte pflegen. Bei den Kinderbildern gibt es jetzt eine Auswahl für Größere (Controller, Kopfhörer, Gitarre …) und Initialen; Bild und PIN eines Kindes lassen sich später ändern.