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

53 lines
1.9 KiB
TypeScript

import type { Metadata } from "next";
import "./globals.css";
import { ClientProviders } from "@/components/ClientProviders";
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="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>
);
}