Files
myeasycms-v2/apps/web/app/home/[account]/_components/team-account-layout-sidebar.tsx
gbuomprisco fb104e0b7f Simplify team account layout sidebar
The team account layout sidebar has been simplified by removing collapsible functionality and unneeded dependencies. The changes aim to improve clarity and reduce complexity in the codebase. With a lesser number of dependencies, future updates or improvements should be easier.
2024-06-13 22:28:15 +08:00

79 lines
2.0 KiB
TypeScript

import { User } from '@supabase/supabase-js';
import { Sidebar, SidebarContent } from '@kit/ui/sidebar';
import { ProfileAccountDropdownContainer } from '~/components//personal-account-dropdown-container';
import { TeamAccountNotifications } from '~/home/[account]/_components/team-account-notifications';
import { TeamAccountAccountsSelector } from '../_components/team-account-accounts-selector';
import { TeamAccountLayoutSidebarNavigation } from './team-account-layout-sidebar-navigation';
type AccountModel = {
label: string | null;
value: string | null;
image: string | null;
};
export function TeamAccountLayoutSidebar(props: {
account: string;
accountId: string;
accounts: AccountModel[];
collapsed: boolean;
user: User;
}) {
return (
<Sidebar>
<SidebarContainer
account={props.account}
accountId={props.accountId}
accounts={props.accounts}
user={props.user}
/>
</Sidebar>
);
}
function SidebarContainer(props: {
account: string;
accountId: string;
accounts: AccountModel[];
collapsible?: boolean;
user: User;
}) {
const { account, accounts, user } = props;
const userId = user.id;
return (
<>
<SidebarContent className={'h-16 justify-center'}>
<div
className={'flex max-w-full items-center justify-between space-x-4'}
>
<TeamAccountAccountsSelector
userId={userId}
selectedAccount={account}
accounts={accounts}
/>
<TeamAccountNotifications
userId={userId}
accountId={props.accountId}
/>
</div>
</SidebarContent>
<SidebarContent className={`mt-5 h-[calc(100%-160px)] overflow-y-auto`}>
<TeamAccountLayoutSidebarNavigation account={account} />
</SidebarContent>
<div className={'absolute bottom-4 left-0 w-full'}>
<SidebarContent>
<ProfileAccountDropdownContainer
user={props.user}
collapsed={false}
/>
</SidebarContent>
</div>
</>
);
}