Version 3 of the kit: - Radix UI replaced with Base UI (using the Shadcn UI patterns) - next-intl replaces react-i18next - enhanceAction deprecated; usage moved to next-safe-action - main layout now wrapped with [locale] path segment - Teams only mode - Layout updates - Zod v4 - Next.js 16.2 - Typescript 6 - All other dependencies updated - Removed deprecated Edge CSRF - Dynamic Github Action runner
45 lines
1.1 KiB
TypeScript
45 lines
1.1 KiB
TypeScript
import { use } from 'react';
|
|
|
|
import { cookies } from 'next/headers';
|
|
|
|
import { Page, PageMobileNavigation, PageNavigation } from '@kit/ui/page';
|
|
import { SidebarProvider } from '@kit/ui/sidebar';
|
|
|
|
import { AdminSidebar } from '~/admin/_components/admin-sidebar';
|
|
import { AdminMobileNavigation } from '~/admin/_components/mobile-navigation';
|
|
|
|
export const metadata = {
|
|
title: `Super Admin`,
|
|
};
|
|
|
|
export const dynamic = 'force-dynamic';
|
|
|
|
export default function AdminLayout(props: React.PropsWithChildren) {
|
|
const state = use(getLayoutState());
|
|
|
|
return (
|
|
<SidebarProvider defaultOpen={state.open}>
|
|
<Page style={'sidebar'}>
|
|
<PageNavigation>
|
|
<AdminSidebar />
|
|
</PageNavigation>
|
|
|
|
<PageMobileNavigation>
|
|
<AdminMobileNavigation />
|
|
</PageMobileNavigation>
|
|
|
|
{props.children}
|
|
</Page>
|
|
</SidebarProvider>
|
|
);
|
|
}
|
|
|
|
async function getLayoutState() {
|
|
const cookieStore = await cookies();
|
|
const sidebarOpenCookie = cookieStore.get('sidebar_state');
|
|
|
|
return {
|
|
open: sidebarOpenCookie?.value === 'true',
|
|
};
|
|
}
|