SPB Git

Repository Public

layout.tsx 1.4 KB 36 lines tsx

1import type { Metadata, Viewport } from "next";2import { cookies, headers } from "next/headers";3import type { ReactNode } from "react";4import "@tokens/tokens.css";5import "@/styles/base.css";6import "@/ui/ui.css";7import "@/styles/shell.css";8import "@/styles/features.css";9import { pickLocale } from "@/i18n/core";10import { Providers } from "@/shell/providers";1112export const metadata: Metadata = {13  title: "MacLustr Command Center",14  description: "Infrastructure cockpit of the MacLustr cluster.",15  referrer: "no-referrer",16  robots: { index: false, follow: false },17  icons: { icon: "/icon.svg" },18};19export const viewport: Viewport = { width: "device-width", initialScale: 1, colorScheme: "dark light" };2021// Rendered per request: the CSP nonce (src/proxy.ts) must reach Next's scripts, and the theme/locale preference22// cookies are applied on the server so there is no flash. No data is fetched here and no secret is read.23export default async function RootLayout({ children }: { children: ReactNode }) {24  const h = await headers();25  const c = await cookies();26  const locale = pickLocale(c.get("mcc_locale")?.value, h.get("accept-language"));27  const theme = c.get("mcc_theme")?.value === "light" ? "light" : "dark";28  return (29    <html lang={locale} data-theme={theme === "light" ? "light" : undefined} suppressHydrationWarning>30      <body>31        <Providers locale={locale} theme={theme}>{children}</Providers>32      </body>33    </html>34  );35}36
Files main
Menu

Theme