-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
VACMS-16913: DUW questions 3 (#29030)
- Loading branch information
1 parent
a8cdc10
commit a27c6f5
Showing
30 changed files
with
1,103 additions
and
93 deletions.
There are no files selected for viewing
This file contains 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 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
22 changes: 22 additions & 0 deletions
22
src/applications/discharge-wizard/components/v2/BreadcrumbsV2.jsx
This file contains 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,22 @@ | ||
import React from 'react'; | ||
import { VaBreadcrumbs } from '@department-of-veterans-affairs/web-components/react-bindings'; | ||
|
||
const BreadcrumbsV2 = () => ( | ||
<VaBreadcrumbs | ||
class="vads-u-margin-left--1p5" | ||
label="Breadcrumbs" | ||
uswds | ||
breadcrumbList={[ | ||
{ | ||
href: '/', | ||
label: 'Home', | ||
}, | ||
{ | ||
href: '/discharge-upgrade-instructions/introduction', | ||
label: 'Discharge upgrade', | ||
}, | ||
]} | ||
/> | ||
); | ||
|
||
export default BreadcrumbsV2; |
This file contains 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
79 changes: 79 additions & 0 deletions
79
src/applications/discharge-wizard/components/v2/questions/CourtMartial.jsx
This file contains 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,79 @@ | ||
import React, { useEffect, useState } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { connect } from 'react-redux'; | ||
import { | ||
QUESTION_MAP, | ||
RESPONSES, | ||
SHORT_NAME_MAP, | ||
} from '../../../constants/question-data-map'; | ||
import RadioGroup from './shared/RadioGroup'; | ||
import { updateCourtMartial } from '../../../actions'; | ||
import { pageSetup } from '../../../utilities/page-setup'; | ||
import { ROUTES } from '../../../constants'; | ||
|
||
const CourtMartial = ({ | ||
formResponses, | ||
setCourtMartial, | ||
router, | ||
viewedIntroPage, | ||
}) => { | ||
const [formError, setFormError] = useState(false); | ||
const shortName = SHORT_NAME_MAP.COURT_MARTIAL; | ||
const H1 = QUESTION_MAP[shortName]; | ||
const courtMartial = formResponses[shortName]; | ||
const { COURT_MARTIAL_1, COURT_MARTIAL_2, COURT_MARTIAL_3 } = RESPONSES; | ||
|
||
useEffect( | ||
() => { | ||
pageSetup(H1); | ||
}, | ||
[H1], | ||
); | ||
|
||
useEffect( | ||
() => { | ||
if (!viewedIntroPage) { | ||
router.push(ROUTES.HOME); | ||
} | ||
}, | ||
[router, viewedIntroPage], | ||
); | ||
|
||
return ( | ||
<RadioGroup | ||
formError={formError} | ||
formResponses={formResponses} | ||
formValue={courtMartial} | ||
H1={H1} | ||
responses={[COURT_MARTIAL_1, COURT_MARTIAL_2, COURT_MARTIAL_3]} | ||
router={router} | ||
setFormError={setFormError} | ||
shortName={shortName} | ||
testId="duw-court_martial" | ||
valueSetter={setCourtMartial} | ||
/> | ||
); | ||
}; | ||
|
||
CourtMartial.propTypes = { | ||
formResponses: PropTypes.object, | ||
router: PropTypes.shape({ | ||
push: PropTypes.func, | ||
}), | ||
setCourtMartial: PropTypes.func, | ||
viewedIntroPage: PropTypes.bool, | ||
}; | ||
|
||
const mapStateToProps = state => ({ | ||
formResponses: state?.dischargeUpgradeWizard?.duwForm?.form, | ||
viewedIntroPage: state?.dischargeUpgradeWizard?.duwForm?.viewedIntroPage, | ||
}); | ||
|
||
const mapDispatchToProps = { | ||
setCourtMartial: updateCourtMartial, | ||
}; | ||
|
||
export default connect( | ||
mapStateToProps, | ||
mapDispatchToProps, | ||
)(CourtMartial); |
This file contains 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
79 changes: 79 additions & 0 deletions
79
src/applications/discharge-wizard/components/v2/questions/DischargeType.jsx
This file contains 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,79 @@ | ||
import React, { useEffect, useState } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { connect } from 'react-redux'; | ||
import { | ||
QUESTION_MAP, | ||
RESPONSES, | ||
SHORT_NAME_MAP, | ||
} from '../../../constants/question-data-map'; | ||
import RadioGroup from './shared/RadioGroup'; | ||
import { updateDischargeType } from '../../../actions'; | ||
import { pageSetup } from '../../../utilities/page-setup'; | ||
import { ROUTES } from '../../../constants'; | ||
|
||
const DischargeType = ({ | ||
formResponses, | ||
setDischargeType, | ||
router, | ||
viewedIntroPage, | ||
}) => { | ||
const [formError, setFormError] = useState(false); | ||
const shortName = SHORT_NAME_MAP.DISCHARGE_TYPE; | ||
const H1 = QUESTION_MAP[shortName]; | ||
const dischargeType = formResponses[shortName]; | ||
const { DISCHARGE_TYPE_1, DISCHARGE_TYPE_2 } = RESPONSES; | ||
|
||
useEffect( | ||
() => { | ||
pageSetup(H1); | ||
}, | ||
[H1], | ||
); | ||
|
||
useEffect( | ||
() => { | ||
if (!viewedIntroPage) { | ||
router.push(ROUTES.HOME); | ||
} | ||
}, | ||
[router, viewedIntroPage], | ||
); | ||
|
||
return ( | ||
<RadioGroup | ||
formError={formError} | ||
formResponses={formResponses} | ||
formValue={dischargeType} | ||
H1={H1} | ||
responses={[DISCHARGE_TYPE_1, DISCHARGE_TYPE_2]} | ||
router={router} | ||
setFormError={setFormError} | ||
shortName={shortName} | ||
testId="duw-discharge_type" | ||
valueSetter={setDischargeType} | ||
/> | ||
); | ||
}; | ||
|
||
DischargeType.propTypes = { | ||
formResponses: PropTypes.object, | ||
setDischargeType: PropTypes.func, | ||
router: PropTypes.shape({ | ||
push: PropTypes.func, | ||
}), | ||
viewedIntroPage: PropTypes.bool, | ||
}; | ||
|
||
const mapStateToProps = state => ({ | ||
formResponses: state?.dischargeUpgradeWizard?.duwForm?.form, | ||
viewedIntroPage: state?.dischargeUpgradeWizard?.duwForm?.viewedIntroPage, | ||
}); | ||
|
||
const mapDispatchToProps = { | ||
setDischargeType: updateDischargeType, | ||
}; | ||
|
||
export default connect( | ||
mapStateToProps, | ||
mapDispatchToProps, | ||
)(DischargeType); |
This file contains 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
79 changes: 79 additions & 0 deletions
79
src/applications/discharge-wizard/components/v2/questions/Intention.jsx
This file contains 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,79 @@ | ||
import React, { useEffect, useState } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { connect } from 'react-redux'; | ||
import { | ||
QUESTION_MAP, | ||
RESPONSES, | ||
SHORT_NAME_MAP, | ||
} from '../../../constants/question-data-map'; | ||
import RadioGroup from './shared/RadioGroup'; | ||
import { updateIntention } from '../../../actions'; | ||
import { pageSetup } from '../../../utilities/page-setup'; | ||
import { ROUTES } from '../../../constants'; | ||
|
||
const Intention = ({ | ||
formResponses, | ||
setIntention, | ||
router, | ||
viewedIntroPage, | ||
}) => { | ||
const [formError, setFormError] = useState(false); | ||
const shortName = SHORT_NAME_MAP.INTENTION; | ||
const H1 = QUESTION_MAP[shortName]; | ||
const intention = formResponses[shortName]; | ||
const { INTENTION_1, INTENTION_2 } = RESPONSES; | ||
|
||
useEffect( | ||
() => { | ||
pageSetup(H1); | ||
}, | ||
[H1], | ||
); | ||
|
||
useEffect( | ||
() => { | ||
if (!viewedIntroPage) { | ||
router.push(ROUTES.HOME); | ||
} | ||
}, | ||
[router, viewedIntroPage], | ||
); | ||
|
||
return ( | ||
<RadioGroup | ||
formError={formError} | ||
formResponses={formResponses} | ||
formValue={intention} | ||
H1={H1} | ||
responses={[INTENTION_1, INTENTION_2]} | ||
router={router} | ||
setFormError={setFormError} | ||
shortName={shortName} | ||
testId="duw-intention" | ||
valueSetter={setIntention} | ||
/> | ||
); | ||
}; | ||
|
||
Intention.propTypes = { | ||
formResponses: PropTypes.object, | ||
router: PropTypes.shape({ | ||
push: PropTypes.func, | ||
}), | ||
setIntention: PropTypes.func, | ||
viewedIntroPage: PropTypes.bool, | ||
}; | ||
|
||
const mapStateToProps = state => ({ | ||
formResponses: state?.dischargeUpgradeWizard?.duwForm?.form, | ||
viewedIntroPage: state?.dischargeUpgradeWizard?.duwForm?.viewedIntroPage, | ||
}); | ||
|
||
const mapDispatchToProps = { | ||
setIntention: updateIntention, | ||
}; | ||
|
||
export default connect( | ||
mapStateToProps, | ||
mapDispatchToProps, | ||
)(Intention); |
Oops, something went wrong.