Skip to content

Commit 288fcfe

Browse files
committed
add eligibility banner
1 parent 4ce19c7 commit 288fcfe

13 files changed

Lines changed: 247 additions & 359 deletions

src/core/utils/buildEligibilityReports.js

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -142,25 +142,12 @@ export const buildEligibilityReports = (validationReport, metadata, hydrationDat
142142
acc[category] = {};
143143
}
144144

145-
if (result === "ff:eligible") {
146-
if (!acc[category][result]) {
147-
acc[category][result] = { preliminary: [], final: [] };
148-
}
149-
150-
if (report.validationStage === "ff:complete-validation") {
151-
acc[category][result].final.push(report);
152-
}
153-
154-
if (report.validationStage === "ff:preliminary-validation") {
155-
acc[category][result].preliminary.push(report);
156-
}
157-
} else {
158-
if (!acc[category][result]) {
159-
acc[category][result] = [];
160-
}
161-
acc[category][result].push(report);
145+
if (!acc[category][result]) {
146+
acc[category][result] = [];
162147
}
163148

149+
acc[category][result].push(report);
150+
164151
return acc;
165152
}, {});
166153

src/ui/language/translations.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { filter } from "lodash";
2-
31
const translations = {
42
en: {
53
home: {
@@ -221,6 +219,10 @@ const translations = {
221219
administrativeLevels: "Administrative level",
222220
providingAgencies: "Providing agency",
223221
associatedLaws: "Associated law",
222+
},
223+
item: {
224+
eligible: "You are likely eligible",
225+
notEligible: "You are likely not eligible",
224226
}
225227
},
226228
profile: {
@@ -514,6 +516,10 @@ const translations = {
514516
administrativeLevels: "Verwaltungsebene",
515517
providingAgencies: "Zuständige Behörde",
516518
associatedLaws: "Zugehöriges Gesetz",
519+
},
520+
item: {
521+
eligible: "Sie haben womöglich Anspruch",
522+
notEligible: "Sie haben voraussichtlich keinen Anspruch",
517523
}
518524
},
519525
profile: {

src/ui/screens/eligibilty-overview/EligibilityOverviewScreen.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import EligibilityOverviewFilter from './components/EligibilityOverviewFilter';
99

1010
const EligibilityOverviewScreen = ({
1111
t,
12-
iconPaths,
1312
eligibilityData,
1413
filterOptions,
1514
filters,
@@ -20,7 +19,7 @@ const EligibilityOverviewScreen = ({
2019
<Layout isApp={true} logo={true}>
2120
<AppScreenWrapperContainer back={true}>
2221
<VBox sx={{ gap: { xs: 4, md: 8 } }} >
23-
<EligibilityOverviewHeader iconPaths={iconPaths} />
22+
<EligibilityOverviewHeader />
2423
<VBox sx={{ gap: { xs: 2, md: 4 } }}>
2524
<EligibilityOverviewFilter
2625
t={t}
@@ -34,18 +33,18 @@ const EligibilityOverviewScreen = ({
3433
{
3534
eligibilityData["social_benefit"] && (
3635
<EligibilityOverviewSection
36+
t={t}
3737
category={t('app.topicSelection.socialBenefitsTitle')}
3838
eligibilitySection={eligibilityData["social_benefit"]}
39-
iconPaths={iconPaths}
4039
/>
4140
)
4241
}
4342
{
4443
eligibilityData["business"] && (
4544
<EligibilityOverviewSection
45+
t={t}
4646
category={t('app.topicSelection.businessTitle')}
4747
eligibilitySection={eligibilityData["business"]}
48-
iconPaths={iconPaths}
4948
/>
5049
)
5150
}

src/ui/screens/eligibilty-overview/EligibilityOverviewScreenContainer.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useMemo, useState } from 'react';
1+
import React, { useState } from 'react';
22
import useFetchData from "@/ui/shared-hooks/utility/useFetchResource";
33
import useTranslation from "@/ui/language/useTranslation";
44
import EligibilityOverviewScreen from './EligibilityOverviewScreen';
@@ -24,17 +24,9 @@ const EligibilityOverviewScreenContainer = () => {
2424
const { eligibilityData, filterOptions } = useEligibilityData(validationReport, metadata, hydrationData, language);
2525
const filteredEligibilityData = useFilterEligibilityData(eligibilityData, filters);
2626

27-
const iconPaths = useMemo(() => ({
28-
eligible: `${process.env.PUBLIC_URL}/assets/images/application/icon-image-eligible.svg`,
29-
preliminaryEligible: `${process.env.PUBLIC_URL}/assets/images/application/icon-image-preliminary-eligible.svg`,
30-
ineligible: `${process.env.PUBLIC_URL}/assets/images/application/icon-image-ineligible.svg`,
31-
missing: `${process.env.PUBLIC_URL}/assets/images/application/icon-image-missing.svg`,
32-
}), []);
33-
3427
return (
3528
<EligibilityOverviewScreen
3629
t={t}
37-
iconPaths={iconPaths}
3830
eligibilityData={filteredEligibilityData}
3931
filterOptions={filterOptions}
4032
filters={filters}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import { Typography } from "@mui/material";
2+
import { HBox } from "@/ui/shared-components/LayoutBoxes";
3+
import theme from "@/theme";
4+
5+
const EligibilityOverviewBanner = ({ t, eligible }) => {
6+
console.log("EligibilityOverviewBanner", eligible);
7+
8+
const eligibilityBannerType = (() => {
9+
switch (eligible) {
10+
case 'eligible':
11+
return {
12+
text: 'app.browseAll.item.eligible',
13+
backgroundColor: 'secondary.light'
14+
}
15+
case 'preliminary-eligible':
16+
return {
17+
text: 'app.browseAll.item.preliminaryEligible',
18+
backgroundColor: 'yellow.main'
19+
}
20+
case 'non-eligible':
21+
return {
22+
text: 'app.browseAll.item.notEligible',
23+
backgroundColor: 'error.light'
24+
}
25+
default:
26+
return {
27+
text: 'app.browseAll.item.missingData',
28+
backgroundColor: theme.palette.black.main
29+
}
30+
}
31+
})();
32+
33+
return (
34+
<HBox sx={{
35+
backgroundColor: eligibilityBannerType.backgroundColor,
36+
padding: '6px 10px',
37+
borderRadius: theme.shape.borderRadius,
38+
}}>
39+
<Typography>{t(eligibilityBannerType.text)}</Typography>
40+
</HBox>
41+
);
42+
}
43+
export default EligibilityOverviewBanner;

src/ui/screens/eligibilty-overview/components/EligibilityOverviewHeader copy.js

Lines changed: 0 additions & 82 deletions
This file was deleted.

src/ui/screens/eligibilty-overview/components/EligibilityOverviewItem copy.js

Lines changed: 0 additions & 127 deletions
This file was deleted.

0 commit comments

Comments
 (0)