This commit is contained in:
parent
a3021b01b4
commit
6cd0444bb0
|
|
@ -122,48 +122,38 @@ export default async function RootLayout({
|
||||||
|
|
||||||
//console.log("[layout.tsx]..............current locale: ", {locale});
|
//console.log("[layout.tsx]..............current locale: ", {locale});
|
||||||
|
|
||||||
return (
|
// return (
|
||||||
<html lang="en" suppressHydrationWarning>
|
// <html lang="en" suppressHydrationWarning>
|
||||||
|
// <body className={inter.className}>
|
||||||
|
// <Providers attribute="class" defaultTheme="dark">
|
||||||
|
// <TranslationsProvider
|
||||||
|
// namespaces={i18nNamespaces}
|
||||||
|
// locale={locale}
|
||||||
|
// resources={resources}
|
||||||
|
// >
|
||||||
|
// <Toaster richColors position="top-center" duration={3000} />
|
||||||
|
// <div className="bg-background text-foreground flex h-dvh flex-col items-center overflow-x-auto">
|
||||||
|
// {data.session ? <GlobalState>{children}</GlobalState> : children}
|
||||||
|
// </div>
|
||||||
|
// </TranslationsProvider>
|
||||||
|
// </Providers>
|
||||||
|
// </body>
|
||||||
|
// </html>
|
||||||
|
// )
|
||||||
|
|
||||||
<head>
|
return (
|
||||||
{/* 使用 next/script 注入 public/env.js 文件 */}
|
<Providers attribute="class" defaultTheme="dark">
|
||||||
<Script
|
<TranslationsProvider
|
||||||
src="/env.js"
|
namespaces={i18nNamespaces}
|
||||||
strategy="beforeInteractive" // 确保在 React 启动之前加载
|
locale={locale}
|
||||||
/>
|
resources={resources}
|
||||||
</head>
|
>
|
||||||
|
<Toaster richColors position="top-center" duration={3000} />
|
||||||
|
<div className={`${inter.className} bg-background text-foreground flex h-dvh flex-col items-center overflow-x-auto`}>
|
||||||
<body className={inter.className}>
|
{data.session ? <GlobalState>{children}</GlobalState> : children}
|
||||||
<Providers attribute="class" defaultTheme="dark">
|
</div>
|
||||||
<TranslationsProvider
|
</TranslationsProvider>
|
||||||
namespaces={i18nNamespaces}
|
</Providers>
|
||||||
locale={locale}
|
)
|
||||||
resources={resources}
|
|
||||||
>
|
|
||||||
<Toaster richColors position="top-center" duration={3000} />
|
|
||||||
<div className="bg-background text-foreground flex h-dvh flex-col items-center overflow-x-auto">
|
|
||||||
{data.session ? <GlobalState>{children}</GlobalState> : children}
|
|
||||||
</div>
|
|
||||||
</TranslationsProvider>
|
|
||||||
</Providers>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
)
|
|
||||||
|
|
||||||
// return (
|
|
||||||
// <Providers attribute="class" defaultTheme="dark">
|
|
||||||
// <TranslationsProvider
|
|
||||||
// namespaces={i18nNamespaces}
|
|
||||||
// locale={locale}
|
|
||||||
// resources={resources}
|
|
||||||
// >
|
|
||||||
// <Toaster richColors position="top-center" duration={3000} />
|
|
||||||
// <div className={`${inter.className} bg-background text-foreground flex h-dvh flex-col items-center overflow-x-auto`}>
|
|
||||||
// {data.session ? <GlobalState>{children}</GlobalState> : children}
|
|
||||||
// </div>
|
|
||||||
// </TranslationsProvider>
|
|
||||||
// </Providers>
|
|
||||||
// )
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
/*
|
||||||
|
eslint-disable @next/next/no-sync-scripts
|
||||||
|
|
||||||
|
⛔ 请勿删除:
|
||||||
|
我们在此处强制同步加载 /env.js 用于注入 window.RUNTIME_ENV,
|
||||||
|
以确保运行时 Supabase 等动态配置在 React 启动前就可用。
|
||||||
|
*/
|
||||||
|
import { Html, Head, Main, NextScript } from "next/document";
|
||||||
|
|
||||||
|
export default function Document() {
|
||||||
|
return (
|
||||||
|
<Html lang="en">
|
||||||
|
<Head>
|
||||||
|
{/* 使用 defer 确保 env.js 加载顺序 */}
|
||||||
|
<script src="/env.js" defer />
|
||||||
|
</Head>
|
||||||
|
<body>
|
||||||
|
<Main />
|
||||||
|
<NextScript />
|
||||||
|
</body>
|
||||||
|
</Html>
|
||||||
|
);
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue