Fix client loading as atomcms normal

This commit is contained in:
openhands committed 2026-07-03 15:16:47 +02:00
1 parent bedf0ee7fa
commit 7e5813bd97
3 files changed
+150 -64

No files matched your search

+125 -53
View File
File diff suppressed because it is too large. Load diff
+24 -10
View File
@@ -2,6 +2,7 @@ import type { Metadata } from "next";
import { NextIntlClientProvider } from "next-intl"; import { NextIntlClientProvider } from "next-intl";
import { getLocale, getMessages } from "next-intl/server"; import { getLocale, getMessages } from "next-intl/server";
import { Nunito } from "next/font/google"; import { Nunito } from "next/font/google";
import { headers } from "next/headers";
import type { ReactNode } from "react"; import type { ReactNode } from "react";
import { Navigation } from "@/components/navigation"; import { Navigation } from "@/components/navigation";
import { PwaRegister } from "@/components/pwa-register"; 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 // "Dusk" / dark-by-default: the site starts dark unless the visitor has picked
// light. The saved choice always wins over the default. // light. The saved choice always wins over the default.
const defaultDark = await siteSettings.getBool("default_dark", false); 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 ( return (
<html lang={locale} className={`app ${nunito.variable}`}> <html lang={locale} className={`app ${nunito.variable}`}>
<head> <head>
@@ -52,19 +59,26 @@ export default async function RootLayout({ children }: { children: ReactNode })
> >
<NextIntlClientProvider locale={locale} messages={messages}> <NextIntlClientProvider locale={locale} messages={messages}>
<ThemeVars /> <ThemeVars />
<TopHeader /> {isClient ? (
<SiteHeader /> children
<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"> <TopHeader />
<div className="col-span-12">{children}</div> <SiteHeader />
</div> <Navigation />
</main> <main className="overflow-hidden site-bg">
<SiteFooter /> <div className="mx-auto mt-10 grid max-w-7xl grid-cols-12 gap-x-3 gap-y-8 p-6 md:mt-0">
<RadioPlayerGate /> <div className="col-span-12">{children}</div>
</div>
</main>
<SiteFooter />
<RadioPlayerGate />
</>
)}
<PwaRegister /> <PwaRegister />
</NextIntlClientProvider> </NextIntlClientProvider>
</body> </body>
</html> </html>
); );
} }
+1 -1
View File
@@ -234,7 +234,7 @@ export default async function HomePage() {
/> />
</Link> </Link>
<div className="flex items-center mb-4"> <div className="flex items-center mb-4">
<Link href="/client"> <Link href="/client" target="_blank" rel="noopener noreferrer">
<button <button
type="button" type="button"
className="group rounded-full px-7 py-3 text-sm font-bold tracking-wider transition-all duration-300 hover:scale-105 active:scale-95" className="group rounded-full px-7 py-3 text-sm font-bold tracking-wider transition-all duration-300 hover:scale-105 active:scale-95"