diff --git a/app/vibenet/demos/_shared/AccountSwitcher.tsx b/app/vibenet/demos/_shared/AccountSwitcher.tsx index 71da24e..6517477 100644 --- a/app/vibenet/demos/_shared/AccountSwitcher.tsx +++ b/app/vibenet/demos/_shared/AccountSwitcher.tsx @@ -7,13 +7,45 @@ import { useState } from 'react'; import { Popover } from '@base-ui/react/popover'; +import { MorphIcon } from 'morphicons/react'; import { cn } from '../../../components/ui/cn'; +import { CHECK_MORPH_ICON, CLIPBOARD_MORPH_ICON } from '../../../components/ui/icons'; import { Text } from '../../../components/ui/Text'; import type { StoredAccount } from '../account/library/model'; import { ChevronIcon, CreateRowButton, DeleteConfirmButton } from './dropdown'; import { AccountAvatar, AccountIdentity, Badge } from './primitives'; +// Icon-only button that copies an account's address; swaps to a green check for +// 2s after copying. Matches the sibling Details button's styling. +function CopyAddressButton({ address, label }: { address: string; label: string }) { + const [copied, setCopied] = useState(false); + + const handleCopy = async () => { + await navigator.clipboard.writeText(address); + setCopied(true); + setTimeout(() => setCopied(false), 2000); + }; + + return ( + + ); +} + function InfoIcon() { return ( - {onDetails || onDelete ? ( - - {onDetails ? ( - - ) : null} - {onDelete ? onDelete(a.id)} label={a.label} /> : null} - - ) : null} + + + {onDetails ? ( + + ) : null} + {onDelete ? onDelete(a.id)} label={a.label} /> : null} + ); };