Skip to content

Memes wave submission testground#1953

Merged
simo6529 merged 3 commits intomainfrom
memes-wave-submission-testground
Feb 18, 2026
Merged

Memes wave submission testground#1953
simo6529 merged 3 commits intomainfrom
memes-wave-submission-testground

Conversation

@simo6529
Copy link
Copy Markdown
Collaborator

@simo6529 simo6529 commented Feb 18, 2026

Summary by CodeRabbit

  • New Features

    • Added preview functionality for meme submissions—users can now review submissions before final submission with "Preview" and "Back to Edit" options.
    • Preview displays how submissions appear in leaderboard list and gallery formats.
  • Bug Fixes

    • Improved data handling for submission metadata to ensure consistent type coercion.

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

coderabbitai Bot commented Feb 18, 2026

📝 Walkthrough

Walkthrough

This PR introduces a preview flow for meme art submissions. It adds new React components to display preview cards (MemesSubmissionPreviewScreen, PreviewLeaderboardListCase, PreviewLeaderboardGalleryCase), utility modules to construct preview data (buildPreviewDrop, objectEntries), presentation presets for responsive widths, and integrates the preview mode into the existing submission container and additional info step with corresponding test coverage.

Changes

Cohort / File(s) Summary
Test Coverage for Preview
__tests__/components/waves/memes/submission/preview/MemesSubmissionPreviewScreen.test.tsx, __tests__/components/waves/memes/submission/preview/presets.test.ts, __tests__/components/waves/memes/submission/utils/buildPreviewDrop.test.ts
New test suites verifying MemesSubmissionPreviewScreen component rendering and interaction, PREVIEW_CASE_WIDTHS constant structure, and buildPreviewDrop utility function output with placeholder metrics.
Preview UI Components
components/waves/memes/submission/preview/MemesSubmissionPreviewScreen.tsx, components/waves/memes/submission/preview/components/PreviewCaseSection.tsx, components/waves/memes/submission/preview/components/PreviewLeaderboardListCase.tsx, components/waves/memes/submission/preview/components/PreviewLeaderboardGalleryCase.tsx, components/waves/memes/submission/preview/components/PreviewWidthFrame.tsx
New React components composing a read-only submission preview with two leaderboard case sections, reusable section/frame components, and responsive width management.
Preview Data & Utilities
components/waves/memes/submission/utils/buildPreviewDrop.ts, components/waves/memes/submission/utils/objectEntries.ts, components/waves/memes/submission/preview/presentation/presets.ts
New utility module to construct a fully-populated preview drop from submission data, generic objectEntries type helper, and responsive width presets constant.
Submission Flow Integration
components/waves/memes/submission/MemesArtSubmissionContainer.tsx, components/waves/memes/submission/steps/AdditionalInfoStep.tsx, components/waves/memes/submission/hooks/useArtworkSubmissionMutation.ts
Updated container to manage preview state and render MemesSubmissionPreviewScreen; AdditionalInfoStep now includes onPreview callback with Preview button; mutation hook uses objectEntries for trait metadata with explicit string coercion.

Sequence Diagram

sequenceDiagram
    participant User
    participant AdditionalInfoStep
    participant MemesArtSubmissionContainer
    participant buildPreviewDrop
    participant MemesSubmissionPreviewScreen
    participant Submit as Submit API

    User->>AdditionalInfoStep: Click Preview Button
    AdditionalInfoStep->>MemesArtSubmissionContainer: onPreview()
    MemesArtSubmissionContainer->>buildPreviewDrop: buildPreviewDrop(wave, traits, media, connectedProfile)
    buildPreviewDrop-->>MemesArtSubmissionContainer: ExtendedDrop with preview data
    MemesArtSubmissionContainer->>MemesSubmissionPreviewScreen: Render with previewDrop
    MemesSubmissionPreviewScreen-->>User: Display preview (list & gallery cards)
    
    User->>MemesSubmissionPreviewScreen: Click "Back to Edit"
    MemesSubmissionPreviewScreen->>MemesArtSubmissionContainer: onBackClick()
    MemesArtSubmissionContainer->>AdditionalInfoStep: Exit preview mode
    
    User->>MemesSubmissionPreviewScreen: Click "Submit Artwork"
    MemesSubmissionPreviewScreen->>MemesArtSubmissionContainer: onSubmit()
    MemesArtSubmissionContainer->>Submit: Submit with submission data
    Submit-->>User: Submission confirmed
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

  • #1728: Updates MemesArtSubmissionContainer props and AdditionalInfoStep signature for preview-related functionality alignment.
  • #1751: Modifies WaveLeaderboardGalleryItem public props to include onDropClick handler used by new preview components.
  • #1733: Adds getDropPreviewImageUrl and metadata surface that intersects with buildPreviewDrop's additional_media.preview_image population.

Suggested reviewers

  • prxt6529
  • ragnep
  • GelatoGenesis

Poem

🐰 A preview before the final hop,
Two cards displayed, no need to stop,
Back to edit, then submit with care,
Responsive frames, with widths to spare! ✨

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

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.
Title check ❓ Inconclusive The title 'Memes wave submission testground' is vague and generic, using the non-descriptive term 'testground' that does not convey meaningful information about the specific changes made. Replace with a more descriptive title that clarifies the main purpose, such as 'Add submission preview screen for meme waves' or 'Implement meme wave submission preview flow'.
✅ 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
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch memes-wave-submission-testground

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.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Feb 18, 2026

Quality Gate Passed Quality Gate passed

Issues
0 New issues
2 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

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

Caution

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

⚠️ Outside diff range comments (1)
components/waves/memes/submission/MemesArtSubmissionContainer.tsx (1)

100-103: ⚠️ Potential issue | 🟡 Minor

Remove console.warn debug artifact before merging.

This logs a warning on every submission phase change in production, polluting the console and potentially leaking internal state labels to end-users.

🗑️ Proposed fix
  const handlePhaseChange = useCallback((phase: SubmissionPhase) => {
    // Any additional phase-specific handling can be done here
-   console.warn(`Submission phase changed to: ${phase}`);
  }, []);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@components/waves/memes/submission/MemesArtSubmissionContainer.tsx` around
lines 100 - 103, In handlePhaseChange (the useCallback for SubmissionPhase),
remove the console.warn debug artifact so phase changes are no longer logged to
the browser console; if you still need telemetry for debugging, replace it with
a proper debug/logger call (e.g., use existing app logger like
submissionLogger.debug or emit an analytics event) rather than console.warn to
avoid leaking internal state in production.
🧹 Nitpick comments (5)
__tests__/components/waves/memes/submission/utils/buildPreviewDrop.test.ts (1)

38-41: LGTM — consider expanding coverage for null-profile author defaults and media URL selection.

The test is intentionally scoped to the placeholder metrics. Optionally, adding assertions that cover the connectedProfile: null author defaults (e.g. author.handle === "preview-user") and the external-URL media path (e.g. parts[0].media[0].url === "https://example.com/art.png") would catch regressions in the broader construction logic without significant test complexity.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@__tests__/components/waves/memes/submission/utils/buildPreviewDrop.test.ts`
around lines 38 - 41, Add assertions to the existing test that verify author
defaults when connectedProfile is null and that the external media URL is
selected: after constructing previewDrop assert that previewDrop.author.handle
=== "preview-user" (and other default author fields as needed) to cover the
null-profile branch, and assert that previewDrop.parts[0].media[0].url ===
"https://example.com/art.png" to ensure the external-URL media path is used;
locate these checks near the existing expectations for
previewDrop.rating/rating_prediction/raters_count so they live in the same test
scope.
__tests__/components/waves/memes/submission/preview/MemesSubmissionPreviewScreen.test.tsx (1)

43-89: LGTM — tests correctly isolate the screen from its leaf components while verifying rendering order and interaction wiring.

