Files
myeasycms-v2/apps/web/app/(dashboard)/home/[account]/layout.tsx
giancarlo c238e08fa7 Replace session with user in team accounts
This commit replaces the session object with the user object in the team accounts feature. This change is reflected in the team-account-danger-zone, layout, team-account-workspace, and billing components. The usage of the user object provides more specificity and accuracy in handling user information compared to the more generic session object.
2024-04-16 22:41:06 +08:00

45 lines
923 B
TypeScript

import { use } from 'react';
import { Page } from '@kit/ui/page';
import { withI18n } from '~/lib/i18n/with-i18n';
import { AccountLayoutSidebar } from './_components/account-layout-sidebar';
import { loadTeamWorkspace } from './_lib/server/team-account-workspace.loader';
interface Params {
account: string;
}
function TeamWorkspaceLayout({
children,
params,
}: React.PropsWithChildren<{
params: Params;
}>) {
const data = use(loadTeamWorkspace(params.account));
const accounts = data.accounts.map(({ name, slug, picture_url }) => ({
label: name,
value: slug,
image: picture_url,
}));
return (
<Page
sidebar={
<AccountLayoutSidebar
collapsed={false}
account={params.account}
accounts={accounts}
user={data?.user ?? null}
/>
}
>
{children}
</Page>
);
}
export default withI18n(TeamWorkspaceLayout);