feat: unified admin panel + back buttons everywhere

AdminPanel.js: sidebar nav с 4 разделами (Настройки API, ЮKassa, Расходы AI, Пользователи)
  Встроены: SettingsSection (API-ключи), SpendingSection (расходы), AdminBilling
  Breadcrumb навигация
/system/page.js: теперь рендерит AdminPanel
Header: 'Расходы' → 'Админ' (ссылка на /system), убран TrendingUp
BackButton.js: переиспользуемая кнопка назад
  Добавлена на /drafts, /billing, /plans
This commit is contained in:
Ник (Claude)
2026-06-12 23:57:38 +03:00
parent d888816f2b
commit 1fbdc9f9b9
7 changed files with 369 additions and 15 deletions
+2
View File
@@ -2,6 +2,7 @@
import { useState, useEffect } from 'react';
import { Coins, RefreshCw, TrendingDown, TrendingUp, Loader2, ArrowRight } from 'lucide-react';
import Link from 'next/link';
import BackButton from '@/components/BackButton';
const TYPE_LABELS = {
spend_image: { label: 'Генерация картинки', sign: '-', color: 'text-red-400' },
@@ -47,6 +48,7 @@ export default function BillingPage() {
return (
<main className="max-w-3xl mx-auto p-4 sm:p-6">
<BackButton />
<div className="flex items-center justify-between mb-6">
<h1 className="text-xl font-bold flex items-center gap-2">
<Coins className="w-5 h-5 text-accent" /> Баланс и кредиты
+2
View File
@@ -2,6 +2,7 @@
import { useState, useEffect, useCallback } from 'react';
import { Clock, Check, X, Edit3, Trash2, RefreshCw, Loader2, Calendar, Image as ImgIcon, Zap } from 'lucide-react';
import Link from 'next/link';
import BackButton from '@/components/BackButton';
const STATUS_TABS = [
{ v: 'pending', label: 'Ожидают', color: 'text-accent' },
@@ -77,6 +78,7 @@ export default function DraftsPage() {
return (
<main className="max-w-3xl mx-auto p-4 sm:p-6">
<BackButton />
<div className="flex items-center justify-between mb-6">
<div>
<h1 className="text-xl font-bold flex items-center gap-2">
+2
View File
@@ -2,6 +2,7 @@
import { useState, useEffect } from 'react';
import { Check, Zap, Loader2 } from 'lucide-react';
import Link from 'next/link';
import BackButton from '@/components/BackButton';
const PLAN_STYLE = {
free: { color: 'border-border', badge: null, btnClass: 'btn-ghost' },
@@ -43,6 +44,7 @@ export default function PlansPage() {
return (
<main className="max-w-5xl mx-auto p-4 sm:p-6">
<BackButton />
<div className="text-center mb-10">
<h1 className="text-3xl font-bold mb-2">Тарифы</h1>
<p className="text-gray-400">Выберите план под ваши задачи. Все планы включают публикацию в TG и VK.</p>
+3 -11
View File
@@ -1,11 +1,11 @@
import { redirect } from 'next/navigation';
import { requireUser } from '@/lib/session';
import Header from '@/components/Header';
import SystemSettings from '@/components/SystemSettings';
import AdminPanel from '@/components/AdminPanel';
export const dynamic = 'force-dynamic';
export default async function SystemPage() {
export default async function SystemPage({ searchParams }) {
const user = await requireUser();
if (!user) redirect('/login');
if (!user.isAdmin) redirect('/');
@@ -13,15 +13,7 @@ export default async function SystemPage() {
return (
<>
<Header user={user} />
<main className="max-w-4xl mx-auto p-4 sm:p-6">
<div className="mb-6">
<h1 className="text-2xl font-bold">Системные настройки</h1>
<p className="text-sm text-gray-500 mt-1">
Конфигурация внешних сервисов (поиск фото, билинги и т.п.). Видно только админам.
</p>
</div>
<SystemSettings />
</main>
<AdminPanel initialSection={searchParams?.section || 'settings'} />
</>
);
}