import { MapPin } from 'lucide-react'; import { createCourseManagementApi } from '@kit/course-management/api'; import { getSupabaseServerClient } from '@kit/supabase/server-client'; import { Card, CardContent, CardHeader, CardTitle } from '@kit/ui/card'; import { AccountNotFound } from '~/components/account-not-found'; import { CmsPageShell } from '~/components/cms-page-shell'; import { EmptyState } from '~/components/empty-state'; import { CreateLocationDialog } from './create-location-dialog'; interface PageProps { params: Promise<{ account: string }>; } export default async function LocationsPage({ params }: PageProps) { const { account } = await params; const client = getSupabaseServerClient(); const { data: acct } = await client .from('accounts') .select('id') .eq('slug', account) .single(); if (!acct) return ; const api = createCourseManagementApi(client); const locations = await api.listLocations(acct.id); return ( Kurs- und Veranstaltungsorte verwalten {locations.length === 0 ? ( } title="Keine Orte vorhanden" description="Fügen Sie Ihren ersten Veranstaltungsort hinzu." actionLabel="Neuer Ort" /> ) : ( Alle Orte ({locations.length}) Name Adresse Raum Kapazität {locations.map((loc: Record) => ( {String(loc.name)} {[loc.street, loc.postal_code, loc.city] .filter(Boolean) .map(String) .join(', ') || '—'} {String(loc.room ?? '—')} {String(loc.capacity ?? '—')} ))} )} ); }
Kurs- und Veranstaltungsorte verwalten