feat: API analytics dashboard with i18n and theme support

Next.js full-stack analytics dashboard for new-api.
- Direct PostgreSQL readonly queries on logs table
- 5 pages: Dashboard, Rankings, Aggregation, Logs, Detail
- Dark/Light/System theme with CSS variables
- Chinese/English i18n (default Chinese)
- Recharts with dual Y-axis for input/output tokens
- Lucide icons + Motion animations
- Docker + docker-compose with external sinobridge network, port 8019
This commit is contained in:
2026-04-02 12:47:50 +08:00
commit b719b358f8
41 changed files with 3430 additions and 0 deletions

45
app/layout.tsx Normal file
View File

@@ -0,0 +1,45 @@
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 dark`} suppressHydrationWarning>
<head>
<script dangerouslySetInnerHTML={{ __html: `
(function(){
var t=localStorage.getItem('theme')||'system';
var r=t==='system'?window.matchMedia('(prefers-color-scheme:dark)').matches?'dark':'light':t;
document.documentElement.classList.add(r);
document.documentElement.setAttribute('data-theme',r);
})();
`}} />
</head>
<body className="min-h-full">
<ClientProviders>{children}</ClientProviders>
</body>
</html>
);
}