Skip to content

Commit 22e6067

Browse files
committed
Re-enable rules/eval-graph toggle
1 parent 5721bf9 commit 22e6067

3 files changed

Lines changed: 17 additions & 5 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"@babel/plugin-transform-private-property-in-object": "^7.24.7",
99
"@emotion/react": "^11.11.4",
1010
"@emotion/styled": "^11.11.5",
11-
"@foerderfunke/matching-engine": "^1.4.1",
11+
"@foerderfunke/matching-engine": "^1.4.3",
1212
"@mui/icons-material": "^5.15.19",
1313
"@mui/material": "^5.15.19",
1414
"@mui/x-charts": "^7.6.2",

src/ui/language/translations.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,8 @@ const translations = {
295295
description: "In this section you will find an overview of the key requirements that must be met for a potential entitlement.\n\nBelow, you can expand the decision tree to explore each step in more detail. If you have already completed our questionnaire, the decision tree will also show which conditions are fulfilled in your case and which may not be.",
296296
btn: "Show requirements",
297297
btnClose: "Close requirements",
298+
toggleRule: "Rule",
299+
toggleEval: "Evaluation",
298300
eligible: "You are likely eligible",
299301
notEligible: "You are likely not eligible",
300302
},
@@ -675,7 +677,9 @@ const translations = {
675677
title: "Wer ist anspruchsberechtigt?",
676678
description: "In diesem Bereich sehen Sie eine Übersicht der wichtigsten Voraussetzungen, die erfüllt sein müssen, damit ein möglicher Anspruch besteht.\n\nUnterhalb können Sie den Entscheidungsbaum ausklappen und die einzelnen Schritte genauer nachvollziehen. Wenn Sie bereits unsere Fragestrecke durchlaufen haben, wird im Entscheidungsbaum zusätzlich dargestellt, welche Bedingungen in Ihrem Fall erfüllt sind und welche möglicherweise nicht.",
677679
btn: "Anspruchsvoraussetzungen anzeigen",
678-
btnClose: "Anspruchsvoraussetzungen schließen"
680+
btnClose: "Anspruchsvoraussetzungen schließen",
681+
toggleRule: "Regeln",
682+
toggleEval: "Evaluation",
679683
},
680684
local: {
681685
title: "Wo finde ich Unterstützung vor Ort?",

src/ui/shared-components/flow-chart/FlowChart.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import React, { useEffect, useState, useRef } from 'react';
22
import theme from '@/theme';
3-
import { VBox } from '@/ui/shared-components/LayoutBoxes';
3+
import { HBox, VBox } from '@/ui/shared-components/LayoutBoxes';
4+
import AntSwitch from "@/ui/shared-components/AntSwitch";
45
import { Typography } from "@mui/material";
56
import mermaid from "mermaid";
67
import { graphToMermaid } from "@foerderfunke/matching-engine/src/rule-graph/EvalGraph";
78
import matchingEngineManager from "@/core/managers/matchingEngineManager";
9+
import useTranslation from "@/ui/language/useTranslation";
810

911
function enablePanZoom(svg) {
1012
if (!svg) return () => { };
@@ -69,9 +71,10 @@ mermaid.initialize({
6971

7072

7173
export default function FlowChart({ evalGraph }) {
74+
const { t } = useTranslation();
7275

7376
const [svgContent, setSvgContent] = useState("");
74-
const graphTypeEval = true;
77+
const [graphTypeEval, setGraphTypeEval] = useState(false);
7578
const printLabels = true;
7679
const orientationVertical = false;
7780

@@ -123,7 +126,7 @@ export default function FlowChart({ evalGraph }) {
123126
if (!evalGraph) return;
124127
const me = matchingEngineManager.matchingEngineInstance;
125128
const mermaidDef = graphToMermaid(
126-
graphTypeEval ? evalGraph.ruleGraph : evalGraph,
129+
graphTypeEval ? evalGraph : evalGraph.ruleGraph,
127130
me, printLabels, orientationVertical
128131
);
129132

@@ -161,6 +164,11 @@ export default function FlowChart({ evalGraph }) {
161164

162165
return (
163166
<div style={{ position: "relative" }}>
167+
<HBox gap={1} alignItems="center" style={{ paddingBottom: "10px" }}>
168+
<span>{t("app.benefitPage.requirements.toggleRule")}</span>
169+
<AntSwitch checked={graphTypeEval} onChange={(e) => setGraphTypeEval(e.target.checked)} color="white"/>
170+
<span>{t("app.benefitPage.requirements.toggleEval")}</span>
171+
</HBox>
164172
<VBox
165173
sx={{
166174
backgroundColor: 'greyTransparent.main',

0 commit comments

Comments
 (0)