Skip to content
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

Refactor/household data #1407

Open
wants to merge 128 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 121 commits
Commits
Show all changes
128 commits
Select commit Hold shift + click to select a range
3ef31ff
Move QuestionHeader to the HHDB return stmt
ivonne-hernandez Oct 15, 2024
7166f3f
Add a HHMSummaryCards wireframe component
ivonne-hernandez Oct 15, 2024
89798b0
Fix TS errors in HHMSummaryCards
ivonne-hernandez Oct 16, 2024
e68ce29
Remove Page and Step from file names and imports
ivonne-hernandez Oct 16, 2024
2fccb70
Pass formData to HHMSummaryCards and add HHMSummaryCardsProps
ivonne-hernandez Oct 16, 2024
189c553
WIP HHMemberForm
ivonne-hernandez Oct 17, 2024
aeca847
Merge branch 'dev' into refactor/household-data
ivonne-hernandez Oct 18, 2024
5ba6046
Remove householdData from questions.tsx
ivonne-hernandez Oct 18, 2024
a8d6f81
Add the birthmonth select component to the HouseholdMemberForm
ivonne-hernandez Nov 14, 2024
4f79f13
Add a MONTHS file
ivonne-hernandez Nov 14, 2024
7130832
Delete unused FM import from PrevAndContBtns
ivonne-hernandez Nov 14, 2024
0b83464
Add HouseholdMemberForm to App
ivonne-hernandez Nov 14, 2024
0a51311
Fix formatting
ivonne-hernandez Nov 14, 2024
480e321
Add hhData cases to useGotToNextStep hook
ivonne-hernandez Nov 14, 2024
090daf6
Add nextStep var to HHMF
ivonne-hernandez Nov 14, 2024
224853c
Merge branch 'dev' into refactor/household-data
ivonne-hernandez Dec 3, 2024
8177392
Add useEffect import
ivonne-hernandez Dec 3, 2024
d5f28ee
Remove unused import, fix immutableReferrer text
ivonne-hernandez Dec 3, 2024
b592495
Add renderBirthMonthHelperText function
ivonne-hernandez Dec 4, 2024
9ba7ac8
Add YEARS and autoCompleteOptions
ivonne-hernandez Dec 4, 2024
c3223c6
Add birthYear to formSchema and defaultValues
ivonne-hernandez Dec 4, 2024
08c3915
Add renderBirthYearHelperText function
ivonne-hernandez Dec 4, 2024
f6269d5
Add birthYear Controller
ivonne-hernandez Dec 4, 2024
45d38bb
Fix format
ivonne-hernandez Dec 4, 2024
630d2be
Replace or with ??
ivonne-hernandez Dec 4, 2024
1a4826b
Remove unused prop
ivonne-hernandez Dec 4, 2024
211a985
Fix the initial invalid Autocomplete value warning
ivonne-hernandez Dec 4, 2024
9a55f10
Add RHFOptionCardGroup WIP component
ivonne-hernandez Dec 9, 2024
d3dcb8a
Remove Controller, add shouldValidate, shouldDirty prop to setValue call
ivonne-hernandez Dec 9, 2024
806669d
Add styling div to RHFOptionCardGroup
ivonne-hernandez Dec 9, 2024
216170c
Add displayHIQ function
ivonne-hernandez Dec 9, 2024
5d7395f
Add displayHealthCareQuestion function
ivonne-hernandez Dec 9, 2024
cd3389c
Conditionally render displayHealthInsuranceBlock in rtn stmt
ivonne-hernandez Dec 9, 2024
2ee3888
Add renderHealthInsuranceHelperText
ivonne-hernandez Dec 9, 2024
98d1272
Add healthInsurance to defaultValues
ivonne-hernandez Dec 9, 2024
4379528
Remove unused control prop from RHFOptionCardGroup
ivonne-hernandez Dec 9, 2024
a291abf
Add healthInsurance to formSchema
ivonne-hernandez Dec 9, 2024
b1fbd40
Add displayConditionsQuestion
ivonne-hernandez Dec 10, 2024
bfd2d02
Add conditions object to defaultValues
ivonne-hernandez Dec 10, 2024
e25fa7f
Add conditions to formSchema
ivonne-hernandez Dec 10, 2024
41f1b94
Add displayConditionsQ call and conditionFields variable
ivonne-hernandez Dec 10, 2024
85fa93e
Add types to RHFOptionCardGroup
ivonne-hernandez Dec 10, 2024
b3f9da4
Rp variables with inline watch calls
ivonne-hernandez Dec 10, 2024
13d410e
Add wip createHOfHRelationQuestion
ivonne-hernandez Dec 11, 2024
21a5720
Update zod validation for relationshipToHH variable
ivonne-hernandez Dec 11, 2024
d45a030
Remove disabled select from createHOfHRelationQ
ivonne-hernandez Dec 11, 2024
00ac0c9
Remove unused variables
ivonne-hernandez Dec 11, 2024
c7147fc
Add renderRelationshipToHHHelperText function
ivonne-hernandez Dec 11, 2024
f6b9ca9
Add error rendering for relationship
ivonne-hernandez Dec 11, 2024
ed0e8f3
Add hasIncome to state and createIncomeRadioQ function
ivonne-hernandez Dec 11, 2024
bcca45b
Add hasIncome and incomeStreams
ivonne-hernandez Dec 13, 2024
37461aa
Add useEffect for watchHasIncome variable
ivonne-hernandez Dec 13, 2024
5280df4
Add renderIncomeStreamNameDropdownMenu
ivonne-hernandez Dec 13, 2024
f5a89a1
Add renderIncomeStreamNameHelperText and call
ivonne-hernandez Dec 13, 2024
fedec06
Refactor function name
ivonne-hernandez Dec 13, 2024
56c170f
Add frequencyOptions
ivonne-hernandez Dec 15, 2024
bc6d840
Add getIncomeStreamSourceLabel
ivonne-hernandez Dec 15, 2024
8275adc
Move helper text functions out of the hhmf
ivonne-hernandez Dec 15, 2024
760ba55
Add SelectHelperFunctions
ivonne-hernandez Dec 15, 2024
9df4401
Add frequencyMenuItems
ivonne-hernandez Dec 15, 2024
524ab46
Remove helper text functions
ivonne-hernandez Dec 15, 2024
ebab8f7
Refactor FormControl minWidth prop and add sx prop to FormHelperText
ivonne-hernandez Dec 15, 2024
f5e5c9d
Add renderIncomeStreamFrequencySelect
ivonne-hernandez Dec 15, 2024
098d4f5
Add renderHoursWorkedHelperText
ivonne-hernandez Dec 15, 2024
41beae0
Add renderHoursWorkedTextfield
ivonne-hernandez Dec 15, 2024
075fe39
Add renderIncomeAmountHelperText
ivonne-hernandez Dec 15, 2024
c288f97
Rename functions to match state var names
ivonne-hernandez Dec 15, 2024
b8768cc
Add renderincomeAmountTextfield function
ivonne-hernandez Dec 15, 2024
7405b69
Add renderIncomeStreamBlockQuestions
ivonne-hernandez Dec 15, 2024
c83aaa1
Add income radio question call to return stmt
ivonne-hernandez Dec 15, 2024
5cfe0c6
Conditionally add additional income button to return stmt
ivonne-hernandez Dec 15, 2024
48dda18
Add fields mapping income blocks to return stmt
ivonne-hernandez Dec 15, 2024
5ef89e2
Update imports
ivonne-hernandez Dec 16, 2024
2ee3993
Fix the backNavigation function
ivonne-hernandez Dec 16, 2024
f449562
Add determineDefaultRelationshipToHH function and call
ivonne-hernandez Dec 16, 2024
e8dfe01
Fix formSubmitHandler
ivonne-hernandez Dec 16, 2024
6ffc78f
Updated relationshipToHH schema
ivonne-hernandez Dec 16, 2024
879d2fd
Remove comments
ivonne-hernandez Dec 16, 2024
878d582
Refactor nested if in formSubmitHandler
ivonne-hernandez Dec 16, 2024
a12b40c
Fix HHMSummaryCards handleEditBtnSubmit
ivonne-hernandez Dec 16, 2024
c883f54
Add HHMSummaryCards
ivonne-hernandez Dec 16, 2024
12364b6
Update useGoToNextStep in questionHooks for hhdata
ivonne-hernandez Dec 16, 2024
dbf70eb
Refactor function name
ivonne-hernandez Dec 16, 2024
3e3cd05
Add renderFirstIncomeBlockQ and call
ivonne-hernandez Dec 16, 2024
7f685b8
Move PersonIncomeBlock css file
ivonne-hernandez Dec 16, 2024
bb427bb
Add PersonIncomeBlock styles to HHMF
ivonne-hernandez Dec 16, 2024
bbe036d
Remove unused imports from Expenses
ivonne-hernandez Dec 16, 2024
8310550
Move MONTHS inside of the HHData step folder
ivonne-hernandez Dec 16, 2024
5d5a394
Add triggerValidation prop to RHFOptionCardGroup to fix error rendering
ivonne-hernandez Dec 16, 2024
dd72cb2
Remove HHDB css file from HHMForm
ivonne-hernandez Dec 16, 2024
bf9240b
Add HHMSummaryCards css and import directly to HHMSCards
ivonne-hernandez Dec 16, 2024
628b6d7
Fix hoursWorked and incomeStream bugs
ivonne-hernandez Dec 17, 2024
06f62b3
Fix bug with data persisting between household memebrs
ivonne-hernandez Dec 17, 2024
bc785ed
Add additional validation for birthYear
ivonne-hernandez Dec 17, 2024
9945725
Merge branch 'dev' into refactor/household-data
ivonne-hernandez Dec 17, 2024
9ecead2
Update calcAge import path
ivonne-hernandez Dec 17, 2024
5656b89
Remove comment in App
ivonne-hernandez Dec 17, 2024
994243d
Refactor HHMSummary cards spacing
ivonne-hernandez Dec 17, 2024
e296135
Replace RHFOptionCardGroup with MultiSelectTiles
ivonne-hernandez Dec 17, 2024
25f75ab
Add margin right property to ageInput
ivonne-hernandez Dec 17, 2024
f924584
Revert "Refactor HHMSummary cards spacing"
ivonne-hernandez Dec 17, 2024
f2ec96a
Reapply "Refactor HHMSummary cards spacing"
ivonne-hernandez Dec 18, 2024
58e118a
Revert "Replace RHFOptionCardGroup with MultiSelectTiles"
ivonne-hernandez Dec 18, 2024
6138229
Fix formatting
ivonne-hernandez Dec 18, 2024
5c3d02a
Make triggerValidation prop optional and cond render it inside handle…
ivonne-hernandez Dec 18, 2024
a9f56c4
Move conditional rendering inside an if block
ivonne-hernandez Dec 18, 2024
54a99fd
Remove hasExpenses, acuteHHConditions from questions.tsx
ivonne-hernandez Dec 18, 2024
4b909a2
Delete HealthInsuranceError component
ivonne-hernandez Dec 18, 2024
08bf674
Delete AgeInput component and css file
ivonne-hernandez Dec 18, 2024
b0c068e
Delete HouseholdDataBlock component and css
ivonne-hernandez Dec 18, 2024
4673463
Delete unused HHDB, expense, hhSize, acuteHHConditions validation fun…
ivonne-hernandez Dec 18, 2024
dd5a767
Delete Autocomplete component
ivonne-hernandez Dec 18, 2024
a8c00f9
Delete Expense Block and Expense Question
ivonne-hernandez Dec 18, 2024
c0b208b
Delete IncomeQuestion and PersonIncomeBlock
ivonne-hernandez Dec 18, 2024
1f110b9
Delete OptionCardGroup
ivonne-hernandez Dec 18, 2024
0bcc0e5
Remove OptionCardGroup section from QCC
ivonne-hernandez Dec 18, 2024
e31f99f
Delete HHDataRadiofield component
ivonne-hernandez Dec 18, 2024
9952dd6
Delete unused handleHHDSubmit function from App
ivonne-hernandez Dec 18, 2024
2d3d902
Rm Radiofield, expense and incomeSources submit funcs and components
ivonne-hernandez Dec 18, 2024
2487f73
Remove handleRadio, expense and incomeStreamsSubmit from App
ivonne-hernandez Dec 18, 2024
5079745
Remove old HHDB component import
ivonne-hernandez Dec 18, 2024
00a50ec
Move the nextStep logic into its own function
ivonne-hernandez Jan 3, 2025
00ceb7f
Add type to relationshipOptions in HHMSummaryCards
ivonne-hernandez Jan 3, 2025
0e32a97
Delete comment
ivonne-hernandez Jan 3, 2025
a9f04e7
Remove unused index declaration
ivonne-hernandez Jan 3, 2025
459b1c1
Remove optional second argument, add comment explaining what the arg …
ivonne-hernandez Jan 3, 2025
65595f6
Fix conditions not saving bug, remove comment
ivonne-hernandez Jan 3, 2025
de3ad2c
Refactor createMemberCard func to use memberIndex for headOfHH relati…
ivonne-hernandez Jan 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 6 additions & 46 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,26 @@ import QuestionComponentContainer from './Components/QuestionComponentContainer/
import Confirmation from './Components/Confirmation/Confirmation';
import Results from './Components/Results/Results';
import Disclaimer from './Components/Steps/Disclaimer/Disclaimer.tsx';
import HouseholdDataBlock from './Components/HouseholdDataBlock/HouseholdDataBlock.js';
import ProgressBar from './Components/ProgressBar/ProgressBar';
import JeffcoLandingPage from './Components/JeffcoComponents/JeffcoLandingPage/JeffcoLandingPage';
import SelectLanguagePage from './Components/Steps/SelectLanguagePage.tsx';
import SelectLanguagePage from './Components/Steps/SelectLanguage.tsx';
import { updateScreen, updateUser } from './Assets/updateScreen.ts';
import { STARTING_QUESTION_NUMBER, useStepNumber, useStepDirectory } from './Assets/stepDirectory';
import Box from '@mui/material/Box';
import { Expense, HealthInsurance, HouseholdData, IncomeStream, SignUpInfo } from './Types/FormData.js';
import { Expense, HealthInsurance, SignUpInfo } from './Types/FormData.js';
import { BrandedFooter, BrandedHeader } from './Components/Referrer/Referrer.tsx';
import { useErrorController } from './Assets/validationFunctions.tsx';
import dataLayerPush from './Assets/analytics.ts';
import { OTHER_PAGE_TITLES } from './Assets/pageTitleTags.ts';
import { isCustomTypedLocationState } from './Types/FormData.ts';
LicenseInfo.setLicenseKey(process.env.REACT_APP_MUI_LICENSE_KEY + '=');
import './App.css';
import CcigLandingPage from './Components/CcigComponents/CcigLandingPage';
import languageRouteWrapper from './Components/RouterUtil/LanguageRouter';
import SelectStatePage from './Components/Steps/SelectStatePage';
import RedirectToWhiteLabel from './Components/RouterUtil/RedirectToWhiteLabel';
import CurrentBenefits from './Components/CurrentBenefits/CurrentBenefits';
import HouseholdMemberForm from './Components/Steps/HouseholdMembers/HouseholdMemberForm.tsx';
import './App.css';

