feat: policy dashboard — paginated list, filters, action flows - #257
Merged
Conversation
- Add paginated policy list at /dashboard with active/expired filter,
sort (expiry/coverage/premium), and row/card layout toggle
- Cursor-based pagination with per-page cache; reset on filter/network change
- Skeleton loaders, empty states (first-time user CTA), and error state with retry
- PolicyCard (mobile) + PolicyRow (desktop) with locale-aware XLM formatting
(stroops ÷ 10^7) and tabular-nums
- Action buttons disabled with tooltip explanations when contract rules forbid:
- Renew: active + within 30-day window (≤518,400 ledgers)
- Terminate: active policies only
- RenewModal + TerminateModal: confirm → sign → done/error steps with
indexer-lag microcopy ("dashboard may take up to 15s to reflect change")
- Deep-link policy detail page at /policy/[holder]/[policyId] using chain
read (no indexer lag); notes this distinction in microcopy
- i18n: add dashboard.* namespace to en + es policy.json
|
@darcszn 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! 🚀 |
|
Hey @darcszn! 👋 It looks like this PR isn't linked to any issue. If this PR is for one of the issues assigned to you as part of a Wave, please link it to ensure your contribution is tracked properly. You can do this by adding a keyword to the PR description (e.g.,
|
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.
What was built
features/policies/api/index.ts
Zod-validated API client that mirrors the backend PolicyListDto shape exactly. Passes holder, status, after (cursor),
and limit as query params. Throws a typed PolicyListError on non-OK responses or parse failures.
features/policies/hooks/usePolicies.ts
useReducer-based hook with per-page cursor caching. Key design decisions:
whole cache
fetches
features/policies/components/PolicyItem.tsx
features/policies/components/PolicyStates.tsx
sense
features/policies/components/PolicyDashboard.tsx
Orchestrates everything: status filter, sort select, layout toggle (table/card), count label, content area, and
pagination. Resets to page 0 on filter change to avoid cursor mismatches.
features/policies/components/RenewModal.tsx + TerminateModal.tsx
Multi-step modals: confirm → signing → done | error. Both explain the on-chain transaction requirement upfront and
include the indexer-lag microcopy note.
app/dashboard/page.tsx
New route at /dashboard rendering PolicyDashboard.
app/policy/[holder]/[policyId]/page.tsx
Deep-link detail page. Uses getPolicy() (chain read, no indexer lag) and explicitly notes this in the microcopy.
Breadcrumb back to /dashboard.
i18n (messages/en/policy.json, messages/es/policy.json)
Added dashboard.* namespace with all UI strings in both languages.