Skip to content

Commit cf74090

Browse files
committed
add localised content
1 parent 4088d49 commit cf74090

10 files changed

Lines changed: 100 additions & 343 deletions

File tree

public/assets/data/requirement-profiles/requirement-profiles-hydration.json

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1806,6 +1806,25 @@
18061806
"en": "The application for work assistance is submitted to the respective responsible authority.\n\n \n\n### Important Details for Application\n- **Responsible Authorities**: Depending on the situation, these are usually the Integration Office, the Employment Agency, the Job Center, or the German Pension Insurance.\n- **Form of Application**: In writing using the official application form; some authorities also allow online applications.\n- **Documents**: Usually required are details about the workplace, a description of the necessary support, and possibly medical certificates.\n- **Deadlines**: The application should be submitted preferably before starting the job or before utilizing the assistance."
18071807
}
18081808
},
1809+
"specific": [
1810+
{
1811+
"pattern": {
1812+
"ff:hasResidence": "ff:hasResidence-bielefeld"
1813+
},
1814+
"PLZs": ["TODO"],
1815+
"de": "**Landschaftsverband Westfalen-Lippe** \nAnsprechperson für Bielefeld: Vanessa Schubert \nGartenstraße 215 \n48147 Münster \nTel: 0251 591-5164 \nE-Mail: vanessa.schubert@lwl.org \n[vCard: Visitenkarte herunterladen](https://www.lwl.org/anis/vcard/1206)",
1816+
"de_es": "**Landschaftsverband Westfalen-Lippe** \nAnsprechperson für Bielefeld: Vanessa Schubert \nGartenstraße 215 \n48147 Münster \nTel: 0251 591-5164 \nE-Mail: vanessa.schubert@lwl.org \n[vCard: Visitenkarte herunterladen](https://www.lwl.org/anis/vcard/1206)",
1817+
"en": "**Regional Association of Westphalia-Lippe (LWL)** \nContact person for Bielefeld: Vanessa Schubert \nGartenstraße 215 \n48147 Münster \nTel: +49 251 591-5164 \nE-Mail: vanessa.schubert@lwl.org \n[vCard: Download contact card](https://www.lwl.org/anis/vcard/1206)"
1818+
},
1819+
{
1820+
"pattern": {
1821+
"ff:hasResidence": "ff:hasResidence-berlin"
1822+
},
1823+
"de": "Berliner Info Test",
1824+
"de_es": "Berliner Info Test",
1825+
"en": "Berlin info test"
1826+
}
1827+
],
18091828
"teaser": {
18101829
"de": "Arbeitsassistenz unterstützt Menschen mit Behinderung am Arbeitsplatz. Eine Assistenzkraft übernimmt nur die Tätigkeiten, die selbst nicht möglich sind. Die fachlichen Aufgaben erledigt die Person weiterhin selbst. Ziel ist es, Chancengleichheit im Berufsleben zu schaffen und Arbeitsplätze oder eine selbstständige Tätigkeit zu sichern. Die Kosten für die Assistenz werden übernommen.",
18111830
"de_es": "Arbeitsassistenz hilft Menschen mit Behinderung am Arbeitsplatz. Eine Assistenzkraft macht nur die Handgriffe, die die Person wegen der Behinderung nicht selbst machen kann. Die eigentliche Arbeit macht die Person selbst. So haben Menschen mit Behinderung die gleichen Chancen im Beruf. Die Kosten für die Assistenz werden übernommen.",
@@ -1835,7 +1854,7 @@
18351854
"specific": [
18361855
{
18371856
"pattern": {
1838-
"ff:hasResidence": "Bielefeld"
1857+
"ff:hasResidence": "ff:hasResidence-bielefeld"
18391858
},
18401859
"PLZs": ["TODO"],
18411860
"de": "**Landschaftsverband Westfalen-Lippe** \nAnsprechperson für Bielefeld: Vanessa Schubert \nGartenstraße 215 \n48147 Münster \nTel: 0251 591-5164 \nE-Mail: vanessa.schubert@lwl.org \n[vCard: Visitenkarte herunterladen](https://www.lwl.org/anis/vcard/1206)",
@@ -1844,7 +1863,7 @@
18441863
},
18451864
{
18461865
"pattern": {
1847-
"ff:hasResidence": "Berlin"
1866+
"ff:hasResidence": "ff:hasResidence-berlin"
18481867
},
18491868
"de": "Berliner Info Test",
18501869
"de_es": "Berliner Info Test",

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

Lines changed: 4 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -8,58 +8,18 @@ import BenefitPageGeneral from './components/BenefitPageGeneral';
88
import BenefitPageApplication from './components/BenefitPageApplication';
99
import BenefitPageRequirements from './components/BenefitPageRequirements';
1010
import BenefitPageLocal from './components/BenefitPageLocal';
11-
import { pickLang } from "@/ui/language/useTranslation";
12-
import { useLanguageStore } from "@/ui/storage/useLanguageStore";
13-
import { useUserStore } from "@/ui/storage/zustand";
14-
import userManager from "@/core/managers/userManager";
15-
import BenefitPageMarkdownElement from "@/ui/screens/benefit-page/components/BenefitPageMarkDownElement";
1611

1712
const BenefitPageScreen = ({
1813
t,
1914
id,
2015
isDesktop,
2116
benefitPageData,
17+
localisedData,
2218
validatedStatus,
2319
categoryTitles,
2420
matchingGraph
2521
}) => {
26-
const language = useLanguageStore((state) => state.language);
27-
28-
const buildContactSection = () => {
29-
if (!benefitPageData?.contactMD) return;
30-
let data = benefitPageData.contactMD;
31-
let blocks = [];
32-
if (data.general) {
33-
blocks.push(pickLang(data.general, language, null));
34-
} else {
35-
blocks.push("No general contact info available");
36-
}
37-
if (data.specific && Array.isArray(data.specific)) {
38-
const activeUserId = useUserStore.getState().activeUserId;
39-
// use keys in "pattern" instead of hardcoded ff:hasResidence TODO
40-
let actualLoc = userManager.retrieveUserField(activeUserId, "ff:hasResidence");
41-
if (!actualLoc) {
42-
blocks.push("Can't customize contact info without residence info in profile --> TODO: option to add it");
43-
}
44-
let found = false;
45-
for (let specificElement of data.specific) {
46-
let requiredLoc = specificElement.pattern["ff:hasResidence"];
47-
if (actualLoc && requiredLoc === actualLoc) {
48-
found = true;
49-
blocks.push(<BenefitPageMarkdownElement content={pickLang(specificElement, language, null)} />)
50-
}
51-
}
52-
if (!found) {
53-
blocks.push(`No specific contact info available yet for your residence ${actualLoc}`);
54-
}
55-
}
56-
return blocks.map((block, index) => (
57-
<div key={index}>
58-
{block}
59-
</div>
60-
))
61-
}
62-
22+
6323
return (
6424
<Layout isApp={true} logo={false} back="Back">
6525
<AppScreenWrapperContainer backTarget={'/eligibility-overview'}>
@@ -69,13 +29,10 @@ const BenefitPageScreen = ({
6929
<BenefitPageGeneral t={t} isDesktop={isDesktop} benefitPageData={benefitPageData} />
7030
<BenefitPageApplication t={t} isDesktop={isDesktop} benefitPageData={benefitPageData} />
7131
{
72-
benefitPageData?.localHelpAvailable && (
73-
<BenefitPageLocal t={t} isDesktop={isDesktop} benefitPageData={benefitPageData} />
32+
localisedData && (
33+
<BenefitPageLocal t={t} isDesktop={isDesktop} localisedData={localisedData} />
7434
)
7535
}
76-
{
77-
buildContactSection()
78-
}
7936
{featureFlags.showMermaidRuleGraph &&
8037
<BenefitPageRequirements t={t} isDesktop={isDesktop} evalGraph={matchingGraph} benefitPageData={benefitPageData} />
8138
}

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ const BenefitPageScreenContainer = () => {
3636
fetchMatchingReport();
3737
}, [id, activeUserId, language]);
3838

39-
console.log('matchingGraph', matchingGraph);
40-
4139
return (
4240
<BenefitPageScreen
4341
t={t}

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

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Typography } from '@mui/material';
55
import BenefitPageMarkdownElement from './BenefitPageMarkDownElement';
66
import RegularButton from '@/ui/shared-components/buttons/RegularButton';
77

8-
const BenefitPageLocal = ({ t, isDesktop, benefitPageData }) => {
8+
const BenefitPageLocal = ({ t, isDesktop, localisedData }) => {
99
const [open, setOpen] = useState(false);
1010
const objectIcon = `${process.env.PUBLIC_URL}/assets/images/benefit-pages/darts.svg`;
1111

@@ -24,16 +24,10 @@ const BenefitPageLocal = ({ t, isDesktop, benefitPageData }) => {
2424
<VBox sx={{ flex: 3, maxWidth: 800, gap: 4 }}>
2525
<VBox>
2626
<Typography variant="h2" sx={{ fontWeight: 500, wordBreak: "break-word" }}>
27-
{t('app.benefitPage.local.title')}
27+
{t('app.benefitPage.local.title')}
2828
</Typography>
2929
<BenefitPageMarkdownElement content={t('app.benefitPage.local.description')} />
3030
</VBox>
31-
<RegularButton
32-
onClick={() => setOpen(!open)}
33-
variant={'whiteOutlinedBlue'}
34-
text={open ? 'app.benefitPage.local.btnClose' : 'app.benefitPage.local.btn'}
35-
size={'small'}
36-
/>
3731
</VBox>
3832
{
3933
isDesktop && (
@@ -44,6 +38,18 @@ const BenefitPageLocal = ({ t, isDesktop, benefitPageData }) => {
4438
)
4539
}
4640
</HBox>
41+
<VBox
42+
sx={{
43+
backgroundColor: 'greyTransparent.main',
44+
borderTop: `1px solid ${theme.palette.grey.light}`,
45+
borderRadius: theme.shape.borderRadius,
46+
boxShadow: '0px 1px 2px rgba(0, 0, 0, 0.25)',
47+
padding: 2,
48+
gap: 2,
49+
}}
50+
>
51+
<BenefitPageMarkdownElement content={localisedData} />
52+
</VBox>
4753
</VBox>
4854
</VBox>
4955
);

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

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1-
import React from 'react';
1+
import React from "react";
22
import ReactMarkdown from "react-markdown";
33
import { Typography, Box } from "@mui/material";
44

55
const BenefitPageMarkdownElement = ({ content, icon = null }) => {
66
return (
77
<ReactMarkdown
88
components={{
9-
h1: ({ node, ...props }) => (<Typography variant="h1" gutterBottom {...props} />),
10-
h2: ({ node, ...props }) => (<Typography variant="h2" gutterBottom {...props} />),
11-
h3: ({ node, ...props }) => (<Typography variant="h3" gutterBottom {...props} />),
12-
h4: ({ node, ...props }) => (<Typography variant="h4" gutterBottom {...props} />),
13-
h5: ({ node, ...props }) => (<Typography variant="h5" gutterBottom {...props} />),
14-
h6: ({ node, ...props }) => (<Typography variant="h6" gutterBottom {...props} />),
15-
p: ({ node, ...props }) => (<Typography variant="body1" component="p" {...props} />),
9+
h1: (props) => <Typography variant="h1" gutterBottom {...props} />,
10+
h2: (props) => <Typography variant="h2" gutterBottom {...props} />,
11+
h3: (props) => <Typography variant="h3" gutterBottom {...props} />,
12+
h4: (props) => <Typography variant="h4" gutterBottom {...props} />,
13+
h5: (props) => <Typography variant="h5" gutterBottom {...props} />,
14+
h6: (props) => <Typography variant="h6" gutterBottom {...props} />,
15+
p: (props) => <Typography variant="body1" component="p" {...props} />,
16+
1617
ul: ({ node, ...props }) => (
1718
<Box
1819
component="ul"
@@ -25,30 +26,36 @@ const BenefitPageMarkdownElement = ({ content, icon = null }) => {
2526
{...props}
2627
/>
2728
),
28-
li: ({ node, children, ...props }) =>
29-
icon ? (
29+
li: ({ node, children, ...props }) => {
30+
if (icon) {
31+
return (
32+
<Box
33+
component="li"
34+
sx={{ display: "flex", alignItems: "flex-start", mb: 1, listStyle: "none" }}
35+
{...props}
36+
>
37+
<Box sx={{ mr: 1, mt: "2px" }}>{icon}</Box>
38+
<Box sx={{ flex: 1 }}>
39+
<Typography variant="body1" component="div">
40+
{children}
41+
</Typography>
42+
</Box>
43+
</Box>
44+
);
45+
}
46+
return (
3047
<Box
3148
component="li"
32-
sx={{ display: "flex", alignItems: "flex-start", mb: 1, listStyle: "none" }}
49+
sx={{ display: "block", mb: 1 }}
50+
{...props}
3351
>
34-
<Box sx={{ mr: 1, mt: "2px" }}>{icon}</Box>
35-
<Typography variant="body1" component="span">
52+
<Typography variant="body1" component="div">
3653
{children}
3754
</Typography>
3855
</Box>
39-
) : (
40-
<Box
41-
component="li"
42-
sx={{ display: "flex", alignItems: "flex-start", mb: 1 }}
43-
>
44-
<li {...props}>
45-
<Typography variant="body1" component="span">
46-
{children}
47-
</Typography>
48-
</li>
49-
</Box>
50-
),
51-
span: ({ node, ...props }) => (<Typography variant="body2" component="span" {...props} />),
56+
);
57+
},
58+
span: (props) => <Typography variant="body2" component="span" {...props} />,
5259
}}
5360
>
5461
{content}

src/ui/screens/benefit-page/hooks/buildFlow.js

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

0 commit comments

Comments
 (0)