Some checks failed
Deploy to Production / Build and Deploy (push) Has been cancelled
- Fix React bug #33580: remove Suspense boundaries co-located with Link components - Delete settings/loading.tsx and admin/loading.tsx (root cause of race condition) - Convert all admin navigation from Next.js Link to anchor tags - Move admin pages to dedicated (admin) route group - Add AdminHeader matching main header visual design - Add AdminSidebar with anchor-based navigation - Add /api/admin/models route handler (replaces server actions for GET) - Add /api/debug/client-error for server-side browser error reporting - Add useNoteRefreshOptional() to fix crash in AdminHeader - Hide Admin Dashboard menu for non-admin users - Change app icons from yellow to blue (#3A7CA5) matching brand primary - Fix admin search bar width to match main header Made-with: Cursor
45 lines
1.8 KiB
TypeScript
45 lines
1.8 KiB
TypeScript
import { Suspense } from "react";
|
|
import { HeaderWrapper } from "@/components/header-wrapper";
|
|
import { Sidebar } from "@/components/sidebar";
|
|
import { ProvidersWrapper } from "@/components/providers-wrapper";
|
|
import { auth } from "@/auth";
|
|
import { detectUserLanguage } from "@/lib/i18n/detect-user-language";
|
|
import { loadTranslations } from "@/lib/i18n/load-translations";
|
|
|
|
export default async function MainLayout({
|
|
children,
|
|
}: Readonly<{
|
|
children: React.ReactNode;
|
|
}>) {
|
|
// Run auth + language detection + translation loading in parallel
|
|
const [session, initialLanguage] = await Promise.all([
|
|
auth(),
|
|
detectUserLanguage(),
|
|
]);
|
|
|
|
// Load initial translations server-side to prevent hydration mismatch
|
|
const initialTranslations = await loadTranslations(initialLanguage);
|
|
|
|
return (
|
|
<ProvidersWrapper initialLanguage={initialLanguage} initialTranslations={initialTranslations}>
|
|
<div className="bg-background-light dark:bg-background-dark font-display text-slate-900 dark:text-white overflow-hidden h-screen flex flex-col">
|
|
{/* Top Navigation - Style Keep */}
|
|
<HeaderWrapper user={session?.user} />
|
|
|
|
{/* Main Layout */}
|
|
<div className="flex flex-1 overflow-hidden">
|
|
{/* Sidebar Navigation - Style Keep */}
|
|
<Suspense fallback={<div className="w-64 flex-none hidden md:flex" />}>
|
|
<Sidebar className="w-64 flex-none flex-col bg-white dark:bg-[#1e2128] border-e border-slate-200 dark:border-slate-800 overflow-y-auto hidden md:flex" user={session?.user} />
|
|
</Suspense>
|
|
|
|
{/* Main Content Area */}
|
|
<main className="flex min-h-0 flex-1 flex-col overflow-y-auto bg-background-light dark:bg-background-dark p-4 scroll-smooth">
|
|
{children}
|
|
</main>
|
|
</div>
|
|
</div>
|
|
</ProvidersWrapper>
|
|
);
|
|
}
|