import { useState } from "react"; import { useAuth } from "../contexts/AuthContext.tsx"; function AccountAvatar() { const { user, isLoading, logout } = useAuth(); const handleLogout = () => { logout(); window.location.href = "/"; }; const getInitials = (user: { name?: string; email?: string }): string => { if (user.name) { return user.name.substring(0, 2).toUpperCase(); } if (user.email) { return user.email.substring(0, 2).toUpperCase(); } return "?"; }; if (isLoading) { return
; } return ( <> {user ? (