generated from Migracode-Barcelona/final-project-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Add react hook form to all form component. #124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
AferePreciousOnome
wants to merge
4
commits into
main
Choose a base branch
from
feat/react_form
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
970e03b
Add react hook form to all form component.
AferePreciousOnome 5915048
Refactor multi-step form to use FormProvider with shared state and ce…
AferePreciousOnome 1a8c8f4
Centralized logic in MultiFormPage, simplified API key flow, removed …
AferePreciousOnome 7565157
Merge branch 'main' into feat/react_form
AferePreciousOnome File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| import * as yup from 'yup'; | ||
| import { isValidMonthYear, isAfter } from '../utils/date.js'; | ||
| import validateApiKey from '../utils/validations.js'; | ||
|
|
||
| const cvSchema = yup.object().shape({ | ||
| apiKey: yup | ||
| .string() | ||
| .required('API key is required') | ||
| .test('is-valid-api-key', 'Invalid API key format', (value) => { | ||
| if (!value) return false; | ||
| return validateApiKey(value); | ||
| }), | ||
| personalInfo: yup.object().shape({ | ||
| fullName: yup.string().required('Full name is required'), | ||
| email: yup.string().email().required('Email is required'), | ||
| phone: yup.string().required('Phone number is required'), | ||
| github: yup.string().url().required('GitHub profile is required'), | ||
| linkedin: yup.string().url().required('LinkedIn profile is required'), | ||
| portfolio: yup.string().url().required('Portfolio is required'), | ||
| }), | ||
| professionalSummary: yup.object().shape({ | ||
| summary: yup.string().required('Professional summary is required'), | ||
| }), | ||
| transferableExperience: yup.object().shape({ | ||
| experience: yup.string().required('Experience is required'), | ||
| }), | ||
| projects: yup | ||
| .array() | ||
| .of( | ||
| yup.object().shape({ | ||
| name: yup.string().required('Project name is required'), | ||
| description: yup | ||
| .string() | ||
| .required('Description is required') | ||
| .test( | ||
| 'charCount', | ||
| 'Description must be more than 150 characters', | ||
| (value) => typeof value === 'string' && value.trim().length > 150 | ||
| ), | ||
| deployedWebsite: yup | ||
| .string() | ||
| .url('Deployed site must be a valid URL') | ||
| .required('Deployed website is required'), | ||
| githubLink: yup | ||
| .string() | ||
| .url('GitHub link must be a valid URL') | ||
| .matches( | ||
| /^https:\/\/github\.com\/.+/, | ||
| 'Must be a GitHub repository URL' | ||
| ) | ||
| .required('GitHub link is required'), | ||
| }) | ||
| ) | ||
| .required('Projects are required'), | ||
| education: yup | ||
| .array() | ||
| .of( | ||
| yup.object().shape({ | ||
| institution: yup.string().required('Institution is required'), | ||
| program: yup.string().required('Program is required'), | ||
| startDate: yup | ||
| .string() | ||
| .required('Start date is required') | ||
| .test( | ||
| 'valid-start-format', | ||
| "Start date must be in 'Month YYYY' format", | ||
| isValidMonthYear | ||
| ), | ||
| endDate: yup | ||
| .string() | ||
| .required('End date is required') | ||
| .test( | ||
| 'valid-or-current', | ||
| 'End date must be a valid date or "current"', | ||
| function (value) { | ||
| return ( | ||
| value?.toLowerCase() === 'current' || isValidMonthYear(value) | ||
| ); | ||
| } | ||
| ) | ||
| .test( | ||
| 'after-start', | ||
| 'End date must be after start date', | ||
| function (value) { | ||
| const { startDate } = this.parent; | ||
| if (!startDate || !value) return true; | ||
| if (value.toLowerCase() === 'current') return true; | ||
|
|
||
| return isAfter(startDate, value); | ||
| } | ||
| ), | ||
| }) | ||
| ) | ||
| .required('Education is required'), | ||
| profileVsJobCriteria: yup.object().shape({ | ||
| jobcriteria: yup | ||
| .string() | ||
| .required('Comparison with job criteria is required'), | ||
| }), | ||
| }); | ||
|
|
||
| export default cvSchema; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "folders": [ | ||
| { | ||
| "path": "." | ||
| } | ||
| ], | ||
| "settings": {} | ||
| } |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.