Skip to content

feat: highlight last-used wallet provider in ConnectWalletModal (Closes #1287) - #1354

Closed
waterWang wants to merge 1 commit into
Fluxora-Org:mainfrom
waterWang:feat/remember-last-wallet-1287
Closed

feat: highlight last-used wallet provider in ConnectWalletModal (Closes #1287)#1354
waterWang wants to merge 1 commit into
Fluxora-Org:mainfrom
waterWang:feat/remember-last-wallet-1287

Conversation

@waterWang

Copy link
Copy Markdown

Summary

Adds a "Remember my last used wallet" preference that pre-highlights the last successfully connected wallet provider the next time the ConnectWalletModal opens.

Changes

  • src/lib/useLastUsedWallet.ts — New hook + utility functions for reading/writing/clearing the last-used wallet preference in localStorage. Uses useSyncExternalStore for reactive updates across tabs.
  • src/components/ConnectWalletModal.tsx — Reads the stored preference on mount; renders a "Last used" badge on the matching wallet option; saves the wallet ID to localStorage on successful Freighter connection.
  • src/components/ConnectWalletModal.module.css — Adds .lastUsedBadge style (accent-colored, uppercase, bordered pill).
  • src/components/wallet-connect/Walletcontext.tsx — Clears the stored preference on disconnect via clearLastUsedWalletId().
  • src/components/__tests__/ConnectWalletModal.test.tsx — 5 new tests covering the preference feature.

Requirements fulfilled

  • ✅ Highlighted provider gets a "Last used" badge (not just a color change)
  • ✅ Preference is scoped to browser/device (localStorage)
  • ✅ Clearing the preference (via disconnect) removes the badge on next open
  • ✅ WCAG 2.1 AA accessible (aria-label on badge, works with keyboard nav)
  • ✅ Responsive and consistent with existing design tokens

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants