59 lines
1.6 KiB
TypeScript
59 lines
1.6 KiB
TypeScript
import type { Metadata } from "next";
|
|
import { Geist, Geist_Mono } from "next/font/google";
|
|
import Script from "next/script";
|
|
import { TooltipProvider } from "@/components/ui/tooltip";
|
|
import { ThemeProvider } from "@/components/theme-provider";
|
|
import "./globals.css";
|
|
|
|
const geistSans = Geist({
|
|
variable: "--font-sans",
|
|
subsets: ["latin"],
|
|
});
|
|
|
|
const geistMono = Geist_Mono({
|
|
variable: "--font-mono",
|
|
subsets: ["latin"],
|
|
});
|
|
|
|
export const metadata: Metadata = {
|
|
title: "RouterLists",
|
|
description: "MikroTik network management platform",
|
|
};
|
|
|
|
// Runs before React hydration — prevents flash of wrong theme (FOUC).
|
|
const ANTI_FOUC = `
|
|
try {
|
|
var t = localStorage.getItem('rl-theme') || 'dark';
|
|
var d = t === 'system'
|
|
? window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'
|
|
: t;
|
|
document.documentElement.classList.toggle('dark', d === 'dark');
|
|
document.documentElement.classList.toggle('light', d === 'light');
|
|
} catch(e) {}
|
|
`.trim()
|
|
|
|
export default function RootLayout({
|
|
children,
|
|
}: Readonly<{
|
|
children: React.ReactNode;
|
|
}>) {
|
|
return (
|
|
<html
|
|
lang="ru"
|
|
suppressHydrationWarning
|
|
className={`${geistSans.variable} ${geistMono.variable} h-full antialiased`}
|
|
>
|
|
<head>
|
|
<Script id="anti-fouc" strategy="beforeInteractive">
|
|
{ANTI_FOUC}
|
|
</Script>
|
|
</head>
|
|
<body className="min-h-full flex flex-col">
|
|
<ThemeProvider defaultTheme="dark" disableTransitionOnChange>
|
|
<TooltipProvider>{children}</TooltipProvider>
|
|
</ThemeProvider>
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|