import { useState } from 'react' import { Link, useLocation, useNavigate } from 'react-router-dom' import { useAuth } from '../context/AuthContext' import { IconTicket, IconUsers, IconTargetArrow, IconReportMoney, IconFolders, IconCalendar, IconRoute, IconLayoutDashboard, IconSettings, IconLogout, IconLayoutSidebarLeftCollapse, IconLayoutSidebarLeftExpand, } from '@tabler/icons-react' export default function Sidebar() { const { user, logout, isAdmin } = useAuth() const navigate = useNavigate() const location = useLocation() const [collapsed, setCollapsed] = useState(false) const handleLogout = async () => { await logout() navigate('/login') } const groups = [ { label: 'Betrieb', links: [ { label: 'Tickets', href: '/tickets', icon: }, { label: 'Planboard', href: '/planboard', icon: }, { label: 'Roadmaps', href: '/roadmaps', icon: }, { label: 'Projekte', href: '/projects', icon: }, ], }, { label: 'CRM', links: [ { label: 'Kunden', href: '/customers', icon: }, { label: 'Leads', href: '/leads', icon: }, ], }, { label: 'Finanzen', links: [{ label: 'Finanzen', href: '/finance', icon: }], }, { label: 'Auswertung', links: [ { label: 'Dashboard', href: '/dashboard', icon: }, ], }, { label: 'System', links: [ ...(isAdmin ? [{ label: 'Admin', href: '/admin', icon: }] : []), ], }, ] const isActive = (href) => location.pathname === href || location.pathname.startsWith(href + '/') return ( ) }