refactor(breadcrumbs): extract representation route-state renderer group
This commit is contained in:
@@ -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
|
||||
};
|
||||
|
||||
@@ -25,6 +25,7 @@ const buildBreadcrumbRendererMaps = ({
|
||||
newAppealRouteRenderersByPath,
|
||||
callbackRouteRenderersByPath,
|
||||
stepBackRouteRenderersByPath,
|
||||
representationRouteRenderersByPath,
|
||||
caseDetailRouteRenderersByPath,
|
||||
detailAndAccountRouteRenderersByPath
|
||||
}) => [
|
||||
@@ -34,6 +35,7 @@ const buildBreadcrumbRendererMaps = ({
|
||||
newAppealRouteRenderersByPath,
|
||||
callbackRouteRenderersByPath,
|
||||
stepBackRouteRenderersByPath,
|
||||
representationRouteRenderersByPath,
|
||||
caseDetailRouteRenderersByPath,
|
||||
detailAndAccountRouteRenderersByPath
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user