Skip to content

Curtion wave add warning if input matches potential submission#2020

Merged
simo6529 merged 2 commits intomainfrom
curtion-wave-add-warning-if-input-matches-potential-submission
Feb 27, 2026
Merged

Curtion wave add warning if input matches potential submission#2020
simo6529 merged 2 commits intomainfrom
curtion-wave-add-warning-if-input-matches-potential-submission

Conversation

@simo6529
Copy link
Copy Markdown
Collaborator

@simo6529 simo6529 commented Feb 27, 2026

Summary by CodeRabbit

Release Notes

  • New Features

    • Added ability to switch to Drop mode with prefilled URLs for improved workflow efficiency.
    • Introduced validation for mode switching with user-facing feedback on invalid actions.
    • Added automatic detection of curation URLs with prompts to switch creation modes.
  • Tests

    • Enhanced test coverage for Drop creation flow, including prefilled URL and mode-switching scenarios.

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

coderabbitai Bot commented Feb 27, 2026

📝 Walkthrough

Walkthrough

The pull request adds curation URL handling to the wave drop creation flow, enabling mode switching between drop and curation modes with URL prefilling. It introduces scope-aware drop-mode management, validation logic, and updates component props and test mocks to support the new functionality.

Changes

Cohort / File(s) Summary
Test updates
__tests__/components/waves/CreateDrop.test.tsx
Adjusts mocks to separate CreateDropContent and CreateCurationDropContent; adds onSwitchToDropModeWithUrl callback mock; introduces PREFILL_URL constant and two new test cases verifying prefilled URL behavior and mode reset on wave scope changes.
Curation content component
components/waves/CreateCurationDropContent.tsx
Adds initialUrl prop to accept prefilled URLs; initializes urlValue state from initialUrl; applies minor layout alignment adjustments to the non-leaderboard variant.
Drop mode state management
components/waves/CreateDrop.tsx
Introduces scope-aware drop-mode management with dropModeOverride and curationPrefillSeed state; replaces effect-based mode sync with derived mode resolution; adds validation via canSwitchDropMode; introduces onSwitchToDropModeWithUrl callback for mode switching with URL prefilling.
Drop content component
components/waves/CreateDropContent.tsx
Adds curation URL detection and normalization; extends props with onSwitchToDropModeWithUrl callback; renders conditional warning block with mode-switch button when curation URL is detected in non-drop mode; threads the new callback through component hierarchy.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CreateDropContent
    participant CreateDrop
    participant CreateCurationDropContent
    participant Validation

    User->>CreateDropContent: Edits markdown with curation URL
    CreateDropContent->>CreateDropContent: Detect & normalize curation URL
    CreateDropContent->>User: Show "Switch to Drop mode" warning

    User->>CreateDropContent: Click "Switch to Drop mode"
    CreateDropContent->>CreateDrop: onSwitchToDropModeWithUrl(url)

    CreateDrop->>Validation: canSwitchDropMode()
    Validation->>CreateDrop: Valid/Invalid result + toast

    CreateDrop->>CreateDrop: Set curationPrefillSeed = url
    CreateDrop->>CreateDrop: Set dropModeOverride for scope
    CreateDrop->>CreateDrop: Update isDropMode

    CreateDrop->>CreateCurationDropContent: Pass initialUrl = prefillSeed
    CreateCurationDropContent->>CreateCurationDropContent: Initialize urlValue from initialUrl
    CreateCurationDropContent->>User: Display prefilled URL field
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • Format text #1529: Modifies CreateDropContent.tsx for markdown export/normalization logic within the same component that is enhanced in this PR with curation URL handling.

Suggested reviewers

  • ragnep
  • prxt6529

Poem

🐰 URLs now dance through drops with care,
Modes switch smoothly in the air,
Scopes are tracked with seeds so fine,
Curation paths now intertwine! 🌊

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title contains a typo ('Curtion' instead of 'Curation') and is somewhat unclear. It references 'warning if input matches potential submission' but doesn't clearly convey the main objective of adding URL prefilling and drop mode switching functionality. Correct the typo to 'Curation' and clarify the main change, such as: 'Add curation wave warning with drop mode switching on URL match' or 'Support prefilled URLs and drop mode switching for curation waves'.
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 (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 curtion-wave-add-warning-if-input-matches-potential-submission

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

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/waves/CreateCurationDropContent.tsx (1)

164-164: Consider syncing urlValue when initialUrl prop changes.

The current implementation only uses initialUrl during the initial mount via the useState initializer. If initialUrl changes after mount (e.g., user switches modes multiple times with different URLs), the input won't update to reflect the new value.

If this is intentional behavior (user edits should persist), this is fine. Otherwise, consider adding an effect to sync urlValue when initialUrl changes:

♻️ Optional: Sync urlValue when initialUrl changes
 const [urlValue, setUrlValue] = useState(() => initialUrl ?? "");
+
+  useEffect(() => {
+    if (initialUrl !== null) {
+      setUrlValue(initialUrl);
+    }
+  }, [initialUrl]);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@components/waves/CreateCurationDropContent.tsx` at line 164, The state
urlValue is only initialized from initialUrl via useState in
CreateCurationDropContent and won't update if the initialUrl prop changes; add a
useEffect that watches initialUrl and calls setUrlValue(initialUrl ?? "") when
initialUrl changes (optionally guard so you don't overwrite user edits if that's
intended), referencing urlValue, setUrlValue, and initialUrl in the effect to
keep the input in sync with prop updates.
🤖 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/waves/CreateCurationDropContent.tsx`:
- Line 164: The state urlValue is only initialized from initialUrl via useState
in CreateCurationDropContent and won't update if the initialUrl prop changes;
add a useEffect that watches initialUrl and calls setUrlValue(initialUrl ?? "")
when initialUrl changes (optionally guard so you don't overwrite user edits if
that's intended), referencing urlValue, setUrlValue, and initialUrl in the
effect to keep the input in sync with prop updates.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 04b54ff and 4e56c90.

📒 Files selected for processing (4)
  • __tests__/components/waves/CreateDrop.test.tsx
  • components/waves/CreateCurationDropContent.tsx
  • components/waves/CreateDrop.tsx
  • components/waves/CreateDropContent.tsx

@simo6529 simo6529 merged commit 46e2cc8 into main Feb 27, 2026
7 checks passed
@simo6529 simo6529 deleted the curtion-wave-add-warning-if-input-matches-potential-submission branch February 27, 2026 19:57
@coderabbitai coderabbitai Bot mentioned this pull request Mar 17, 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