From 37248384835dc43e5cbdd0f2fc31207a2f58f8ff Mon Sep 17 00:00:00 2001 From: Montana Wong Date: Mon, 31 Aug 2026 15:59:13 -0400 Subject: [PATCH] feat(vibenet): add copy-address button to account dropdown rows --- app/vibenet/demos/_shared/AccountSwitcher.tsx | 69 ++++++++++++++----- 1 file changed, 50 insertions(+), 19 deletions(-) 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} + ); };