Repository navigation
feat(watchlist): investor watchlist page with state-change alerts (#474) - #486
Open
solomonadzape95 wants to merge 5 commits into
Open
solomonadzape95 wants to merge 5 commits into
solomonadzape95 wants to merge 5 commits into
Conversation
|
@solomonadzape95 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! 🚀 |
Contributor
|
conflict |
…ellarState#474) - Add /watchlist page listing watched invoices as InvoiceCard components - Sync watchlist from the on-chain registry via the connected wallet - Surface recent state transitions (Now Funded / Matured / Settled) as badges - Add a bell WatchlistButton to InvoiceCard with optimistic add/remove and rollback - Add illustrated empty state with Browse Marketplace CTA - Redirect legacy /investor/watchlist route to /watchlist - Cover state-change detection, registry sync, optimistic rollback and page states with tests
solomonadzape95
force-pushed
the
feature/474-investor-watchlist
branch
from
October 18, 2026 10:07
452259f to
97e64e5
Compare
- Close the unterminated fetchInvestorLoyalty function in lib/api/index.ts (TS1005 parse error inherited from the dev merge; it crashed lint, type-check and every test importing the API module) - Escape the apostrophe in LimitOrderPanel (react/no-unescaped-entities) - Use next/link for the marketplace fixture in PlatformOnboardingTour test (@next/next/no-html-link-for-pages)
…ests pass Port of the baseline repair from StellarState#478: - Restore the lib/api exports and internal normalisers dropped by the 88e43dc merge, still referenced across the app - Fix stale typings (KycStatus split, RESALE_INVOICE_TYPES, notification normalisation, Invoice/NotificationItem/PayoutRecord fields, updateInvoice, useTopUpMutation, …) - Wrap useSearchParams pages in Suspense and the compare page in ComparisonProvider so next build prerenders - Fix the admin suspend target-state bug and the duplicate InvoiceFraudReport import; repair test infrastructure and stale expectations Verified: tsc 0 errors, lint clean, next build passes, 1333/1333 tests pass.
Keep render-with-card-providers identical across the open feature branches so merging them is conflict-free.
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
Implements #474 — an investor watchlist page with recent state-change alerts and a bell toggle on every invoice card. The watchlist is read from the on-chain registry for the connected wallet, and add/remove calls are optimistic with rollback on failure.
Changes
/watchlistpage (app/(dashboard)/watchlist/page.tsx) lists watched invoices as fullInvoiceCards, with connect-wallet state, loading skeletons, error + retry, and an illustrated empty state whose CTA browses the marketplace.lib/watchlist.ts) — puredetectStateChange()resolvesNow Funded,Matured,Settled, orNow Openfrom an explicit registry transition, then invoice timestamps (funded_at/settled_at), then a funded invoice whose maturity just passed. Missing fields degrade to no badge instead of crashing.StateChangeBadge(components/marketplace/StateChangeBadge.tsx) rendered byInvoiceCard.components/marketplace/WatchlistButton.tsx, bell / bell-ring) added toInvoiceCard; the invoice-detail header uses the labelled variant (components/invoices/WatchlistButton.tsx).useWatchlist(hooks/useWatchlist.ts) readsfetchWatchlistRegistry(address), hydrates ids into invoices, and layers optimistic add/remove with snapshot rollback and an error toast.lib/api/index.ts): registry-awarefetchWatchlistRegistry/watchInvoiceOnRegistry/unwatchInvoiceOnRegistry./investor/watchlistredirects to/watchlist;MobileNavupdated.Acceptance criteria
Testing
New coverage (21 tests):
lib/__tests__/watchlist.test.ts— state-change detection, recency window, graceful degradationhooks/__tests__/useWatchlist.test.tsx— registry sync per wallet, optimistic add/remove, rollback + toast on failurecomponents/marketplace/__tests__/watchlist-button.test.tsx— bell states, watch/unwatch calls, disconnected disabled stateapp/(dashboard)/watchlist/__tests__/watchlist-page.test.tsx— empty state, card listing + badge, connect-wallet promptAlso fixed the pre-existing missing
CompareToggleButtonimport ininvoice-card.tsxand wrapped the two existingInvoiceCardtests with the providers the bell now needs.Targeted run:
npx vitest run lib/__tests__/watchlist.test.ts hooks/__tests__/useWatchlist.test.tsx components/marketplace/__tests__/watchlist-button.test.tsx "app/(dashboard)/watchlist/__tests__/watchlist-page.test.tsx" components/marketplace/__tests__/invoice-card.test.tsx components/marketplace/__tests__/invoice-card-suitability.test.tsx→ 54 passed.Closes #474
Note on the
tsc --noEmitchecknpx tsc --noEmitis red on this PR, but it is red ondevitself:origin/dev(1d6099f): 283 errorsCompareToggleButtonimport ininvoice-card.tsxand its unuseduseComparisonimport).All 281 remaining errors are pre-existing and unrelated to the watchlist. They stem from merge
88e43dc(PR #430) resolvinglib/api/index.tsin a way that dropped ~40 functions still referenced elsewhere (fetchAdminUsers,transferInvoicePosition,fetchLeaderboard,uploadDocumentToIpfs, …), plus a handful of stale component/test typings.#487(KYC tier) was merged with the identical failing check.Happy to open a separate baseline-fix PR restoring the dropped
lib/apiexports and driving the type-check to zero — that is a large, repo-wide change and is kept out of this feature PR on purpose.