feat(frontend): command palette, live timestamps, printable record & quote delta (#296 #297 #298 #299) - #367
Open
spotkorner-dot wants to merge 5 commits into
Conversation
|
@spotkorner-dot 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
Four UX enhancements for the Vortex frontend, one commit each:
Cmd/Ctrl+Kcommand palette for keyboard navigationCloses #296
Closes #297
Closes #298
Closes #299
Changes
#298 – Command palette (
Cmd/Ctrl+K)src/components/CommandPalette.tsx: globalkeydownlistener toggles aWAI-ARIA combobox/listbox modal. Navigates the four top-level routes; a pasted
Stellar public key routes to
/solve/[address], any other whitespace-freetoken that matches no route is offered as an
/explore/[id]lookup. Fullkeyboard operation (arrows wrap,
Enteractivates,Esc/backdrop close),focus is moved in on open and restored on close.
src/app/layout.tsx.src/components/CommandPalette.test.tsx(8 cases),e2e/command-palette.spec.ts,and a
docs/components.mdentry.ExplorePageClientconvention and avoiding edits to the (currently out-of-sync) i18n catalogs.
#299 – Live relative timestamps
src/hooks/useLiveRelativeTime.ts: one shared 45s interval returning anowtimestamp; pauses onvisibilitychange(same pattern asuseWebSocket)and clears on unmount. One interval per list, not one timer per row.
ActivityFeed.tsx,ExplorePageClient.tsx, andmy-intents/page.tsx(
timeAgo(iso, now)), the latter gaining a "submitted … ago" line per row.useLiveRelativeTime.test.tsandExplorePageClient.test.tsx(new), thelatter asserting the label advances on its own as time passes.
#296 – Printable intent record
explore/[id]/page.tsx: aprint:hidden"Print / Save as PDF" button callingwindow.print(); the summary card is wrapped as#intent-recordwith aprint-only header; any non-
filledintent shows a "not a completed-swaprecord" notice so a mid-flight print can't be mistaken for a receipt. The
"Submitted" field now shows an absolute timestamp.
@media printblock insrc/app/globals.cssstripsnav/footerandinteractive chrome and renders the record black-on-white.
stays legible in greyscale.
#297 – Quote-change delta indicator
SwapCard.tsxtracks the immediately-previous quote for the same route(chain + token pair) in a ref. When a fresh same-route quote moves the output
amount or price impact, a small ▲/▼ badge (green = better for the user, amber =
worse) shows next to that field and fades after 4s. No delta on the first
quote for a route or after a token/route change.
SwapCard.delta.test.tsx(new, 4 cases): improves / worsens / first-quote /route-change.
swap.quote.noSolver,swap.quote.highPriceImpactWarning)added to
en/es.Testing
npm run build– blocked by pre-existing breakage (see below)npx tsc --noEmit– blocked by pre-existing breakage (see below)CommandPalette.test.tsx8/8useLiveRelativeTime.test.ts3/3,ExplorePageClient.test.tsx2/2explore/[id]/page.test.tsx11/11 (was 0/8),my-intents/page.test.tsx18/19 (was 0/17)ActivityFeed.test.tsx10/10 (was 0/10)SwapCard.test.tsx14/14 (was 0/14, file didn't collect),SwapCard.delta.test.tsx4/4(52 new tests added, all green; 17 pre-existing failures fixed as a side effect
of repairing files these features touch).
Pre-existing breakage (not introduced here)
maindoes not build, typecheck, lint, or pass its own test suite atc87dc14. Root cause: PRs #217/#218/#219 were merged withMerge branch main into feature/…conflict resolutions that kept both sides, leaving duplicatedeclarations, half-applied features, and test files from divergent branches.
To ship these four features the following files had to be repaired just enough
to compile and render (their existing test suites are exercised above):
src/components/SwapCard.tsx– had ~42 type errors (duplicatechainPickerRef/chainToggleRef/closeChainPicker/useEffect; undefineddstAddress,slippagePct,quoteFetchedAt,STALE_QUOTE_THRESHOLD_MS,quoteErrorType).The dropped slippage-tolerance field + min-out line were restored (both have
en/eskeys and are required by the existingSwapCard.test.tsx); theamount input is now
type="text" inputMode="decimal"so 18-dp values aren'treformatted.
src/components/ActivityFeed.tsx– duplicateexport, undefineduseTranslation/announcement/FeedSkeleton/ActivityFeedView; rebuiltwithout i18n (matching
ExplorePageClient) and with the debounced live-regionannouncement its test expects.
src/app/explore/[id]/page.tsx–CopyButton/copy/copiedundefined.src/app/my-intents/page.tsx–downloadCsv/buildIntentsCsvnot imported,duplicate status badge, over-riding
aria-labels.Still red and left untouched (out of scope): the 3 files with unresolved
merge-conflict markers that block a full
tsc/build(
src/app/explore/page.tsx,src/app/solve/page.tsx,src/app/solve/[address]/page.test.tsx);Nav.tsx/ConnectWalletButton.tsx/wallet.ts(mocked in the touched test suites); the i18n catalog key-paritygap;
*.stories.tsx.my-intents/page.test.tsx's "retry button" case referencesundefined
user/mutateMockin the test body and cannot pass without a testrewrite.
Print-preview screenshots for #296 could not be captured because the app does
not currently run; the print trigger is covered by a mocked
window.printtest.Checklist