Files
Giancarlo Buomprisco 7ebff31475 Next.js Supabase V3 (#463)
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
2026-03-24 13:40:38 +08:00

50 lines
1.2 KiB
TypeScript

import { getLocale } from 'next-intl/server';
import { SidebarInset, SidebarProvider } from '@kit/ui/sidebar';
import { DocsHeader } from './_components/docs-header';
// local imports
import { DocsNavigation } from './_components/docs-navigation';
import { getDocs } from './_lib/server/docs.loader';
import { buildDocumentationTree } from './_lib/utils';
type DocsLayoutProps = React.PropsWithChildren<{
params: Promise<{ locale?: string }>;
}>;
async function DocsLayout({ children, params }: DocsLayoutProps) {
let { locale } = await params;
if (!locale) {
locale = await getLocale();
}
return (
<SidebarProvider
defaultOpen={true}
style={
{
'--sidebar-width': '300px',
} as React.CSSProperties
}
>
<DocsSidebar locale={locale} />
<SidebarInset className="h-screen overflow-y-auto overscroll-y-none">
<DocsHeader />
{children}
</SidebarInset>
</SidebarProvider>
);
}
async function DocsSidebar({ locale }: { locale: string }) {
const pages = await getDocs(locale);
const tree = buildDocumentationTree(pages);
return <DocsNavigation pages={tree} />;
}
export default DocsLayout;