Skip to content

Commit 5cde130

Browse files
committed
add org tags
1 parent 855f703 commit 5cde130

11 files changed

Lines changed: 86 additions & 16 deletions

File tree

src/theme.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const theme = createTheme({
5050
tangerineOrange: '#FF8531',
5151
tangerineOrangeTransparent: 'rgba(255, 133, 49, 0.1)',
5252
plumPurple: '#BC5090',
53-
plumPurpleTransparent: 'rgba(188, 80, 144, 0.1)',
53+
plumPurpleTransparent: 'rgba(188, 80, 144, 0.5)',
5454
darkGrey: '#333333',
5555
darkGreyTransparent: 'rgba(51, 51, 51, 0.1)',
5656
lightGrey: '#BDBDBD',

src/ui/language/translations.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,8 @@ const translations = {
265265
item: {
266266
eligible: "You are likely eligible",
267267
notEligible: "You are likely not eligible",
268-
}
268+
},
269+
orgTag: "For organisations"
269270
},
270271
profile: {
271272
header: "Your locally stored profile",
@@ -653,7 +654,8 @@ const translations = {
653654
item: {
654655
eligible: "Sie haben womöglich Anspruch",
655656
notEligible: "Sie haben voraussichtlich keinen Anspruch"
656-
}
657+
},
658+
orgTag: "Für Organisationen"
657659
},
658660
profile: {
659661
header: "Ihr lokal gespeichertes Profil",

src/ui/screens/benefit-page/BenefitPageScreen.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const BenefitPageScreen = ({
1616
benefitPageData,
1717
localisedData,
1818
xml,
19+
targetClass,
1920
validatedStatus,
2021
validationResult,
2122
categoryTitles,
@@ -26,7 +27,14 @@ const BenefitPageScreen = ({
2627
<Layout isApp={true} logo={false} back="Back">
2728
<AppScreenWrapperContainer backTarget={'/eligibility-overview'}>
2829
<VBox sx={{ gap: { xs: 4, md: 8 } }}>
29-
<BenefitPageHeader id={id} benefit={benefitPageData} validatedStatus={validatedStatus} validationResult={validationResult} categoryTitles={categoryTitles} />
30+
<BenefitPageHeader
31+
id={id}
32+
benefit={benefitPageData}
33+
validatedStatus={validatedStatus}
34+
validationResult={validationResult}
35+
targetClass={targetClass}
36+
categoryTitles={categoryTitles}
37+
/>
3038
<VBox sx={{ gap: { xs: 4, md: 8 }}}>
3139
<BenefitPageGeneral t={t} isDesktop={isDesktop} benefitPageData={benefitPageData} />
3240
<BenefitPageApplication t={t} isDesktop={isDesktop} benefitPageData={benefitPageData} xml={xml} />

src/ui/screens/benefit-page/BenefitPageScreenContainer.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { useUserStore } from '@/ui/storage/zustand';
1111
import { useStore } from "@/ui/shared-components/ViewportUpdater";
1212
import { useFetchLocaliseData } from './hooks/useFetchLocalisedData';
1313
import useFetchData from '@/ui/shared-hooks/utility/useFetchResource';
14+
import useFetchTargetClass from './hooks/useFetchTargetClass';
1415

1516
const BenefitPageScreenContainer = () => {
1617
const { id } = useParams();
@@ -25,6 +26,7 @@ const BenefitPageScreenContainer = () => {
2526
const activeUserId = useUserStore((state) => state.activeUserId);
2627
const localisedData = useFetchLocaliseData(benefitPageData);
2728
const xml = useFetchData(`assets/data/xml/${id.split(":")[1]}.xml`);
29+
const targetClass = useFetchTargetClass(id);
2830

2931
useEffect(() => {
3032
const fetchMatchingReport = async () => {
@@ -50,6 +52,7 @@ const BenefitPageScreenContainer = () => {
5052
xml={xml}
5153
validatedStatus={validatedStatus}
5254
validationResult={validationResult}
55+
targetClass={targetClass}
5356
categoryTitles={categoryTitles}
5457
matchingGraph={matchingGraph}
5558
/>

src/ui/screens/benefit-page/components/BenefitPageHeader.js

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ import { useSelectedBenefitsStore, useSelectedTopicsStore } from "@/ui/storage/z
77
import useTranslation from "@/ui/language/useTranslation";
88
import theme from "@/theme";
99
import EligibilityOverviewBanner from "../../eligibilty-overview/components/EligibilityOverviewBanner";
10+
import EligibilityOverviewOrgTag from "../../eligibilty-overview/components/EligibilityOverviewOrgTag";
1011

1112
const BenefitPageHeader = ({
1213
id,
1314
benefit,
1415
validatedStatus,
1516
validationResult,
17+
targetClass,
1618
categoryTitles
1719
}) => {
1820
const { t } = useTranslation();
@@ -22,20 +24,30 @@ const BenefitPageHeader = ({
2224
const clearSelectedTopics = useSelectedTopicsStore((state) => state.clear);
2325

2426
return (
25-
<HBox sx={{ justifyContent: 'space-between', gap: {xs: 2, md: 4}, flexWrap: 'wrap' }}>
26-
<VBox sx={{ gap: {xs: 2, md: 4} }}>
27+
<HBox sx={{ justifyContent: 'space-between', gap: { xs: 2, md: 4 }, flexWrap: 'wrap' }}>
28+
<VBox sx={{ gap: { xs: 2, md: 4 } }}>
2729
<Typography variant="h1" sx={{ wordBreak: 'break-word' }}>
2830
{benefit?.title}
2931
</Typography>
3032
<VBox sx={{ gap: 2 }}>
3133
<VBox sx={{ gap: 1 }}>
32-
{
33-
validatedStatus && (
34-
<HBox>
35-
<EligibilityOverviewBanner t={t} eligible={validationResult} />
36-
</HBox>
37-
)
38-
}
34+
<HBox sx={{
35+
gap: (validatedStatus || targetClass) ? 2 : 0,
36+
alignItems: 'center'
37+
}}>
38+
{
39+
validatedStatus && (
40+
<HBox>
41+
<EligibilityOverviewBanner t={t} eligible={validationResult} />
42+
</HBox>
43+
)
44+
}
45+
{
46+
targetClass && (
47+
<EligibilityOverviewOrgTag t={t} />
48+
)
49+
}
50+
</HBox>
3951
<HBox sx={{ gap: 1, alignItems: 'center' }}>
4052
{
4153
benefit?.leikaId && (
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { useMemo, } from 'react';
2+
import { useMetadataStore } from '@/ui/storage/zustand';
3+
4+
const useFetchClassTag = (id) => {
5+
const metadata = useMetadataStore((state) => state.metadata);
6+
7+
return useMemo(() => {
8+
if (!metadata || !id) return null;
9+
const rpMetaData = metadata['ff:hasRP']?.find(rp => rp['@id'] === id) || null;
10+
return rpMetaData['ff:targetClass']?.["@id"]
11+
}, [metadata, id]);
12+
};
13+
14+
export default useFetchClassTag;

src/ui/screens/eligibilty-overview/components/EligibilityOverviewBanner.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const EligibilityOverviewBanner = ({ t, eligible }) => {
5959
padding: '6px 18px',
6060
borderRadius: theme.shape.borderRadius,
6161
alignItems: 'center',
62-
gap: 1,
62+
gap: 1
6363
}}>
6464
<Typography variant="body1">{t(eligibilityBannerType.text)}</Typography>
6565
{eligibilityIcon}

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import RegularButton from '@/ui/shared-components/buttons/RegularButton';
66
import { useSelectedBenefitsStore, useSelectedTopicsStore } from "@/ui/storage/zustand";
77
import EligibilityOverviewTag from './EligibilityOverviewTag';
88
import EligibilityOverviewBanner from './EligibilityOverviewBanner';
9+
import EligibilityOverviewOrgTag from './EligibilityOverviewOrgTag';
910
import AddIcon from '@mui/icons-material/Add';
1011
import RemoveIcon from '@mui/icons-material/Remove';
1112
import EastIcon from '@mui/icons-material/East';
@@ -24,7 +25,7 @@ const EligibilityOverviewItem = ({ t, item, eligible, isDesktop }) => {
2425
const clearSelectedTopics = useSelectedTopicsStore((state) => state.clear);
2526

2627
const hasFirstSectionChildren =
27-
eligible !== 'indeterminate' ||
28+
eligible !== 'indeterminate' || item.targetClass ||
2829
(!isVisible && isDesktop && item.benefitCategories?.length > 0);
2930

3031
return (
@@ -113,6 +114,11 @@ const EligibilityOverviewItem = ({ t, item, eligible, isDesktop }) => {
113114
<EligibilityOverviewBanner t={t} eligible={eligible} />
114115
)
115116
}
117+
{
118+
item.targetClass && (
119+
<EligibilityOverviewOrgTag t={t} />
120+
)
121+
}
116122
{!isVisible && isDesktop &&
117123
item.benefitCategories?.map(tag => (
118124
<EligibilityOverviewTag
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { Typography } from "@mui/material";
2+
import { HBox } from "@/ui/shared-components/LayoutBoxes";
3+
import theme from "@/theme";
4+
import GroupsIcon from '@mui/icons-material/Groups';
5+
6+
const EligibilityOverviewOrgTag = ({ t }) => {
7+
return (
8+
<HBox sx={{
9+
backgroundColor: theme.palette.custom.plumPurpleTransparent,
10+
padding: '6px 18px',
11+
borderRadius: theme.shape.borderRadius,
12+
alignItems: 'center',
13+
gap: 1
14+
}}>
15+
<Typography variant="body1">{t("app.browseAll.orgTag")}</Typography>
16+
<GroupsIcon sx={{ fontSize: 20 }} />
17+
</HBox>
18+
);
19+
}
20+
export default EligibilityOverviewOrgTag;

src/ui/screens/eligibilty-overview/hooks/useEligibilityData.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ const useEligibilityData = (validationReport, metadata, hydrationData, language)
9191
}))
9292
: [];
9393

94+
// target Class
95+
const targetClass = rpMetadata?.['ff:targetClass']?.['@id'] || null;
96+
9497
return {
9598
uri: rpUri,
9699
result,
@@ -108,7 +111,8 @@ const useEligibilityData = (validationReport, metadata, hydrationData, language)
108111
providingAgencies,
109112
tags,
110113
administrativeLevels,
111-
benefitCategories
114+
benefitCategories,
115+
targetClass
112116
};
113117
});
114118

0 commit comments

Comments
 (0)