/** * @file components/sidebar/UserPanel.tsx * @description Client component providing a footer user panel with session information, avatar display, online status, and settings/logout actions. */ "use client"; import { LogOut, Settings } from "lucide-react"; import { signOut } from "next-auth/react"; import { UserAvatar } from "@/components/ui/UserAvatar"; import { UserStatus } from "@/db/schema"; /** * Props for the UserPanel component. */ interface UserPanelProps { /** User details including username, avatar color, and online status. */ user: { username: string; color: string; status: UserStatus; }; } /** * Renders the user panel footer containing the user's avatar, status, and action buttons. * * @param {UserPanelProps} props - Component properties. * @returns {JSX.Element} The rendered user panel component. */ export function UserPanel({ user }: UserPanelProps) { /** * Handles user logout by invalidating the local session and redirecting to the login page. */ const handleLogout = async () => { await fetch("/api/auth/logout", { method: "POST" }); await signOut({ callbackUrl: "/login" }); }; return (