56 lines
1.5 KiB
TypeScript
56 lines
1.5 KiB
TypeScript
'use server';
|
|
|
|
import { use } from 'react';
|
|
|
|
import { CompanyGuard } from '@/packages/features/team-accounts/src/components';
|
|
import { createTeamAccountsApi } from '@/packages/features/team-accounts/src/server/api';
|
|
import { getSupabaseServerClient } from '@/packages/supabase/src/clients/server-client';
|
|
|
|
import { PageBody } from '@kit/ui/page';
|
|
import { Trans } from '@kit/ui/trans';
|
|
|
|
import { createI18nServerInstance } from '~/lib/i18n/i18n.server';
|
|
import { withI18n } from '~/lib/i18n/with-i18n';
|
|
|
|
import { Dashboard } from './_components/dashboard';
|
|
import { TeamAccountLayoutPageHeader } from './_components/team-account-layout-page-header';
|
|
|
|
interface TeamAccountHomePageProps {
|
|
params: Promise<{ account: string }>;
|
|
}
|
|
|
|
export const generateMetadata = async () => {
|
|
const i18n = await createI18nServerInstance();
|
|
const title = i18n.t('teams:home.pageTitle');
|
|
|
|
return {
|
|
title,
|
|
};
|
|
};
|
|
|
|
function TeamAccountHomePage({ params }: TeamAccountHomePageProps) {
|
|
const account = use(params).account;
|
|
const client = getSupabaseServerClient();
|
|
const api = createTeamAccountsApi(client);
|
|
const teamAccount = use(api.getTeamAccount(account));
|
|
|
|
return (
|
|
<>
|
|
<TeamAccountLayoutPageHeader
|
|
title={
|
|
<Trans
|
|
i18nKey={'teams:home.headerTitle'}
|
|
values={{ companyName: account }}
|
|
/>
|
|
}
|
|
/>
|
|
|
|
<PageBody>
|
|
<Dashboard teamAccount={teamAccount} />
|
|
</PageBody>
|
|
</>
|
|
);
|
|
}
|
|
|
|
export default withI18n(CompanyGuard(TeamAccountHomePage));
|