const App = () => {
const navigate = useNavigate();
Expand All @@ -42,6 +42,7 @@ const App = () => {
setTheme: changeTheme,
pageIsLoading,
getReferrer,
configLoading,
} = useContext(Context);

const stepDirectory = useStepDirectory();
Expand Down Expand Up @@ -161,12 +162,6 @@ const App = () => {
}
};

const handleRadioButtonChange = (event: Event) => {
const { name, value } = event.target as HTMLInputElement;
let boolValue = value === 'true';
setFormData({ ...formData, [name]: boolValue });
};

const handleNoAnswerChange = (event: Event) => {
const { name, value } = event.target as HTMLInputElement;
setFormData({ ...formData, [name]: value });
Expand Down Expand Up @@ -218,33 +213,6 @@ const App = () => {
}
};

const handleIncomeStreamsSubmit = (validatedIncomeStreams: IncomeStream[], stepId: number, uuid: string) => {
const updatedFormData = { ...formData, incomeStreams: validatedIncomeStreams };
updateScreen(uuid, updatedFormData, locale);
setFormData(updatedFormData);
navigate(`/${formData.whiteLabel}/${uuid}/step-${stepId + 1}`);
};

const handleExpenseSourcesSubmit = (validatedExpenseSources: Expense[], stepId: number, uuid: string) => {
const isComingFromConfirmationPg = isCustomTypedLocationState(location.state)
? location.state.routedFromConfirmationPg
: false;
const updatedFormData = { ...formData, expenses: validatedExpenseSources };
updateScreen(uuid, updatedFormData, locale);
setFormData(updatedFormData);
isComingFromConfirmationPg
? navigate(`/${formData.whiteLabel}/${uuid}/confirm-information`)
: navigate(`/${formData.whiteLabel}/${uuid}/step-${stepId + 1}`);
};

