Files
myeasycms-v2/apps/web/app/(dashboard)/home/_components/home-sidebar.tsx
giancarlo 53f94abe88 Update 'next' version and dependencies in pnpm-lock.yaml
This commit updates the package version of 'next' from 14.3.0-canary.7 to 14.3.0-canary.9 throughout the pnpm-lock.yaml file. Other dependencies updated with the respective package include '@makerkit/data-loader-supabase-nextjs', '@keystatic/next' and so on. This update is important to ensure the latest features are being utilized while retaining compatibility with existing code.
2024-04-18 15:34:07 +08:00

55 lines
1.7 KiB
TypeScript

import { use } from 'react';
import { cookies } from 'next/headers';
import { If } from '@kit/ui/if';
import { Sidebar, SidebarContent, SidebarNavigation } from '@kit/ui/sidebar';
import { AppLogo } from '~/components/app-logo';
import featuresFlagConfig from '~/config/feature-flags.config';
import { personalAccountSidebarConfig } from '~/config/personal-account-sidebar.config';
// home imports
import { HomeSidebarAccountSelector } from '../_components/home-sidebar-account-selector';
import { ProfileAccountDropdownContainer } from '../_components/personal-account-dropdown-container';
import { loadUserWorkspace } from '../_lib/load-user-workspace';
export function HomeSidebar() {
const collapsed = getSidebarCollapsed();
const { accounts, user, workspace } = use(loadUserWorkspace());
return (
<Sidebar collapsed={collapsed}>
<SidebarContent className={'h-16 justify-center'}>
<If
condition={featuresFlagConfig.enableTeamAccounts}
fallback={<AppLogo className={'py-2'} />}
>
<HomeSidebarAccountSelector
collapsed={collapsed}
accounts={accounts}
/>
</If>
</SidebarContent>
<SidebarContent className={`h-[calc(100%-160px)] overflow-y-auto mt-5`}>
<SidebarNavigation config={personalAccountSidebarConfig} />
</SidebarContent>
<div className={'absolute bottom-4 left-0 w-full'}>
<SidebarContent>
<ProfileAccountDropdownContainer
collapsed={collapsed}
user={user}
account={workspace}
/>
</SidebarContent>
</div>
</Sidebar>
);
}
function getSidebarCollapsed() {
return cookies().get('sidebar-collapsed')?.value === 'true';
}