import { Tooltip } from "antd"; import { ArrowLeft, BarChart3, BellRing, Coins, FileClock, HardDrive, Home, Infinity as InfinityIcon, Mail, MessageSquareText, Paintbrush, PanelLeftClose, PanelLeftOpen, RadioTower, Settings2, ShieldCheck, TicketCheck, UsersRound } from "lucide-react"; import { useState, type ReactNode } from "react"; import { Link, NavLink, Outlet } from "react-router"; import { AppChangelogButton } from "@/components/layout/app-changelog-modal"; import { WorkspacePage } from "@/components/layout/workspace-page"; import { WORKSPACE_SIDEBAR_STORAGE_KEY } from "@/components/layout/workspace-sidebar-state"; import { cn } from "@/lib/utils"; type AdminNavigationItem = { path: string; label: string; description: string; icon: ReactNode; }; const adminNavigation: Array<{ label: string; items: AdminNavigationItem[] }> = [ { label: "概览", items: [{ path: "/admin", label: "数据概览", description: "活跃、调用与成本趋势", icon: }], }, { label: "平台资源", items: [ { path: "/admin/users", label: "用户管理", description: "账号、角色与状态", icon: }, { path: "/admin/channels", label: "系统渠道", description: "渠道、模型与售价", icon: }, { path: "/admin/prompt-templates", label: "提示词模板", description: "平台创作策略版本", icon: }, ], }, { label: "运营", items: [ { path: "/admin/announcements", label: "系统公告", description: "发布、关闭与历史公告", icon: }, { path: "/admin/credit-operations", label: "积分运营", description: "人工调账与异常计费", icon: }, { path: "/admin/redemption-codes", label: "兑换码", description: "生成与查看兑换码批次", icon: }, { path: "/admin/logs", label: "请求明细", description: "上游调用与费用", icon: }, ], }, { label: "系统配置", items: [ { path: "/admin/settings/drawing-engine", label: "绘图工具", description: "画布绘图节点默认引擎", icon: }, { path: "/admin/settings/runtime-policy", label: "资源与策略", description: "配额、并发、频控与超时", icon: }, { path: "/admin/settings/access", label: "登录与注册", description: "注册策略与 Linux.do", icon: }, { path: "/admin/settings/email", label: "邮件服务", description: "注册验证码 SMTP", icon: }, { path: "/admin/settings/storage", label: "存储服务", description: "OSS 与资源存储", icon: }, ], }, ]; export function AdminShell() { const [collapsed, setCollapsed] = useState(() => window.localStorage.getItem(WORKSPACE_SIDEBAR_STORAGE_KEY) === "1"); const toggleCollapsed = () => { setCollapsed((current) => { const next = !current; window.localStorage.setItem(WORKSPACE_SIDEBAR_STORAGE_KEY, next ? "1" : "0"); return next; }); }; return (
); } export function AdminPageFrame({ title, description, actions, back, children }: { title: string; description: string; actions?: ReactNode; back?: { label: string; onClick: () => void }; children: ReactNode }) { return (
{back ? ( ) : null}

{title}

{description}

{actions ?
{actions}
: null}
{children}
); } function MobileAdminNavigation() { return ( ); } function AdminNavigation({ collapsed }: { collapsed: boolean }) { return ( ); }