Release 2.4.0: bulk download rework, toasts and Sakani polish

- ZIP download from the Merkzettel: every photo is a new usage by
  default; only already downloaded photos offer "Neu / Bereits genutzt"
  (SegmentedControl), with thumbnails and a cost summary. "Bild
  auslassen" is gone.
- Toasts (Sakani Toaster) for admin saves, deletes and errors; billing
  errors are readable and use router.refresh instead of reloads. Errors
  inside modal dialogs stay inline (a toast would sit behind the
  backdrop).
- Album overview in blog-listing style, Sakani Pagination for albums,
  search and usage history, skeleton loading states.
- Registration stepper; verification mail lands on step 3.
- Editorials as a searchable, filterable table; audit log with event
  picker, German labels and collapsible details.
- Release notes 2.4.0 seeded (migration 0009).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Leon TonhäuserandClaude Opus 5.5 committed 2026-12-01 00:09:37 +01:00
1 parent 2775b406bf
commit cba70310f9
48 files changed
+3474 -454

No files matched your search

+21 -83
View File
@@ -3,10 +3,13 @@ import Link from "next/link";
import { db } from "@/db/client";
import { editorialAccounts, usages } from "@/db/schema";
import { PageHeader } from "@/components/ui/page-header";
import { IconChevronRight } from "@sakaniui/react/icons";
import { Badge, Card, EmptyState } from "@/components/ui/sakani";
import { EmptyState } from "@/components/ui/sakani";
import { requireAdminPage } from "../access";
import { EditorialsTable } from "./EditorialsTable";
export default async function EditorialsPage() {
await requireAdminPage();
const [editorials, openUsageTotals] = await Promise.all([
db
.select({
@@ -37,96 +40,31 @@ export default async function EditorialsPage() {
openUsageTotals.map((total) => [total.editorialId, total.openCents]),
);
const activeEditorials = editorials.filter((e) => !e.archivedAt);
const archivedEditorials = editorials.filter((e) => e.archivedAt);
return (
<section className="flex flex-col gap-6">
<PageHeader
kicker="Kontoverwaltung"
title="Redaktionen"
description="Verwalte hier alle registrierten und archivierten Redaktionszugänge."
description="Alle registrierten Redaktionszugänge mit Status, Preis und noch nicht abgerechneten Nutzungen."
/>
{activeEditorials.length === 0 ? (
<EmptyState title="Noch keine aktiven Redaktionen registriert." description="Neue Registrierungen erscheinen hier zur Freigabe." />
{editorials.length === 0 ? (
<EmptyState title="Noch keine Redaktionen registriert." description="Neue Registrierungen erscheinen hier zur Freigabe." />
) : (
<ul className="grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3">
{activeEditorials.map((editorial) => {
const openCents = openCentsByEditorial.get(editorial.id) ?? 0;
return (
<li key={editorial.id}>
<Link href={`/admin/redaktionen/${editorial.id}`} className={CARD_LINK}>
<Card interactive className="h-full">
<div className="flex items-start justify-between gap-3">
<h2 className="text-base font-semibold text-[var(--color-fg-default)]">{editorial.name}</h2>
<Badge variant={STATUS[editorial.status]?.variant ?? "danger"}>
{STATUS[editorial.status]?.label ?? "Gesperrt"}
</Badge>
</div>
<dl className="grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-sm">
<dt className="text-[var(--color-fg-muted)]">Kontakt</dt>
<dd className="truncate">{editorial.contactName}</dd>
<dt className="text-[var(--color-fg-muted)]">E-Mail</dt>
<dd className="truncate">{editorial.loginEmail}</dd>
</dl>
<p className="mt-auto border-t border-[var(--color-border-subtle)] pt-3 text-sm font-medium">
{editorial.currentPriceCents === null
? "Preis noch nicht festgelegt"
: `Netto ${formatCents(editorial.currentPriceCents)}`}
<span
className={`ml-2 ${openCents > 0 ? "text-[var(--color-warning-fg)]" : "text-[var(--color-fg-muted)]"}`}
title="Summe der noch nicht abgerechneten Bildnutzungen"
>
· Offen {formatCents(openCents)}
</span>
</p>
</Card>
</Link>
</li>
);
})}
</ul>
)}
{archivedEditorials.length > 0 && (
<details className="group mt-6">
<summary className="mb-4 flex cursor-pointer list-none items-center gap-2 text-sm font-medium text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)]">
<IconChevronRight size={16} aria-hidden="true" className="transition-transform group-open:rotate-90" />
Archivierte Redaktionen ({archivedEditorials.length})
</summary>
<ul className="grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3">
{archivedEditorials.map((editorial) => (
<li key={editorial.id}>
<Link href={`/admin/redaktionen/${editorial.id}`} className={CARD_LINK}>
<Card interactive className="h-full opacity-80">
<div className="flex items-start justify-between gap-3">
<h2 className="text-base font-semibold text-[var(--color-fg-muted)]">{editorial.name}</h2>
<Badge>Archiviert</Badge>
</div>
<p className="text-sm text-[var(--color-fg-muted)]">{editorial.contactName} · {editorial.loginEmail}</p>
<p className="text-sm text-[var(--color-fg-muted)]">
Archiviert am: {editorial.archivedAt ? new Date(editorial.archivedAt).toLocaleDateString("de-DE") : ""}
</p>
</Card>
</Link>
</li>
))}
</ul>
</details>
<EditorialsTable
rows={editorials.map((editorial) => ({
id: editorial.id,
name: editorial.name,
contactName: editorial.contactName,
loginEmail: editorial.loginEmail,
status: editorial.status,
archived: Boolean(editorial.archivedAt),
priceCents: editorial.currentPriceCents,
openCents: openCentsByEditorial.get(editorial.id) ?? 0,
createdAt: editorial.createdAt.toISOString(),
}))}
/>
)}
</section>
);
}
const CARD_LINK =
"block h-full rounded-[var(--radius-xl)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--color-border-focus)]";
const STATUS: Record<string, { label: string; variant: "success" | "warning" | "danger" }> = {
active: { label: "Aktiv", variant: "success" },
pending_approval: { label: "Ausstehend", variant: "warning" },
};
function formatCents(cents: number): string {
return new Intl.NumberFormat("de-DE", { style: "currency", currency: "EUR" }).format(cents / 100);
}