import { useLocation, useNavigate } from 'react-router-dom'
import {
AppstoreOutlined, MessageOutlined, HistoryOutlined, TeamOutlined,
FileTextOutlined, BarChartOutlined, SettingOutlined, LogoutOutlined,
ThunderboltOutlined,
} from '@ant-design/icons'
import { useAuth } from '@/stores/auth'
const menuItems = [
{ key: '/agent/dashboard', icon: , label: '工作台' },
{ key: '/agent/customers', icon: , label: '客户管理' },
{ key: '/agent/chat-history', icon: , label: '对话记录' },
{ key: '/agent/knowledge', icon: , label: '知识库' },
{ key: '/agent/quick-replies', icon: , label: '快捷回复' },
{ key: '/agent/statistics', icon: , label: '数据统计' },
{ key: '/agent/settings', icon: , label: '系统设置' },
]
const AgentSidebar = () => {
const location = useLocation()
const navigate = useNavigate()
const { user, logout } = useAuth()
const visibleMenuItems = menuItems.filter(item => {
if (item.key === '/agent/statistics') return user?.role === 'admin' || user?.role === 'supervisor'
if (item.key === '/agent/settings') return user?.role === 'admin'
return true
})
const selectedKey = visibleMenuItems.find(item => location.pathname.startsWith(item.key))?.key || '/agent/dashboard'
const handleLogout = () => {
logout()
navigate('/login', { replace: true })
}
const initial = (user?.nickname || '客').slice(0, 1)
return (
)
}
export default AgentSidebar