Skip to content

Commit

Permalink
add section for funding conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
wbglaeser committed Mar 2, 2025
1 parent d2e3a3d commit 6ea8a8f
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/ui/language/translations.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ const translations = {
eligibilityBtn: "Check eligibility",
whatIsIt: "What is ",
applicationProcess: "How do I apply?",
fundingConditions: "What are the funding conditions?",
requiredDocuments: "Which documents do I need?",
additionalSupport: "Where can I get additional support?",
legalBasis: "Legal basis",
Expand Down Expand Up @@ -402,6 +403,7 @@ const translations = {
eligibilityBtn: "Anspruch prüfen",
whatIsIt: "Was ist ",
applicationProcess: "Wie stelle ich den Antrag?",
fundingConditions: "Wie sieht die Leistung oder Förderung aus?",
requiredDocuments: "Welche Dokumente benötige ich?",
additionalSupport: "Wo kann ich zusätzliche Unterstützung erhalten?",
legalBasis: "Rechtsgrundlage",
Expand Down
8 changes: 7 additions & 1 deletion src/ui/screens/benefit-page/BenefitPageScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import BenefitPageRequiredDocuments from './components/BenefitPageRequiredDocume
import ContentBox from '../../shared-components/ContentBox';
import BenefitPageLinksList from './components/BenefitPageLinksList';
import theme from '../../../theme';
import BenefitPageInfoList from './components/BenefitPageInfoList';

const BenefitPageScreen = () => {
const { id } = useParams();
Expand Down Expand Up @@ -83,6 +84,11 @@ const BenefitPageScreen = () => {
<Typography variant="h6">{t('app.benefitPage.whatIsIt')}{benefitPageData.title}</Typography>
<Typography sx={{ marginTop: theme.spacing(1) }} variant="body1">{benefitPageData.description || t('app.noData')}</Typography>
</ContentBox>
{
benefitPageData.fundingConditions.title && (
<BenefitPageInfoList listTitle={t('app.benefitPage.fundingConditions')} data={benefitPageData.fundingConditions} />
)
}
<BenefitPageRules benefitId={id} validated_status={validated_status} />
{
benefitPageData.applicationProcess.title && (
Expand All @@ -93,7 +99,7 @@ const BenefitPageScreen = () => {
benefitPageData.requiredDocuments.length > 0 && (
<BenefitPageRequiredDocuments requiredDocuments={benefitPageData.requiredDocuments} />
)
}
}
{
benefitPageData.additionalSupport.title && (
<BenefitPageLinksList listTitle={t('app.benefitPage.additionalSupport')} data={benefitPageData.additionalSupport} />
Expand Down
56 changes: 56 additions & 0 deletions src/ui/screens/benefit-page/components/BenefitPageInfoList.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import React, { useState } from 'react';
import { Typography } from "@mui/material";
import IconButton from "@mui/material/IconButton";
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
import Collapse from "@mui/material/Collapse";
import { HBox, VBox } from "../../../shared-components/LayoutBoxes";
import ContentBox from "../../../shared-components/ContentBox";
import theme from '../../../../theme';
import InfoIcon from '@mui/icons-material/Info';


const BenefitPageInfoList = ({ listTitle, data }) => {
const [showAdditionalSupport, setShowAdditionalSupport] = useState(false);

return (
<ContentBox sx={{ width: "100%" }}>
<HBox sx={{ justifyContent: 'space-between', alignItems: "center", cursor: "pointer" }} onClick={() => setShowAdditionalSupport(!showAdditionalSupport)}>
<Typography variant="h6">{listTitle}</Typography>
<IconButton
sx={{
transition: "transform 0.3s",
transform: showAdditionalSupport ? "rotate(180deg)" : "rotate(0deg)",
marginLeft: "8px",
}}
>
<ExpandMoreIcon />
</IconButton>
</HBox>
{
showAdditionalSupport && (
<Collapse in={showAdditionalSupport} sx={{ marginTop: theme.spacing(1) }}>
<VBox gap={2}>
<Typography variant="body1">{data.title}</Typography>
{
data.details.length > 0 && (
<VBox gap={1}>
{
data.details.map((item, index) => (
<HBox sx={{alignItems: 'center'}} >
<InfoIcon sx={{fontSize: '20px'}} />
<Typography sx={{ color: "inherit" }} variant="body1">{item}</Typography>
</HBox>
))
}
</VBox>
)
}
</VBox>
</Collapse>
)
}
</ContentBox>
);
}

export default BenefitPageInfoList;
3 changes: 2 additions & 1 deletion src/ui/screens/benefit-page/hooks/useFetchBenefitPageData.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ const useFetchBenefitPageData = (id, hydrationData, language) => {
const description = hydrationData[rpUri]?.description?.[language] || 'Unknown Description';
const status = hydrationData[rpUri]?.status || 'Unknown Status';
const applicationProcess = hydrationData[rpUri]?.application_process?.[language] || {};
const fundingConditions = hydrationData[rpUri]?.funding_conditions?.[language] || {};
const requiredDocuments = hydrationData[rpUri]?.required_documents?.[language] || [];
const additionalSupport = hydrationData[rpUri]?.additional_support?.[language] || {};
const legalBasis = hydrationData[rpUri]?.legal_basis?.[language] || {};
const furtherInformation = hydrationData[rpUri]?.further_information?.[language] || [];
const data = { title, leikaId, description, status, applicationProcess, requiredDocuments, additionalSupport, legalBasis, furtherInformation };
const data = { title, leikaId, description, status, applicationProcess, fundingConditions, requiredDocuments, additionalSupport, legalBasis, furtherInformation };
setBenefitPageData(data);
}
}, [rpUri, hydrationData, language]);
Expand Down

0 comments on commit 6ea8a8f

Please sign in to comment.