feat: add real-time character counter with min/max validation and pro…#261
feat: add real-time character counter with min/max validation and pro…#261Owais-Siddique-11 wants to merge 1 commit into
Conversation
|
@Owais-Siddique-11 is attempting to deploy a commit to the Karan Mani Tripathi 's projects Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Technical Review
Hi @Owais-Siddique-11! Thank you for your contribution to DoubtDesk.
The code changes look good. Before we can complete the technical review, approve, and merge this pull request, we have one final requirement for all contributors: Please star the DoubtDesk repository.
Once you have starred the repository, please drop a comment here saying "done" (or we will automatically detect it) and we will proceed with approving and merging your PR. Thank you.
There was a problem hiding this comment.
Pull request overview
Adds real-time length feedback to the doubt submission modal to guide users toward higher-quality submissions and prevent overly long/short questions.
Changes:
- Introduces min/max length validation (20–500) and blocks submission when out of bounds.
- Adds a live character counter with inline validation messaging and dynamic textarea border styling.
- Adds an animated progress bar that reflects typing progress and validation state.
Comments suppressed due to low confidence (1)
components/AskDoubt.tsx:405
- The “empty” helper text is shown only when
charCount === 0. If the user types only whitespace,hasContentis false butcharCountis non-zero, so none of the helper/validation messages render (blank area). Using!hasContent/content.trim().length === 0for the empty-state message (and making it mutually exclusive with other states) will avoid this UX gap.
{charCount === 0 && (
<span className="text-slate-500">Min {minLength} · Max {maxLength} characters</span>
)}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <button | ||
| type="submit" | ||
| disabled={isSubmitting || (!content.trim() && !imageUrl) || !subject.trim()} | ||
| disabled={isSubmitting || (!content.trim() && !imageUrl) || !subject.trim() || isTooLong || (hasContent && isTooShort)} | ||
| className="flex-[2] py-4 bg-blue-600 hover:bg-blue-700 text-white rounded-2xl font-bold transition-all shadow-lg shadow-blue-600/20 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2" |
|
Hi there! 👋 Thanks for your contribution to DoubtDesk. It looks like there are currently some merge conflicts between your branch and the Once the conflicts are resolved and the PR is clean, we'll be able to merge it! |
feat: add real-time character counter with min/max validation and progress bar
Closes #232
Summary
Added real-time character counter, progress bar, and inline validation feedback to the doubt submission form in
AskDoubt.tsx.Changes
Screenshots
UI changes visible in the doubt submission modal on the community and classroom pages.