Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClimateMapped Africa Fixes #1051

Merged
merged 7 commits into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ function DropdownSearch({
{suggestions.map(({ name, code }) => (
<ListItem
component={Link}
href={`${hrefProp}/${code}`}
variant="subtitle1"
underline="none"
onClick={() => handleSelect(code, name)}
Expand Down
4 changes: 3 additions & 1 deletion apps/climatemappedafrica/src/components/ExplorePage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function ExplorePage({
if (geoCode) {
dispatch({
type: "fetch",
payload: { code: geoCode, onClick: handleClickTag },
payload: { code: geoCode },
});
}
}, [dispatch, geoCode]);
Expand Down Expand Up @@ -129,6 +129,8 @@ function ExplorePage({
};

const handleClickMap = (_, feature) => {
const code = feature?.properties?.code;
setGeoCode(code);
return handleSelectLocation(feature.properties);
};

Expand Down
21 changes: 2 additions & 19 deletions apps/climatemappedafrica/src/components/HURUmap/Chart/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import { ChartTooltip, IndicatorTitle, Download, Share } from "@hurumap/core";
import { Source } from "@hurumap/next";
import { Box, useMediaQuery, useTheme } from "@mui/material";
import { debounce } from "lodash";
import React, { useState, useRef, useCallback, useEffect } from "react";
import * as vega from "vega";
import embed from "vega-embed";
Expand Down Expand Up @@ -68,25 +67,9 @@

const handler = useCallback(
(_, event, item, value) => {
const debouncedTooltip = debounce((e, i, v) => {
if (!v) {
setTooltipData(null);
return;
}
if (
!tooltipData ||
tooltipData.value?.group !== v?.group ||
tooltipData.event?.clientX !== e?.clientX ||
tooltipData.event?.clientY !== e?.clientY
) {
setTooltipData({ item: i, value: v, id, geoCode, event: e });
}
}, 50);

debouncedTooltip(event, item, value);
return () => debouncedTooltip.cancel();
setTooltipData({ item, value, id, geoCode, event });
},
[id, geoCode, tooltipData],
[id, geoCode],
);

useEffect(() => {
Expand All @@ -110,7 +93,7 @@

setView(newView.view);
} catch (error) {
console.error("Error rendering chart", error);

Check warning on line 96 in apps/climatemappedafrica/src/components/HURUmap/Chart/index.js

View workflow job for this annotation

GitHub Actions / Build and Test (20.16, ubuntu-latest)

Unexpected console statement
}
}
}
Expand All @@ -131,7 +114,7 @@
setDownloadView(viewProp);
}
} catch (error) {
console.error("Error creating view", error);

Check warning on line 117 in apps/climatemappedafrica/src/components/HURUmap/Chart/index.js

View workflow job for this annotation

GitHub Actions / Build and Test (20.16, ubuntu-latest)

Unexpected console statement
}
}, [cSpec]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function DesktopPanel({ sx, ...props }) {
overscrollBehaviorBlock: "none",
},
}}
variant="persistent"
{...(open && { variant: "persistent" })}
PaperProps={{
elevation: 0,
square: true,
Expand Down
4 changes: 2 additions & 2 deletions apps/climatemappedafrica/src/lib/data/blockify/hero.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export default async function hero(block, _api, _context, { hurumap }) {
});
const { level } = geometries.boundary?.properties ?? {};
const childLevelMaps = {
continent: "country",
country: "region",
Continent: "Country",
Country: "Region",
};
const childLevel = childLevelMaps[level];
const { locations, preferredChildren } = await fetchProfile({
Expand Down
1 change: 1 addition & 0 deletions apps/pesayetu/src/components/DropdownSearch/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ function DropdownSearch({
{suggestions.map(({ name, code }) => (
<ListItem
component={Link}
href={`${hrefProp}/${code}`}
variant="subtitle1"
underline="none"
onClick={() => handleSelect(code, name)}
Expand Down
2 changes: 2 additions & 0 deletions apps/pesayetu/src/components/ExplorePage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ function ExplorePage({ panelProps, profile: profileProp, ...props }) {
};

const handleClickMap = (_, feature) => {
const code = feature?.properties?.code;
setGeoCode(code);
return handleSelectLocation(feature.properties);
};

Expand Down
Loading