feat(frontend): form validation with inline error states (#184) - #233
Closed
ifygreg01-best wants to merge 1 commit into
Closed
feat(frontend): form validation with inline error states (#184)#233ifygreg01-best wants to merge 1 commit into
ifygreg01-best wants to merge 1 commit into
Conversation
- Add loginSchema, registerSchema, courseSchema, credentialIssuanceSchema to src/lib/schemas.ts with full Zod validation rules - Add reusable FormField component with red-border error state, inline error message (role=alert), helper text, and ARIA attributes - Add LoginForm: email/password/rememberMe, onBlur validation, server error banner, disabled submit while invalid - Add RegisterForm: name/email/password/confirmPassword/acceptTerms, onChange validation (required for checkbox), password complexity rules, cross-field match check - Add CourseCreationForm: all course fields, category/difficulty/currency selects, description character counter, publish toggle - Add CredentialIssuanceForm: recipient info, credential type/title, fieldset grouping, issue/expiration date validation - Add /app/auth/login and /app/auth/register pages with branded layout - Add 54 tests: 38 schema unit tests + 16 RTL component tests Closes Epondia#184
Contributor
|
Closing: this branch has merge conflicts with |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements client-side form validation with inline error messages and visual error states for all user input forms, closing #184.
Changes
Schemas (
src/lib/schemas.ts)loginSchema— email, password, optional rememberMeregisterSchema— name, email, password (complexity: uppercase, lowercase, digit, 8+ chars), confirmPassword cross-field match, acceptTermscourseSchema— title, description, category, difficulty, price (decimal regex + non-negative), currency, duration, prerequisites, tags, isPublishedcredentialIssuanceSchema— recipient name/email/wallet, credential type/title/description, issue date, optional expiration dateReusable
FormFieldcomponent (src/components/forms/FormField.tsx)errorprop is setrole="alert"and error icon*indicator and full ARIA wiring (aria-invalid,aria-describedby)<input>and<textarea>Form components (
src/components/forms/)mode: 'onBlur'mode: 'onChange'(required for checkbox isValid)Auth pages
/app/auth/login/page.tsx— branded card, POST/api/auth/login, redirect on success/app/auth/register/page.tsx— branded card, POST/api/auth/register, redirect on successTesting
54 tests, all passing:
Acceptance criteria