feat: 简化侧栏 - 移除冗余的线索详情菜单项,扁平化线索池入口
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
parent
209f2e3d05
commit
481d01c89f
@ -11,13 +11,6 @@ interface User {
|
|||||||
role: string
|
role: string
|
||||||
}
|
}
|
||||||
|
|
||||||
const sceneGroups: Record<string, { label: string; icon: string; pages: Page[] }> = {
|
|
||||||
inquiry: { label: '询价发布助手', icon: '📋', pages: ['inquiry', 'lead-detail'] },
|
|
||||||
product: { label: '商品上架助手', icon: '📦', pages: ['product'] },
|
|
||||||
image: { label: '商品生图助手', icon: '🖼️', pages: ['image'] },
|
|
||||||
comparison: { label: '智能比价助手', icon: '⚖️', pages: ['comparison'] },
|
|
||||||
}
|
|
||||||
|
|
||||||
const adminPages: { key: Page; label: string }[] = [
|
const adminPages: { key: Page; label: string }[] = [
|
||||||
{ key: 'admin-tenants', label: '租户管理' },
|
{ key: 'admin-tenants', label: '租户管理' },
|
||||||
{ key: 'admin-stats', label: '使用统计' },
|
{ key: 'admin-stats', label: '使用统计' },
|
||||||
@ -37,7 +30,6 @@ export default function Sidebar({
|
|||||||
onLogout?: () => void
|
onLogout?: () => void
|
||||||
}) {
|
}) {
|
||||||
const [expandedGroups, setExpandedGroups] = useState<Record<string, boolean>>({
|
const [expandedGroups, setExpandedGroups] = useState<Record<string, boolean>>({
|
||||||
inquiry: true,
|
|
||||||
system: true,
|
system: true,
|
||||||
admin: true,
|
admin: true,
|
||||||
})
|
})
|
||||||
@ -45,10 +37,6 @@ export default function Sidebar({
|
|||||||
const toggleGroup = (id: string) =>
|
const toggleGroup = (id: string) =>
|
||||||
setExpandedGroups((prev) => ({ ...prev, [id]: !prev[id] }))
|
setExpandedGroups((prev) => ({ ...prev, [id]: !prev[id] }))
|
||||||
|
|
||||||
const inScene = Object.entries(sceneGroups).find(([, g]) =>
|
|
||||||
g.pages.includes(current)
|
|
||||||
)
|
|
||||||
|
|
||||||
const isInAdmin = current.startsWith('admin-')
|
const isInAdmin = current.startsWith('admin-')
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -84,48 +72,17 @@ export default function Sidebar({
|
|||||||
业务场景
|
业务场景
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<button
|
||||||
<button
|
onClick={() => onNavigate('inquiry')}
|
||||||
onClick={() => toggleGroup('inquiry')}
|
className={`w-full flex items-center gap-3 px-4 py-3 rounded-lg text-sm transition-colors ${
|
||||||
className={`w-full flex items-center justify-between px-4 py-3 rounded-lg text-sm transition-colors ${
|
current === 'inquiry'
|
||||||
inScene?.[0] === 'inquiry'
|
? 'bg-secondary text-white font-semibold'
|
||||||
? 'bg-secondary text-white font-semibold'
|
: 'text-on-surface-variant hover:bg-surface-container-low'
|
||||||
: 'text-on-surface-variant hover:bg-surface-container-low'
|
}`}
|
||||||
}`}
|
>
|
||||||
>
|
<span>📋</span>
|
||||||
<div className="flex items-center gap-3">
|
<span>线索池</span>
|
||||||
<span>📋</span>
|
</button>
|
||||||
<span>询价发布助手</span>
|
|
||||||
</div>
|
|
||||||
<span className={`transition-transform text-xs ${expandedGroups.inquiry ? 'rotate-90' : ''}`}>▶</span>
|
|
||||||
</button>
|
|
||||||
{expandedGroups.inquiry && (
|
|
||||||
<div className="ml-2 space-y-1 mt-1">
|
|
||||||
<button
|
|
||||||
onClick={() => onNavigate('inquiry')}
|
|
||||||
className={`w-full flex items-center gap-3 px-4 py-2 rounded-lg text-sm transition-colors ${
|
|
||||||
current === 'inquiry'
|
|
||||||
? 'bg-secondary/10 text-secondary font-semibold'
|
|
||||||
: 'text-on-surface-variant hover:bg-surface-container-low'
|
|
||||||
}`}
|
|
||||||
>
|
|
||||||
<span className="w-1.5 h-1.5 rounded-full bg-current" />
|
|
||||||
<span>线索池</span>
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
onClick={() => onNavigate('lead-detail')}
|
|
||||||
className={`w-full flex items-center gap-3 px-4 py-2 rounded-lg text-sm transition-colors ${
|
|
||||||
current === 'lead-detail'
|
|
||||||
? 'bg-secondary/10 text-secondary font-semibold'
|
|
||||||
: 'text-on-surface-variant hover:bg-surface-container-low'
|
|
||||||
}`}
|
|
||||||
>
|
|
||||||
<span className="w-1.5 h-1.5 rounded-full bg-current" />
|
|
||||||
<span>线索详情</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{[
|
{[
|
||||||
{ id: 'image', key: 'image' as Page, label: '商品生图助手', icon: '🖼️' },
|
{ id: 'image', key: 'image' as Page, label: '商品生图助手', icon: '🖼️' },
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user