import { Link, useLocation } from 'react-router' import { Button } from '@/components/ui/button' import { Sidebar, SidebarHeader, SidebarContent, SidebarFooter, SidebarNav, SidebarNavItem } from '@/components/ui/sidebar' import { useAuth } from '@/contexts/AuthContext' import { useSidebar } from '@/contexts/SidebarContext' import { Home, Settings, Users, Activity, LogOut } from 'lucide-react' const navigationItems = [ { title: 'Dashboard', href: '/dashboard', icon: Home, }, { title: 'Activity', href: '/activity', icon: Activity, }, { title: 'Settings', href: '/settings', icon: Settings, }, ] const adminNavigationItems = [ { title: 'Users', href: '/admin/users', icon: Users, }, ] export function AppSidebar() { const { user, logout } = useAuth() const { isOpen } = useSidebar() const location = useLocation() const handleLogout = async () => { try { await logout() } catch (error) { console.error('Logout failed:', error) } } if (!user) return null const allNavItems = [ ...navigationItems, ...(user.role === 'admin' ? adminNavigationItems : []) ] return (
SB
{isOpen && (

Soundboard

v2.0

)}
{allNavItems.map((item) => { const Icon = item.icon const isActive = location.pathname === item.href return ( {isOpen && item.title} ) })}
{user.picture && ( Profile )} {isOpen && (

{user.name}

{user.email}

)}
) }