Skip to content

Commit

Permalink
Merge pull request #508 from nwplus/remove-vaccination-checkbox
Browse files Browse the repository at this point in the history
Remove all vaccination info from (nwHacks) application
  • Loading branch information
sidyakinian authored Oct 12, 2023
2 parents 5e18731 + 967e8ff commit 4c35c4e
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 112 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import React from 'react'
import { CenteredH1, ErrorMessage, ErrorSpan as Required } from '../Typography'
import { Checkbox } from '../../components/Input'
import { FormSpacing, SubHeading } from './'
import { copyText } from '../../utility/Constants'
import { CenteredH1 } from '../Typography'
import { FormSpacing, SubHeading } from '.'

// form part 0 for vaccine info
export default ({ formInputs, onChange, error }) => {
export default () => {
return (
<>
<FormSpacing>
Expand All @@ -24,22 +21,6 @@ export default ({ formInputs, onChange, error }) => {
attendees, so please fill out the form so we can get a better idea of the amount of people
attending, and of course, craft the best 24-hour hacker experience for you!
</SubHeading>
<Checkbox
flex
checked={formInputs.willBeDoubleVaxed}
onChange={() =>
onChange({
willBeDoubleVaxed: !formInputs.willBeDoubleVaxed,
})
}
required
>
<span>
I confirm I am or will be double-vaccinated at {copyText.hackathonName}
<Required />
</span>
</Checkbox>
{error?.willBeDoubleVaxed && <ErrorMessage>{error?.willBeDoubleVaxed}</ErrorMessage>}
</FormSpacing>
</>
)
Expand Down
27 changes: 0 additions & 27 deletions src/components/ApplicationForm/ReviewCards.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,33 +151,6 @@ export default ({ formInputs, handleEdit, onChange }) => {
</CenterH1>
</FormSpacing>

<ReviewContainer>
<JohnDiv>
<QuestionHeading>Vaccination Status</QuestionHeading>
<Button
onClick={() => handleEdit('/application/part-0')}
height="short"
color="secondary"
>
Edit
</Button>
</JohnDiv>
<StyledBanner wide={true} blur>
<ContentWrapper grid>
<InfoGroup
heading="Will be double-vaccinated"
data={
formInputs.vaccineInfo.willBeDoubleVaxed
? 'Yes'
: formInputs.vaccineInfo.willBeDoubleVaxed === null
? ''
: 'No'
}
/>
</ContentWrapper>
</StyledBanner>
</ReviewContainer>

<ReviewContainer>
<JohnDiv>
<QuestionHeading>Tell us about yourself</QuestionHeading>
Expand Down
45 changes: 4 additions & 41 deletions src/containers/Application/Part0.js
Original file line number Diff line number Diff line change
@@ -1,70 +1,33 @@
import React, { useState, useEffect } from 'react'
import React, { useState } from 'react'
import { useLocation } from 'wouter'
import VaccineInfo from '../../components/ApplicationForm/VaccineInfo'
import HackathonInfo from '../../components/ApplicationForm/HackathonInfo'
import NavigationButtons from '../../components/NavigationButtons'
import VerticalProgressBar from '../../components/VerticalProgressBar'
import { useHackerApplication } from '../../utility/HackerApplicationContext'
import { checkForError, validateFormSection } from '../../utility/Validation'

export default () => {
const { application, updateApplication, forceSave } = useHackerApplication()
const { application, forceSave } = useHackerApplication()
const [, setLocation] = useLocation()
const [errors, setErrors] = useState({})
const [loading, setLoading] = useState(false)

const validate = change => {
const newErrors = validateFormSection(change, 'vaccineInfo')
setErrors({ ...errors, ...newErrors })
return { ...errors, ...newErrors }
}

const save = async () => {
setLoading(true)
await forceSave()
setLoading(false)
}

const updateVaccineInfo = change => {
validate(change)

updateApplication({
vaccineInfo: {
...change,
},
})
}

useEffect(() => {
if (!application.vaccineInfo) {
updateVaccineInfo({ willBeDoubleVaxed: false })
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [])

/**
* Saves and moves to next page
*/
const handleNavigation = async href => {
await save()
if (href === '/application/part-1') {
const newErrors = validate(application.vaccineInfo)
if (checkForError(newErrors)) {
return
}
}
setLocation(href)
window.scrollTo(0, 0)
}

return (
<>
{application.vaccineInfo && (
<VaccineInfo
error={errors}
formInputs={application.vaccineInfo}
onChange={updateVaccineInfo}
/>
)}
<HackathonInfo />
<VerticalProgressBar percent={25} />
<NavigationButtons
secondButtonText="Next"
Expand Down
3 changes: 0 additions & 3 deletions src/utility/Constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,6 @@ export const EVENTS_ATTENDED = Object.freeze({

export const HACKER_APPLICATION_TEMPLATE = Object.freeze({
_id: '',
vaccineInfo: {
willBeDoubleVaxed: false,
},
basicInfo: {
email: '',
firstName: '',
Expand Down
5 changes: 0 additions & 5 deletions src/utility/HackerApplicationContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ export function HackerApplicationProvider({ children }) {
Keep the ref up to date with the latest application
Handles merging of the current app with the new one */
const updateApplication = ({
vaccineInfo,
basicInfo,
skills,
questionnaire,
Expand All @@ -122,10 +121,6 @@ export function HackerApplicationProvider({ children }) {
}) => {
const mergedApp = {
...application,
vaccineInfo: {
...application.vaccineInfo,
...vaccineInfo,
},
basicInfo: {
...application.basicInfo,
...basicInfo,
Expand Down
14 changes: 0 additions & 14 deletions src/utility/Validation.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import { copyText } from './Constants'

const MUST_BE_VACCINATED = `You can only participate in ${copyText.hackathonName} if you are double-vaccinated by then!`
const EMAIL_MESSAGE = 'Please include a valid email.'
const NOT_EMPTY = 'Please include this field.'
const NOT_NONE = 'Please select at least one that applies.'
Expand Down Expand Up @@ -68,12 +65,6 @@ const validateResume = thing => {
}

// eslint-disable-next-line no-unused-vars
const mustBeVaccinatedFunction = thing => {
return {
error: !thing,
message: MUST_BE_VACCINATED,
}
}

const noEmptyFunction = thing => {
return {
Expand Down Expand Up @@ -158,7 +149,6 @@ export const validateFormSection = (change, section) => {
}

export const validateEntireForm = application => {
// const vaccineInfoErrors = validateFormSection(application.vaccineInfo, 'vaccineInfo')
const basicInfoErrors = validateFormSection(application.basicInfo, 'basicInfo')
const skillsErrors = validateFormSection(application.skills, 'skills')
const questionnaireErrors = validateFormSection(application.questionnaire, 'questionnaire')
Expand All @@ -168,7 +158,6 @@ export const validateEntireForm = application => {
)

return {
// ...vaccineInfoErrors,
...basicInfoErrors,
...skillsErrors,
...questionnaireErrors,
Expand All @@ -177,9 +166,6 @@ export const validateEntireForm = application => {
}

const validators = {
vaccineInfo: {
willBeDoubleVaxed: mustBeVaccinatedFunction,
},
basicInfo: {
email: email => {
return {
Expand Down

0 comments on commit 4c35c4e

Please sign in to comment.