Skip to content

Fix/campaign creation form#610

Merged
aunali8812 merged 2 commits intostagingfrom
fix/campaign-creation-form
Mar 24, 2026
Merged

Fix/campaign creation form#610
aunali8812 merged 2 commits intostagingfrom
fix/campaign-creation-form

Conversation

@aunali8812
Copy link
Copy Markdown
Collaborator

@aunali8812 aunali8812 commented Mar 24, 2026

Summary by CodeRabbit

  • Bug Fixes

    • Improved timestamp validation error messages for better clarity
    • Campaigns now automatically adjust start times if they drift into the past
    • Added validation to prevent campaigns with past end dates
  • New Features

    • Featured campaigns carousel now displays 5 campaigns instead of 4
  • Updates

    • New campaigns default to starting 5 minutes from now
    • Updated featured projects list

@aunali8812 aunali8812 requested a review from Ebube111 as a code owner March 24, 2026 19:01
@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
potlock-next-app Ready Ready Preview, Comment Mar 25, 2026 6:59am

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 24, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e9f5d319-967a-42ba-a332-1af53a2beb22

📥 Commits

Reviewing files that changed from the base of the PR and between 10fd191 and 1a3e5dc.

📒 Files selected for processing (5)
  • src/common/lib/datetime.ts
  • src/entities/campaign/components/editor.tsx
  • src/entities/campaign/hooks/forms.ts
  • src/pages/campaigns.tsx
  • src/pages/index.tsx

Walkthrough

This PR updates validation messaging for future timestamps, refines the campaign creation flow to auto-correct past start times with Temporal-based defaults, adjusts form submission logic and validation, and refreshes featured campaigns and project listings by updating carousel filters and removing specific accounts.

Changes

Cohort / File(s) Summary
Validation & Datetime
src/common/lib/datetime.ts
Updated futureTimestamp validation error message from "Cannot be in the past" to "Must be a future date and time".
Campaign Editor & Forms
src/entities/campaign/components/editor.tsx, src/entities/campaign/hooks/forms.ts
Modified form submission to conditionally refresh start_ms to "now + 1 minute" in create mode when drifted into the past. Added Temporal-based default start time ("now + 5 minutes") for new campaigns. Introduced end_ms validation to reject past end dates with a destructive toast. Updated required-fields message and refined start_ms inclusion logic for new vs. updated campaigns.
Featured Listings
src/pages/campaigns.tsx, src/pages/index.tsx
Updated featured campaigns carousel total from /4 to /5 and expanded on_chain_id filter to include campaigns with ID 136. Removed "yearofchef.near" and "yearofchef.testnet" from featured project account lists.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Editor as Campaign Editor
    participant Form as Form Logic
    participant Handler as Submit Handler

    User->>Editor: Submit campaign form
    Editor->>Handler: onSubmit triggered
    Handler->>Form: Check if create mode & start_ms in past
    alt Create mode & start_ms < now
        Form->>Form: Refresh start_ms to now + 1 min
        Form->>Form: Update form values (shouldValidate: false)
    end
    Handler->>Form: Validate end_ms if provided
    alt end_ms in past
        Form->>Editor: Show destructive toast error
        Form->>Handler: Abort submission
    else end_ms valid or not provided
        Handler->>Form: Call form.handleSubmit()
        Form->>Handler: Return submission payload
        Handler->>Handler: Submit with allow_fee_avoidance
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • PotLock/potlock-nextjs-app#382: Overlapping campaign start-time handling modifications in src/entities/campaign/hooks/forms.ts and campaign editor components affecting start_ms validation and inclusion logic.
  • PotLock/potlock-nextjs-app#586: Modifies the same futureTimestamp refinement in src/common/lib/datetime.ts affecting validation boundary conditions.
  • PotLock/potlock-nextjs-app#502: Modifies featured listings in src/pages/campaigns.tsx and src/pages/index.tsx to change carousel filtering and featured account selections.

Suggested reviewers

  • Ebube111
  • carina-akaia

Poem

🐰⏰ The future awaits with five-minute grace,
No more campaigns lost in the time-space!
With auto-correction and validation so bright,
We build tomorrow with schedules just right.
Featured friends gather in carousel rows. 🌟

✨ 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 fix/campaign-creation-form

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.

@aunali8812 aunali8812 merged commit ae42bb7 into staging Mar 24, 2026
3 of 4 checks passed
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