"use client"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { useAuth } from "@/lib/auth"; export default function Sidebar() { const pathname = usePathname(); const { user, logout } = useAuth(); const navItems = [ // Dashboard para todos: el equipo ve el global (o su área) y los // usuarios normales ven solo sus tickets (sin mensaje de permisos). { href: "/", icon: "bi-speedometer2", label: "Dashboard" }, { href: "/tickets", icon: "bi-ticket-detailed", label: "Tickets" }, { href: "/knowledge-base", icon: "bi-journal-bookmark", label: "Knowledge Base" }, ]; const configItems = [ { href: "/settings/departments", icon: "bi-diagram-3", label: "Departamentos" }, { href: "/settings/team", icon: "bi-people", label: "Equipo" }, { href: "/settings/sla", icon: "bi-stopwatch", label: "SLA" }, { href: "/settings/email", icon: "bi-envelope", label: "Correo" }, ]; const isActive = (href: string) => pathname === href || (href !== "/" && pathname.startsWith(href)); const fullName = user ? `${user.nombres} ${user.apPaterno}` : "Usuario"; const isAdmin = user?.role === "admin"; const roleLabel = user?.role === "admin" ? "Administrador" : user?.role === "supervisor" ? "Supervisor" : user?.role === "agent" ? "Agente" : "Usuario"; const initials = user?.nombres ?.split(" ") .map((n: string) => n[0]) .join("") .toUpperCase() .slice(0, 2) || "U"; return ( ); }