import { Avatar, AvatarFallback, AvatarImage, } from '@affine/admin/components/ui/avatar'; import { Button } from '@affine/admin/components/ui/button'; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, } from '@affine/admin/components/ui/dropdown-menu'; import { CircleUser, MoreVertical } from 'lucide-react'; import { useCallback } from 'react'; import { toast } from 'sonner'; import { useCurrentUser, useRevalidateCurrentUser } from '../common'; export function UserDropdown() { const currentUser = useCurrentUser(); const relative = useRevalidateCurrentUser(); const handleLogout = useCallback(() => { fetch('/api/auth/sign-out') .then(() => { toast.success('Logged out successfully'); relative(); }) .catch(err => { toast.error(`Failed to logout: ${err.message}`); }); }, [relative]); return (