import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar' import { Button } from '@/components/ui/button' import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from '@/components/ui/dropdown-menu' import { toWallet } from '@/lib/link' import { formatPubkey, generateImageByPubkey } from '@/lib/pubkey' import { usePrimaryPage, useSecondaryPage } from '@/PageManager' import { useNostr } from '@/providers/NostrProvider' import { ArrowDownUp, LogIn, LogOut, UserRound, Wallet } from 'lucide-react' import { useState } from 'react' import { useTranslation } from 'react-i18next' import LoginDialog from '../LoginDialog' import LogoutDialog from '../LogoutDialog' import SidebarItem from './SidebarItem' export default function AccountButton() { const { pubkey } = useNostr() if (pubkey) { return } else { return } } function ProfileButton() { const { t } = useTranslation() const { account, profile } = useNostr() const pubkey = account?.pubkey const { navigate } = usePrimaryPage() const { push } = useSecondaryPage() const [loginDialogOpen, setLoginDialogOpen] = useState(false) const [logoutDialogOpen, setLogoutDialogOpen] = useState(false) if (!pubkey) return null const defaultAvatar = generateImageByPubkey(pubkey) const { username, avatar } = profile || { username: formatPubkey(pubkey), avatar: defaultAvatar } return ( navigate('profile')}> {t('Profile')} push(toWallet())}> {t('Wallet')} setLoginDialogOpen(true)}> {t('Switch account')} setLogoutDialogOpen(true)} > {t('Logout')} ) } function LoginButton() { const { checkLogin } = useNostr() return ( checkLogin()} title="Login"> ) }