Files
new-api-analytics/app/layout.tsx

66 lines
2.3 KiB
TypeScript

import type { Metadata } from "next";
import { Outfit, JetBrains_Mono } from "next/font/google";
import "./globals.css";
import { ClientProviders } from "@/components/ClientProviders";
const outfit = Outfit({
variable: "--font-geist-sans",
subsets: ["latin"],
weight: ["300", "400", "500", "600", "700", "800"],
});
const jetbrains = JetBrains_Mono({
variable: "--font-geist-mono",
subsets: ["latin"],
weight: ["400", "500", "600"],
});
export const metadata: Metadata = {
title: "API Analytics — Neural Pulse",
description: "Real-time API usage analytics dashboard",
};
export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="zh" className={`${outfit.variable} ${jetbrains.variable} h-full antialiased`} suppressHydrationWarning>
<head>
<script dangerouslySetInnerHTML={{ __html: `
(function(){
var q=null;
try{
var rawTheme=new URLSearchParams(window.location.search).get('theme');
if(rawTheme){
rawTheme=rawTheme.toLowerCase();
if(rawTheme==='light'||rawTheme==='dark'){
q=rawTheme;
}else if(rawTheme==='auto'||rawTheme==='system'){
q=window.matchMedia('(prefers-color-scheme:dark)').matches?'dark':'light';
}
}
}catch(e){}
var parentTheme=null;
try{
if(window.self!==window.top){
var parentDoc=window.parent.document;
parentTheme=(parentDoc.body&&parentDoc.body.getAttribute('theme-mode')==='dark')||parentDoc.documentElement.classList.contains('dark')?'dark':'light';
}
}catch(e){}
var t=localStorage.getItem('theme')||'system';
var r=q||parentTheme||(t==='system'?window.matchMedia('(prefers-color-scheme:dark)').matches?'dark':'light':t);
document.documentElement.classList.remove('light','dark');
document.documentElement.classList.add(r);
document.documentElement.setAttribute('data-theme',r);
})();
`}} />
</head>
<body className="min-h-full">
<ClientProviders>{children}</ClientProviders>
</body>
</html>
);
}