Files
myeasycms-v2/apps/web/app/(dashboard)/home/_components/home-sidebar.tsx
giancarlo ee507e0816 Refactor code and improve usage of package dependencies
This commit updates the naming convention of icons from Lucide-React, moving some package dependencies to "peerDependencies" in 'team-accounts', 'admin' and 'auth'. Additionally, it includes tweaks to the development server command in apps/web package.json and adds a logger reference to the shared package. Furthermore, cleanup work has been performed within the features and UI packages, and new scripts to interact with Stripe have been added to the root package.json.
2024-03-26 01:34:19 +08:00

38 lines
1.3 KiB
TypeScript

import { use } from 'react';
import { cookies } from 'next/headers';
import { Sidebar, SidebarContent, SidebarNavigation } from '@kit/ui/sidebar';
import { HomeSidebarAccountSelector } from '~/(dashboard)/home/_components/home-sidebar-account-selector';
import { ProfileDropdownContainer } from '~/(dashboard)/home/_components/personal-account-dropdown';
import { loadUserWorkspace } from '~/(dashboard)/home/_lib/load-user-workspace';
import { personalAccountSidebarConfig } from '~/config/personal-account-sidebar.config';
export function HomeSidebar() {
const collapsed = getSidebarCollapsed();
const { session, accounts } = use(loadUserWorkspace());
return (
<Sidebar collapsed={collapsed}>
<SidebarContent className={'my-4'}>
<HomeSidebarAccountSelector collapsed={collapsed} accounts={accounts} />
</SidebarContent>
<SidebarContent className={`h-[calc(100%-160px)] overflow-y-auto`}>
<SidebarNavigation config={personalAccountSidebarConfig} />
</SidebarContent>
<div className={'absolute bottom-4 left-0 w-full'}>
<SidebarContent>
<ProfileDropdownContainer session={session} collapsed={collapsed} />
</SidebarContent>
</div>
</Sidebar>
);
}
function getSidebarCollapsed() {
return cookies().get('sidebar-collapsed')?.value === 'true';
}