Replace the hand-rolled Tailwind/shadcn look with Sakani UI across the editorial area, the admin area and all signed-out pages. - AppShell (Sakani Sidebar + TopBar) for /redaktion and /admin, with a mobile drawer, theme toggle, sign-out, legal links and a "Was ist neu" button; PublicShell for login, registration, password, 2FA and errors. - Shared primitives (Button, Card, Input, PageHeader) now render Sakani; components/ui/sakani.tsx is the client boundary for Server Components (Sakani ships no "use client") and adds FormSelect (native form value) and DataTable (element cells from the server). - Legacy CSS variables map onto Sakani tokens; globals.css shrinks from ~2200 to ~700 lines. Geist replaces Inter. recharts/lucide-react dropped (charts via Sakani BarChart). - Release notes popup per area, shown once per version (localStorage) and reopenable from the sidebar; native <dialog> for focus trapping. - Fixes found while testing: TOTP field reused the typed password in clear text, modal dialogs sat top-left, invisible unchecked checkboxes in dark mode. - Parallel run: compose.parallel.yaml, AUTO_RULE_SYNC_DISABLED switch and docs/operations.md §8 (start, rollback, cutover). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
81 lines
2.5 KiB
TypeScript
81 lines
2.5 KiB
TypeScript
"use client";
|
|
|
|
import { useId, useState, useTransition } from "react";
|
|
|
|
import { Alert, Input, Textarea } from "@sakaniui/react";
|
|
|
|
import { Card } from "@/components/ui/sakani";
|
|
|
|
import { Button } from "@/components/ui/button";
|
|
|
|
import type { AnnouncementActionResult } from "./actions";
|
|
|
|
// Same direct-call-in-transition pattern as the album bulk grant form so the
|
|
// message box clears after a successful publish without an effect.
|
|
export function AnnouncementForm({
|
|
action,
|
|
defaultEventDate,
|
|
}: Readonly<{
|
|
action: (
|
|
state: AnnouncementActionResult,
|
|
formData: FormData,
|
|
) => Promise<AnnouncementActionResult>;
|
|
defaultEventDate: string;
|
|
}>) {
|
|
const messageId = useId();
|
|
const dateId = useId();
|
|
const [state, setState] = useState<AnnouncementActionResult>({ ok: true, message: "" });
|
|
const [pending, startTransition] = useTransition();
|
|
const [message, setMessage] = useState("");
|
|
|
|
const handleSubmit = (formData: FormData) => {
|
|
startTransition(async () => {
|
|
const result = await action({ ok: true, message: "" }, formData);
|
|
setState(result);
|
|
if (result.ok) {
|
|
setMessage("");
|
|
}
|
|
});
|
|
};
|
|
|
|
return (
|
|
<Card title="Neuer Hinweis">
|
|
<form action={handleSubmit} className="flex flex-col gap-4">
|
|
<Textarea
|
|
description={`${message.length}/500 Zeichen`}
|
|
id={messageId}
|
|
label="Nachricht"
|
|
maxLength={500}
|
|
name="message"
|
|
onChange={(event) => setMessage(event.target.value)}
|
|
placeholder="z. B. Liebl ist heute beim HSV-Spiel — Freigaben und Downloads sind trotzdem verfügbar, Antworten dauern etwas länger."
|
|
required
|
|
rows={3}
|
|
value={message}
|
|
/>
|
|
<div className="sm:max-w-xs">
|
|
<Input
|
|
defaultValue={defaultEventDate}
|
|
description="Der Hinweis wird sofort sichtbar und verschwindet automatisch drei Tage nach diesem Datum."
|
|
id={dateId}
|
|
label="Datum des Ereignisses (z. B. Spieltag)"
|
|
name="eventDate"
|
|
required
|
|
type="date"
|
|
/>
|
|
</div>
|
|
<div>
|
|
<Button type="submit" disabled={pending}>
|
|
{pending ? "Wird veröffentlicht …" : "Hinweis veröffentlichen"}
|
|
</Button>
|
|
</div>
|
|
{state.message ? (
|
|
<div aria-live="polite">
|
|
<Alert color={state.ok ? "success" : "danger"} description={state.message} />
|
|
</div>
|
|
) : null}
|
|
</form>
|
|
</Card>
|
|
);
|
|
}
|