import Link from 'next/link'; import { CalendarDays, MapPin, Users, Clock, Pencil, UserPlus, } from 'lucide-react'; import { createEventManagementApi } from '@kit/event-management/api'; import { formatDate } from '@kit/shared/dates'; import { getSupabaseServerClient } from '@kit/supabase/server-client'; import { Badge } from '@kit/ui/badge'; import { Button } from '@kit/ui/button'; import { Card, CardContent, CardHeader, CardTitle } from '@kit/ui/card'; import { CmsPageShell } from '~/components/cms-page-shell'; import { DeleteEventButton } from './delete-event-button'; interface PageProps { params: Promise<{ account: string; eventId: string }>; } const STATUS_LABEL: Record = { draft: 'Entwurf', published: 'Veröffentlicht', registration_open: 'Anmeldung offen', registration_closed: 'Anmeldung geschlossen', cancelled: 'Abgesagt', completed: 'Abgeschlossen', }; const STATUS_VARIANT: Record< string, 'secondary' | 'default' | 'info' | 'outline' | 'destructive' > = { draft: 'secondary', published: 'default', registration_open: 'info', registration_closed: 'outline', cancelled: 'destructive', completed: 'outline', }; export default async function EventDetailPage({ params }: PageProps) { const { account, eventId } = await params; const client = getSupabaseServerClient(); const api = createEventManagementApi(client); const [event, registrations] = await Promise.all([ api.getEvent(eventId), api.getRegistrations(eventId), ]); if (!event) return
Veranstaltung nicht gefunden
; const eventData = event as Record; return (
{/* Action Buttons */}
{/* Header */}

{String(eventData.name)}

{STATUS_LABEL[String(eventData.status)] ?? String(eventData.status)}
{/* Detail Cards */}

Datum

{formatDate(eventData.event_date as string)}

Uhrzeit

{String(eventData.start_time ?? '—')} –{' '} {String(eventData.end_time ?? '—')}

Ort

{String(eventData.location ?? '—')}

Anmeldungen

{registrations.length} / {String(eventData.capacity ?? '∞')}

{/* Description */} {eventData.description ? ( Beschreibung

{String(eventData.description)}

) : null} {/* Registrations Table */} Anmeldungen ({registrations.length}) {registrations.length === 0 ? (

Noch keine Anmeldungen

) : (
{registrations.map((reg: Record) => ( ))}
Name E-Mail Elternteil Datum
{String(reg.last_name ?? '')},{' '} {String(reg.first_name ?? '')} {String(reg.email ?? '—')} {String(reg.parent_name ?? '—')} {formatDate(reg.created_at as string)}
)}
); }