refactor(breadcrumbs): extract representation route-state renderer group

This commit is contained in:
2026-04-09 15:16:01 +01:00
parent 7a60e64a84
commit d3f4dda8af
6 changed files with 160 additions and 38 deletions
@@ -203,6 +203,36 @@ export const createStepBackRouteRenderers = ({
}
});
export const createRepresentationRouteRenderers = ({
currentView,
hasRepDetails,
repDetails,
showQuestionnaireSection,
onRepresentationSubmitBackFromConfirmation,
onRepresentationSubmitBackToDetails,
onRepresentationQuestionnaireBack,
renderBackCrumb
}) => ({
"/myportal/representation": () => (
<>
{currentView.representationSubmit === true &&
currentView.representationSubmitConfirmation !== true &&
renderBackCrumb(onRepresentationSubmitBackFromConfirmation)}
{currentView.representationSubmit !== true &&
hasRepDetails &&
repDetails?.representationType !== "Questionnaire" &&
renderBackCrumb(onRepresentationSubmitBackToDetails)}
{currentView.representationSubmit !== true &&
hasRepDetails &&
repDetails?.representationType === "Questionnaire" &&
showQuestionnaireSection > 1 &&
renderBackCrumb(onRepresentationQuestionnaireBack)}
</>
)
});
export const createCaseDetailRouteRenderers = ({
t,
router,
@@ -457,6 +487,13 @@ export const createMappedRouteRendererGroups = ({
currentSection,
onStepBack,
onStepBackWithInlineClass,
currentView,
hasRepDetails,
repDetails,
showQuestionnaireSection,
onRepresentationSubmitBackFromConfirmation,
onRepresentationSubmitBackToDetails,
onRepresentationQuestionnaireBack,
renderAnchorCrumb,
renderLinkCrumb,
renderTextCrumb,
@@ -525,6 +562,18 @@ export const createMappedRouteRendererGroups = ({
renderBackCrumb
});
const representationRouteRenderersByPath =
createRepresentationRouteRenderers({
currentView,
hasRepDetails,
repDetails,
showQuestionnaireSection,
onRepresentationSubmitBackFromConfirmation,
onRepresentationSubmitBackToDetails,
onRepresentationQuestionnaireBack,
renderBackCrumb
});
const caseDetailRouteRenderersByPath = createCaseDetailRouteRenderers({
t,
router,
@@ -562,6 +611,7 @@ export const createMappedRouteRendererGroups = ({
newAppealRouteRenderersByPath,
callbackRouteRenderersByPath,
stepBackRouteRenderersByPath,
representationRouteRenderersByPath,
caseDetailRouteRenderersByPath,
detailAndAccountRouteRenderersByPath
};
+2
View File
@@ -25,6 +25,7 @@ const buildBreadcrumbRendererMaps = ({
newAppealRouteRenderersByPath,
callbackRouteRenderersByPath,
stepBackRouteRenderersByPath,
representationRouteRenderersByPath,
caseDetailRouteRenderersByPath,
detailAndAccountRouteRenderersByPath
}) => [
@@ -34,6 +35,7 @@ const buildBreadcrumbRendererMaps = ({
newAppealRouteRenderersByPath,
callbackRouteRenderersByPath,
stepBackRouteRenderersByPath,
representationRouteRenderersByPath,
caseDetailRouteRenderersByPath,
detailAndAccountRouteRenderersByPath
];