One minor note: the h5 heading assertions in lines 57–64 are coupled to the rendering internals of PreviewLeaderboardListCase / PreviewLeaderboardGalleryCase (which are intentionally not mocked). If those component section titles ever change, this assertion will fail at a distance; a data-testid on the section wrappers would make the coupling explicit.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@__tests__/components/waves/memes/submission/preview/MemesSubmissionPreviewScreen.test.tsx`
around lines 43 - 89, Add explicit data-testid attributes to the section wrapper
elements inside the MemesSubmissionPreviewScreen (specifically on the containers
rendered by PreviewLeaderboardListCase and PreviewLeaderboardGalleryCase) and
update the test in MemesSubmissionPreviewScreen.test.tsx to assert
presence/order using those testids (e.g., "preview-list-card" and
"preview-gallery-card") rather than relying on h5 heading text; ensure the test
still checks the overall heading "Submission Preview" and footer buttons wiring
(onBackToEdit/onSubmit) remain unchanged.
components/waves/memes/submission/preview/MemesSubmissionPreviewScreen.tsx (2)

27-31: exit animation is a no-op without an AnimatePresence parent.

The exit={{ opacity: 0, y: -20 }} will silently have no effect because the parent container (MemesArtSubmissionContainer) renders steps as {stepComponents[form.currentStep]} without an AnimatePresence wrapper. The mount animations (initial/animate) still work. Either add AnimatePresence in the container around the step render, or remove the exit prop to avoid misleading future readers.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@components/waves/memes/submission/preview/MemesSubmissionPreviewScreen.tsx`
around lines 27 - 31, The exit animation on the motion.div in
MemesSubmissionPreviewScreen is a no-op because the parent
(MemesArtSubmissionContainer) renders steps as
{stepComponents[form.currentStep]} without AnimatePresence; either wrap the step
rendering in MemesArtSubmissionContainer with Framer Motion's <AnimatePresence>
(ensuring keys on step components) to enable exit animations, or remove the exit
prop from the motion.div in MemesSubmissionPreviewScreen to avoid misleading
dead code—update the container to import AnimatePresence and wrap the dynamic
step render, or delete the exit attribute accordingly.

58-65: Hardcoded disabled={false} on the Submit button is easy to misread.

PrimaryButton disables itself internally when loading is true (disabled || loading), so the behaviour is correct. However, future changes that need to truly disable the button without a loading state (e.g., a validation gate) will be missed because the prop is locked to false. Consider passing a computed value, or at minimum add an inline comment to signal intent.

🔎 Suggested clarification
  <PrimaryButton
    onClicked={onSubmit}
