Skip to content

Commit

Permalink
Merge pull request #1248 from Gary-Community-Ventures/dev
Browse files Browse the repository at this point in the history
Release 8/19/2024
  • Loading branch information
CalebPena authored Aug 19, 2024
2 parents 3ad7cd1 + b55d13e commit f26b43d
Show file tree
Hide file tree
Showing 6 changed files with 110 additions and 551 deletions.
137 changes: 73 additions & 64 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { useConfig } from './Components/Config/configHook';
LicenseInfo.setLicenseKey(process.env.REACT_APP_MUI_LICENSE_KEY + '=');
import './App.css';
import CcigLandingPage from './Components/CcigComponents/CcigLandingPage';
import languageRouteWrapper from './Components/LanguageRouter/LanguageRouter';

const App = () => {
const navigate = useNavigate();
Expand Down Expand Up @@ -297,12 +298,16 @@ const App = () => {
<ThemeProvider theme={theme}>
<CssBaseline />
<Routes>
<Route path=":uuid">
<Route path="" element={<FetchScreen />} />
<Route path="*" element={<FetchScreen />} />
</Route>
<Route path="" element={<LoadingPage />} />
<Route path="*" element={<LoadingPage />} />
{languageRouteWrapper(
<>
<Route path=":uuid">
<Route path="" element={<FetchScreen />} />
<Route path="*" element={<FetchScreen />} />
</Route>
<Route path="" element={<LoadingPage />} />
<Route path="*" element={<LoadingPage />} />
</>,
)}
</Routes>
</ThemeProvider>
);
Expand All @@ -323,66 +328,70 @@ const App = () => {
<Route path="*" element={<></>} />
</Routes>
<Routes>
<Route path="/" element={<Navigate to={`/step-1${urlSearchParams}`} replace />} />
<Route path="/current-benefits" element={<CurrentBenefits />} />
<Route path="/jeffcohs" element={<JeffcoLandingPage referrer="jeffcoHS" />} />
<Route path="/jeffcohscm" element={<JeffcoLandingPage referrer="jeffcoHSCM" />} />
<Route path="/ccig" element={<CcigLandingPage />} />
<Route path="/step-1" element={<SelectLanguagePage />} />
<Route path="/step-2" element={<LandingPage handleCheckboxChange={handleCheckboxChange} />} />
<Route path=":uuid">
<Route path="" element={<Navigate to="/step-1" replace />} />
<Route path="step-1" element={<SelectLanguagePage />} />
<Route path="step-2" element={<LandingPage handleCheckboxChange={handleCheckboxChange} />} />
<Route
path={`step-${getStepNumber('householdData', formData.immutableReferrer)}/:page`}
element={
<HouseholdDataBlock
key={window.location.href}
handleHouseholdDataSubmit={handleHouseholdDataSubmit}
{languageRouteWrapper(
<>
<Route path="" element={<Navigate to={`/step-1${urlSearchParams}`} replace />} />
<Route path="current-benefits" element={<CurrentBenefits />} />
<Route path="jeffcohs" element={<JeffcoLandingPage referrer="jeffcoHS" />} />
<Route path="jeffcohscm" element={<JeffcoLandingPage referrer="jeffcoHSCM" />} />
<Route path="ccig" element={<CcigLandingPage />} />
<Route path="step-1" element={<SelectLanguagePage />} />
<Route path="step-2" element={<LandingPage handleCheckboxChange={handleCheckboxChange} />} />
<Route path=":uuid">
<Route path="" element={<Navigate to="/step-1" replace />} />
<Route path="step-1" element={<SelectLanguagePage />} />
<Route path="step-2" element={<LandingPage handleCheckboxChange={handleCheckboxChange} />} />
<Route
path={`step-${getStepNumber('householdData', formData.immutableReferrer)}/:page`}
element={
<HouseholdDataBlock
key={window.location.href}
handleHouseholdDataSubmit={handleHouseholdDataSubmit}
/>
}
/>
}
/>
<Route
path="step-:id"
element={
<QuestionComponentContainer
key={window.location.href}
handleTextfieldChange={handleTextfieldChange}
handleContinueSubmit={handleContinueSubmit}
handleRadioButtonChange={handleRadioButtonChange}
handleNoAnswerChange={handleNoAnswerChange}
handleIncomeStreamsSubmit={handleIncomeStreamsSubmit}
handleExpenseSourcesSubmit={handleExpenseSourcesSubmit}
handleCheckboxChange={handleCheckboxChange}
<Route
path="step-:id"
element={
<QuestionComponentContainer
key={window.location.href}
handleTextfieldChange={handleTextfieldChange}
handleContinueSubmit={handleContinueSubmit}
handleRadioButtonChange={handleRadioButtonChange}
handleNoAnswerChange={handleNoAnswerChange}
handleIncomeStreamsSubmit={handleIncomeStreamsSubmit}
handleExpenseSourcesSubmit={handleExpenseSourcesSubmit}
handleCheckboxChange={handleCheckboxChange}
/>
}
/>
}
/>
<Route path="confirm-information" element={<Confirmation />} />
<Route
path="results/benefits"
element={<Results type="program" handleTextfieldChange={handleTextfieldChange} />}
/>
<Route
path="results/near-term-needs"
element={<Results type="need" handleTextfieldChange={handleTextfieldChange} />}
/>
<Route
path="results/benefits/:programId"
element={<Results type="program" handleTextfieldChange={handleTextfieldChange} />}
/>
<Route
path="results/benefits/:programId/navigators"
element={<Results type="navigator" handleTextfieldChange={handleTextfieldChange} />}
/>
<Route
path="results/more-help"
element={<Results type="help" handleTextfieldChange={handleTextfieldChange} />}
/>
<Route path="results" element={<Navigate to="benefits" replace />} />
<Route path="*" element={<Navigate to="/step-1" replace />} />
</Route>
<Route path="*" element={<Navigate to={`/step-1${urlSearchParams}`} replace />} />
<Route path="confirm-information" element={<Confirmation />} />
<Route
path="results/benefits"
element={<Results type="program" handleTextfieldChange={handleTextfieldChange} />}
/>
<Route
path="results/near-term-needs"
element={<Results type="need" handleTextfieldChange={handleTextfieldChange} />}
/>
<Route
path="results/benefits/:programId"
element={<Results type="program" handleTextfieldChange={handleTextfieldChange} />}
/>
<Route
path="results/benefits/:programId/navigators"
element={<Results type="navigator" handleTextfieldChange={handleTextfieldChange} />}
/>
<Route
path="results/more-help"
element={<Results type="help" handleTextfieldChange={handleTextfieldChange} />}
/>
<Route path="results" element={<Navigate to="benefits" replace />} />
<Route path="*" element={<Navigate to="/step-1" replace />} />
</Route>
<Route path="*" element={<Navigate to={`/step-1${urlSearchParams}`} replace />} />
</>,
)}
</Routes>
</Box>
</div>
Expand Down
19 changes: 19 additions & 0 deletions src/Components/LanguageRouter/LanguageRouter.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { ReactElement } from 'react';
import { Route } from 'react-router-dom';
import languageOptions from '../../Assets/languageOptions';

export default function languageRouteWrapper(children: ReactElement) {
const languages = Object.keys(languageOptions);
return (
<>
{languages.map((language, key) => {
return (
<Route path={`/${language}`} key={key}>
{children}
</Route>
);
})}
{children}
</>
);
}
15 changes: 15 additions & 0 deletions src/Components/Results/ProgramPage/NavigatorLanguages.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { FormattedMessage } from 'react-intl';

export const allNavigatorLanguages = {
'en-us': <FormattedMessage id="navLanguage.en-us" defaultMessage="English Available" />,
es: <FormattedMessage id="navLanguage.es" defaultMessage="Spanish Available" />,
vi: <FormattedMessage id="navLanguage.vi" defaultMessage="Vietnamese Available" />,
fr: <FormattedMessage id="navLanguage.fr" defaultMessage="French Available" />,
am: <FormattedMessage id="navLanguage.am" defaultMessage="Amharic Available" />,
so: <FormattedMessage id="navLanguage.so" defaultMessage="Somali Available" />,
ru: <FormattedMessage id="navLanguage.ru" defaultMessage="Russian Available" />,
ne: <FormattedMessage id="navLanguage.ne" defaultMessage="Nepali Available" />,
my: <FormattedMessage id="navLanguage.my" defaultMessage="Burmese Available" />,
zh: <FormattedMessage id="navLanguage.zh" defaultMessage="Chinese Available" />,
ar: <FormattedMessage id="navLanguage.ar" defaultMessage="Arabic Available" />,
};
6 changes: 3 additions & 3 deletions src/Components/Results/ProgramPage/ProgramPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import { useContext } from 'react';
import { Context } from '../../Wrapper/Wrapper';
import { findValidationForProgram, useResultsContext, useResultsLink } from '../Results';
import { deleteValidation, postValidation } from '../../../apiCalls';
import { languageOptions, Language } from '../../../Assets/languageOptions.tsx';
import { Language } from '../../../Assets/languageOptions.tsx';
import { allNavigatorLanguages } from './NavigatorLanguages.tsx';

type ProgramPageProps = {
program: Program;
Expand Down Expand Up @@ -123,8 +124,7 @@ const ProgramPage = ({ program }: ProgramPageProps) => {
{navigatorLanguages.map((lang) => {
return (
<p className="navigator-lang-flag" key={lang}>
{languageOptions[lang]}
<FormattedMessage id="programPage.lang-available" defaultMessage=" Available" />
{allNavigatorLanguages[lang]}
</p>
);
})}
Expand Down
Loading

0 comments on commit f26b43d

Please sign in to comment.