Skip to content

feat(creator-detail): add max supply cap display and mint progress bar - #1195

Merged
Chucks1093 merged 1 commit into
accesslayerorg:devfrom
Noobb-byte:feat/1156-mint-progress-bar
Oct 19, 2026
Merged

Chucks1093 merged 1 commit into
accesslayerorg:devfrom
Noobb-byte:feat/1156-mint-progress-bar

Conversation

@Noobb-byte

Copy link
Copy Markdown
Contributor

Summary

Resolves #1156

  • Mint Progress Bar & Supply Cap: Added a dedicated KeyMintProgressSection to CreatorDetailPage displaying key supply mint progress towards the configured maxSupply cap.
  • Pure Calculation Helpers: Implemented calculateMintProgress and formatMintPercentage in mintProgress.utils.ts with safe 0–100 clamping, divide-by-zero avoidance, sensible rounding (never prematurely displaying 100% until supply actually equals or exceeds max supply), and tiny fraction support (<1% display).
  • Remaining Mintable Keys: Integrated the existing MiniStatChip design primitive to cleanly display the remaining keys available to mint.
  • Cap Enforcement & Error Copy: Automatically disables the "Buy Key" button when supply meets or exceeds maxSupply, displaying a contextual alert with the standard copy: "Maximum supply reached. No more keys can be minted.".
  • Uncapped Key Handling: Cleanly hides the progress bar and remaining stat chip for uncapped keys (maxSupply null, undefined, or <= 0) while keeping buy functionality enabled.
  • Type Definitions & Error Mapping: Extended Course in course.service.ts with maxSupply?: number | null; and mapped MaxSupplyReached in errorHandling.utils.ts.

Testing

  • pnpm vitest run src/utils/__tests__/mintProgress.utils.test.ts (14 unit tests passing: 0%, partial, exactly at cap, over cap, fractions, edge cases)
  • pnpm vitest run src/components/common/__tests__/KeyMintProgressSection.test.tsx (6 component tests passing: accessibility semantics, progress bar values, remaining chip, buy button gating, uncapped state)
  • pnpm vitest run src/pages/__tests__/CreatorDetailPage.integration.test.tsx (Integration tests passing for capped, maxed, and uncapped flows)
  • pnpm vitest run src/pages/__tests__/CreatorDetailPageSkeleton.test.tsx (Skeleton loading states verified)
  • pnpm tsc -b (TypeScript typecheck passed with 0 errors)

Checklist

accesslayerorg#1156)

- Implement mint progress bar and supply cap section below key stats on CreatorDetailPage

- Add pure calculation helper calculateMintProgress and formatMintPercentage with safe clamping (0-100), divide-by-zero prevention, and sensible rounding that prevents premature 100% display

- Display remaining mintable key count via existing MiniStatChip primitive

- Disable the Buy button when supply reaches or exceeds cap, showing the MaxSupplyReached user-facing error message

- Hide progress bar and remaining chip for uncapped keys (maxSupply null, undefined, or <= 0) while keeping buy functionality enabled

- Extend Course interface with optional maxSupply property

- Add MaxSupplyReached entry to WALLET_ERROR_COPY and error code mappings

- Add unit tests for calculation helper, component tests for KeyMintProgressSection, and integration tests for CreatorDetailPage
@Chucks1093
Chucks1093 merged commit f4f15aa into accesslayerorg:dev Oct 19, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build max supply cap display and mint progress bar on key detail

2 participants