af2c3b245a
- Server action echoes kitaName, the three module booleans, and the
Mindest-Verfügbarkeiten value on every error path so failed submits no
longer wipe what the user typed; OnboardingState gains an `attempt`
counter that drives a per-field remount key on the client.
- Schema now rejects min=0 when the Notdienst module is active (via
superRefine) — previously a kita could be created with 0 minimum days,
which is fachlich sinnlos. When the module is off, 0 stays valid.
- Validation error messages reworded from terse fragments ("Nicht
negativ.", "Bitte ganze Zahl.") to full sentences.
- Field error <p> elements gain role="alert" + aria-live="polite" so
screen readers announce them on submit.
- CardTitle now accepts as="h1" and the onboarding page uses it for
"Willkommen, …" — the page now has a real top-level heading.
- ModuleCheckbox uses aria-labelledby + aria-describedby so the
accessible name is just the module title; the longer description is
exposed as secondary info instead of being concatenated into the AN.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
48 lines
1.3 KiB
TypeScript
48 lines
1.3 KiB
TypeScript
import { redirect } from "next/navigation";
|
|
import { UserRole } from "@prisma/client";
|
|
|
|
import { requireSession } from "@/lib/auth-utils";
|
|
import {
|
|
Card,
|
|
CardContent,
|
|
CardDescription,
|
|
CardHeader,
|
|
CardTitle,
|
|
} from "@/components/ui/card";
|
|
|
|
import { OnboardingForm } from "./onboarding-form";
|
|
|
|
export const metadata = { title: "Kita einrichten · Kita-Planer" };
|
|
|
|
export default async function OnboardingPage() {
|
|
const session = await requireSession();
|
|
|
|
// Guard: User MIT bereits zugeordneter Kita gehört nicht hierhin.
|
|
if (session.user.kitaId) {
|
|
redirect("/dashboard");
|
|
}
|
|
// Superadmins haben grundsätzlich keine Kita; sie nutzen /admin.
|
|
if (session.user.role === UserRole.SUPERADMIN) {
|
|
redirect("/admin");
|
|
}
|
|
|
|
return (
|
|
<div className="flex min-h-screen items-center justify-center bg-muted/30 px-4 py-12">
|
|
<Card className="w-full max-w-2xl">
|
|
<CardHeader className="space-y-2">
|
|
<CardTitle as="h1">
|
|
Willkommen, {session.user.name?.split(" ")[0] ?? "Gründer:in"}!
|
|
</CardTitle>
|
|
<CardDescription>
|
|
Lass uns deine Kita in 3 kurzen Schritten einrichten. Du kannst alle
|
|
Einstellungen später noch anpassen.
|
|
</CardDescription>
|
|
</CardHeader>
|
|
<CardContent>
|
|
<OnboardingForm />
|
|
</CardContent>
|
|
</Card>
|
|
</div>
|
|
);
|
|
}
|