// NOTE: This file is stable and usually should not be modified. // It is important that all functionality in this file is preserved, and should only be modified if explicitly requested. import { ChevronDown, LogOut, UserIcon, UserPlus } from 'lucide-react'; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, } from '@/components/ui/dropdown-menu.tsx'; import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar.tsx'; import { RelaySelector } from '@/components/RelaySelector'; import { useLoggedInAccounts, type Account } from '@/hooks/useLoggedInAccounts'; import { genUserName } from '@/lib/genUserName'; interface AccountSwitcherProps { onAddAccountClick: () => void; } export function AccountSwitcher({ onAddAccountClick }: AccountSwitcherProps) { const { currentUser, otherUsers, setLogin, removeLogin } = useLoggedInAccounts(); if (!currentUser) return null; const getDisplayName = (account: Account): string => { return account.metadata.name ?? genUserName(account.pubkey); } return (
Switch Relay
Switch Account
{otherUsers.map((user) => ( setLogin(user.id)} className='flex items-center gap-2 cursor-pointer p-2 rounded-md' > {getDisplayName(user)?.charAt(0) || }

{getDisplayName(user)}

{user.id === currentUser.id &&
}
))} Add another account removeLogin(currentUser.id)} className='flex items-center gap-2 cursor-pointer p-2 rounded-md text-red-500' > Log out
); }