Skip to content

feat(dashmint-lab): show mint supply, collapse form when sold out#89

Merged
thephez merged 9 commits into
mainfrom
dashmint/tokens-pt2
Jun 2, 2026
Merged

feat(dashmint-lab): show mint supply, collapse form when sold out#89
thephez merged 9 commits into
mainfrom
dashmint/tokens-pt2

Conversation

@thephez
Copy link
Copy Markdown
Collaborator

@thephez thephez commented Jun 1, 2026

Summary

  • Adds a Supply block (X / 100 minted + progress bar) to the Mint page, sourced from sdk.tokens.totalSupply — every mint burns one fixed-supply DashMint token, so minted = SUPPLY − circulating.
  • When supply is exhausted, the form collapses to just the Supply block and odds table; name/description fields, token-balance block, and both mint buttons are hidden so the page reads as intentionally finished. The starter pack also disables itself when fewer than pack-size mints remain.
  • Refresh the DashMint token balance when the Mint tab becomes active so values don't lag a recent mint until the next reload. A module-level cache for the minted count keeps the value visible across tab switches (no "—" placeholder flash).
  • Two small e2e fixes that surfaced alongside this work: the Marketplace price-sort regex now accepts the K/M/B/T/Q suffixes from formatCreditsCompact, and the mobile-drawer dismiss click moved out from under the sticky top bar.

Summary by CodeRabbit

  • New Features

    • Added supply tracking with minted progress indicator to the minting interface
    • Added sold-out prevention logic and UI messaging
    • Enhanced sign-in page with new onboarding content and an "About this starter app" panel
  • UI/UX Improvements

    • Redesigned sign-in form layout with improved interaction patterns
    • Added visual badge and styling for onboarding content
    • Improved mobile navigation drawer closing behavior
    • Updated marketplace price parsing to support compact number formats
  • Chores

    • Updated contract data identifiers across the application
    • Enhanced SDK protocol version configuration

thephez and others added 7 commits May 28, 2026 18:21
Restructure the sign-in screen so the form is the focal point rather than competing with paragraphs of prose. Add an eyebrow + headline hero, lift the form into a card with primary "Sign in" and secondary "Get a testnet identity" buttons, mark sample notes as a preview with muted styling, move the longer explanation into a collapsed `<details>`, and submit on Enter (Shift+Enter for newline). Sample-note copy now teaches identity-ownership, the shared-contract model, and revision-based conflict rejection.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…old out

Adds a Supply block to the mint form (X / 100 minted with a progress bar) sourced from sdk.tokens.totalSupply — every mint burns one fixed-supply DashMint token, so minted = SUPPLY − circulating.

When the supply is exhausted, the form collapses to just the Supply block and odds table; the name/description fields, token-balance block, mint button, and starter-pack section are hidden so the page reads as intentionally finished instead of broken. The starter-pack button is also disabled when fewer than pack-size mints remain.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ter-pack gating

Mocks fetchCardsMintedCount with a never-resolving default so existing tests stay in the supply-unknown branch, then adds three cases driving the new behavior: rendered supply count + progress, full-form collapse at 100/100, and starter-pack disabling when fewer than pack-size mints remain.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Marketplace price sort: regex now accepts the K/M/B/T/Q suffixes produced by formatCreditsCompact (e.g. "999.9B cr"), with the suffix multiplied back into the parsed base so the descending-order assertion still holds.

Mobile drawer: the previous backdrop click at (380, 10) landed inside the sticky mobile top bar, which shares the backdrop's z-index but renders above it due to its own stacking context — the close handler never fired. Moved the click to (360, 400), clearly below the top bar and right of the 208px drawer.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Refresh the DashMint token balance whenever the Mint tab becomes active — SessionContext's balance effect only re-runs on login/contract change, so the value could otherwise lag a recent mint until the next page reload.

Add a module-level cache keyed by contractId for the supply count so re-entering the Mint tab renders the last known value immediately instead of flashing the "—" placeholder while the refetch is in flight. A failed refetch now keeps the previous value rather than regressing to "—".

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Leads with how many cards get minted instead of the abstract "random set," and spells out that the token cost is 1 per card so the math is obvious.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 1, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

This PR adds minted card supply tracking to DashMint Lab, displays supply progress with sold-out gating for both single and starter-pack mints, and updates the Dashnote starter's sign-in onboarding experience. The changes include SDK interface extension, supply-query helper, form state management, supply UI rendering, comprehensive component and E2E tests, and sign-in component restructuring with matching CSS styles.

Changes

DashMint Lab Supply Tracking

Layer / File(s) Summary
SDK interface for token supply
example-apps/dashmint-lab/src/dash/types.ts, setupDashClient-core.d.mts
SDK tokens interface extended with totalSupply(tokenId) method that returns promise of supply object or undefined.
Supply query and minted count calculation
example-apps/dashmint-lab/src/dash/dashMintToken.ts
New fetchCardsMintedCount helper derives minted count from DashMint token supply by computing token ID, fetching total supply, and returning difference from fixed supply constant.
Contract ID and SDK protocol configuration
example-apps/dashmint-lab/src/dash/contractStorage.ts, example-apps/dashmint-lab/public/dashmint-lite.html
DEFAULT_CONTRACT_ID and dashmint-lite CONTRACT_ID updated to new testnet contract; SDK connection pinned to protocol version 11 to prevent incompatible protocol handshake.
MintForm supply state and validation
example-apps/dashmint-lab/src/components/MintForm.tsx (state setup)
MintForm tracks minted count in state with module-level cache persistence; fetchCardsMintedCount effect computes supply percentage; soldOut and starterPackSoldOut flags guard card and starter-pack submissions.
Supply display UI and messaging
example-apps/dashmint-lab/src/components/MintForm.tsx (UI rendering)
New supplyBlock shows minted/total count with progress bar; supply card inserted into main render; sold-out notice shown when exhausted; starter-pack messaging and button logic distinguish supply-limited vs. token-insufficient states.
Balance refresh on Mint tab activation
example-apps/dashmint-lab/src/App.tsx
App triggers refreshBalance() when user navigates to Mint tab while authenticated.
Component test suite for supply tracking
example-apps/dashmint-lab/test/MintForm.test.tsx
Test mocks extended with mockFetchCardsMintedCount; module mock injected for dashMintToken; beforeEach establishes never-resolving default; balance header text assertion updated; new test cases verify supply display, sold-out form collapse, and starter-pack disable logic.
E2E test refinements
example-apps/dashmint-lab/test/e2e/browse.spec.ts
Price-sort test now parses compact magnitude suffixes (K/M/B/T/Q) in price chips; mobile drawer-close click repositioned to target backdrop.

Dashnote Starter SignIn UI

Layer / File(s) Summary
SignIn component restructuring and content
example-apps/dashnote-starter/src/components/SignIn.tsx
SAMPLE_NOTES entries refreshed with tutorial-focused copy; layout reorganized into intro (eyebrow/headline/lede), signin-card with Enter-key submit via requestSubmit(), preview section with badge, and collapsible "About this starter app" details.
SignIn component styling
example-apps/dashnote-starter/src/styles.css
CSS added for signin typography, card/actions layout, secondary button styling, badge/preview utilities, sample note styling, and expandable about section with summary interactions.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • dashpay/platform-tutorials#86: Introduces DashMint token burn and fixed-supply mechanics; this PR reads that token supply to compute minted/sold-out state via fetchCardsMintedCount and aligns both dashmint-lite.html and form validation with the same protocol version pin and contract ID.

Poem

🐰 A rabbit hops through DashMint's supply path,
Counting minted cards with Dash SDK math,
When sold-out arrives, the form bows low,
While Dashnote's intro gets a fresh glow.
Tab switches trigger balance's dance—
The platform learns to track its chance! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately captures the main objectives of the pull request: adding supply display and collapsing the form when sold out in dashmint-lab.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dashmint/tokens-pt2

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

example-apps/dashmint-lab/src/App.tsx

ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.

example-apps/dashmint-lab/src/components/MintForm.tsx

ESLint skipped: the ESLint configuration for this file references a package that is not available in the sandbox.

example-apps/dashmint-lab/src/dash/contractStorage.ts

ESLint skipped: the ESLint configuration for this file references a package that is not available in the sandbox.

  • 6 others

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

thephez and others added 2 commits June 1, 2026 14:39
DashMint Lab now calls sdk.tokens.totalSupply to render the mint-supply progress block, so the shared core type needed the matching method declaration. Returns { totalSupply: bigint, tokenId: string } | undefined to match the SDK shape.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@thephez thephez force-pushed the dashmint/tokens-pt2 branch from c78cb66 to 6306ba6 Compare June 1, 2026 18:59
@thephez
Copy link
Copy Markdown
Collaborator Author

thephez commented Jun 1, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 1, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@example-apps/dashmint-lab/src/components/MintForm.tsx`:
- Around line 43-58: The mint UI allows actions when mintedCount is null
(unknown) after a failed initial fetch; update the logic so actions are disabled
while supply is unknown: ensure the fetch in useEffect (using
fetchCardsMintedCount, mintedCountCache, and setMintedCount) sets a definitive
cached fallback or a separate "loading/unknown" flag and change any
action-enabling checks to require mintedCount !== null (or require !isUnknown)
before enabling mint/sold-out gating; apply the same guard to the other
occurrences that reference mintedCount (the blocks around the other noted
locations) so actions remain blocked until a concrete count or cached value is
present.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: adb7696d-6aaa-44eb-91f2-b6cf4e35b44b

📥 Commits

Reviewing files that changed from the base of the PR and between f57b312 and 6306ba6.

📒 Files selected for processing (11)
  • example-apps/dashmint-lab/public/dashmint-lite.html
  • example-apps/dashmint-lab/src/App.tsx
  • example-apps/dashmint-lab/src/components/MintForm.tsx
  • example-apps/dashmint-lab/src/dash/contractStorage.ts
  • example-apps/dashmint-lab/src/dash/dashMintToken.ts
  • example-apps/dashmint-lab/src/dash/types.ts
  • example-apps/dashmint-lab/test/MintForm.test.tsx
  • example-apps/dashmint-lab/test/e2e/browse.spec.ts
  • example-apps/dashnote-starter/src/components/SignIn.tsx
  • example-apps/dashnote-starter/src/styles.css
  • setupDashClient-core.d.mts

Comment thread example-apps/dashmint-lab/src/components/MintForm.tsx
@thephez thephez merged commit 662b16b into main Jun 2, 2026
3 checks passed
@thephez thephez deleted the dashmint/tokens-pt2 branch June 2, 2026 13:33
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.

1 participant