const handleHouseholdDataSubmit = (memberData: HouseholdData, stepId: number, uuid: string) => {
const updatedMembers = [...formData.householdData];
updatedMembers[stepId] = memberData;
const updatedFormData = { ...formData, householdData: updatedMembers };
updateScreen(uuid, updatedFormData, locale);
setFormData(updatedFormData);
};

if (pageIsLoading) {
return (
<ThemeProvider theme={theme}>
Expand Down Expand Up @@ -316,12 +284,7 @@ const App = () => {
<Route path="step-2" element={<Disclaimer />} />
<Route
path={`step-${householdMemberStepNumber}/:page`}
element={
<HouseholdDataBlock
key={window.location.href}
handleHouseholdDataSubmit={handleHouseholdDataSubmit}
/>
}
element={<HouseholdMemberForm key={window.location.href} />}
ivonne-hernandez marked this conversation as resolved.
Show resolved Hide resolved
/>
<Route
path="step-:id"
Expand All @@ -330,10 +293,7 @@ const App = () => {
key={window.location.href}
handleTextfieldChange={handleTextfieldChange}
handleContinueSubmit={handleContinueSubmit}
handleRadioButtonChange={handleRadioButtonChange}
handleNoAnswerChange={handleNoAnswerChange}
handleIncomeStreamsSubmit={handleIncomeStreamsSubmit}
handleExpenseSourcesSubmit={handleExpenseSourcesSubmit}
handleCheckboxChange={handleCheckboxChange}
/>
}
Expand Down
78 changes: 0 additions & 78 deletions src/Assets/questions.tsx
Original file line number Diff line number Diff line change
@@ -1,71 +1,13 @@
import {
radiofieldHasError,
householdAssetsHasError,
benefitsHasError,
selectHasError,
displayReferralSourceHelperText,
signUpOptionsHaveError,
acuteHHConditionsHasError,
displayBenefitsHelperText,
displayHouseholdAssetsHelperText,
otherReferalSourceHelperText,
} from './validationFunctions.tsx';
import { FormattedMessage } from 'react-intl';
import type { QuestionName, Question } from '../Types/Questions.ts';
import HelpButton from '../Components/HelpBubbleIcon/HelpButton.tsx';

const questions: Record<QuestionName, Question> = {
householdData: {
name: 'householdData',
componentDetails: {
componentType: 'HouseholdDataBlock',
ariaLabel: 'questions.householdData-ariaLabel',
inputName: 'householdData',
},
},
hasExpenses: {
name: 'hasExpenses',
header: <FormattedMessage id="qcc.about_household" defaultMessage="Tell us about your household" />,
question: (
<>
<div style={{ marginBottom: '-16px' }}>
<FormattedMessage id="questions.hasExpenses" defaultMessage="Does your household have any expenses?" />
<HelpButton
helpText="Add up expenses for everyone who lives in your home. This includes costs like child care, child support, rent, medical expenses, heating bills, and more. We will ask only about expenses that may affect benefits. We will not ask about expenses such as food since grocery bills do not affect benefits."
helpId="questions.hasExpenses-description"
/>
</div>
</>
),
questionDescription: (
<FormattedMessage
id="questions.hasExpenses-description-additional"
defaultMessage="Expenses can affect benefits! We can be more accurate if you tell us key expenses like your rent or mortgage, utilities, and child care."
/>
),
componentDetails: {
componentType: 'Radiofield',
ariaLabel: 'questions.hasExpenses-ariaLabel',
inputName: 'hasExpenses',
inputError: radiofieldHasError,
},
followUpQuestions: [
{
question: (
<FormattedMessage
id="questions.hasExpenses-a"
defaultMessage="What type of expense has your household had most recently?"
/>
),
name: 'expenses',
componentDetails: {
componentType: 'ExpenseBlock',
ariaLabel: 'questions.hasExpenses-a-ariaLabel',
inputName: 'expenses',
},
},
],
},
householdAssets: {
name: 'householdAssets',
header: <FormattedMessage id="qcc.about_household" defaultMessage="Tell us about your household" />,
Expand Down Expand Up @@ -93,26 +35,6 @@ const questions: Record<QuestionName, Question> = {
required: true,
},
},
acuteHHConditions: {
name: 'acuteHHConditions',
header: (
<FormattedMessage
id="qcc.tell-us-final-text"
defaultMessage="Tell us some final information about your household."
/>
),
question: (
<FormattedMessage
id="questions.acuteHHConditions"
defaultMessage="Is anyone in your household in immediate need of help with any of the following?"
/>
),
componentDetails: {
componentType: 'OptionCardGroup',
inputName: 'acuteHHConditions',
inputError: acuteHHConditionsHasError,
},
},
signUpInfo: {
name: 'signUpInfo',
header: (
Expand Down
Loading
Loading