Skip to content

feat: add creator revenue, supply cap, dividend, and timelock panels - #124

Merged
Chucks1093 merged 2 commits into
StellarState:devfrom
davidugorji:feat/creator-admin-dashboard-panels
Aug 27, 2026
Merged

feat: add creator revenue, supply cap, dividend, and timelock panels#124
Chucks1093 merged 2 commits into
StellarState:devfrom
davidugorji:feat/creator-admin-dashboard-panels

Conversation

@davidugorji

Copy link
Copy Markdown
Contributor

Adds four dashboard panels backed by shared API + react-query hooks following existing lib/api conventions.

Issue Panel Location
#106 Supply cap configuration Creator dashboard → new Settings tab
#105 Revenue + 12-month chart Creator dashboard → Overview
#109 Dividend distribution Creator dashboard → Overview
#104 Timelock proposals Admin dashboard → new Timelock tab

22 tests added covering every acceptance criterion. Full rationale is in the commit message.

Notes for review:

Closes #104
Closes #105
Closes #106
Closes #109

Adds four dashboard panels backed by shared API + react-query hooks that
follow the existing lib/api normalize-and-fetch conventions.

Supply cap configuration (StellarState#106)
- SupplyCapSettings renders in a new creator-only Settings tab and shows
  the current cap, circulating supply, and remaining mintable.
- The number input is pre-filled with the current cap; Save stays disabled
  unless the value is a positive integer >= circulatingSupply and changed.
- A 409 from the server is surfaced as an inline error rather than a toast,
  so the creator can correct the value in place. updateKeySupplyCap tags
  conflicts via isApiConflictError; a plain tagged Error is used instead of
  a class so the module keeps only type-level exports and existing
  vi.spyOn(api, ...) call sites are unaffected.
- Renders "No cap set" for both the placeholder and the stats when the cap
  is null. The pre-existing read-only SupplyCapSection in BuyKeyPanel is
  left untouched; it serves buyers, not creators.

Creator revenue (StellarState#105)
- CreatorRevenueSection shows total/buy/sell royalty stat cards and a
  recharts bar chart of the trailing 12 months, with a loading skeleton and
  a "No revenue yet" empty state when tradeCount is zero.
- Months are sliced to the most recent 12 so an over-long API response
  cannot stretch the axis.
- Chart values are mirrored into an sr-only list. Recharts renders values
  only inside the SVG and on hover, so this is what makes the amounts
  reachable by screen readers and assertable in tests.

Dividend distribution (StellarState#109)
- DistributeDividendsPanel previews perKeyAmount as amount /
  circulatingSupply, shows holder count and circulating keys, and reports
  totalDistributed plus perKeyAmount in the success toast.
- Submit is disabled when the amount is non-positive, when circulating
  supply is zero (division would be undefined), or while signing.

Timelock proposals (StellarState#104)
- TimelockProposalsPanel adds a Timelock tab to the admin dashboard listing
  pending proposals with change type, payload summary, proposedAt, and
  executionNotBefore, split from a separate Completed section.
- A 1s ticker drives the countdown to the execution window and gates the
  Execute button, so a proposal becomes executable without a reload. The
  interval only runs while pending proposals exist. useCountdown was not
  reused because it ticks per minute and omits seconds.
- Cancel requires confirmation before firing, then the list refetches.

Testing
- 22 tests across the four panels covering every acceptance criterion.
- vitest.setup.ts stubs ResizeObserver, which jsdom lacks and recharts'
  ResponsiveContainer subscribes to on mount. This is the repo's first
  recharts usage, so no chart could render under test without it.

Closes StellarState#104
Closes StellarState#105
Closes StellarState#106
Closes StellarState#109
@drips-wave

drips-wave Bot commented Aug 27, 2026

Copy link
Copy Markdown

@davidugorji 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 2370ea2 into StellarState:dev Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment