"use client" import { useState } from "react" import Link from "next/link" import { usePathname } from "next/navigation" import { motion, AnimatePresence } from "framer-motion" import { cn } from "@/lib/utils" import { SystemMonitor } from "./system-monitor" import { Button } from "@/components/ui/button" import { Avatar, AvatarImage, AvatarFallback } from "@/components/ui/avatar" import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip" import { LayoutDashboard, Users, Settings, ChevronLeft, ChevronRight, Building2, PanelLeftClose, MessageSquare, Bot, Facebook, Calendar, } from "lucide-react" import { useUser } from "@/providers/user-provider" import { useNotifications } from "@/providers/notification-provider" import { FacebookAccountsDialog } from "@/components/settings/facebook-accounts-dialog" const navItems = [ { href: "/dashboard", label: "Dashboard", icon: LayoutDashboard }, { href: "/leads", label: "Leads", icon: Users }, { href: "/calendar", label: "Calendar", icon: Calendar }, { href: "/chats", label: "Chats", icon: MessageSquare }, { href: "/ai-assistant", label: "AI Assistant", icon: Bot, roles: ["sales", "admin", "super_admin"] }, { href: "/users", label: "Users", icon: Building2 }, { href: "/settings", label: "Settings", icon: Settings }, ] interface SidebarProps { collapsed: boolean onToggle: () => void mobileOpen: boolean onMobileClose: () => void } export function Sidebar({ collapsed, onToggle, mobileOpen, onMobileClose }: SidebarProps) { const pathname = usePathname() const { user } = useUser() const { unreadChatCount } = useNotifications() const [fbDialogOpen, setFbDialogOpen] = useState(false) if (!user) return null const isAdmin = user.role === "admin" || user.role === "super_admin" const initials = user.name.split(" ").map((n) => n[0]).join("") const sidebarContent = (
{user.name}
{user.role}