Skip to content

Commit

Permalink
Merge pull request #36 from globalfund/fix/partner-breadcrumb
Browse files Browse the repository at this point in the history
fix: partners breadcrumb fix
  • Loading branch information
stephanoshadjipetrou authored May 19, 2023
2 parents e559f86 + 2ec1ec1 commit 4d03c27
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 31 deletions.
1 change: 0 additions & 1 deletion src/app/hooks/useClearDataPathStepsOnDatasetChange.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ export function useClearDataPathStepsOnDatasetChange() {
if (newDataPathSteps.length > 0) {
newDataPathSteps[newDataPathSteps.length - 1].path =
location.pathname;
console.log("newDataPathSteps", newDataPathSteps);
setDataPathSteps(newDataPathSteps);
}
}
Expand Down
17 changes: 1 addition & 16 deletions src/app/modules/partner-detail-module/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,22 +96,6 @@ export default function PartnerDetail() {
return 0;
}

useUpdateEffect(() => {
if (
partnerInfoData &&
partnerInfoData.partnerName &&
!dataPathSteps.find((item) => item.id === partnerInfoData.partnerName)
) {
addDataPathSteps([
{
id: "partner",
name: partnerInfoData.partnerName,
path: location.pathname,
},
]);
}
}, [partnerInfoData]);

return (
<div
css={`
Expand Down Expand Up @@ -188,6 +172,7 @@ export default function PartnerDetail() {
type="Signed"
code={paramCode}
toolboxOpen={openToolboxPanel}
partnerName={partnerInfoData.partnerName}
/>
</Route>
<Route path={`/partner/${params.code}/signed/table`}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ interface Props {
code: string;
toolboxOpen?: boolean;
type: "Disbursed" | "Signed" | "Commitment";
partnerName?: string;
}

export function PartnerDetailInvestmentsDisbursedWrapper(props: Props) {
Expand Down Expand Up @@ -114,6 +115,7 @@ export function PartnerDetailInvestmentsDisbursedWrapper(props: Props) {
isDrilldownLoading={false}
setVizSelected={setVizSelected}
toolboxOpen={props.toolboxOpen}
partnerName={props.partnerName}
/>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ interface InvestmentsDisbursedModuleProps {
toolboxOpen?: boolean;
setOpenToolboxPanel?: (value: boolean) => void;
codeParam?: string;
partnerName?: string;
isGrantDetail?: boolean;
isPartnerDetail?: boolean;
isLocationDetail?: boolean;
Expand Down Expand Up @@ -122,27 +123,46 @@ 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([
{
id: "partner",
name: props.codeParam || "Partner",
name: props.partnerName as string,
path: `${history.location.pathname}${history.location.search}`,
},
]);
}
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) {
Expand All @@ -158,7 +178,7 @@ export function InvestmentsDisbursedModule(
},
]);
}
}, [props.vizLevel, props.vizSelected]);
}, [props.vizLevel, props.vizSelected, props.partnerName]);

const setToolboxPanelDisbursementsSliderMaxValue = useStoreActions(
(store) => store.ToolBoxPanelDisbursementsSliderValues.setMax
Expand Down

0 comments on commit 4d03c27

Please sign in to comment.