'use client'; import { useName } from '@/identity/hooks/useName'; import { Spinner } from '@/internal/components/Spinner'; import { basenameSvg } from '@/internal/svg/basenameSvg'; import { base } from 'viem/chains'; import { useAccount } from 'wagmi'; import { cn, pressable, text } from '../../styles/theme'; export type WalletDropdownBasenameProps = { /** Optional className override for the element */ className?: string; }; export function WalletDropdownBasename({ className, }: WalletDropdownBasenameProps) { const { address } = useAccount(); if (!address) { return null; } // eslint-disable-next-line react-hooks/rules-of-hooks const { data: basename, isLoading } = useName({ address, chain: base, }); const hasBaseUserName = !!basename; const title = hasBaseUserName ? 'Profile' : 'Claim Basename'; const href = hasBaseUserName ? `https://www.base.org/name/${basename}` : 'https://www.base.org/names'; return (
{basenameSvg}
{isLoading ? ( ) : ( <> {title} {!hasBaseUserName && ( NEW )} )}
); }