fixes #368: add player count limit and date validation in TournamentHub#369
fixes #368: add player count limit and date validation in TournamentHub#369compiler041 wants to merge 2 commits intoAOSSIE-Org:mainfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdd client-side validation and UI tweaks: enforce start date >= today, add configurable max participants with power-of-two and bounds checks, reset new participant fields on create, cap avatar display to 6 with “+N” overflow, and change card container overflow to hidden. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment Tip CodeRabbit can suggest fixes for GitHub Check annotations.Configure the |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@frontend/src/Pages/TournamentHub.tsx`:
- Around line 84-85: The form relies on the date input's min attribute only; add
a submit-time validation inside handleCreate (and the other create/submit
handler around lines 278-285) that reads the chosen date (e.g., tournament date
state), parses it to a Date, compares it to today's date (ignoring time), and if
the chosen date is in the past set a clear error state/flag (e.g., setDateError
or setFormError) and return early so submission is blocked; reference
getMaxParticipants for context where maxParticipants is fetched and ensure the
new check runs before any create logic uses that value.
- Around line 60-75: getMaxParticipants currently validates minimum and
power-of-two but doesn't enforce an upper cap; update the function to compare
against a defined maximum (e.g. const MAX_PARTICIPANTS = 64) and if val >
MAX_PARTICIPANTS call setCustomError("Must be at most X.") and return null, then
clear error and return val; also ensure the non-custom branch (return
parseInt(participantOption)) validates/caps against MAX_PARTICIPANTS as well,
and add the max={MAX_PARTICIPANTS} attribute to the custom participants input so
the UI prevents oversized values; reference getMaxParticipants,
participantOption, customParticipants, setCustomError, and isPowerOfTwo when
making changes.
- Around line 319-329: The placeholder and helper text next to the custom input
conflict with the validation (power-of-two) — update the input placeholder (the
JSX input element with placeholder="e.g. 12, 20, 32") to show valid power-of-two
examples (e.g. "e.g. 8, 16, 32") and adjust the helper copy (the fallback <p>
that currently reads "Must be a power of 2...") if needed to match the
placeholder; keep the conditional rendering that shows {customError} unchanged
so validation errors still display.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 938278c6-1a68-4ad3-83be-6960f232264a
📒 Files selected for processing (1)
frontend/src/Pages/TournamentHub.tsx
…on submit, placeholder fix
|
I have resolved all the issues reported by coderabbit. |
Addressed Issues:
Fixes #368
Screenshots/Recordings:
**After:

Additional Notes:
Added client-side validation to TournamentHub.tsx:
AI Usage Disclosure:
I have used the following AI models and tools: Claude
Checklist
Summary by CodeRabbit
New Features
UI/UX Improvements
Bug Fixes