From 82d274009e00cc05de31735b0cca53e306bd98bf Mon Sep 17 00:00:00 2001 From: ahmadysalah Date: Tue, 9 Jun 2020 12:20:03 +0300 Subject: [PATCH] create file for select choises and change message to display for admin #183 --- .../NonlinearStepper/GeneralInfo.js | 82 ++++--------------- .../application/NonlinearStepper/questions.js | 64 +++++++++++++++ .../application/nLinearStepperValidation.js | 18 ++-- 3 files changed, 94 insertions(+), 70 deletions(-) create mode 100644 client/src/components/application/NonlinearStepper/questions.js diff --git a/client/src/components/application/NonlinearStepper/GeneralInfo.js b/client/src/components/application/NonlinearStepper/GeneralInfo.js index f3c7b78..cb84dff 100644 --- a/client/src/components/application/NonlinearStepper/GeneralInfo.js +++ b/client/src/components/application/NonlinearStepper/GeneralInfo.js @@ -9,66 +9,19 @@ import PropTypes from 'prop-types'; import InputText from '../../common/TextField'; import SelectBox from '../SelectBox'; import Typography from '../../common/Typography'; - +import selectBoxQuestions from './questions'; import { GeneralInfoStyles } from './style'; const GereralInfos = ({ handleFormInput, formValues, errorMsg }) => { const classes = GeneralInfoStyles(); - const GazaAreas = [ - 'North of Gaza Strip', - 'Gaza City', - 'Middle Area of Gaza', - 'Khan Younis', - 'Rafah', - ]; - const GazaUniversity = [ - "I didn't go to university", - 'Islamic University of Gaza', - 'Al Azhar University', - 'Palestine University', - 'UCAS', - 'Al Quds Open University', - 'University College of Science and Technology', - 'Al Aqsa University', - 'Gaza University', - 'I went to university outside of Gaza', - ]; - - const KhalilUniversity = [ - "I didn't go to university", - 'Palestine Polytechnic University (PPU)', - 'Hebron University', - 'Bethlehem University', - 'Birzeit University', - 'Al Najah University', - 'Arab American University', - 'Al Quds Open University', - 'Al Quds University', - 'Palestine Technical University - Kadoori', - 'IT College - Vocational Center', - 'University outside of Palestine', - 'Other', - ]; - const advert = [ - 'Gaza Sky Geeks Social Media (Facebook, Twitter, Instagram)', - 'Friend or family member who is a Code Academy graduate', - 'I came to a GSG workshop or event (such as “Coding for Everyone”)', - 'Online / browsing the web', - 'Jobs.ps', - 'Other', - ]; - const codeExperience = [ - 'No Experience', - 'Some experience as hobby', - 'A lot of experience as a hobby', - 'I have a university degree in Computer Science or another related field', - 'I have had a paid job as a developer.', - ]; - const primaryMotivationForm = [ - 'I want to gain employment/earn income as a developer.', - "I want to learn something new - I don't know if I want a coding career", - 'I want to be part of the GSG and Code Academy community', - ]; + const { + GazaAreas, + GazaUniversities, + KhalilUniversities, + advertisement, + codeExperience, + primaryMotivationForm, + } = selectBoxQuestions; const KhalilAreas = ['Old Town', 'New Town']; return ( @@ -164,11 +117,11 @@ const GereralInfos = ({ handleFormInput, formValues, errorMsg }) => { label="university" name="university" items={ - formValues.location === 'gaza' ? GazaUniversity : KhalilUniversity + formValues.location === 'gaza' ? GazaUniversities : KhalilUniversities } setVal={handleFormInput} value={formValues.university} - isError={errorMsg.includes('university')} + isError={errorMsg.includes('Chose your university')} /> { label="specialization" name="specialization" onChange={handleFormInput} - isError={errorMsg.includes('specialization')} + isError={errorMsg.includes('Insert your Specialization')} message="(If you didn't go to university, just write N/A) ?" /> { items={codeExperience} setVal={handleFormInput} value={formValues.codingExperience} - isError={errorMsg.includes('codingExperience')} + isError={errorMsg.includes('Select your coding experience')} /> { items={primaryMotivationForm} setVal={handleFormInput} value={formValues.primaryMotivation} - isError={errorMsg.includes('primaryMotivation')} + isError={errorMsg.includes('Select your primary motivation first')} /> { name="cvLink" onChange={handleFormInput} isError={ - errorMsg.includes('cvLink') || errorMsg.includes('Enter correct url!') + errorMsg.includes('Insert Your Cv Link first') || + errorMsg.includes('Enter correct url!') } /> diff --git a/client/src/components/application/NonlinearStepper/questions.js b/client/src/components/application/NonlinearStepper/questions.js new file mode 100644 index 0000000..910df6c --- /dev/null +++ b/client/src/components/application/NonlinearStepper/questions.js @@ -0,0 +1,64 @@ +const GazaAreas = [ + 'North of Gaza Strip', + 'Gaza City', + 'Middle Area of Gaza', + 'Khan Younis', + 'Rafah', +]; +const GazaUniversities = [ + "I didn't go to university", + 'Islamic University of Gaza', + 'Al Azhar University', + 'Palestine University', + 'UCAS', + 'Al Quds Open University', + 'University College of Science and Technology', + 'Al Aqsa University', + 'Gaza University', + 'I went to university outside of Gaza', +]; + +const KhalilUniversities = [ + "I didn't go to university", + 'Palestine Polytechnic University (PPU)', + 'Hebron University', + 'Bethlehem University', + 'Birzeit University', + 'Al Najah University', + 'Arab American University', + 'Al Quds Open University', + 'Al Quds University', + 'Palestine Technical University - Kadoori', + 'IT College - Vocational Center', + 'University outside of Palestine', + 'Other', +]; +const advertisement = [ + 'Gaza Sky Geeks Social Media (Facebook, Twitter, Instagram)', + 'Friend or family member who is a Code Academy graduate', + 'I came to a GSG workshop or event (such as “Coding for Everyone”)', + 'Online / browsing the web', + 'Jobs.ps', + 'Other', +]; +const codeExperience = [ + 'No Experience', + 'Some experience as hobby', + 'A lot of experience as a hobby', + 'I have a university degree in Computer Science or another related field', + 'I have had a paid job as a developer.', +]; +const primaryMotivationForm = [ + 'I want to gain employment/earn income as a developer.', + "I want to learn something new - I don't know if I want a coding career", + 'I want to be part of the GSG and Code Academy community', +]; + +export default { + GazaAreas, + GazaUniversities, + KhalilUniversities, + advertisement, + codeExperience, + primaryMotivationForm, +}; diff --git a/client/src/utils/application/nLinearStepperValidation.js b/client/src/utils/application/nLinearStepperValidation.js index 3c70dc4..e4ad1ef 100644 --- a/client/src/utils/application/nLinearStepperValidation.js +++ b/client/src/utils/application/nLinearStepperValidation.js @@ -10,18 +10,24 @@ const generalInfosSchema = yup.object().shape({ age: yup.string().required('Age is required').trim(), address: yup.string().required('Address is required'), motivation: yup.string().required(`Insert motivation`).trim(), - specialization: yup.string().required(`specialization`).trim(), - university: yup.string().required(`university`).trim(), - codingExperience: yup.string().required(`codingExperience`).trim(), - primaryMotivation: yup.string().required(`primaryMotivation`).trim(), - caReading: yup.string().required(`caReading`).trim(), + specialization: yup.string().required(`Insert your Specialization`).trim(), + university: yup.string().required(`Select your university`).trim(), + codingExperience: yup + .string() + .required(`Select your coding experience`) + .trim(), + primaryMotivation: yup + .string() + .required(`Select your primary motivation first`) + .trim(), + caReading: yup.string().required(`Select how you here about Us first`).trim(), cvLink: yup .string() .matches( /^((https?):\/\/)?(www.)?[a-z0-9]+(\.[a-z]{2,}){1,3}(#?\/?[a-zA-Z0-9#]+)*\/?(\?[a-zA-Z0-9-_]+=[a-zA-Z0-9-%]+&?)?$/, 'Enter correct url!' ) - .required(`cvLink`) + .required(`Insert Your Cv Link first`) .trim(), });