71 lines
1.9 KiB
TypeScript
71 lines
1.9 KiB
TypeScript
import { NavLink } from 'react-router-dom';
|
|
|
|
type NavItem = {
|
|
to: string;
|
|
label: string;
|
|
end?: boolean;
|
|
};
|
|
|
|
type NavSection = {
|
|
label?: string;
|
|
items: NavItem[];
|
|
};
|
|
|
|
const NAV_SECTIONS: NavSection[] = [
|
|
{
|
|
items: [{ to: '/', label: '概览', end: true }],
|
|
},
|
|
{
|
|
label: '用户与账户',
|
|
items: [{ to: '/users', label: '用户管理' }],
|
|
},
|
|
{
|
|
label: '计费',
|
|
items: [{ to: '/billing', label: '计费中心', end: false }],
|
|
},
|
|
{
|
|
label: '平台配置',
|
|
items: [
|
|
{ to: '/wechat', label: '服务号' },
|
|
{ to: '/mindspace', label: 'MindSpace 配置' },
|
|
{ to: '/analytics', label: 'Analytics 配置' },
|
|
{ to: '/memory-v2', label: 'Memory V2' },
|
|
{ to: '/mindsearch', label: 'MindSearch' },
|
|
{ to: '/skill-runtime', label: 'Skill Runtime' },
|
|
{ to: '/system-tests', label: '系统测试验证' },
|
|
{ to: '/capabilities', label: '能力' },
|
|
{ to: '/skills', label: '技能' },
|
|
{ to: '/policies', label: '策略' },
|
|
{ to: '/providers', label: '统一模型中心' },
|
|
{ to: '/asset-gateway', label: '资产能力' },
|
|
{ to: '/blocked-words', label: '违禁词管理' },
|
|
],
|
|
},
|
|
{
|
|
label: 'Plaza',
|
|
items: [{ to: '/ops', label: '运营后台', end: false }],
|
|
},
|
|
];
|
|
|
|
export function AdminNav() {
|
|
return (
|
|
<nav className="admin-sidebar-nav" aria-label="管理后台导航">
|
|
{NAV_SECTIONS.map((section) => (
|
|
<div key={section.label ?? section.items[0]?.to} className="admin-nav-section">
|
|
{section.label && <div className="admin-nav-section-label">{section.label}</div>}
|
|
{section.items.map((item) => (
|
|
<NavLink
|
|
key={item.to}
|
|
to={item.to}
|
|
end={item.end}
|
|
className={({ isActive }) => `admin-nav-link${isActive ? ' active' : ''}`}
|
|
>
|
|
{item.label}
|
|
</NavLink>
|
|
))}
|
|
</div>
|
|
))}
|
|
</nav>
|
|
);
|
|
}
|