import { useState } from 'react' import { Link, useLocation, useNavigate } from 'react-router-dom' import { useAuth } from '../context/AuthContext' import { IconTicket, IconUsers, IconTargetArrow, IconReportMoney, IconScale, IconFolders, IconCalendar, IconSettings, IconLogout, IconLayoutSidebarLeftCollapse, IconLayoutSidebarLeftExpand, IconExternalLink, } from '@tabler/icons-react' import { openProjectAdmin } from '../lib/employeeAdminApi' export default function Sidebar() { const { user, logout, isAdmin } = useAuth() const navigate = useNavigate() const location = useLocation() const [collapsed, setCollapsed] = useState(false) const [switching, setSwitching] = useState(false) const handleProjectAdmin = async () => { setSwitching(true) await openProjectAdmin() } const handleLogout = async () => { await logout() navigate('/login') } // Eine flache Liste: fuer ein kleines Team reichen acht Eintraege ohne Gruppen const links = [ { label: 'Tickets', href: '/tickets', icon: }, { label: 'Planboard', href: '/planboard', icon: }, { label: 'Projekte', href: '/projects', icon: }, { label: 'Kunden', href: '/customers', icon: }, // Leads liegen auf Eis (Lead-Automatik gestoppt 2026-09-30): grau, nicht klickbar { label: 'Leads', href: '/leads', icon: , paused: true }, { label: 'Finanzen', href: '/finance', icon: }, { label: 'Rechtliches', href: '/rechtliches', icon: }, ...(isAdmin ? [{ label: 'Admin', href: '/admin', icon: }] : []), ] const isActive = (href) => location.pathname === href || location.pathname.startsWith(href + '/') return ( ) }