diff --git a/apps/climatemappedafrica/src/components/DropdownSearch/DownloadSearch.js b/apps/climatemappedafrica/src/components/DropdownSearch/DownloadSearch.js
index fb3cfc7b2..b1f4b04ff 100644
--- a/apps/climatemappedafrica/src/components/DropdownSearch/DownloadSearch.js
+++ b/apps/climatemappedafrica/src/components/DropdownSearch/DownloadSearch.js
@@ -16,7 +16,7 @@ import Link from "@/climatemappedafrica/components/Link";
function DropdownSearch({
href: hrefProp = "/explore",
- label = "Search for a location",
+ label,
locations,
onClick,
icon: IconProp = SearchIcon,
@@ -87,8 +87,8 @@ function DropdownSearch({
component={iconComponent}
viewBox="0 0 48 48"
sx={{
- width: 48,
- height: 48,
+ width: 40,
+ height: 40,
...iconBorder,
}}
/>
@@ -97,15 +97,17 @@ function DropdownSearch({
return (
- ({
- color: palette.text.primary,
- marginBottom: typography.pxToRem(10),
- })}
- >
- {label}
-
+ {label && (
+ ({
+ color: palette.text.primary,
+ marginBottom: typography.pxToRem(10),
+ })}
+ >
+ {label}
+
+ )}
renders unchanged 1`] = `
Search for a location
renders unchanged 1`] = `
>
diff --git a/apps/climatemappedafrica/src/components/ExplorePage/index.js b/apps/climatemappedafrica/src/components/ExplorePage/index.js
index f7652dd65..35cc52c07 100644
--- a/apps/climatemappedafrica/src/components/ExplorePage/index.js
+++ b/apps/climatemappedafrica/src/components/ExplorePage/index.js
@@ -80,7 +80,10 @@ function ExplorePage({
]);
useEffect(() => {
if (geoCode) {
- dispatch({ type: "fetch", payload: { code: geoCode } });
+ dispatch({
+ type: "fetch",
+ payload: { code: geoCode, onClick: handleClickTag },
+ });
}
}, [dispatch, geoCode]);
@@ -94,7 +97,7 @@ function ExplorePage({
if (data) {
dispatch({
type: "show",
- payload: { profile: data, options: { onClick: handleClickTag } },
+ payload: { profile: data, onClick: handleClickTag },
});
}
}, [dispatch, data]);
diff --git a/apps/climatemappedafrica/src/components/Hero/Hero.snap.js b/apps/climatemappedafrica/src/components/Hero/Hero.snap.js
index 1af23dffd..6b4302a5f 100644
--- a/apps/climatemappedafrica/src/components/Hero/Hero.snap.js
+++ b/apps/climatemappedafrica/src/components/Hero/Hero.snap.js
@@ -58,7 +58,7 @@ exports[`
renders unchanged 1`] = `
Search for a location
renders unchanged 1`] = `
>
diff --git a/apps/climatemappedafrica/src/components/HowItWorks/index.js b/apps/climatemappedafrica/src/components/HowItWorks/index.js
index 155c23933..9b3dd3d90 100644
--- a/apps/climatemappedafrica/src/components/HowItWorks/index.js
+++ b/apps/climatemappedafrica/src/components/HowItWorks/index.js
@@ -56,7 +56,15 @@ function HowItWorks({
})}
/>
-
+
({
},
}));
-function ExploreNavigation({ explorePagePath, logo, variant }) {
+function ExploreNavigation({ explorePagePath, locations, logo, variant }) {
const classes = useStyles();
const { setIsOpen } = useTour();
@@ -72,8 +72,9 @@ function ExploreNavigation({ explorePagePath, logo, variant }) {
{
+export const blockify = async (blocks, api, context, settings) => {
+ const { hurumap, hurumapProfile } = settings;
const promises = blocks?.map(async (block) => {
const slug = block.blockType;
const propsifyBlock = propsifyBlockBySlug[slug];
if (propsifyBlock) {
- return propsifyBlock({ block, api, context, hurumap });
+ return propsifyBlock({ block, api, context, hurumap, hurumapProfile });
}
return {
...block,
diff --git a/apps/climatemappedafrica/src/lib/data/common/index.js b/apps/climatemappedafrica/src/lib/data/common/index.js
index fb7918025..7fb75928c 100644
--- a/apps/climatemappedafrica/src/lib/data/common/index.js
+++ b/apps/climatemappedafrica/src/lib/data/common/index.js
@@ -1,4 +1,5 @@
import { blockify } from "@/climatemappedafrica/lib/data/blockify";
+import { fetchProfile } from "@/climatemappedafrica/lib/hurumap";
export function imageFromMedia(alt, url) {
return { alt, src: url };
@@ -34,7 +35,8 @@ function getFooter(siteSettings, variant) {
};
}
-function getNavBar(siteSettings, variant, { slug }) {
+async function getNavBar(siteSettings, variant, { slug }, hurumapProfile) {
+ const { locations } = hurumapProfile;
const {
connect: { links = [] },
primaryNavigation: { menus = [], connect = [] },
@@ -51,6 +53,7 @@ function getNavBar(siteSettings, variant, { slug }) {
menus,
socialLinks,
variant,
+ locations,
};
}
@@ -62,6 +65,8 @@ export async function getPageProps(api, context) {
const { draftMode = false } = context;
const options = { draft: draftMode };
+ const hurumapProfile = await fetchProfile();
+
const {
docs: [page],
} = await api.findPage(slug, options);
@@ -74,13 +79,24 @@ export async function getPageProps(api, context) {
const {
page: { value: explorePage },
} = hurumap;
+ const siteSettings = await api.findGlobal("settings-site");
+
+ const settings = {
+ hurumap,
+ hurumapProfile,
+ siteSettings,
+ };
- let blocks = await blockify(page.blocks, api, context, hurumap);
+ let blocks = await blockify(page.blocks, api, context, settings);
const variant = page.slug === explorePage.slug ? "explore" : "default";
- const siteSettings = await api.findGlobal("settings-site");
const footer = getFooter(siteSettings, variant);
- const menus = getNavBar(siteSettings, variant, explorePage);
+ const menus = await getNavBar(
+ siteSettings,
+ variant,
+ explorePage,
+ hurumapProfile,
+ );
if (slug === explorePage.slug) {
// The explore page is a special case. The only block we need to render is map and tutorial.
@@ -93,7 +109,7 @@ export async function getPageProps(api, context) {
blockType: "tutorial",
},
];
- blocks = await blockify(explorePageBlocks, api, context, hurumap);
+ blocks = await blockify(explorePageBlocks, api, context, settings);
}
return {