feat(dashboard): swap history table with miles tracking#111
Open
passandscore wants to merge 8 commits intomainfrom
Open
feat(dashboard): swap history table with miles tracking#111passandscore wants to merge 8 commits intomainfrom
passandscore wants to merge 8 commits intomainfrom
Conversation
…ve miles estimator - Add per-transaction swap history table to the dashboard (5 most recent) with "Show all" modal for full paginated history matching the leaderboard's pagination pattern - Replace slippage-based MEV pot model with historical median surplus rate (0.68%) derived from 654 recent swaps — fixes false-zero miles estimates on small/medium swaps - Show "TBD miles" with info tooltip when estimate is zero instead of misleading "No miles" label, linking to new learn article section - Add swap-submitted event bus (window events + sessionStorage) so the dashboard table polls for new rows after a swap completes, even if the user navigates to the dashboard after swapping - Fire refetchMiles when a pending row transitions to finalized so the AppHeader balance updates without a page refresh - Add "About the miles estimate" section to the miles learn article explaining the conservative estimator and what to trust instead - Surface info tooltip explaining pre-fee row totals vs post-fee header balance (2% referral fee) - Load UserSwapsTable via next/dynamic with ssr:false to prevent hydration mismatch from wagmi server/client state divergence
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Once a user is confirmed as approved (whitelisted or waitlist-approved), cache that fact in sessionStorage keyed by address. On subsequent page loads within the same tab session, React Query is seeded with initialData and staleTime: Infinity so no API call is made and no loading skeleton is shown. The cache clears naturally when the tab closes, ensuring a fresh check on the next browsing session.
The previous commit cached the approval flag but SwapOrLandingGate still started at view="landing", requiring user interaction to proceed. Now an auto-proceed effect checks the gate status on mount and transitions directly to the swap view when both isPreApproved and acceptedInvite are true — which resolves synchronously from the sessionStorage cache with no API call, no skeleton, and no landing page flash. Also tightens the cache condition: only persists to sessionStorage after the user has both been approved AND accepted the invite (clicked "Start Swapping"), so first-time approved users still see the welcome screen.
…age flash Previously the auto-proceed logic ran in a useEffect, which fires after the first render — causing a visible flash of the landing page for returning approved users. Now: 1. A `ready` flag suppresses all rendering until the mount effect runs 2. The mount effect checks sessionStorage for a cached approval 3. If found, transitions directly to swap view before any content paints 4. If not found, shows the landing page with the Check Access button The user sees one invisible frame (~16ms of null), then either swap or landing — never a flash of the wrong one.
Appends "(pre-fee)" to the miles badge on both the inline swap table and the Show All modal so the 2% referral deduction is visible at a glance, not only in the info tooltip.
The tooltip from the inline card's info icon was bleeding through the modal overlay. Removed MilesDiscrepancyInfo from the modal header — the "(pre-fee)" label on the pill already communicates the same thing.
- Polling and tab-refocus refetches no longer show the loading spinner; only the initial mount fetch shows loading feedback - Tab refocus only triggers a refetch when there are pending or awaited rows — fully finalized tables produce zero network activity - Replace "(pre-fee)" text on miles badge with a hover/tap tooltip on the badge itself for a cleaner visual
- Run formatter across all changed files - Show "TBD" instead of "Swap too small" in confirmation modal with the same tooltip copy and Learn link as the swap interface - Change InfoRow tooltip prop to ReactNode to support inline links
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
slippage% × outputwas structurally lower than real captured surplus.refetchMiles()fires so the header balance updates without a page refresh.New files
src/app/api/fastswap-miles/by-address/route.tsfastswap_milessrc/lib/analytics/services/fastswap.service.tssrc/hooks/use-user-swaps.tssrc/lib/swap-events.tssrc/components/dashboard/UserSwapsTable.tsxsrc/components/dashboard/UserSwapsModal.tsxsrc/components/dashboard/user-swaps-parts.tsxTest plan