From 0940620e045ff42519df010a715d34f196287d78 Mon Sep 17 00:00:00 2001 From: okorie2 Date: Wed, 17 May 2023 07:40:12 +0100 Subject: [PATCH 1/4] fix: partners breadcrumb fix --- src/app/hooks/useClearDataPathStepsOnDatasetChange.tsx | 1 - src/app/modules/partner-detail-module/index.tsx | 3 ++- .../investments/disbursed/data-wrappers/partnerDetail.tsx | 2 ++ .../viz-module/sub-modules/investments/disbursed/index.tsx | 3 ++- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/app/hooks/useClearDataPathStepsOnDatasetChange.tsx b/src/app/hooks/useClearDataPathStepsOnDatasetChange.tsx index 50cda0f71..16684f35b 100644 --- a/src/app/hooks/useClearDataPathStepsOnDatasetChange.tsx +++ b/src/app/hooks/useClearDataPathStepsOnDatasetChange.tsx @@ -92,7 +92,6 @@ export function useClearDataPathStepsOnDatasetChange() { if (newDataPathSteps.length > 0) { newDataPathSteps[newDataPathSteps.length - 1].path = location.pathname; - console.log("newDataPathSteps", newDataPathSteps); setDataPathSteps(newDataPathSteps); } } diff --git a/src/app/modules/partner-detail-module/index.tsx b/src/app/modules/partner-detail-module/index.tsx index 91255e323..1a0ccf1d0 100644 --- a/src/app/modules/partner-detail-module/index.tsx +++ b/src/app/modules/partner-detail-module/index.tsx @@ -100,7 +100,7 @@ export default function PartnerDetail() { if ( partnerInfoData && partnerInfoData.partnerName && - !dataPathSteps.find((item) => item.id === partnerInfoData.partnerName) + !dataPathSteps.find((item) => item.id === "partner") ) { addDataPathSteps([ { @@ -188,6 +188,7 @@ export default function PartnerDetail() { type="Signed" code={paramCode} toolboxOpen={openToolboxPanel} + partnerName={partnerInfoData.partnerName} /> diff --git a/src/app/modules/viz-module/sub-modules/investments/disbursed/data-wrappers/partnerDetail.tsx b/src/app/modules/viz-module/sub-modules/investments/disbursed/data-wrappers/partnerDetail.tsx index 1264354b2..af9419fe4 100644 --- a/src/app/modules/viz-module/sub-modules/investments/disbursed/data-wrappers/partnerDetail.tsx +++ b/src/app/modules/viz-module/sub-modules/investments/disbursed/data-wrappers/partnerDetail.tsx @@ -13,6 +13,7 @@ interface Props { code: string; toolboxOpen?: boolean; type: "Disbursed" | "Signed" | "Commitment"; + partnerName?: string; } export function PartnerDetailInvestmentsDisbursedWrapper(props: Props) { @@ -114,6 +115,7 @@ export function PartnerDetailInvestmentsDisbursedWrapper(props: Props) { isDrilldownLoading={false} setVizSelected={setVizSelected} toolboxOpen={props.toolboxOpen} + partnerName={props.partnerName} /> ); } diff --git a/src/app/modules/viz-module/sub-modules/investments/disbursed/index.tsx b/src/app/modules/viz-module/sub-modules/investments/disbursed/index.tsx index 414fa02ac..403bc93d9 100644 --- a/src/app/modules/viz-module/sub-modules/investments/disbursed/index.tsx +++ b/src/app/modules/viz-module/sub-modules/investments/disbursed/index.tsx @@ -34,6 +34,7 @@ interface InvestmentsDisbursedModuleProps { toolboxOpen?: boolean; setOpenToolboxPanel?: (value: boolean) => void; codeParam?: string; + partnerName?: string; isGrantDetail?: boolean; isPartnerDetail?: boolean; isLocationDetail?: boolean; @@ -125,7 +126,7 @@ export function InvestmentsDisbursedModule( addDataPathSteps([ { id: "partner", - name: props.codeParam || "Partner", + name: props.partnerName || "Partner", path: `${history.location.pathname}${history.location.search}`, }, ]); From a5d5cf03e4791c87a9615f4a014935d82e55ff18 Mon Sep 17 00:00:00 2001 From: okorie2 Date: Fri, 19 May 2023 12:51:29 +0100 Subject: [PATCH 2/4] fix: partner details breadcrumb --- .../viz-module/sub-modules/investments/disbursed/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/modules/viz-module/sub-modules/investments/disbursed/index.tsx b/src/app/modules/viz-module/sub-modules/investments/disbursed/index.tsx index 403bc93d9..4e50f98f9 100644 --- a/src/app/modules/viz-module/sub-modules/investments/disbursed/index.tsx +++ b/src/app/modules/viz-module/sub-modules/investments/disbursed/index.tsx @@ -126,7 +126,7 @@ export function InvestmentsDisbursedModule( addDataPathSteps([ { id: "partner", - name: props.partnerName || "Partner", + name: props.partnerName as string, path: `${history.location.pathname}${history.location.search}`, }, ]); From 3f914db96636900c5b8a0139129a29d21ca78ea7 Mon Sep 17 00:00:00 2001 From: okorie2 Date: Fri, 19 May 2023 13:57:02 +0100 Subject: [PATCH 3/4] fix: partner detail breadcrumbs fix --- .../investments/disbursed/index.tsx | 45 +++++++++++++------ 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/src/app/modules/viz-module/sub-modules/investments/disbursed/index.tsx b/src/app/modules/viz-module/sub-modules/investments/disbursed/index.tsx index 4e50f98f9..f76009508 100644 --- a/src/app/modules/viz-module/sub-modules/investments/disbursed/index.tsx +++ b/src/app/modules/viz-module/sub-modules/investments/disbursed/index.tsx @@ -121,7 +121,8 @@ export function InvestmentsDisbursedModule( ]); } else if ( props.isPartnerDetail && - !find(dataPathSteps, (step) => step.path.indexOf("/partner/") > -1) + !find(dataPathSteps, (step) => step.path.indexOf("/partner/") > -1) && + props.partnerName ) { addDataPathSteps([ { @@ -131,17 +132,35 @@ export function InvestmentsDisbursedModule( }, ]); } - if ( - dataPathSteps.length === 0 || - !find(dataPathSteps, { name: `Grant Implementation: ${props.type}` }) - ) { - addDataPathSteps([ - { - id: uniqueId(), - name: `Grant Implementation: ${props.type}`, - path: `${history.location.pathname}${history.location.search}`, - }, - ]); + if (props.isPartnerDetail) { + if ( + props.partnerName && + (dataPathSteps.length === 0 || + !find(dataPathSteps, { + name: `Grant Implementation: ${props.type}`, + })) + ) { + addDataPathSteps([ + { + id: uniqueId(), + name: `Grant Implementation: ${props.type}`, + path: `${history.location.pathname}${history.location.search}`, + }, + ]); + } + } else { + if ( + dataPathSteps.length === 0 || + !find(dataPathSteps, { name: `Grant Implementation: ${props.type}` }) + ) { + addDataPathSteps([ + { + id: uniqueId(), + name: `Grant Implementation: ${props.type}`, + path: `${history.location.pathname}${history.location.search}`, + }, + ]); + } } } if (props.vizLevel > 0 && props.vizSelected) { @@ -157,7 +176,7 @@ export function InvestmentsDisbursedModule( }, ]); } - }, [props.vizLevel, props.vizSelected]); + }, [props.vizLevel, props.vizSelected, props.partnerName]); const setToolboxPanelDisbursementsSliderMaxValue = useStoreActions( (store) => store.ToolBoxPanelDisbursementsSliderValues.setMax From 2ec1ec1f9456f1888bacbb881fe23f529dd24267 Mon Sep 17 00:00:00 2001 From: okorie2 Date: Fri, 19 May 2023 14:30:47 +0100 Subject: [PATCH 4/4] fix: partners breadcrumb fix --- src/app/modules/partner-detail-module/index.tsx | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/app/modules/partner-detail-module/index.tsx b/src/app/modules/partner-detail-module/index.tsx index 1a0ccf1d0..feb397028 100644 --- a/src/app/modules/partner-detail-module/index.tsx +++ b/src/app/modules/partner-detail-module/index.tsx @@ -96,22 +96,6 @@ export default function PartnerDetail() { return 0; } - useUpdateEffect(() => { - if ( - partnerInfoData && - partnerInfoData.partnerName && - !dataPathSteps.find((item) => item.id === "partner") - ) { - addDataPathSteps([ - { - id: "partner", - name: partnerInfoData.partnerName, - path: location.pathname, - }, - ]); - } - }, [partnerInfoData]); - return (