From d15ea28e8f1ca87075d7453987eed07f0e4e1275 Mon Sep 17 00:00:00 2001 From: Vantz Stockwell Date: Sun, 22 Feb 2026 02:56:39 -0500 Subject: [PATCH] feat: Restructure sidebar nav into section-grouped menu Replaces flat 25-item navItems array with 6 labeled sections: Dashboard, Server, Plugin Configs, Operations, Monitoring, Management. Section headers only render when at least one item is visible to the user's permissions. Platform Admin section restyled to match. Co-Authored-By: Claude Opus 4.6 --- .../src/components/layout/DashboardLayout.vue | 141 ++++++++++++------ 1 file changed, 92 insertions(+), 49 deletions(-) diff --git a/frontend/src/components/layout/DashboardLayout.vue b/frontend/src/components/layout/DashboardLayout.vue index cf72b62..b72fafc 100644 --- a/frontend/src/components/layout/DashboardLayout.vue +++ b/frontend/src/components/layout/DashboardLayout.vue @@ -44,34 +44,67 @@ const auth = useAuthStore() const server = useServerStore() const sidebarOpen = ref(false) -const navItems = [ - { name: 'Dashboard', path: '/', icon: LayoutDashboard, permission: null }, - { name: 'Server', path: '/server', icon: Server, permission: 'server.view' }, - { name: 'Console', path: '/console', icon: Terminal, permission: 'console.view' }, - { name: 'Players', path: '/players', icon: Users, permission: 'players.view' }, - { name: 'Plugins', path: '/plugins', icon: Puzzle, permission: 'plugins.view' }, - { name: 'File Manager', path: '/files', icon: FolderOpen, permission: 'files.view' }, - { name: 'Loot Builder', path: '/loot-builder', icon: Crosshair, permission: 'loot.view' }, - { name: 'Teleport Config', path: '/teleport-config', icon: Navigation2, permission: 'teleport.view' }, - { name: 'Gather Rates', path: '/gather-manager', icon: Pickaxe, permission: 'gather.view' }, - { name: 'Auto Doors', path: '/autodoors', icon: DoorOpen, permission: 'autodoors.view' }, - { name: 'Kits', path: '/kits', icon: Gift, permission: 'kits.view' }, - { name: 'Furnace Splitter', path: '/furnace-splitter', icon: Flame, permission: 'furnacesplitter.view' }, - { name: 'Better Chat', path: '/better-chat', icon: MessageSquare, permission: 'betterchat.view' }, - { name: 'Timed Execute', path: '/timed-execute', icon: Clock, permission: 'timedexecute.view' }, - { name: 'Raidable Bases', path: '/raidable-bases', icon: Swords, permission: 'raidablebases.view' }, - { name: 'Auto-Wiper', path: '/wipes', icon: RefreshCw, permission: 'wipes.view' }, - { name: 'Maps', path: '/maps', icon: Map, permission: 'maps.view' }, - { name: 'Chat Log', path: '/chat', icon: MessageSquare, permission: 'chat.view' }, - { name: 'Analytics', path: '/analytics', icon: BarChart3, permission: 'analytics.view' }, - { name: 'Schedules', path: '/schedules', icon: Clock, permission: 'schedules.view' }, - { name: 'Alerts', path: '/alerts', icon: AlertTriangle, permission: 'alerts.view' }, - { name: 'Notifications', path: '/notifications', icon: Bell, permission: 'notifications.view' }, - { name: 'Team', path: '/team', icon: UserPlus, permission: null }, - { name: 'Store', path: '/store/config', icon: ShoppingBag, permission: 'store.view' }, - { name: 'Modules', path: '/modules', icon: Package, permission: 'modules.view' }, - { name: 'Changelog', path: '/changelog', icon: FileText, permission: 'changelog.view' }, - { name: 'Settings', path: '/settings', icon: Settings, permission: 'settings.view' }, +type NavItem = { name: string; path: string; icon: any; permission: string | null } +type NavSection = { label: string; items: NavItem[] } + +const navSections: NavSection[] = [ + { + label: '', + items: [ + { name: 'Dashboard', path: '/', icon: LayoutDashboard, permission: null }, + ], + }, + { + label: 'Server', + items: [ + { name: 'Server', path: '/server', icon: Server, permission: 'server.view' }, + { name: 'Console', path: '/console', icon: Terminal, permission: 'console.view' }, + { name: 'Players', path: '/players', icon: Users, permission: 'players.view' }, + { name: 'Plugins', path: '/plugins', icon: Puzzle, permission: 'plugins.view' }, + { name: 'File Manager', path: '/files', icon: FolderOpen, permission: 'files.view' }, + ], + }, + { + label: 'Plugin Configs', + items: [ + { name: 'Loot Builder', path: '/loot-builder', icon: Crosshair, permission: 'loot.view' }, + { name: 'Teleport', path: '/teleport-config', icon: Navigation2, permission: 'teleport.view' }, + { name: 'Gather Rates', path: '/gather-manager', icon: Pickaxe, permission: 'gather.view' }, + { name: 'Auto Doors', path: '/autodoors', icon: DoorOpen, permission: 'autodoors.view' }, + { name: 'Kits', path: '/kits', icon: Gift, permission: 'kits.view' }, + { name: 'Furnace Splitter', path: '/furnace-splitter', icon: Flame, permission: 'furnacesplitter.view' }, + { name: 'Better Chat', path: '/better-chat', icon: MessageSquare, permission: 'betterchat.view' }, + { name: 'Timed Execute', path: '/timed-execute', icon: Clock, permission: 'timedexecute.view' }, + { name: 'Raidable Bases', path: '/raidable-bases', icon: Swords, permission: 'raidablebases.view' }, + ], + }, + { + label: 'Operations', + items: [ + { name: 'Auto-Wiper', path: '/wipes', icon: RefreshCw, permission: 'wipes.view' }, + { name: 'Maps', path: '/maps', icon: Map, permission: 'maps.view' }, + { name: 'Schedules', path: '/schedules', icon: Clock, permission: 'schedules.view' }, + ], + }, + { + label: 'Monitoring', + items: [ + { name: 'Chat Log', path: '/chat', icon: MessageSquare, permission: 'chat.view' }, + { name: 'Analytics', path: '/analytics', icon: BarChart3, permission: 'analytics.view' }, + { name: 'Alerts', path: '/alerts', icon: AlertTriangle, permission: 'alerts.view' }, + { name: 'Notifications', path: '/notifications', icon: Bell, permission: 'notifications.view' }, + ], + }, + { + label: 'Management', + items: [ + { name: 'Team', path: '/team', icon: UserPlus, permission: null }, + { name: 'Store', path: '/store/config', icon: ShoppingBag, permission: 'store.view' }, + { name: 'Modules', path: '/modules', icon: Package, permission: 'modules.view' }, + { name: 'Changelog', path: '/changelog', icon: FileText, permission: 'changelog.view' }, + { name: 'Settings', path: '/settings', icon: Settings, permission: 'settings.view' }, + ], + }, ] const adminNavItems = [ @@ -96,10 +129,14 @@ function closeSidebar() { sidebarOpen.value = false } -function canShowNavItem(item: typeof navItems[0]): boolean { +function canShowNavItem(item: NavItem): boolean { if (!item.permission) return true return auth.hasPermission(item.permission) } + +function hasVisibleItems(section: NavSection): boolean { + return section.items.some(canShowNavItem) +}