Repository navigation
Toast confirmation + responsive fix, wallet refresh, App offline/404 handling, and sim/sequence/account-switch fixes - #987
Open
Themancalledpg wants to merge 5 commits into
Conversation
…ell/LabelledValue (Sorokit#964) Adds a success toast when copying a value from InfoCell/LabelledValue, and fixes the label/value overlap on screens narrower than 360px by giving the grid in AccountCard a single-column fallback and adding min-w-0/break-words to both components so their text can shrink and wrap instead of overflowing.
…s restore (Sorokit#965) Adds a manual Refresh button and a touch-based pull-to-refresh gesture (new usePullToRefresh hook) to WalletScreen, both calling refreshAccount(). While wiring this up, found that the QR modal's "Show QR" button was never registered as the Radix Dialog's trigger (open/close was driven externally via onOpenChange with no <Dialog.Trigger>), so Dialog's own onCloseAutoFocus handler pre-empted FocusScope's restore and focus silently fell back to document.body on close instead of returning to the button that opened it. Fixed by wrapping the trigger button in <Dialog.Trigger asChild>. Also mocks @/context/ToastContext in NetworkScreen's test files, which started rendering InfoCell without a ToastProvider after Sorokit#964 added a useToast() call inside InfoCell.
…pp (Sorokit#966) Adds an OfflineBanner that listens for the browser's online/offline events and shows a persistent notice while connectivity is down, a visually-hidden "Skip to main content" link that's the first focusable element on the page, and a NotFoundCard shown for any URL that doesn't match a known dashboard path (sectionForPath previously fell back to "wallet" silently for any unmapped path, which is what a visitor landing on an unknown route actually saw instead of a blank layout). Added isKnownPath to nav-routes.ts so App can tell "unmapped path" apart from a normal section route. The 404 card takes priority over both the connect screen and the dashboard, so it shows for an unknown path whether or not the wallet is connected.
…count-switch draft reset (Sorokit#967) Three integration-test gaps from the issue each pointed to a real missing behavior, not just missing coverage: - SorobanPanel: disconnecting the wallet while a simulate/invoke call was in flight had no handling at all, so the stale request would land with no reconnect path other than refreshing the page. Added a "disconnected" state: an effect watching isConnected aborts the in-flight AbortController and shows a reconnect prompt instead. - TransactionPanel: a tx_bad_seq submission error only ever showed a friendly message asking the user to "refresh and try again" manually. Added isSequenceError() (factored out of friendlyError's existing substring check) and call refreshAccount() automatically when it matches. - TransactionPanel: the draft payment form (destination/amount/memo) was never cleared when the active account changed. This app has no in-place "switch account" primitive, since address only ever changes via disconnect (to null) then reconnecting as a possibly-different account, so the new effect clears the draft on any address change, including through a disconnect, rather than risking a stale draft getting submitted against the new account. Added integration tests for all three in wallet-flow.test.tsx, rendering SorobanPanel/TransactionPanel against a real SorokitProvider and mock client rather than asserting against mocked hook state.
|
@Themancalledpg Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Batches four assigned issues: a copy-confirmation toast and responsive overlap fix for InfoCell/LabelledValue, a manual and pull-to-refresh flow for WalletScreen (plus a real pre-existing focus-restore bug found while building it), an offline banner/skip-link/404 fallback for App, and three real missing behaviors in SorobanPanel/TransactionPanel around wallet disconnect, sequence desync, and account switching.
closes #964
closes #965
closes #966
closes #967
Changes
Add copy action and responsive label wrapping in InfoCell & LabelledValue #964 - Copy toast and responsive overlap fix: InfoCell and LabelledValue now show a success toast ("X Copied") after a successful clipboard copy, using the existing useToast() context. Root-caused the reported "label overlaps value on narrow screens" to AccountCard's non-responsive
grid-cols-2combined with missingmin-w-0on the grid children; fixed the grid to fall back to a single column below 360px and addedmin-w-0/break-wordsinside both components so they are robust regardless of their container.Add pull-to-refresh on mobile and focus trap in WalletScreen #965 - Manual + pull-to-refresh on WalletScreen: Added a Refresh button next to Disconnect (shows
isLoadingAccountvia the existing Buttonloadingprop) and a newusePullToRefreshhook implementing a touch-based pull-to-refresh gesture, armed only when the scroll container is already atscrollTop === 0. Both callrefreshAccount(). While writing the focus-trap test for the existing QR modal, found the "Show QR" button was never registered as the RadixDialog's trigger (it only droveopenexternally viaonOpenChange), soDialog's ownonCloseAutoFocushandler pre-emptedFocusScope's restore-on-close and silently left focus ondocument.bodyinstead of returning it to the button that opened the modal. Fixed by wrapping the trigger in<Dialog.Trigger asChild>. Also discovered and fixed a regression this toast change caused inNetworkScreen's two test files (InfoCell now callsuseToast(), which they rendered without mocking).Add global offline status banner and skip-to-content link in App.tsx #966 - Offline banner, skip link, 404 fallback in App: Added an
OfflineBannerlistening to the browser'sonline/offlineevents, a visually-hidden "Skip to main content" link that is the first focusable element on the page, and aNotFoundCardfor any URL that does not match a known section path.sectionForPathpreviously fell back to"wallet"silently for literally any unmapped path, so an unknown route silently rendered the wallet section rather than erroring loudly or showing nothing; addedisKnownPathtonav-routes.tsso App can tell the two cases apart. The 404 card takes priority over both the connect screen and the dashboard so it shows regardless of connection state.Handle wallet disconnect during simulation and ledger desync in wallet-flow.test.tsx #967 - Disconnect-during-simulation, sequence resync, account-switch draft reset: All three acceptance criteria described real missing behavior, not just missing tests.
SorobanPanel: added a"disconnected"state. An effect watchingisConnectedaborts the in-flight simulate/invokeAbortControllerand shows a reconnect prompt (with a "Reconnect wallet" button) if the wallet disconnects while a request is pending, instead of leaving a stale loading spinner or a misleading generic error.TransactionPanel: factoredisSequenceError()out offriendlyError's existingtx_bad_seq/"bad sequence" substring check, and now callsrefreshAccount()automatically when a submission fails with a stale sequence, instead of only telling the user to refresh manually.TransactionPanel: the draft payment form (destination/amount/memo/asset) was never cleared on an account change. This app has no in-place "switch account" primitive (addressonly ever changes via disconnect tonull, then reconnecting as a possibly different account), so the new effect clears the draft on anyaddresschange, including through a disconnect, rather than risking a stale draft being submitted against the newly active account.Test plan
src/components/ui/InfoCell.test.tsx/LabelledValue.test.tsx: added toast-confirmation tests and aresponsive wrapping (#964)describe block (26 tests total, all passing).src/screens/WalletScreen.test.tsx: addedmanual refresh (#965),pull-to-refresh (#965), andQR modal accessibility (#965)describe blocks (21 tests total, all passing, including the focus-trap/restore test against the real Radix behavior).src/screens/NetworkScreen.test.tsx/NetworkScreen.race.test.tsx: added auseToastmock to fix the regression from Add copy action and responsive label wrapping in InfoCell & LabelledValue #964 (both files fully passing again).src/App.test.tsx: addedoffline banner (#966),skip-to-content link (#966), and404 fallback for unknown routes (#966)describe blocks (17 tests total, all passing).src/__tests__/wallet-flow.test.tsx: added three new integration tests renderingSorobanPanel/TransactionPanelagainst a realSorokitProviderand mock client (not just mocked hook state) for each Handle wallet disconnect during simulation and ledger desync in wallet-flow.test.tsx #967 scenario: disconnect mid-simulate, tx_bad_seq auto-refetch, and account-switch draft reset.npx vitest runpasses 1916/1916 tests across all 100 test files.npx tsc --noEmit -p .andnpx eslint src/are both clean.Pre-existing, unrelated to this PR:
build:contentandcheck:linksare known to be red on a clean checkout of main in this org's sibling repos; not applicable here since this repo has no such scripts, but noting per standing disclosure practice. No other pre-existing failures were found; the full test suite was green before and after this batch aside from the one regression (#965/NetworkScreen) that this PR itself fixes.