Fix client loading as atomcms normal
This commit is contained in:
1 parent
bedf0ee7fa
commit
7e5813bd97
3 files changed
+150
-64
No files matched your search
+24
-10
@@ -2,6 +2,7 @@ import type { Metadata } from "next";
|
||||
import { NextIntlClientProvider } from "next-intl";
|
||||
import { getLocale, getMessages } from "next-intl/server";
|
||||
import { Nunito } from "next/font/google";
|
||||
import { headers } from "next/headers";
|
||||
import type { ReactNode } from "react";
|
||||
import { Navigation } from "@/components/navigation";
|
||||
import { PwaRegister } from "@/components/pwa-register";
|
||||
@@ -36,6 +37,12 @@ export default async function RootLayout({ children }: { children: ReactNode })
|
||||
// "Dusk" / dark-by-default: the site starts dark unless the visitor has picked
|
||||
// light. The saved choice always wins over the default.
|
||||
const defaultDark = await siteSettings.getBool("default_dark", false);
|
||||
|
||||
const headersList = await headers();
|
||||
const pathname = headersList.get("x-pathname") || "";
|
||||
const isClient = pathname === "/client" || pathname.startsWith("/client/");
|
||||
console.log(`[RootLayout] pathname: "${pathname}", isClient: ${isClient}`);
|
||||
|
||||
return (
|
||||
<html lang={locale} className={`app ${nunito.variable}`}>
|
||||
<head>
|
||||
@@ -52,19 +59,26 @@ export default async function RootLayout({ children }: { children: ReactNode })
|
||||
>
|
||||
<NextIntlClientProvider locale={locale} messages={messages}>
|
||||
<ThemeVars />
|
||||
<TopHeader />
|
||||
<SiteHeader />
|
||||
<Navigation />
|
||||
<main className="overflow-hidden site-bg">
|
||||
<div className="mx-auto mt-10 grid max-w-7xl grid-cols-12 gap-x-3 gap-y-8 p-6 md:mt-0">
|
||||
<div className="col-span-12">{children}</div>
|
||||
</div>
|
||||
</main>
|
||||
<SiteFooter />
|
||||
<RadioPlayerGate />
|
||||
{isClient ? (
|
||||
children
|
||||
) : (
|
||||
<>
|
||||
<TopHeader />
|
||||
<SiteHeader />
|
||||
<Navigation />
|
||||
<main className="overflow-hidden site-bg">
|
||||
<div className="mx-auto mt-10 grid max-w-7xl grid-cols-12 gap-x-3 gap-y-8 p-6 md:mt-0">
|
||||
<div className="col-span-12">{children}</div>
|
||||
</div>
|
||||
</main>
|
||||
<SiteFooter />
|
||||
<RadioPlayerGate />
|
||||
</>
|
||||
)}
|
||||
<PwaRegister />
|
||||
</NextIntlClientProvider>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user