import Announcement from '@/components/announcement';
import { SidebarInset, SidebarProvider } from '@workspace/ui/components/sidebar';
import { cookies } from 'next/headers';
import { SidebarLeft } from './sidebar-left';
// import { SidebarTrigger } from '@workspace/ui/components/sidebar';

export default async function DashboardLayout({ children }: { children: React.ReactNode }) {
  const cookieStore = await cookies();
  const defaultOpen = cookieStore.get('sidebar:state')?.value === 'true';

  return (
    <SidebarProvider className='' defaultOpen={defaultOpen}>
      <SidebarLeft className='w-[288px] border-r-0 bg-transparent lg:flex' />
      <SidebarInset className='relative flex-grow overflow-hidden'>
        {/*<SidebarTrigger />*/}
        <div className='h-[calc(100vh-56px)] flex-grow gap-4 overflow-auto p-4'>{children}</div>
      </SidebarInset>
      {/*<SidebarRight className='sticky top-[84px] hidden w-[288px] border-r-0 bg-transparent 2xl:flex' />*/}
      <Announcement type='popup' Authorization={(await cookies()).get('Authorization')?.value} />
    </SidebarProvider>
  );
}
