"use client" import Link from "next/link" import Image from "next/image" import { usePathname } from "next/navigation" import { cn } from "@/lib/utils" import { LayoutDashboard, Briefcase, Users, MessageSquare, Building2, FileText, HelpCircle, Ticket } from "lucide-react" import { getCurrentUser, isAdminUser } from "@/lib/auth" import { useTranslation } from "@/lib/i18n" const Sidebar = () => { const { t } = useTranslation() const pathname = usePathname() const user = getCurrentUser() const isSuperadmin = user?.role === "superadmin" const adminItems = [ { title: t('sidebar.dashboard'), href: "/dashboard", icon: LayoutDashboard, }, { title: t('sidebar.jobs'), href: "/dashboard/jobs", icon: Briefcase, }, { title: t('sidebar.candidates'), href: "/dashboard/candidates", icon: Users, }, { title: t('sidebar.users'), href: "/dashboard/users", icon: Users, }, { title: t('sidebar.companies'), href: "/dashboard/companies", icon: Building2, }, { title: t('sidebar.backoffice'), href: "/dashboard/backoffice", icon: FileText, }, { title: t('sidebar.messages'), href: "/dashboard/messages", icon: MessageSquare, }, { title: t('sidebar.tickets'), href: "/dashboard/tickets", icon: Ticket, }, ] const companyItems = [ { title: t('sidebar.dashboard'), href: "/dashboard", icon: LayoutDashboard, }, { title: t('sidebar.my_jobs'), href: "/dashboard/my-jobs", icon: Briefcase, }, { title: t('sidebar.applications'), href: "/dashboard/applications", icon: Users, }, { title: t('sidebar.messages'), href: "/dashboard/messages", icon: MessageSquare, }, { title: t('sidebar.support'), href: "/dashboard/support", icon: HelpCircle, }, ] const candidateItems = [ { title: t('sidebar.dashboard'), href: "/dashboard", icon: LayoutDashboard, }, { title: t('sidebar.jobs'), href: "/jobs", icon: Briefcase, }, { title: t('sidebar.my_applications'), href: "/dashboard/my-applications", icon: FileText, }, { title: t('sidebar.support'), href: "/dashboard/support/tickets", icon: HelpCircle, }, ] let items = candidateItems if (isAdminUser(user)) { items = isSuperadmin ? adminItems : adminItems.filter(item => item.href !== "/dashboard/backoffice" && item.href !== "/dashboard/companies") } else if (user?.role === "company") { items = companyItems } return ( ) } export { Sidebar }