-   disabled={false}
+   disabled={false} // always enabled; `loading={isSubmitting}` handles the active-submission lockout
    loading={isSubmitting}
    padding="tw-px-6 tw-py-3"
  >
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@components/waves/memes/submission/preview/MemesSubmissionPreviewScreen.tsx`
around lines 58 - 65, The Submit button currently hardcodes disabled={false} on
PrimaryButton (onClicked={onSubmit}, loading={isSubmitting}), which is confusing
and will hide future validation-driven disabling; replace the hardcoded prop
with a computed value (e.g., disabled={isFormInvalid} or
disabled={shouldDisableSubmit}) that reflects validation/UX state, or remove the
disabled prop and add a short inline comment next to PrimaryButton noting that
the button is disabled via that computed prop and that loading is already
handled by loading={isSubmitting}; update any references to
isFormInvalid/shouldDisableSubmit as needed in the surrounding component logic.
components/waves/memes/submission/MemesArtSubmissionContainer.tsx (1)

122-124: handleBackToEdit leaves a stale previewDrop in state; consider aligning with resetPreviewState.

handleBackToEdit only clears isPreviewMode, while resetPreviewState clears both flags. The stale drop is never displayed (it's gated by isPreviewMode && previewDrop), but a subsequent re-preview call overwrites it, so there's no functional bug. For consistency and to avoid accidental future misuse, reuse resetPreviewState here.

♻️ Proposed simplification
- const handleBackToEdit = useCallback(() => {
-   setIsPreviewMode(false);
- }, []);
+ const handleBackToEdit = resetPreviewState;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@components/waves/memes/submission/MemesArtSubmissionContainer.tsx` around
lines 122 - 124, handleBackToEdit currently only calls setIsPreviewMode(false)
leaving previewDrop stale; change it to reuse the existing resetPreviewState
helper so both isPreviewMode and previewDrop are cleared. Replace the body of
handleBackToEdit to call resetPreviewState (or invoke the same logic that clears
previewDrop and sets isPreviewMode) so previewDrop is not left in state;
reference functions/variables: handleBackToEdit, resetPreviewState, previewDrop,
isPreviewMode.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@components/waves/memes/submission/utils/buildPreviewDrop.ts`:
- Around line 91-94: The preview builder currently always pushes an
"additional_media" metadata entry using operationalData.additional_media in
buildPreviewDrop (metadata.push with data_key "additional_media"), causing
previews to include entries that the real submission path (see
useArtworkSubmissionMutation.ts which only pushes when
operationalData.additional_media is truthy) would omit; change buildPreviewDrop
to only add that metadata entry when operationalData.additional_media is
present/non-empty (mirror the same conditional used in
useArtworkSubmissionMutation.ts) so the preview matches the real submission
metadata.
- Around line 65-69: In buildPreviewDrop, the code assumes entry.address is
always a string and calls entry.address.trim(), which throws when address is
null/undefined; update the filtering logic in the operationalData.airdrop_config
processing to defensive-guard the address (e.g., use entry.address?.trim() ?? ""
or equivalent) before calling validateStrictAddress and computing trimmedAddress
so validateStrictAddress always receives a string; ensure this change is made
inside the function buildPreviewDrop where operationalData.airdrop_config is
filtered and the variable trimmedAddress is assigned.

---

Outside diff comments:
In `@components/waves/memes/submission/MemesArtSubmissionContainer.tsx`:
- Around line 100-103: In handlePhaseChange (the useCallback for
SubmissionPhase), remove the console.warn debug artifact so phase changes are no
longer logged to the browser console; if you still need telemetry for debugging,
replace it with a proper debug/logger call (e.g., use existing app logger like
submissionLogger.debug or emit an analytics event) rather than console.warn to
avoid leaking internal state in production.

---

Nitpick comments:
In
`@__tests__/components/waves/memes/submission/preview/MemesSubmissionPreviewScreen.test.tsx`:
- Around line 43-89: Add explicit data-testid attributes to the section wrapper
elements inside the MemesSubmissionPreviewScreen (specifically on the containers
rendered by PreviewLeaderboardListCase and PreviewLeaderboardGalleryCase) and
update the test in MemesSubmissionPreviewScreen.test.tsx to assert
presence/order using those testids (e.g., "preview-list-card" and
"preview-gallery-card") rather than relying on h5 heading text; ensure the test
still checks the overall heading "Submission Preview" and footer buttons wiring
(onBackToEdit/onSubmit) remain unchanged.

In `@__tests__/components/waves/memes/submission/utils/buildPreviewDrop.test.ts`:
- Around line 38-41: Add assertions to the existing test that verify author
defaults when connectedProfile is null and that the external media URL is
selected: after constructing previewDrop assert that previewDrop.author.handle
=== "preview-user" (and other default author fields as needed) to cover the
null-profile branch, and assert that previewDrop.parts[0].media[0].url ===
"https://example.com/art.png" to ensure the external-URL media path is used;
locate these checks near the existing expectations for
previewDrop.rating/rating_prediction/raters_count so they live in the same test
scope.

In `@components/waves/memes/submission/MemesArtSubmissionContainer.tsx`:
- Around line 122-124: handleBackToEdit currently only calls
setIsPreviewMode(false) leaving previewDrop stale; change it to reuse the
existing resetPreviewState helper so both isPreviewMode and previewDrop are
cleared. Replace the body of handleBackToEdit to call resetPreviewState (or
invoke the same logic that clears previewDrop and sets isPreviewMode) so
previewDrop is not left in state; reference functions/variables:
handleBackToEdit, resetPreviewState, previewDrop, isPreviewMode.

In `@components/waves/memes/submission/preview/MemesSubmissionPreviewScreen.tsx`:
- Around line 27-31: The exit animation on the motion.div in
MemesSubmissionPreviewScreen is a no-op because the parent
(MemesArtSubmissionContainer) renders steps as
{stepComponents[form.currentStep]} without AnimatePresence; either wrap the step
rendering in MemesArtSubmissionContainer with Framer Motion's <AnimatePresence>
(ensuring keys on step components) to enable exit animations, or remove the exit
prop from the motion.div in MemesSubmissionPreviewScreen to avoid misleading
dead code—update the container to import AnimatePresence and wrap the dynamic
step render, or delete the exit attribute accordingly.
- Around line 58-65: The Submit button currently hardcodes disabled={false} on
PrimaryButton (onClicked={onSubmit}, loading={isSubmitting}), which is confusing
and will hide future validation-driven disabling; replace the hardcoded prop
with a computed value (e.g., disabled={isFormInvalid} or
disabled={shouldDisableSubmit}) that reflects validation/UX state, or remove the
disabled prop and add a short inline comment next to PrimaryButton noting that
the button is disabled via that computed prop and that loading is already
handled by loading={isSubmitting}; update any references to
isFormInvalid/shouldDisableSubmit as needed in the surrounding component logic.

Comment thread components/waves/memes/submission/utils/buildPreviewDrop.ts
Comment thread components/waves/memes/submission/utils/buildPreviewDrop.ts
@simo6529 simo6529 merged commit 8d2d1bb into main Feb 18, 2026
7 checks passed
@simo6529 simo6529 deleted the memes-wave-submission-testground branch February 18, 2026 18:34
@coderabbitai coderabbitai Bot mentioned this pull request Apr 20, 2026
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