diff --git a/panel/src/components/Layout.tsx b/panel/src/components/Layout.tsx index 5cd5a97..73c8504 100644 --- a/panel/src/components/Layout.tsx +++ b/panel/src/components/Layout.tsx @@ -27,25 +27,165 @@ interface NavItem { icon: React.ComponentType<{ className?: string }>; } -const adminNavItems: NavItem[] = [ - { path: "/admin", label: "Dashboard", icon: LayoutDashboard }, - { path: "/admin/users", label: "Users", icon: Users }, - { path: "/admin/items", label: "Items", icon: Package }, - { path: "/admin/classes", label: "Classes", icon: GraduationCap }, - { path: "/admin/quests", label: "Quests", icon: Scroll }, - { path: "/admin/lootdrops", label: "Lootdrops", icon: Gift }, - { path: "/admin/moderation", label: "Moderation", icon: Shield }, - { path: "/admin/transactions", label: "Transactions", icon: ArrowLeftRight }, - { path: "/admin/settings", label: "Settings", icon: Settings }, - { path: "/games", label: "Games", icon: Gamepad2 }, +interface NavGroup { + label: string | null; + items: NavItem[]; +} + +const adminNavGroups: NavGroup[] = [ + { + label: "Administration", + items: [ + { path: "/admin", label: "Dashboard", icon: LayoutDashboard }, + { path: "/admin/users", label: "Users", icon: Users }, + { path: "/admin/items", label: "Items", icon: Package }, + { path: "/admin/classes", label: "Classes", icon: GraduationCap }, + { path: "/admin/quests", label: "Quests", icon: Scroll }, + { path: "/admin/lootdrops", label: "Lootdrops", icon: Gift }, + { path: "/admin/moderation", label: "Moderation", icon: Shield }, + { path: "/admin/transactions", label: "Transactions", icon: ArrowLeftRight }, + { path: "/admin/settings", label: "Settings", icon: Settings }, + ], + }, + { + label: "Player", + items: [ + { path: "/dashboard", label: "Dashboard", icon: LayoutDashboard }, + { path: "/games", label: "Games", icon: Gamepad2 }, + { path: "/leaderboards", label: "Leaderboards", icon: Trophy }, + ], + }, ]; -const playerNavItems: NavItem[] = [ - { path: "/dashboard", label: "Dashboard", icon: LayoutDashboard }, - { path: "/games", label: "Games", icon: Gamepad2 }, - { path: "/leaderboards", label: "Leaderboards", icon: Trophy }, +const playerNavGroups: NavGroup[] = [ + { + label: null, + items: [ + { path: "/dashboard", label: "Dashboard", icon: LayoutDashboard }, + { path: "/games", label: "Games", icon: Gamepad2 }, + { path: "/leaderboards", label: "Leaderboards", icon: Trophy }, + ], + }, ]; +function SidebarNavItem({ + path, + label, + icon: Icon, + active, + showLabel, + onNavigate, +}: NavItem & { active: boolean; showLabel: boolean; onNavigate: (path: string) => void }) { + return ( + + ); +} + +function SidebarNavSection({ + group, + index, + showLabels, + isActive, + onNavigate, +}: { + group: NavGroup; + index: number; + showLabels: boolean; + isActive: (path: string) => boolean; + onNavigate: (path: string) => void; +}) { + return ( +