feat: admin dashboard UI — DashboardSection as default panel

AdminPanel: Сводка раздел первый (initialSection='dashboard')
DashboardSection: users stats, channels by platform, posts stats,
  revenue vs AI costs cards, drafts pending alert, registrations bar chart 14d
SECTIONS: +Dashboard, +Engine (Движок)
API route: /api/admin/dashboard proxy
This commit is contained in:
Ник (Claude)
2026-06-13 00:10:40 +03:00
parent a5f6c080bd
commit 92b743512c
3 changed files with 165 additions and 7 deletions
+15
View File
@@ -0,0 +1,15 @@
import { NextResponse } from 'next/server';
import { requireUser } from '@/lib/session';
const ENGINE_URL = process.env.ENGINE_URL || 'http://127.0.0.1:3030';
const ENGINE_SECRET = process.env.ENGINE_SECRET || '';
export async function GET() {
const user = await requireUser();
if (!user?.isAdmin) return NextResponse.json({ error: 'Forbidden' }, { status: 403 });
const res = await fetch(`${ENGINE_URL}/api/admin/dashboard`, {
headers: { 'x-internal-secret': ENGINE_SECRET, 'x-user-id': String(user.id) },
cache: 'no-store',
});
return NextResponse.json(await res.json());
}