import { PageHeader } from "@/components/ui/page-header"; import { formatIsoDateGerman, isoDateInBerlin } from "@/modules/announcements/service"; import { calendarService } from "@/modules/calendar/service"; import { immichClient } from "@/modules/immich/client"; 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([ calendarService.listAdminEvents(), immichClient.listAlbums().catch(() => []), ]); const today = isoDateInBerlin(new Date()); return (
({ id: album.id, albumName: album.albumName }))} /> {immichUnavailable ? (

Immich ist gerade nicht erreichbar. Verknüpfte Alben werden angezeigt, sobald die Verbindung wieder steht.

) : null}

Alle Termine

{events.length} insgesamt

{events.length === 0 ? (

Noch keine Termine vorhanden. Legen Sie oben den ersten Termin an.

) : (
    {events.map((event) => { const attending = event.responses.filter((response) => response.status === "attending"); const notAttending = event.responses.filter((response) => response.status === "not_attending"); return (
  • {event.title} {event.eventDate < today ? ( vorbei ) : null}

    {formatIsoDateGerman(event.eventDate)} ·{" "} {event.album ? ( Album: {event.album.albumName} ) : ( Noch kein Album verknüpft )}

    {event.responses.length > 0 ? (
    {attending.map((response) => ( {response.editorialName}: da ))} {notAttending.map((response) => ( {response.editorialName}: nicht da ))}
    ) : (

    Noch keine Rückmeldungen.

    )}
  • ); })}
)}
); }