Decouple admin from public max-w-7xl via (site) route group.
Public chrome and width live only under (site). /admin and /client inherit the root layout alone, so housekeeping width is no longer tied to the public template. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -0,0 +1,27 @@
|
|||||||
|
import type { ReactNode } from "react";
|
||||||
|
import { Navigation } from "@/components/navigation";
|
||||||
|
import RadioPlayerGate from "@/components/public/radio-player-gate";
|
||||||
|
import { SiteFooter } from "@/components/site-footer";
|
||||||
|
import { SiteHeader } from "@/components/site-header";
|
||||||
|
import { TopHeader } from "@/components/top-header";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Public site chrome. Route group `(site)` keeps this off `/admin` and `/client`,
|
||||||
|
* so housekeeping is never constrained by the public max-w-7xl grid.
|
||||||
|
*/
|
||||||
|
export default function SiteLayout({ children }: { children: ReactNode }) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<TopHeader />
|
||||||
|
<SiteHeader />
|
||||||
|
<Navigation />
|
||||||
|
<main>
|
||||||
|
<div className="mx-auto mt-6 grid max-w-7xl grid-cols-12 gap-x-3 gap-y-6 px-4 py-4 md:mt-0 md:p-6">
|
||||||
|
<div className="col-span-12 min-w-0">{children}</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
<SiteFooter />
|
||||||
|
<RadioPlayerGate />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
+2
-30
@@ -1,17 +1,11 @@
|
|||||||
import type { Metadata } from "next";
|
import type { Metadata } from "next";
|
||||||
import { Nunito, Pixelify_Sans } from "next/font/google";
|
import { Nunito, Pixelify_Sans } from "next/font/google";
|
||||||
import { headers } from "next/headers";
|
|
||||||
import Script from "next/script";
|
import Script from "next/script";
|
||||||
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 type { ReactNode } from "react";
|
import type { ReactNode } from "react";
|
||||||
import { Navigation } from "@/components/navigation";
|
|
||||||
import RadioPlayerGate from "@/components/public/radio-player-gate";
|
|
||||||
import { PwaRegister } from "@/components/pwa-register";
|
import { PwaRegister } from "@/components/pwa-register";
|
||||||
import { SiteFooter } from "@/components/site-footer";
|
|
||||||
import { SiteHeader } from "@/components/site-header";
|
|
||||||
import { ThemeVars } from "@/components/theme-vars";
|
import { ThemeVars } from "@/components/theme-vars";
|
||||||
import { TopHeader } from "@/components/top-header";
|
|
||||||
import { enforceSiteAccess } from "@/lib/access-guard";
|
import { enforceSiteAccess } from "@/lib/access-guard";
|
||||||
import { siteSettings } from "@/lib/services/site-settings";
|
import { siteSettings } from "@/lib/services/site-settings";
|
||||||
import "./globals.css";
|
import "./globals.css";
|
||||||
@@ -63,16 +57,9 @@ export default async function RootLayout({
|
|||||||
await enforceSiteAccess();
|
await enforceSiteAccess();
|
||||||
const locale = await getLocale();
|
const locale = await getLocale();
|
||||||
const messages = await getMessages();
|
const messages = await getMessages();
|
||||||
// "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 defaultDark = await siteSettings.getBool("default_dark", false);
|
||||||
|
|
||||||
const headersList = await headers();
|
|
||||||
const pathname =
|
|
||||||
headersList.get("x-pathname") || headersList.get("next-url") || "";
|
|
||||||
const isClient = pathname === "/client" || pathname.startsWith("/client/");
|
|
||||||
const isAdmin = pathname === "/admin" || pathname.startsWith("/admin/");
|
|
||||||
const nitroUrl = await siteSettings.get("nitro_client_url", "");
|
const nitroUrl = await siteSettings.get("nitro_client_url", "");
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<html
|
<html
|
||||||
lang={locale}
|
lang={locale}
|
||||||
@@ -93,22 +80,7 @@ export default async function RootLayout({
|
|||||||
>
|
>
|
||||||
<NextIntlClientProvider locale={locale} messages={messages}>
|
<NextIntlClientProvider locale={locale} messages={messages}>
|
||||||
<ThemeVars />
|
<ThemeVars />
|
||||||
{isClient || isAdmin ? (
|
{children}
|
||||||
children
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
<TopHeader />
|
|
||||||
<SiteHeader />
|
|
||||||
<Navigation />
|
|
||||||
<main>
|
|
||||||
<div className="mx-auto mt-6 grid max-w-7xl grid-cols-12 gap-x-3 gap-y-6 px-4 py-4 md:mt-0 md:p-6">
|
|
||||||
<div className="col-span-12 min-w-0">{children}</div>
|
|
||||||
</div>
|
|
||||||
</main>
|
|
||||||
<SiteFooter />
|
|
||||||
<RadioPlayerGate />
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
<PwaRegister />
|
<PwaRegister />
|
||||||
</NextIntlClientProvider>
|
</NextIntlClientProvider>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
Reference in New Issue
Block a user