import { Menu } from 'antd'
import { useNavigate, useLocation } from 'react-router-dom'
import {
DashboardOutlined,
FileTextOutlined,
BookOutlined,
SyncOutlined,
UserOutlined,
TeamOutlined,
SoundOutlined,
LineChartOutlined,
} from '@ant-design/icons'
import useAuthStore from '../../stores/authStore'
function SideNav() {
const navigate = useNavigate()
const location = useLocation()
const { user } = useAuthStore()
const allMenuItems = [
{ key: '/dashboard', icon: , label: '仪表盘' },
{ key: '/analytics', icon: , label: '收视分析' },
{ key: '/editor-desk', icon: , label: '责编录入' },
{ key: '/tps', icon: , label: 'TPS 选题策划' },
{ key: '/knowledge', icon: , label: '知识库' },
{ key: '/doco', icon: , label: '文稿对齐' },
{ key: '/editor-home', icon: , label: '个人首页' },
{ key: '/users', icon: , label: '用户管理' },
{
key: 'tts-placeholder',
icon: ,
label: (
蓝皓配音 TTS 2.0
即将上线
),
disabled: true,
},
{
key: 'collab-placeholder',
icon: ,
label: (
内部协作(Mattermost)
即将上线
),
disabled: true,
},
]
// 按角色过滤菜单项
// user.role 值来自后端 /api/auth/me,应为字符串 'zhipianren' / 'zebian' / 'biandao'
const visibleItems = allMenuItems.filter(item => {
// /dashboard 三角色都可见
if (item.key === '/dashboard') return true
// /analytics 三角色都可见
if (item.key === '/analytics') return true
// /users 仅 zhipianren
if (item.key === '/users') return String(user?.role) === 'zhipianren'
// /editor-desk 仅 zhipianren + zebian
if (item.key === '/editor-desk') {
const role = String(user?.role)
return role === 'zhipianren' || role === 'zebian'
}
// 其余三角色都可见(保留后期 Phase 入口)
return true
})
return (
军事科技
TPS 工作台
)
}
export default SideNav