Skip to content

feat: Top investors leaderboard, edit invoice page, admin review page, and optimistic notification updates - #74

Merged
Chucks1093 merged 3 commits into
StellarState:devfrom
makuo567:fix-issues-53-52-41-42
Aug 26, 2026
Merged

feat: Top investors leaderboard, edit invoice page, admin review page, and optimistic notification updates#74
Chucks1093 merged 3 commits into
StellarState:devfrom
makuo567:fix-issues-53-52-41-42

Conversation

@makuo567

Copy link
Copy Markdown
Contributor

Summary

This PR addresses and resolves issues #53, #52, #41, and #42 in StellarState/SS-frontend.


Features & Fixes Included

1. Top Investors Leaderboard Section (#53)

  • Component & Hook: Implemented TopInvestorsLeaderboard component and useLeaderboard hook fetching from /api/leaderboard.
  • Refetch Interval: Configured to auto-refresh every 5 minutes (refetchInterval: 300,000ms).
  • Data Rendering: Renders rank, truncated wallet address (truncateAddress), total committed XLM (formatXLM), and invoice count in descending order of total committed XLM (top 5).
  • Loading & Empty States: Displays skeleton rows while loading and automatically hides the section if fewer than 1 investor is returned.
  • Home Page: Integrated into app/page.tsx.

2. Edit Draft Invoice Page for Sellers (#52)

  • Component & Route: Created EditInvoiceForm component and routes at /seller/edit/[id] and /seller/invoices/[id]/edit.
  • Pre-populated Fields: Pre-populates title, description, face value, and funding deadline from existing invoice data.
  • Document Replacement: Displays existing document CID with a "Replace document" option integrating DocumentUpload to upload to IPFS.
  • Save & Navigation: Sends a PATCH request on save with updated fields and redirects back to the seller dashboard (/seller).
  • Access Guard: Blocks non-draft invoices with a "This invoice cannot be edited" message and hides editing form controls.

3. Admin Invoice Review Page (#41)

  • Component & Route: Created AdminInvoiceReview component and routes at /admin/review, /admin/invoices, and /admin.
  • Pending List: Fetches and lists all pending_review invoices displaying title, seller wallet (truncated), face value, and submission date.
  • Approve Action: Transitions status to published and removes the invoice from the pending list.
  • Reject Action: Requires an inline rejection reason input before confirming rejection.
  • Non-Admin Guard: Redirects non-admin wallets to the home page with a "Not authorised" toast.
  • Empty State: Renders clear empty state when no invoices are pending review.

4. Optimistic Update for Notification Read Action (#42)

  • Hook Optimization: Updated useMarkNotificationRead using React Query's onMutate, onError, and onSettled.
  • Optimistic UI: Immediately clears the unread indicator on click and decrements the navbar bell unread counter before server response.
  • Rollback & Invalidation: Cancels in-flight queries on mutate, restores unread state and nav bell count on error/rollback, and invalidates notification list cache when settled.
  • Navbar Bell: Added notification bell with unread badge counter in Navbar.tsx.

Verification & Testing

  • Unit tests written and passing for all four features (TopInvestorsLeaderboard.test.tsx, EditInvoiceForm.test.tsx, AdminInvoiceReview.test.tsx, useNotifications.test.tsx).
  • Verified TypeScript compilation (npm run type-check) passed with zero errors.
  • Verified Next.js build (npm run build) succeeded cleanly.

closes #53
closes #52
closes #41
closes #42

…nvoice review, and optimistic notifications update

- Issue StellarState#53: Add TopInvestorsLeaderboard section to home page with 5-minute refetchInterval
- Issue StellarState#52: Add EditInvoiceForm and pages at seller edit routes for draft invoices
- Issue StellarState#41: Add AdminInvoiceReview page with approve and reject actions & non-admin guard
- Issue StellarState#42: Add optimistic updates to useMarkNotificationRead with rollback and nav bell counter update
@drips-wave

drips-wave Bot commented Aug 25, 2026

Copy link
Copy Markdown

@makuo567 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! 🚀

Learn more about application limits

@Chucks1093
Chucks1093 merged commit de53d6e into StellarState:dev Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment