Release 2.3.0: calendar categories, reservations, month view, dashboard

- Admin-managed event categories (name + one of Sakani's 8 calendar
  colors) at /admin/kalender/kategorien; events pick a category.
- Calendar as Sakani MonthCalendar with a German header and a color
  legend, for editorials and admins.
- "Zu meinen Alben hinzufügen" replaces RSVP: grants the event album at
  once when it exists, otherwise reserves it; the auto-rule scheduler
  grants pending reservations once the album appears. Editorials see when
  an auto rule already covers the event. event_responses is dropped.
- New admin dashboard: to-dos, next events, 30-day figures, activity.
- Photo grid reads left to right in uniform 3:2 tiles.
- Release notes 2.3.0 seeded (migration 0008).

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 23:45:59 +01:00
1 parent 4fb6f2d373
commit 2775b406bf
39 files changed
+9754 -701

No files matched your search

+71 -51
View File
@@ -1,97 +1,118 @@
import Link from "next/link";
import { CategoryDot, CategoryLegend } from "@/components/calendar/category-legend";
import { EventMonth } from "@/components/calendar/event-month";
import { Button } from "@/components/ui/button";
import { PageHeader } from "@/components/ui/page-header";
import { Alert, Badge, Card, EmptyState } from "@/components/ui/sakani";
import { formatIsoDateGerman, isoDateInBerlin } from "@/modules/announcements/service";
import { categoryService } from "@/modules/calendar/categories";
import { calendarService } from "@/modules/calendar/service";
import { immichClient } from "@/modules/immich/client";
import { requireAdminPage } from "../access";
import { CalendarEventForm } from "./CalendarEventForm";
import { DeleteCalendarEventButton } from "./DeleteCalendarEventButton";
import { createCalendarEventAction, deleteCalendarEventAction } from "./actions";
export default async function AdminCalendarPage() {
const [{ events, immichUnavailable }, albums] = await Promise.all([
await requireAdminPage();
const [{ events, immichUnavailable }, albums, categories] = await Promise.all([
calendarService.listAdminEvents(),
immichClient.listAlbums().catch(() => []),
categoryService.listCategories(),
]);
const today = isoDateInBerlin(new Date());
return (
<div className="space-y-8 max-w-7xl animate-in fade-in slide-in-from-bottom-4 duration-500">
<section className="flex flex-col gap-6">
<PageHeader
kicker="Planung"
title="Kalender"
description="Termine für Redaktionen, z. B. kommende Spiele. Redaktionen melden zurück, ob sie da sind, und können das verknüpfte Album selbst freischalten. Alben ohne Kalender-Termin bleiben unsichtbar; automatische Zuweisungsregeln gelten unabhängig davon."
/>
description="Termine für Redaktionen, z. B. kommende Spiele. Redaktionen merken Termine vor und bekommen das verknüpfte Album automatisch, sobald es da ist. Alben ohne Termin bleiben unsichtbar; automatische Zuweisungsregeln gelten unabhängig davon."
>
<Button asChild variant="outline">
<Link href="/admin/kalender/kategorien">Kategorien verwalten</Link>
</Button>
</PageHeader>
<CalendarEventForm
action={createCalendarEventAction}
defaultEventDate={today}
albums={albums.map((album) => ({ id: album.id, albumName: album.albumName }))}
categories={categories.map((category) => ({ id: category.id, name: category.name }))}
defaultEventDate={today}
/>
{immichUnavailable ? (
<p className="bg-muted p-4 rounded-md text-sm" role="status">
Immich ist gerade nicht erreichbar. Verknüpfte Alben werden angezeigt, sobald die Verbindung wieder steht.
</p>
<Alert
color="warning"
description="Immich ist gerade nicht erreichbar. Verknüpfte Alben werden angezeigt, sobald die Verbindung wieder steht."
/>
) : null}
<section className="space-y-4" aria-labelledby="calendar-list-title">
<Card title="Monatsübersicht">
<EventMonth
events={events.map((event) => ({
id: event.id,
title: event.title,
eventDate: event.eventDate,
color: event.category?.color ?? null,
}))}
/>
<CategoryLegend categories={categories} showUncategorized={events.some((event) => !event.category)} />
</Card>
<section aria-labelledby="calendar-list-title" className="flex flex-col gap-4">
<div className="flex items-baseline justify-between">
<h2 id="calendar-list-title" className="text-xl font-semibold">
<h2 className="text-xl font-semibold" id="calendar-list-title">
Alle Termine
</h2>
<p className="text-sm text-muted-foreground">{events.length} insgesamt</p>
<p className="text-sm text-[var(--color-fg-muted)]">{events.length} insgesamt</p>
</div>
{events.length === 0 ? (
<p className="text-muted-foreground py-8 text-center">
Noch keine Termine vorhanden. Legen Sie oben den ersten Termin an.
</p>
<EmptyState title="Noch keine Termine" description="Legen Sie oben den ersten Termin an." />
) : (
<ul className="space-y-3">
<ul className="flex flex-col gap-3">
{events.map((event) => {
const attending = event.responses.filter((response) => response.status === "attending");
const notAttending = event.responses.filter((response) => response.status === "not_attending");
const granted = event.reservations.filter((row) => row.grantedAt).length;
return (
<li
className="flex flex-col justify-between gap-4 rounded-xl border border-[var(--color-border-subtle)] bg-[var(--color-bg-surface)] p-4 outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-border-focus)] sm:flex-row sm:items-start"
id={`termin-${event.id}`}
key={event.id}
className="bg-card p-4 rounded-xl border border-border shadow-sm flex flex-col sm:flex-row sm:items-start gap-4 justify-between"
tabIndex={-1}
>
<div className="space-y-2 min-w-0">
<p className="font-semibold">
<div className="flex min-w-0 flex-col gap-2">
<p className="flex flex-wrap items-center gap-2 font-semibold">
{event.title}
{event.eventDate < today ? (
<span className="ml-2 text-xs font-normal text-muted-foreground">vorbei</span>
{event.eventDate < today ? <Badge>vorbei</Badge> : null}
</p>
<p className="flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-[var(--color-fg-muted)]">
<span>{formatIsoDateGerman(event.eventDate)}</span>
{event.category ? (
<span className="flex items-center gap-1.5">
· <CategoryDot color={event.category.color} /> {event.category.name}
</span>
) : null}
<span>· {event.album ? `Album: ${event.album.albumName}` : "Noch kein Album verknüpft"}</span>
</p>
<p className="text-xs text-muted-foreground">
{formatIsoDateGerman(event.eventDate)} ·{" "}
{event.album ? (
<span>Album: {event.album.albumName}</span>
) : (
<span>Noch kein Album verknüpft</span>
)}
</p>
{event.responses.length > 0 ? (
<div className="flex flex-wrap gap-1.5 text-xs">
{attending.map((response) => (
<span
key={response.editorialId}
className="rounded-full bg-green-600/10 px-2.5 py-1 font-medium text-green-700 dark:text-green-400"
>
{response.editorialName}: da
</span>
))}
{notAttending.map((response) => (
<span
key={response.editorialId}
className="rounded-full bg-muted px-2.5 py-1 text-muted-foreground"
>
{response.editorialName}: nicht da
</span>
))}
{event.reservations.length > 0 ? (
<div className="flex flex-col gap-1.5">
<p className="text-xs text-[var(--color-fg-muted)]">
{event.reservations.length === 1 ? "1 Vormerkung" : `${event.reservations.length} Vormerkungen`}
{granted > 0 ? `, ${granted} freigeschaltet` : ""}
</p>
<div className="flex flex-wrap gap-1.5">
{event.reservations.map((row) => (
<Badge key={row.editorialId} variant={row.grantedAt ? "success" : "neutral"}>
{row.editorialName}: {row.grantedAt ? "freigeschaltet" : "vorgemerkt"}
</Badge>
))}
</div>
</div>
) : (
<p className="text-xs text-muted-foreground">Noch keine Rückmeldungen.</p>
<p className="text-xs text-[var(--color-fg-muted)]">Noch keine Vormerkungen.</p>
)}
</div>
<DeleteCalendarEventButton action={deleteCalendarEventAction} eventId={event.id} />
@@ -101,7 +122,6 @@ export default async function AdminCalendarPage() {
</ul>
)}
</section>
</div>
</section>
);
}