Skip to content

Fix main stage preview#2044

Merged
simo6529 merged 3 commits intomainfrom
fix-main-stage-preview
Mar 3, 2026
Merged

Fix main stage preview#2044
simo6529 merged 3 commits intomainfrom
fix-main-stage-preview

Conversation

@simo6529
Copy link
Copy Markdown
Collaborator

@simo6529 simo6529 commented Mar 3, 2026

Summary by CodeRabbit

  • Tests

    • Expanded test coverage for link handlers, seize link parsing, and several UI button/meme behaviors.
  • Refactor

    • Link handling now distinguishes raw vs stable URLs; seize link validation tightened to reject legacy/non-canonical forms.
  • UI

    • Submit button for memes hides in compact layout.
    • Closed and Info buttons support configurable full/auto width and extra styling class.
    • Wave link routing now uses a path-based URL.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 3, 2026

📝 Walkthrough

Walkthrough

Seize vs non-seize link handling was split between raw and stable hrefs: seize handlers now match and render using raw hrefs while non-seize handlers continue to use stable hrefs. Seize link parsing was tightened to reject legacy/rebased paths and require canonical UUID wave IDs. Tests added/updated to cover these behaviors.

Changes

Cohort / File(s) Summary
Link handler tests
__tests__/components/drops/.../linkHandlers.test.tsx
Adds mocks for SeizeLinkParser.ensureStableSeizeLink, replaces static handler mocks with jest.fn() stubs, and adds tests verifying seize handlers match/render using raw hrefs while non-seize handlers use stable hrefs.
Seize link parser & tests
helpers/SeizeLinkParser.ts, __tests__/helpers/SeizeLinkParser.test.ts
Tightens parseSeizeDropLink to use getWaveIdFromWavesUrl, reject legacy/rebased paths, and require UUID waveId; tests updated to expect null for legacy/rebased/missing canonical IDs.
Link handler runtime changes
components/drops/.../linkHandlers.tsx, components/drops/.../handlers/seize.tsx
Introduces rawHref and stableHref; seize matching uses rawHref, render helper accepts a targetHref and calls handler.render with it; tightens null-check in seize query handler to value === null.
UI: meme tab & submit, and buttons
components/brain/my-stream/.../MyStreamWaveTabsMeme.tsx, components/brain/.../MyStreamWaveTabsMemeSubmit.tsx, components/home/now-minting/LatestDropNextMintSection.tsx, components/utils/button/ClosedButton.tsx, components/utils/button/InfoButton.tsx, __tests__/components/.../*.test.tsx
Adds responsive/compact label logic and timing/urgency states for meme submit; conditions submit visibility on compact breakpoint; Button components gain fullWidth prop (and className for InfoButton) with updated classes; tests adjusted/expanded for these UI changes.

Sequence Diagram

sequenceDiagram
    participant Caller as Caller
    participant LinkRenderer as createLinkRenderer
    participant Parser as SeizeLinkParser
    participant SeizeHandler as Seize Handler
    participant NonSeizeHandler as Non-Seize Handler

    Caller->>LinkRenderer: createLinkRenderer(rawHref, handlers)

    rect rgba(100, 150, 200, 0.5)
    Note over LinkRenderer,Parser: Process & Match
    LinkRenderer->>Parser: parseSeizeDropLink(rawHref)
    alt Valid Seize Link
        Parser-->>LinkRenderer: {waveId, dropId}
        LinkRenderer->>SeizeHandler: findMatch(rawHref)
        SeizeHandler-->>LinkRenderer: match found
        rect rgba(150, 200, 100, 0.5)
        LinkRenderer->>SeizeHandler: render(rawHref)
        SeizeHandler-->>LinkRenderer: rendered element
        end
    else No Seize Match or Invalid
        LinkRenderer->>NonSeizeHandler: findMatch(stableHref)
        NonSeizeHandler-->>LinkRenderer: match found
        rect rgba(200, 150, 100, 0.5)
        LinkRenderer->>NonSeizeHandler: render(stableHref)
        NonSeizeHandler-->>LinkRenderer: rendered element
        end
    end
    end

    LinkRenderer-->>Caller: rendered result
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

  • Drop serialNo code revert #1619: Touches seize handler and createLinkRenderer signatures; overlaps on raw/stable href and seize handling changes.
  • drop preview url fix #1556: Also modifies SeizeLinkParser and createLinkRenderer to distinguish stable vs raw hrefs and normalization logic.
  • quick test fix #1557: Adjusts test-time mocking for SeizeLinkParser.ensureStableSeizeLink, closely related to the new test mocks here.

Suggested reviewers

  • prxt6529
  • ragnep

"🐇 I chased the links through night and day,
Raw paths led where the seize flags play,
Canonical IDs now shine so bright,
Legacy paths tucked out of sight.
Hooray for tidy hops and code delight! 🥕"

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Fix main stage preview' is vague and generic, using non-descriptive terms that don't convey what specific changes were made to fix the preview. Replace with a more specific title that describes the main change, such as 'Make wave links path-based and improve meme submit responsiveness' or similar.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-main-stage-preview

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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 575d82ce16

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread helpers/SeizeLinkParser.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.

🧹 Nitpick comments (2)
components/drops/view/part/dropPartMarkdown/handlers/seize.tsx (1)

92-101: Keep match and render null semantics aligned.

After Line 100, render rejects only null, but match at Line 97 still uses truthiness. This can silently skip valid falsey non-null values if new extractors are added.

Proposed diff
 const createSeizeQueryHandler = <T,>(
   extract: (href: string) => T | null,
   onMissing: string,
   render: (value: T, href: string) => ReactElement
 ): LinkHandler => ({
-  match: (href) => Boolean(extract(href)),
+  match: (href) => extract(href) !== null,
   render: (href) => {
     const value = extract(href);
     if (value === null) {
       throw new Error(onMissing);
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@components/drops/view/part/dropPartMarkdown/handlers/seize.tsx` around lines
92 - 101, The match vs render null semantics diverge: match uses truthiness
(Boolean(extract(href))) which will drop valid falsey-but-non-null values;
change match in createSeizeQueryHandler to explicitly check for non-null (e.g.,
extract(href) !== null) so it aligns with render's null rejection, referencing
the createSeizeQueryHandler function and its match/render handlers and the
extract parameter; ensure the check uses strict non-null comparison rather than
truthiness so falsey values returned by extract are treated as valid.
helpers/SeizeLinkParser.ts (1)

236-243: Tighten SeizeDropLinkInfo.waveId to non-nullable.

Given Line 237 now rejects missing/invalid/legacy wave IDs, successful parse results always have a concrete waveId. Keeping string | null weakens type safety for downstream consumers.

Proposed diff
 interface SeizeDropLinkInfo {
-  waveId: string | null;
+  waveId: string;
   dropId: string;
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@helpers/SeizeLinkParser.ts` around lines 236 - 243, The parser currently
rejects missing/invalid/legacy wave IDs (via getWaveIdFromWavesUrl and
UUID_REGEX) but still types SeizeDropLinkInfo.waveId as nullable; update the
SeizeDropLinkInfo/type/interface so waveId is a non-nullable string and adjust
any signatures/returns in SeizeLinkParser.parse (or the function returning {
waveId, dropId }) to reflect waveId: string; ensure callers expecting string |
null are updated or narrowed accordingly so the return value matches the runtime
check.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@components/drops/view/part/dropPartMarkdown/handlers/seize.tsx`:
- Around line 92-101: The match vs render null semantics diverge: match uses
truthiness (Boolean(extract(href))) which will drop valid falsey-but-non-null
values; change match in createSeizeQueryHandler to explicitly check for non-null
(e.g., extract(href) !== null) so it aligns with render's null rejection,
referencing the createSeizeQueryHandler function and its match/render handlers
and the extract parameter; ensure the check uses strict non-null comparison
rather than truthiness so falsey values returned by extract are treated as
valid.

In `@helpers/SeizeLinkParser.ts`:
- Around line 236-243: The parser currently rejects missing/invalid/legacy wave
IDs (via getWaveIdFromWavesUrl and UUID_REGEX) but still types
SeizeDropLinkInfo.waveId as nullable; update the
SeizeDropLinkInfo/type/interface so waveId is a non-nullable string and adjust
any signatures/returns in SeizeLinkParser.parse (or the function returning {
waveId, dropId }) to reflect waveId: string; ensure callers expecting string |
null are updated or narrowed accordingly so the return value matches the runtime
check.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 677046e and 575d82c.

📒 Files selected for processing (5)
  • __tests__/components/drops/view/part/dropPartMarkdown/linkHandlers.test.tsx
  • __tests__/helpers/SeizeLinkParser.test.ts
  • components/drops/view/part/dropPartMarkdown/handlers/seize.tsx
  • components/drops/view/part/dropPartMarkdown/linkHandlers.tsx
  • helpers/SeizeLinkParser.ts

Signed-off-by: Simo <simo@6529.io>
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Mar 3, 2026

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.

🧹 Nitpick comments (1)
components/brain/my-stream/tabs/MyStreamWaveTabsMemeSubmit.tsx (1)

43-55: Consolidate duplicate urgency branches in getActiveLabels.

isEndingVerySoon and isEndingHighlyUrgent currently return identical payloads; merging them will simplify control flow.

♻️ Suggested simplification
-  if (isEndingVerySoon) {
-    return {
-      activeLabelFull: ACTIVE_LABEL_SUBMIT_MEME,
-      activeLabelCompact: ACTIVE_LABEL_SUBMIT_MEME,
-    };
-  }
-
-  if (isEndingHighlyUrgent) {
+  if (isEndingVerySoon || isEndingHighlyUrgent) {
     return {
       activeLabelFull: ACTIVE_LABEL_SUBMIT_MEME,
       activeLabelCompact: ACTIVE_LABEL_SUBMIT_MEME,
     };
   }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@components/brain/my-stream/tabs/MyStreamWaveTabsMemeSubmit.tsx` around lines
43 - 55, The two identical branches checking isEndingVerySoon and
isEndingHighlyUrgent in getActiveLabels should be merged into a single condition
to reduce duplication; replace the separate if blocks with one that checks
(isEndingVerySoon || isEndingHighlyUrgent) and returns the
ACTIVE_LABEL_SUBMIT_MEME payload (activeLabelFull and activeLabelCompact),
leaving other logic unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@components/brain/my-stream/tabs/MyStreamWaveTabsMemeSubmit.tsx`:
- Around line 43-55: The two identical branches checking isEndingVerySoon and
isEndingHighlyUrgent in getActiveLabels should be merged into a single condition
to reduce duplication; replace the separate if blocks with one that checks
(isEndingVerySoon || isEndingHighlyUrgent) and returns the
ACTIVE_LABEL_SUBMIT_MEME payload (activeLabelFull and activeLabelCompact),
leaving other logic unchanged.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 575d82c and 3c4205f.

📒 Files selected for processing (9)
  • __tests__/components/brain/my-stream/tabs/MyStreamWaveTabsMeme.test.tsx
  • __tests__/components/brain/my-stream/tabs/MyStreamWaveTabsMemeSubmit.test.tsx
  • __tests__/components/utils/button/ClosedButton.test.tsx
  • __tests__/components/utils/button/InfoButton.test.tsx
  • components/brain/my-stream/tabs/MyStreamWaveTabsMeme.tsx
  • components/brain/my-stream/tabs/MyStreamWaveTabsMemeSubmit.tsx
  • components/home/now-minting/LatestDropNextMintSection.tsx
  • components/utils/button/ClosedButton.tsx
  • components/utils/button/InfoButton.tsx

@simo6529 simo6529 merged commit 1bab573 into main Mar 3, 2026
7 checks passed
@simo6529 simo6529 deleted the fix-main-stage-preview branch March 3, 2026 18:51
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.

3 participants