feat: redesign portal UI with Sakani UI and add release notes

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>
This commit is contained in:
Leon TonhäuserandClaude Opus 5.5 committed 2026-11-30 18:24:05 +01:00
1 parent 453bece72c
commit 9e938e4d07
79 files changed
+2266 -4316

No files matched your search

@@ -2,6 +2,11 @@
import { useMemo, useState } from "react";
import Link from "next/link";
import { Alert, Badge, Checkbox, EmptyState, Table, Textarea } from "@sakaniui/react";
import { IconDownload, IconFileText } from "@sakaniui/react/icons";
import { Button } from "@/components/ui/button";
import { Card, FormSelect } from "@/components/ui/sakani";
import type { BillingPosition, RepeatDownloadPosition } from "@/modules/billing/queries";
import { formatCents } from "@/modules/billing/format";
@@ -40,6 +45,12 @@ const STATUS_LABELS: Record<BillingPosition["status"], string> = {
reopened: "Wiedereröffnet",
};
const STATUS_BADGES: Record<BillingPosition["status"], "warning" | "success"> = {
open: "warning",
billed: "success",
reopened: "warning",
};
const REPORT_STATUS_LABELS: Record<string, string> = {
draft: "Entwurf",
final: "Erstellt",
@@ -172,178 +183,162 @@ export function BillingSelection({
<>
<PeriodSelector year={year} month={month} quarter={quarter} isQuarter={isQuarter} />
<div className="billing-selection-controls">
<button type="button" onClick={selectAllOpen} disabled={selectablePositions.length === 0}>
<div className="flex flex-wrap items-center gap-3">
<Button type="button" variant="secondary" onClick={selectAllOpen} disabled={selectablePositions.length === 0}>
{isQuarter ? "Alle offenen im Quartal" : "Alle offenen im Monat"}
</button>
{isQuarter ? (
<Link href={monthHref} className="billing-nav-link">
Monatsansicht
</Link>
) : (
<Link href={quarterHref} className="billing-nav-link">
Ganzes Quartal
</Link>
)}
<button type="button" onClick={clearSelection} disabled={selectedCount === 0}>
</Button>
<Button asChild variant="outline">
{isQuarter ? <Link href={monthHref}>Monatsansicht</Link> : <Link href={quarterHref}>Ganzes Quartal</Link>}
</Button>
<Button type="button" variant="ghost" onClick={clearSelection} disabled={selectedCount === 0}>
Auswahl aufheben
</button>
</Button>
<p className="ml-auto text-sm text-[var(--color-fg-muted)]" aria-live="polite">
Zeitraum: {periodLabel}
</p>
</div>
<p className="billing-period-label" aria-live="polite">
Zeitraum: {periodLabel}
</p>
{positions.length === 0 ? (
<p className="billing-empty">Keine abrechenbaren Nutzungen in diesem Zeitraum.</p>
) : (
<table className="billing-table">
<caption className="billing-caption">
Abrechenbare Nutzungen
</caption>
<thead>
<tr>
<th scope="col">Auswahl</th>
<th scope="col">Datei</th>
<th scope="col">Album</th>
<th scope="col">Zweck</th>
<th scope="col">Referenz</th>
<th scope="col">Preis</th>
<th scope="col">Status</th>
</tr>
</thead>
<tbody>
{positions.map((position) => (
<tr key={position.id} className={position.selectable ? "" : "billing-row-billed"}>
<td>
<input
type="checkbox"
checked={selectedIds.has(position.id)}
onChange={() => togglePosition(position.id)}
disabled={!position.selectable}
<section className="flex flex-col gap-3" aria-labelledby="positions-title">
<h2 id="positions-title" className="text-lg font-semibold">Abrechenbare Nutzungen</h2>
{positions.length === 0 ? (
<EmptyState title="Keine abrechenbaren Nutzungen in diesem Zeitraum." description="Wählen Sie oben einen anderen Monat oder ein Quartal." />
) : (
<Table<BillingPosition>
rowKey={(position) => position.id}
rows={positions}
columns={[
{
key: "id",
header: "Auswahl",
render: (position) => (
<Checkbox
aria-label={`${position.filename} auswählen`}
checked={selectedIds.has(position.id)}
disabled={!position.selectable}
onChange={() => togglePosition(position.id)}
/>
</td>
<td>{position.filename}</td>
<td>{position.albumName}</td>
<td>{position.purpose}</td>
<td>{position.reference ?? "—"}</td>
<td className="billing-price">{formatCents(position.priceCents)}</td>
<td>
<span className="billing-status">
{STATUS_LABELS[position.status]}
),
},
{ key: "filename", header: "Datei" },
{ key: "albumName", header: "Album" },
{ key: "purpose", header: "Zweck" },
{ key: "reference", header: "Referenz", render: (position) => position.reference ?? "—" },
{
key: "priceCents",
header: "Preis",
align: "right",
render: (position) => <span className="tabular-nums">{formatCents(position.priceCents)}</span>,
},
{
key: "status",
header: "Status",
render: (position) => (
<span className="flex flex-wrap items-center gap-2">
<Badge variant={STATUS_BADGES[position.status] ?? "neutral"}>{STATUS_LABELS[position.status]}</Badge>
{position.status === "billed" && position.reportNumber !== null && (
<span className="billing-report-ref">
{" "}· Bericht Nr. {position.reportNumber}
<span className="text-xs text-[var(--color-fg-muted)]">
Bericht Nr. {position.reportNumber}
{position.invoiceNumber ? ` · ${position.invoiceNumber}` : ""}
</span>
)}
</span>
</td>
</tr>
))}
</tbody>
</table>
)}
),
},
]}
/>
)}
</section>
{repeatDownloads.length > 0 && (
<section aria-labelledby="repeat-downloads-title" className="billing-repeat-section">
<h2 id="repeat-downloads-title">Kostenlose Wiederabrufe</h2>
<p className="form-note">
<section aria-labelledby="repeat-downloads-title" className="flex flex-col gap-3">
<h2 id="repeat-downloads-title" className="text-lg font-semibold">Kostenlose Wiederabrufe</h2>
<p className="text-sm text-[var(--color-fg-muted)]">
Wiederholte Downloads rufen bereits abgerechnete Nutzungen erneut ab und sind nicht
abrechenbar.
</p>
<table className="billing-table billing-table-repeat">
<caption className="billing-caption">Wiederabrufe im Zeitraum</caption>
<thead>
<tr>
<th scope="col">Datei</th>
<th scope="col">Datum</th>
<th scope="col">Status</th>
<th scope="col">Notiz</th>
</tr>
</thead>
<tbody>
{repeatDownloads.map((download) => (
<tr key={download.id}>
<td>{download.assetId}</td>
<td>
<time dateTime={download.authorizedAt.toISOString()} suppressHydrationWarning>
{download.authorizedAt.toLocaleDateString("de-DE")}
</time>
</td>
<td>{download.status}</td>
<td>{download.repeatDownloadNote ?? "—"}</td>
</tr>
))}
</tbody>
</table>
<Table<RepeatDownloadPosition>
rowKey={(download) => download.id}
rows={repeatDownloads}
columns={[
{ key: "assetId", header: "Datei" },
{
key: "authorizedAt",
header: "Datum",
render: (download) => (
<time dateTime={download.authorizedAt.toISOString()} suppressHydrationWarning>
{download.authorizedAt.toLocaleDateString("de-DE")}
</time>
),
},
{ key: "status", header: "Status" },
{ key: "repeatDownloadNote", header: "Notiz", render: (download) => download.repeatDownloadNote ?? "—" },
]}
/>
</section>
)}
<div className="billing-summary" aria-live="polite">
<p>
<strong>{selectedCount}</strong> {selectedCount === 1 ? "Nutzung" : "Nutzungen"} ausgewählt
</p>
<p className="billing-summary-total">
Summe: <strong>{formatCents(selectedTotalCents)}</strong>
</p>
</div>
<div className="billing-actions">
<button
type="button"
onClick={handlePreview}
disabled={selectedCount === 0 || actionState.loading}
>
Vorschau
</button>
<button
type="button"
className="billing-action-primary"
onClick={handleFinalize}
disabled={selectedCount === 0 || actionState.loading}
>
Abrechnung erstellen
</button>
</div>
{actionState.message && (
<p className="billing-status-message" role={actionState.isError ? "alert" : "status"}>
{actionState.message}
</p>
)}
<Card>
<div className="flex flex-wrap items-center justify-between gap-4">
<div aria-live="polite" className="billing-summary flex flex-col gap-1">
<p className="text-sm text-[var(--color-fg-muted)]">
<strong className="text-[var(--color-fg-default)]">{selectedCount}</strong> {selectedCount === 1 ? "Nutzung" : "Nutzungen"} ausgewählt
</p>
<p className="text-2xl font-semibold tabular-nums">
Summe: <strong>{formatCents(selectedTotalCents)}</strong>
</p>
</div>
<div className="flex flex-wrap gap-3">
<Button type="button" variant="outline" onClick={handlePreview} disabled={selectedCount === 0 || actionState.loading}>
Vorschau
</Button>
<Button type="button" onClick={handleFinalize} disabled={selectedCount === 0 || actionState.loading}>
Abrechnung erstellen
</Button>
</div>
</div>
{actionState.message && (
<div role={actionState.isError ? undefined : "status"}>
<Alert color={actionState.isError ? "danger" : "info"} description={actionState.message} />
</div>
)}
</Card>
{reports.length > 0 && (
<section aria-labelledby="reports-title" className="billing-reports-section">
<h2 id="reports-title">Erstellte Abrechnungen</h2>
<ul className="billing-reports-list">
<section aria-labelledby="reports-title" className="flex flex-col gap-3">
<h2 id="reports-title" className="text-lg font-semibold">Erstellte Abrechnungen</h2>
<ul className="flex flex-col gap-3">
{reports.map((report) => (
<li key={report.id}>
<div className="billing-report-meta">
<span>Bericht Nr. {report.reportNumber}</span>
{report.invoiceNumber && <span>{report.invoiceNumber}</span>}
<span>Summe: {formatCents(report.netTotalCents)}</span>
<span>Status: {REPORT_STATUS_LABELS[report.status] ?? report.status}</span>
<span>
Erstellt am:{" "}
<time dateTime={report.createdAt.toISOString()} suppressHydrationWarning>
{report.createdAt.toLocaleDateString("de-DE")}
</time>
</span>
</div>
{report.status === "final" && (
<>
<Card>
<div className="flex flex-wrap items-center gap-x-4 gap-y-2 text-sm">
<span className="inline-flex items-center gap-2 font-semibold">
<IconFileText size={16} aria-hidden="true" />
Bericht Nr. {report.reportNumber}
</span>
{report.invoiceNumber && <span>{report.invoiceNumber}</span>}
<span className="tabular-nums">Summe: {formatCents(report.netTotalCents)}</span>
<Badge variant={report.status === "final" ? "success" : "neutral"}>
{REPORT_STATUS_LABELS[report.status] ?? report.status}
</Badge>
<span className="text-[var(--color-fg-muted)]">
Erstellt am:{" "}
<time dateTime={report.createdAt.toISOString()} suppressHydrationWarning>
{report.createdAt.toLocaleDateString("de-DE")}
</time>
</span>
{report.status === "final" && (
<Button asChild variant="outline">
<a className="ml-auto" href={`/api/billing-reports/${encodeURIComponent(report.id)}`} download>
<IconDownload size={16} aria-hidden="true" />
PDF herunterladen
</a>
</Button>
)}
</div>
{report.status === "final" && (
<CancelReportForm reportId={report.id} reportNumber={report.reportNumber} />
<a
href={`/api/billing-reports/${encodeURIComponent(report.id)}`}
className="billing-report-download"
download
>
PDF herunterladen
</a>
</>
)}
)}
</Card>
</li>
))}
</ul>
@@ -364,42 +359,33 @@ function PeriodSelector({ year, month, quarter, isQuarter }: PeriodSelectorProps
const years = [2025, 2026, 2027];
return (
<form className="billing-period-selector" method="get">
<label>
<span>Jahr</span>
<select name="year" defaultValue={year}>
{years.map((y) => (
<option key={y} value={y}>
{y}
</option>
))}
</select>
</label>
{isQuarter ? (
<label>
<span>Quartal</span>
<select name="quarter" defaultValue={quarter ?? 1}>
{[1, 2, 3, 4].map((q) => (
<option key={q} value={q}>
Q{q}
</option>
))}
</select>
</label>
) : (
<label>
<span>Monat</span>
<select name="month" defaultValue={month ?? 8}>
{MONTHS.map((name, index) => (
<option key={index} value={index + 1}>
{name}
</option>
))}
</select>
</label>
)}
<button type="submit">Zeitraum laden</button>
</form>
<Card>
<form className="flex flex-wrap items-end gap-4" method="get">
<div className="w-32">
<FormSelect name="year" label="Jahr" defaultValue={String(year)} options={years.map((y) => ({ label: String(y), value: String(y) }))} />
</div>
{isQuarter ? (
<div className="w-32">
<FormSelect
name="quarter"
label="Quartal"
defaultValue={String(quarter ?? 1)}
options={[1, 2, 3, 4].map((q) => ({ label: `Q${q}`, value: String(q) }))}
/>
</div>
) : (
<div className="w-40">
<FormSelect
name="month"
label="Monat"
defaultValue={String(month ?? 8)}
options={MONTHS.map((name, index) => ({ label: name, value: String(index + 1) }))}
/>
</div>
)}
<Button type="submit" variant="secondary">Zeitraum laden</Button>
</form>
</Card>
);
}
@@ -440,38 +426,28 @@ function CancelReportForm({ reportId, reportNumber }: CancelReportFormProps) {
}
return (
<form className="billing-cancel-form" onSubmit={handleSubmit}>
<label>
<span>Stornierungsgrund (5–500 Zeichen)</span>
<textarea
value={reason}
onChange={(e) => setReason(e.target.value)}
rows={2}
maxLength={500}
<form className="flex flex-col gap-3 border-t border-[var(--color-border-subtle)] pt-4" onSubmit={handleSubmit}>
<Textarea
aria-label={`Stornierungsgrund für Bericht Nr. ${reportNumber}`}
disabled={loading}
label="Stornierungsgrund (5–500 Zeichen)"
maxLength={500}
onChange={(e) => setReason(e.target.value)}
rows={2}
value={reason}
/>
</label>
<div className="billing-cancel-controls">
<label>
<input
type="checkbox"
<div className="flex flex-wrap items-center gap-4">
<Checkbox
checked={confirmed}
onChange={(e) => setConfirmed(e.target.checked)}
disabled={loading}
aria-label="Stornierung bestätigen"
label="Stornierung bestätigen"
onChange={(e) => setConfirmed(e.target.checked)}
/>
<span>Stornierung bestätigen</span>
</label>
<button type="submit" disabled={!valid || loading}>
{loading ? "Wird storniert…" : "Stornieren"}
</button>
</div>
{error && (
<p className="billing-status-message" role="alert">
{error}
</p>
)}
</form>
<Button type="submit" variant="destructive" disabled={!valid || loading}>
{loading ? "Wird storniert …" : "Stornieren"}
</Button>
</div>
{error && <Alert color="danger" description={error} />}
</form>
);
}
}