feat(mobile): pull-to-refresh + polling on the dashboard - #587
Open
kaylachi wants to merge 1 commit into
Open
Conversation
Turn the placeholder home route into a dashboard that stays fresh two ways. `lib/activity.ts` loads the account's native XLM balance and recent payments from Horizon; the pure `mapPayments` turns Horizon records into direction-aware activity rows. `hooks/usePolling.ts` is a ref-backed interval that re-fetches quietly every POLL_INTERVAL_MS without restarting on each render. The screen wraps its ScrollView in a RefreshControl so a pull refreshes balance + feed, and an unfunded account reads as a zero balance with no activity rather than an error. Closes Miracle656#462
|
@kaylachi is attempting to deploy a commit to the miracle656's projects Team on Vercel. A member of the Team first needs to authorize it. |
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
Keeps the mobile dashboard fresh both ways (backlog #34 / #462): an explicit pull gesture and quiet background polling of balance + activity.
Added / changed
lib/activity.ts—fetchDashboardData(publicKey)loads the account's native XLM balance and its 20 most recent payments from Horizon. The puremapPaymentsturns Horizonpayment/create_accountrecords into direction-aware activity rows (received-from / sent-to), dropping non-transfer ops. An unfunded account (Horizon 404) reads as a zero balance with no activity, not an error.hooks/usePolling.ts— a ref-backedsetInterval(the native stand-in for the web dashboard's service-worker polling) that re-fires everyPOLL_INTERVAL_MSand never restarts when the callback identity changes; always cleared on unmount / when disabled.app/index.tsx— the placeholder home route is now the dashboard: a balance card + activity feed inside aScrollViewwithRefreshControl(pull-to-refresh) and background polling while a wallet is present. Distinct loading / no-wallet / empty / error states.Testing
tsc --noEmit✅jest lib/__tests__/activity.test.ts✅ (6/6 — direction, counterparty, non-native asset code, create_account, non-transfer filtering, timestamp conversion)Closes #462