From 50ca225b8fda45dddf49562028c73533767c91c5 Mon Sep 17 00:00:00 2001 From: Jonni Date: Tue, 11 Jun 2024 13:16:35 +0000 Subject: [PATCH 1/2] fix: empty title for formStepper --- .../ui-shell/src/components/FormStepper.tsx | 77 +++++++++++-------- 1 file changed, 46 insertions(+), 31 deletions(-) diff --git a/libs/application/ui-shell/src/components/FormStepper.tsx b/libs/application/ui-shell/src/components/FormStepper.tsx index 0978da8f6af1..145016f700a0 100644 --- a/libs/application/ui-shell/src/components/FormStepper.tsx +++ b/libs/application/ui-shell/src/components/FormStepper.tsx @@ -53,20 +53,25 @@ const FormStepper = ({ childrenToParse.push(child) }) - return childrenToParse.map((child, i) => { - const isChildActive = - isParentActive && currentScreen.subSectionIndex === i - - return ( - - {formatText(child.title, application, formatMessage)} - - ) - }) + return childrenToParse + .map((child, i) => { + const isChildActive = + isParentActive && currentScreen.subSectionIndex === i + const childText = formatText(child.title, application, formatMessage) + + if (!childText) return null + + return ( + + {formatText(child.title, application, formatMessage)} + + ) + }) + .filter(Boolean as unknown as ExcludesFalse) } const stepperTitle = isMobile ? null : ( @@ -85,23 +90,33 @@ const FormStepper = ({ sections && [ stepperTitle, - ...sections.map((section, i) => ( -
1 - ? parseSubsections( - section.children, - currentScreen.sectionIndex === i, - ) - : undefined - } - isComplete={currentScreen.sectionIndex > i} - /> - )), + ...sections.map((section, i) => { + const sectionTitle = formatText( + section.title, + application, + formatMessage, + ) + + if (!sectionTitle) return null + + return ( +
1 + ? parseSubsections( + section.children, + currentScreen.sectionIndex === i, + ) + : undefined + } + isComplete={currentScreen.sectionIndex > i} + /> + ) + }), ].filter(Boolean as unknown as ExcludesFalse) } /> From 079ce93cf44aeedb64506443c6b599886948a6e2 Mon Sep 17 00:00:00 2001 From: Jonni Date: Tue, 11 Jun 2024 13:22:08 +0000 Subject: [PATCH 2/2] fix: use the constant I defined --- libs/application/ui-shell/src/components/FormStepper.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/application/ui-shell/src/components/FormStepper.tsx b/libs/application/ui-shell/src/components/FormStepper.tsx index 145016f700a0..5029dac268a2 100644 --- a/libs/application/ui-shell/src/components/FormStepper.tsx +++ b/libs/application/ui-shell/src/components/FormStepper.tsx @@ -67,7 +67,7 @@ const FormStepper = ({ fontWeight={isChildActive ? 'semiBold' : 'regular'} key={`formStepperChild-${i}`} > - {formatText(child.title, application, formatMessage)} + {childText} ) })