43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
// app/layout.tsx
|
|
import "./globals.css";
|
|
import type { ReactNode } from "react";
|
|
import { AuthProvider } from "@/context/AuthContext";
|
|
import { Banner } from "@/components/Banner";
|
|
|
|
export const metadata = {
|
|
title: {
|
|
default: "Battl Builders",
|
|
template: "%s — Battl Builders",
|
|
},
|
|
description: "Build rifles smarter, not harder.",
|
|
};
|
|
|
|
const themeScript = `
|
|
(function () {
|
|
try {
|
|
const storedTheme = localStorage.getItem("theme");
|
|
const prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
const theme = storedTheme || (prefersDark ? "dark" : "light");
|
|
document.documentElement.classList.toggle("dark", theme === "dark");
|
|
} catch (_) {}
|
|
})();
|
|
`;
|
|
|
|
export default function RootLayout({ children }: { children: ReactNode }) {
|
|
return (
|
|
<html lang="en" suppressHydrationWarning>
|
|
<head>
|
|
<script dangerouslySetInnerHTML={{ __html: themeScript }} />
|
|
</head>
|
|
|
|
<body className="bg-white text-zinc-950 dark:bg-black dark:text-zinc-50">
|
|
{" "}
|
|
<AuthProvider>
|
|
<Banner />
|
|
{children}
|
|
</AuthProvider>
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|