44 lines
1.2 KiB
TypeScript
44 lines
1.2 KiB
TypeScript
import { getSupabaseServerClient } from '@kit/supabase/server-client';
|
|
import { createVerbandApi } from '@kit/verbandsverwaltung/api';
|
|
import {
|
|
VerbandTabNavigation,
|
|
VerbandDashboard,
|
|
} from '@kit/verbandsverwaltung/components';
|
|
|
|
import { AccountNotFound } from '~/components/account-not-found';
|
|
import { CmsPageShell } from '~/components/cms-page-shell';
|
|
|
|
interface PageProps {
|
|
params: Promise<{ account: string }>;
|
|
}
|
|
|
|
export default async function VerbandPage({ 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 <AccountNotFound />;
|
|
|
|
const api = createVerbandApi(client);
|
|
|
|
let stats = { totalClubs: 0, totalMembers: 0, totalRoles: 0, totalFeeTypes: 0 };
|
|
|
|
try {
|
|
stats = await api.getDashboardStats(acct.id);
|
|
} catch (e) {
|
|
console.error('Failed to load verband dashboard:', e);
|
|
}
|
|
|
|
return (
|
|
<CmsPageShell account={account} title="Verbandsverwaltung">
|
|
<VerbandTabNavigation account={account} activeTab="overview" />
|
|
<VerbandDashboard stats={stats} account={account} />
|
|
</CmsPageShell>
|
|
);
|
|
}
|