refactor(breadcrumbs): map step-back route branches into renderer group

This commit is contained in:
2026-04-09 15:03:19 +01:00
parent 0b905f9374
commit cebd47bf1c
6 changed files with 163 additions and 48 deletions
+11 -40
View File
@@ -215,6 +215,7 @@ const Breadcrumbs = (props) => {
simpleMyPortalRouteRenderersByPath,
newAppealRouteRenderersByPath,
callbackRouteRenderersByPath,
stepBackRouteRenderersByPath,
caseDetailRouteRenderersByPath,
detailAndAccountRouteRenderersByPath
} = createMappedRouteRendererGroups({
@@ -234,13 +235,21 @@ const Breadcrumbs = (props) => {
onBack: () => {
router.back();
},
currentSection: appealType.currentSection,
onStepBack: () => {
setCurrentSection(appealType.currentSection - 1);
},
onStepBackWithInlineClass: () => {
setCurrentSection(appealType.currentSection - 1);
},
renderAnchorCrumb,
renderLinkCrumb,
renderTextCrumb,
renderCaseReferenceCrumb,
renderMyPortalCrumb,
renderMyPortalSectionCrumbs,
renderDnsCaseReferenceCrumbs
renderDnsCaseReferenceCrumbs,
renderBackCrumb
});
const mappedRouteRendererMaps = buildBreadcrumbRendererMaps({
@@ -249,6 +258,7 @@ const Breadcrumbs = (props) => {
simpleMyPortalRouteRenderersByPath,
newAppealRouteRenderersByPath,
callbackRouteRenderersByPath,
stepBackRouteRenderersByPath,
caseDetailRouteRenderersByPath,
detailAndAccountRouteRenderersByPath
});
@@ -274,45 +284,6 @@ const Breadcrumbs = (props) => {
{isPath("/newappeal") && <></>}
{isPath("/newappeal/[appealtypes]") && (
<>
{appealType.currentSection > 1 &&
(appealType.currentSection === 9999
? renderLinkCrumb(
"/",
t(
"common:service-name-breadcrumb"
)
)
: renderBackCrumb(
() =>
setCurrentSection(
appealType.currentSection -
1
),
"govuk-breadcrumbs__link-item"
))}
</>
)}
{isPath("/myportal/[appealtypes]") && (
<>
{appealType.currentSection > 1 &&
(appealType.currentSection === 9999
? renderLinkCrumb(
"/",
t(
"common:service-name-breadcrumb"
)
)
: renderBackCrumb(() =>
setCurrentSection(
appealType.currentSection - 1
)
))}
</>
)}
{isPath("/myportal/representation") && (
<>
{currentView.representationSubmit === true &&