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});
|
||||
|
||||
return (
|
||||
<html lang="en" suppressHydrationWarning>
|
||||
// return (
|
||||
// <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>
|
||||
{/* 使用 next/script 注入 public/env.js 文件 */}
|
||||
<Script
|
||||
src="/env.js"
|
||||
strategy="beforeInteractive" // 确保在 React 启动之前加载
|
||||
/>
|
||||
</head>
|
||||
|
||||
|
||||
<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>
|
||||
)
|
||||
|
||||
// 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>
|
||||
// )
|
||||
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