"use client"; import { cn } from "@/lib/utils"; import { ScrollArea } from "@/components/ui/scroll-area"; import { motion, AnimatePresence } from "framer-motion"; import { ChevronsUpDown, LogOut, MessagesSquare, UserCircle, UserPlus, X, Menu, } from "lucide-react"; import Image from "next/image"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { useState, useCallback } from "react"; import { Button } from "@/components/ui/button"; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; import { Separator } from "@/components/ui/separator"; import { signOut } from "@/utils/profile/profile"; const variants = { open: { x: 0, opacity: 1, transition: { x: { stiffness: 1000, velocity: -100 } }, }, closed: { x: -20, opacity: 0, transition: { x: { stiffness: 100 } }, }, }; const staggerVariants = { open: { transition: { staggerChildren: 0.03, delayChildren: 0.02 }, }, }; const navItems = [ { label: "Rooms", href: "/rooms", icon: MessagesSquare, }, { label: "Friends", href: "/friends", icon: UserPlus, }, { label: "Profile", href: "/profile", icon: UserCircle, }, ]; function SidebarContent({ isCollapsed, displayName, email, avatarUrl, onNavigate, }: { isCollapsed: boolean; displayName: string; email: string; avatarUrl: string; onNavigate?: () => void; }) { const pathname = usePathname(); return (
{/* Header / brand */}
{/* Navigation */}
{navItems.map((item) => { const active = pathname === item.href; const Icon = item.icon; return ( {!isCollapsed && (

{item.label}

)}
); })}
{/* User section */}
{avatarUrl ? ( ) : (
{displayName.charAt(0).toUpperCase()}
)}
{!isCollapsed && ( <>

{displayName}

)}
{avatarUrl ? ( ) : (
{displayName.charAt(0).toUpperCase()}
)}
{displayName} {email}
Profile e.preventDefault()} >
); } export function Sidebar({ displayName, email, avatarUrl, }: Readonly<{ displayName: string; email: string; avatarUrl: string; }>) { const [mobileOpen, setMobileOpen] = useState(false); const closeMobile = useCallback(() => setMobileOpen(false), []); return ( <> {/* Mobile hamburger button — visible on small screens */} {/* Mobile overlay sidebar */} {mobileOpen && ( <> {/* Backdrop */} {/* Sidebar panel */}
)}
{/* Desktop sidebar — always open */}
); }