import React from 'react'; import { useNavigate, useLocation, Link } from 'react-router-dom'; import { Home, Users, Disc, Radio, Settings, LogOut, ShoppingBag, GraduationCap, BarChart2, Shield, Box, MessageSquare, Cloud, Layers, Cpu, Heart, ListMusic, CreditCard, DollarSign, Terminal, ChevronLeft, ChevronRight, } from 'lucide-react'; import { NavItem } from '../../types'; import { useAuthStore } from '@/features/auth/store/authStore'; import { useUIStore } from '@/stores/ui'; import { cn } from '@/lib/utils'; import { Button } from '@/components/ui/button'; interface SidebarProps { currentView?: string; onNavigate?: (viewId: string) => void; onLogout?: () => void; } const navItems: { section: string; items: NavItem[] }[] = [ { section: 'My Studio', items: [ { id: 'dashboard', label: 'Command Center', icon: }, { id: 'studio', label: 'Cloud Files', icon: }, { id: 'tracks', label: 'Projects', icon: }, { id: 'gear', label: 'Gear Locker', icon: }, { id: 'analytics', label: 'Performance', icon: }, ], }, { section: 'Veza Network', items: [ { id: 'social', label: 'Community Feed', icon: }, { id: 'marketplace', label: 'Marketplace', icon: }, { id: 'live', label: 'Live Sessions', icon: , badge: 3 }, { id: 'chat', label: 'Channels', icon: , badge: 12 }, { id: 'education', label: 'Academy', icon: }, ], }, { section: 'Commerce', items: [ { id: 'sell', label: 'Seller Dashboard', icon: }, { id: 'wishlist', label: 'Wishlist', icon: }, { id: 'purchases', label: 'Purchases', icon: }, ], }, { section: 'Library', items: [ { id: 'playlists', label: 'Playlists', icon: }, { id: 'queue', label: 'Play Queue', icon: }, ], }, { section: 'System', items: [ { id: 'developer', label: 'Developer API', icon: }, { id: 'admin', label: 'Admin Panel', icon: }, ], }, ]; const routeMap: Record = { dashboard: '/dashboard', studio: '/library', tracks: '/library', gear: '/gear', analytics: '/analytics', social: '/social', marketplace: '/marketplace', live: '/live', chat: '/chat', education: '/education', sell: '/sell', wishlist: '/wishlist', purchases: '/purchases', playlists: '/playlists', queue: '/queue', developer: '/developer', admin: '/admin', settings: '/settings', }; export const Sidebar: React.FC = ({ currentView, onNavigate, onLogout }) => { const navigate = useNavigate(); const location = useLocation(); const { logout } = useAuthStore(); const { sidebarOpen, setSidebarOpen } = useUIStore(); const handleMobileNav = () => { if (window.innerWidth < 1024) setSidebarOpen(false); }; const activeView = currentView || Object.keys(routeMap).find((key) => routeMap[key] === location.pathname) || 'dashboard'; const handleLogout = () => { logout(); navigate('/login'); onLogout?.(); }; return ( <> {sidebarOpen && (
setSidebarOpen(false)} aria-hidden="true" /> )} ); };