// EwoooC - 後台外殼(Sidebar + Topbar)Nothing × Claude 風格 // 對應截圖的「商品看板 / 活動看板 / 分析報表 / 廠商缺貨 / AI 助手 / 雲端匯入 / 系統管理」 const NAV_GROUPS = [ { title: '監控', items: [ { id: 'dashboard', label: '商品看板', icon: 'dashboard', code: '01' }, { id: 'campaigns', label: '活動看板', icon: 'marketing', code: '02' }, { id: 'analytics', label: '分析報表', icon: 'analytics', code: '03', children: [ { id: 'analytics-sales', label: '業績分析', code: '03·1' }, { id: 'analytics-daily', label: '當日業績', code: '03·2' }, { id: 'analytics-growth', label: '成長分析', code: '03·3' }, { id: 'analytics-monthly', label: '月份總表', code: '03·4' }, ], }, ], }, { title: '營運', items: [ { id: 'outofstock',label: '廠商缺貨', icon: 'inventory', code: '04', badge: 48 }, { id: 'ai', label: 'AI 助手', icon: 'sparkle', code: '05' }, { id: 'cloud', label: '雲端匯入', icon: 'download', code: '06' }, ], }, { title: '系統', items: [ { id: 'settings', label: '系統管理', icon: 'settings', code: '07' }, ], }, ]; // ===== Sidebar ===== const Sidebar = ({ active, onNavigate, collapsed, sidebarTheme }) => { const isDark = sidebarTheme === 'dark'; const width = collapsed ? 72 : 240; // 子選單展開狀態:父 id 命中(active 為自己或子項之一)就展開 const parentOf = React.useMemo(() => { const map = {}; NAV_GROUPS.forEach(g => g.items.forEach(it => { if (it.children) it.children.forEach(c => { map[c.id] = it.id; }); })); return map; }, []); const [openMap, setOpenMap] = React.useState({}); const isOpen = (id) => openMap[id] ?? (active === id || parentOf[active] === id); // 淺色側邊欄改用米色 paper(不純白),active 用焦糖橘 const bg = isDark ? '#1f1a14' : 'var(--momo-bg-paper)'; const textMuted = isDark ? 'rgba(255,247,240,0.55)' : 'var(--momo-text-secondary)'; const text = isDark ? '#faf7f0' : 'var(--momo-text-primary)'; const itemHoverBg = isDark ? 'rgba(255,247,240,0.06)' : 'rgba(201,100,66,0.08)'; const itemActiveBg = isDark ? 'rgba(201,100,66,0.18)' : 'var(--momo-accent)'; const itemActiveText = isDark ? '#faf7f0' : '#faf7f0'; const itemActiveBorder = 'var(--momo-accent)'; const groupTitle = isDark ? 'rgba(255,247,240,0.4)' : 'var(--momo-text-tertiary)'; const borderC = isDark ? 'rgba(255,247,240,0.08)' : 'var(--momo-border-light)'; return ( ); }; // ===== Topbar ===== const Topbar = ({ onToggleSidebar, onOpenCmd }) => ( e.currentTarget.style.background = 'var(--momo-bg-subtle)'} onMouseLeave={e => e.currentTarget.style.background = 'transparent'}> { e.currentTarget.style.background = '#fff'; }} onMouseLeave={e => { e.currentTarget.style.background = 'var(--momo-bg-paper)'; }} > 搜尋商品名稱、編號、品牌⋯ ⌘K {/* 排程徽章 */} 下次排程 13:00 e.currentTarget.style.background = 'var(--momo-bg-subtle)'} onMouseLeave={e => e.currentTarget.style.background = 'transparent'}> e.currentTarget.style.background = 'var(--momo-bg-subtle)'} onMouseLeave={e => e.currentTarget.style.background = 'transparent'}> e.currentTarget.style.background = 'var(--momo-bg-subtle)'} onMouseLeave={e => e.currentTarget.style.background = 'transparent'}> 蜡蜡佯 管理員 ); Object.assign(window, { Sidebar, Topbar, NAV_GROUPS });