Un pot de crédits global (BASIC 100 / PRO 1 000 / BUSINESS 4 000) remplace les seaux par fonction côté débit. Packs one-shot S/M/L, admin sans seaux legacy, usage multi-features, hints de coût, anti-flash thème et hydratation admin. Inclut aussi le pipeline slides renforcé et la page publique polishée.
57 lines
2.1 KiB
TypeScript
57 lines
2.1 KiB
TypeScript
import { Suspense } from "react";
|
|
import { Sidebar } from "@/components/sidebar";
|
|
import { ProvidersWrapper } from "@/components/providers-wrapper";
|
|
import { auth } from "@/auth";
|
|
import { headers } from "next/headers";
|
|
import { detectUserLanguage, parseAcceptLanguage } from "@/lib/i18n/detect-user-language";
|
|
import { loadTranslations } from "@/lib/i18n/load-translations";
|
|
import { getAISettings } from "@/app/actions/ai-settings";
|
|
import { AIChatLayoutBridge } from "@/components/ai-chat-layout-bridge";
|
|
|
|
|
|
export default async function MainLayout({
|
|
children,
|
|
}: Readonly<{
|
|
children: React.ReactNode;
|
|
}>) {
|
|
const headersList = await headers();
|
|
const browserLang = parseAcceptLanguage(headersList.get("accept-language"));
|
|
|
|
const [session, initialLanguage] = await Promise.all([
|
|
auth(),
|
|
detectUserLanguage(browserLang),
|
|
]);
|
|
|
|
const initialTranslations = await loadTranslations(initialLanguage);
|
|
|
|
const aiSettings = session?.user?.id
|
|
? await getAISettings(session.user.id)
|
|
: null;
|
|
const showAIAssistant = aiSettings?.paragraphRefactor !== false;
|
|
|
|
return (
|
|
<ProvidersWrapper
|
|
initialLanguage={initialLanguage}
|
|
initialTranslations={initialTranslations}
|
|
initialAiProcessingConsent={aiSettings?.aiProcessingConsent === true}
|
|
>
|
|
{/* Fond via --background (suit .dark) — évite le flash beige/clair au changement de route */}
|
|
<div className="flex h-screen overflow-hidden bg-background">
|
|
<Suspense fallback={<div className="hidden w-80 md:w-[26rem] 2xl:w-[30rem] shrink-0 md:block h-full self-stretch bg-sidebar" />}>
|
|
<Sidebar user={session?.user} />
|
|
</Suspense>
|
|
|
|
<main className="flex min-h-0 flex-1 flex-col overflow-y-auto scroll-smooth bg-background" id="main-content">
|
|
<a href="#main-content" className="sr-only focus:not-sr-only focus:absolute focus:z-[9999] focus:top-2 focus:left-2 focus:bg-brand-accent focus:text-white focus:px-4 focus:py-2 focus:rounded-lg focus:text-sm focus:font-bold">
|
|
Skip to content
|
|
</a>
|
|
{children}
|
|
</main>
|
|
|
|
{showAIAssistant && <AIChatLayoutBridge />}
|
|
</div>
|
|
</ProvidersWrapper>
|
|
);
|
|
}
|
|
|