Skip to content

Clipboard Copy Button with Visual Confirmation for Wallet Addresses #480

Description

@Kingsman-99

Description

Stellar wallet addresses displayed in the app must be manually selected and copied, which is error-prone on mobile and desktop alike. Every address display should include a copy-to-clipboard button with a brief visual confirmation that the copy succeeded.

Technical Context

src/components/ui/CopyButton.tsx (new) wraps the navigator.clipboard.writeText API, falling back to document.execCommand('copy') for older browsers. The button toggles between a copy icon and a check icon from lucide-react for 2 seconds after a successful copy. src/components/invoice/RecipientRow.tsx, src/components/wallet/WalletAddress.tsx, and src/app/invoice/[id]/page.tsx all use this component. A useClipboard hook centralizes the copy logic and state.

Acceptance Criteria

  • Every rendered Stellar G-address has a copy icon button immediately adjacent to it
  • Clicking the button writes the full untruncated address to the clipboard
  • The button icon changes to a checkmark for 2 seconds, then reverts to the copy icon
  • If navigator.clipboard is unavailable, the fallback silently attempts execCommand and shows the same confirmation
  • The button has an aria-label="Copy address" and a tooltip showing "Copied!" on success
  • All CI checks (npm test, npm run build, ESLint/TypeScript) pass and the branch has no merge conflicts

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions