Skip to content

Show next winner if mint is over#1879

Merged
simo6529 merged 13 commits intomainfrom
show-next-winner-if-mint-is-over
Feb 6, 2026
Merged

Show next winner if mint is over#1879
simo6529 merged 13 commits intomainfrom
show-next-winner-if-mint-is-over

Conversation

@simo6529
Copy link
Copy Markdown
Collaborator

@simo6529 simo6529 commented Feb 3, 2026

Summary by CodeRabbit

Release Notes

  • New Features

    • Added next mint drop preview section displaying upcoming mint details including title, timestamp, and author information.
  • Refactor

    • Restructured home page minting section layout for improved organization.
    • Enhanced next mint visibility logic to better manage current versus upcoming mint states.
    • Updated component composition for improved data flow management.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 3, 2026

📝 Walkthrough

Walkthrough

This pull request refactors the home page's minting section to conditionally display either the current NFT being minted or the next upcoming drop based on minting status. It introduces new hooks (useNowMintingStatus, useNextMintDrop), visibility helpers, and new/refactored components (LatestDropSection, LatestDropNextMintSection) to manage the logic.

Changes

Cohort / File(s) Summary
Home Page Integration
components/home/HomePageContent.tsx, components/home/now-minting/index.ts
Replaces NowMintingSection with LatestDropSection as the primary export and import for the home page's minting display.
New Minting Status Hooks
hooks/useNowMintingStatus.ts, hooks/useNextMintDrop.ts
Introduces two new hooks: useNowMintingStatus wraps current NFT and manifold claim status; useNextMintDrop computes next mint drop data from wave decisions.
Minting Visibility Logic
helpers/mint-visibility.helpers.ts
Adds helper functions shouldShowNextMintInLatestDrop and shouldShowNextWinnerInComingUp to determine when to display next mint based on minting state and calendar eligibility.
LatestDrop Components
components/home/now-minting/LatestDropSection.tsx, components/home/now-minting/LatestDropNextMintSection.tsx
New LatestDropSection orchestrates conditional rendering between current mint (NowMintingSection) and next mint (LatestDropNextMintSection) using status and visibility helpers; LatestDropNextMintSection renders drop media, timestamp, author, wave, and stats.
Refactored Minting Components
components/home/now-minting/NowMintingSection.tsx, components/home/now-minting/NowMintingStatsItem.tsx
NowMintingSection refactored to accept nft and isFetching props instead of internal hook; NowMintingStatsItem adds optional allowWrap prop for text wrapping control.
Next Mint Leading Section
components/home/next-mint-leading/NextMintLeadingSection.tsx
Updated to use useNowMintingStatus and useNextMintDrop hooks; now displays next mint conditionally using shouldShowNextWinnerInComingUp helper and sources next mint data from new hooks instead of wave decisions.

Sequence Diagram

sequenceDiagram
    participant User
    participant LatestDropSection
    participant useNowMintingStatus
    participant useNextMintDrop
    participant shouldShowNextMintInLatestDrop
    participant NowMintingSection
    participant LatestDropNextMintSection

    User->>LatestDropSection: Load page
    LatestDropSection->>useNowMintingStatus: Fetch current minting status
    useNowMintingStatus-->>LatestDropSection: { nft, isFetching, status }
    LatestDropSection->>useNextMintDrop: Fetch next mint drop data
    useNextMintDrop-->>LatestDropSection: { nextMint, waveId, isReady }
    
    alt Decision ready
        LatestDropSection->>shouldShowNextMintInLatestDrop: Check visibility
        shouldShowNextMintInLatestDrop-->>LatestDropSection: shouldShowNextMint boolean
        
        alt Should show next mint
            LatestDropSection->>LatestDropNextMintSection: Render with nextMint drop
            LatestDropNextMintSection-->>User: Display next mint card
        else Show current mint
            LatestDropSection->>NowMintingSection: Render with current NFT
            NowMintingSection-->>User: Display now minting section
        end
    else Not ready
        LatestDropSection->>NowMintingSection: Render with undefined NFT
        NowMintingSection-->>User: Display loading state
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related issues

Possibly related PRs

  • Index redesign #1719: Modifies HomePageContent.tsx and the now-minting module export surface, similar to this PR's switch from NowMintingSection to LatestDropSection export.
  • Simo6529/remove dms from wave icon #1812: Also modifies HomePageContent and the now-minting UI components (NowMintingSection), restructuring the minting section's behavior and rendering.
  • Mint profile selector #1792: Updates the now-minting component surface including changes to NowMintingSection/LatestDropSection and NowMintingStatsItem's API.

Suggested reviewers

  • prxt6529

Poem

🐰 A drop has bloomed, now next one shows,
When minting ends, the winner glows,
With visibility helpers true,
Fresh hooks compose the perfect view,
Hopping through the code so clean! 🌿✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: introducing logic to show the next winner when the current mint ends, which is reflected across the helper functions, hooks, and component refactoring.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch show-next-winner-if-mint-is-over

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.

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: 3

🤖 Fix all issues with AI agents
In `@components/home/next-mint-leading/NextMintLeadingSection.tsx`:
- Around line 49-52: The showNextMint boolean is inverted: currently it hides
the next mint when the current mint has ended. Change its definition to show the
next mint when a nextMint exists AND (the current mint has ended OR the next
mint is not the same as the now minting). Update the expression for showNextMint
(referencing isNowMintingEnded, nextMint, and isNextMintSameAsNowMinting) to use
(isNowMintingEnded || !isNextMintSameAsNowMinting) so leadingCount continues to
derive from showNextMint correctly.

In `@components/home/now-minting/LatestDropNextMintSection.tsx`:
- Around line 46-56: The code assumes arrays exist and can throw; update the
media, title, and description computations to safely handle missing arrays by
adding guards: when computing media (const media = ...), check drop.parts is an
array and drop.parts[0]?.media is an array before indexing; when computing title
and description, guard drop.metadata is an array before calling find (e.g., use
Array.isArray(drop.metadata) && drop.metadata.find(...)?...); ensure
authorHandle/authorName logic remains unchanged. Locate symbols: media, title,
description, and the use of drop.metadata and drop.parts in
LatestDropNextMintSection and replace direct indexing/find usage with these safe
checks.

In `@hooks/useNextMintDrop.ts`:
- Around line 14-28: seizeSettings and nextMint.metadata can be undefined during
loading causing runtime crashes; update the logic around
useSeizeSettings/useWaveDecisions and the derivation of
latestDecision/nextMint/nextMintTitle to defensively guard optional values:
ensure waveId is derived only when seizeSettings and seizeSettings.memes_wave_id
exist before calling useWaveDecisions, check decisionPoints length before
accessing decisionPoints[decisionPoints.length - 1], use optional chaining
(e.g., latestDecision?.winners?.[0]?.drop) and safe access for metadata (e.g.,
nextMint?.metadata?.find(...)) and fall back to null/defaults for nextMint and
nextMintTitle to avoid throws.

Comment thread components/home/next-mint-leading/NextMintLeadingSection.tsx Outdated
Comment thread components/home/now-minting/LatestDropNextMintSection.tsx
Comment thread hooks/useNextMintDrop.ts
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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
components/home/next-mint-leading/NextMintLeadingSection.tsx (1)

42-55: ⚠️ Potential issue | 🟡 Minor

Use stable IDs to detect “same drop” instead of titles.

The title/name comparison can misidentify the same drop when metadata differs or is missing, causing the current mint to show again as “Next Mint.” Prefer comparing IDs when available, with a title fallback only if IDs are absent.

🔁 Suggested fix
-  const isNextMintSameAsNowMinting =
-    !!nowMinting?.name &&
-    !!nextMintTitle &&
-    nowMinting.name.toLowerCase().trim() === nextMintTitle.toLowerCase().trim();
+  const isNextMintSameAsNowMinting =
+    (!!nowMinting?.id && !!nextMint?.id && nowMinting.id === nextMint.id) ||
+    (!!nowMinting?.name &&
+      !!nextMintTitle &&
+      nowMinting.name.toLowerCase().trim() ===
+        nextMintTitle.toLowerCase().trim());
🤖 Fix all issues with AI agents
In `@components/home/now-minting/LatestDropSection.tsx`:
- Around line 22-24: The current check in LatestDropSection returns a loading
NowMintingSection with nft={undefined} whenever isDecisionReady is false, which
hides the already-fetched current mint; instead, keep showing the real current
mint by rendering NowMintingSection with the existing nft and an isFetching flag
(e.g., nft={nft} isFetching={true}) until you’re ready to swap. Locate the
conditional that references isDecisionReady in LatestDropSection and change the
return so it passes through the current nft and sets isFetching appropriately
rather than forcing nft={undefined}. Ensure props names match NowMintingSection
(nft and isFetching) so the current mint remains visible while next-mint
readiness completes.

Comment thread components/home/now-minting/LatestDropSection.tsx
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Feb 6, 2026

@simo6529 simo6529 merged commit 1261bfd into main Feb 6, 2026
7 checks passed
@simo6529 simo6529 deleted the show-next-winner-if-mint-is-over branch February 6, 2026 16:17
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.

2 participants