import { MapPin } from 'lucide-react'; import { getTranslations } from 'next-intl/server'; 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 t = await getTranslations('courses'); const { data: acct } = await client .from('accounts') .select('id') .eq('slug', account) .single(); if (!acct) return ; const api = createCourseManagementApi(client); const locations = await api.referenceData.listLocations(acct.id); return (

{t('locations.manage')}

{locations.length === 0 ? ( } title={t('locations.noLocations')} description={t('locations.noLocationsDescription')} actionLabel={t('locations.newLocationLabel')} /> ) : ( {t('locations.allTitle', { count: locations.length })}
{locations.map((loc: Record) => ( ))}
{t('common.name')} {t('common.address')} {t('common.room')} {t('list.capacity')}
{String(loc.name)} {[loc.street, loc.postal_code, loc.city] .filter(Boolean) .map(String) .join(', ') || '—'} {String(loc.room ?? '—')} {String(loc.capacity ?? '—')}
)}
); }