Skip to content

Commit

Permalink
Fixed disabled hurumap
Browse files Browse the repository at this point in the history
  • Loading branch information
koechkevin committed Nov 5, 2024
1 parent b799829 commit 66db738
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
5 changes: 2 additions & 3 deletions apps/climatemappedafrica/src/lib/data/blockify/hero.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ import {
export default async function hero({ block, hurumap }) {
const {
rootGeography: { center, code, rootGeographyHasData: pinRootGeography },
page: {
value: { slug: explorePageSlug },
},
page,
} = hurumap;
const explorePageSlug = page?.value?.slug ?? null;
const { geometries } = await fetchProfileGeography(code.toLowerCase());
const { level } = geometries.boundary?.properties ?? {};
const childLevelMaps = {
Expand Down
13 changes: 3 additions & 10 deletions apps/climatemappedafrica/src/lib/data/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,7 @@ async function getNavBar(siteSettings, variant, { slug }, hurumapProfile) {
export async function getPagePaths(api) {
const hurumapSettings = await api.findGlobal("settings-hurumap");
const { docs: pages } = await api.getCollection("pages");
let explorePage;
if (hurumapSettings.page) {
explorePage = hurumapSettings.page.value;
} else {
explorePage = null;
}
const explorePage = hurumapSettings.page?.value || { slug: null };
const paths = pages.flatMap(({ slug }) => {
// TODO(kilemensi): Handle parent > child page relation e.g. /insights/news
if (slug !== explorePage?.slug) {
Expand Down Expand Up @@ -112,9 +107,7 @@ export async function getPageProps(api, context) {
}

const hurumap = await api.findGlobal("settings-hurumap");
const {
page: { value: explorePage },
} = hurumap;
const explorePage = hurumap.page?.value || { slug: null };
const siteSettings = await api.findGlobal("settings-site");

const settings = {
Expand All @@ -124,7 +117,7 @@ export async function getPageProps(api, context) {
};

let blocks = await blockify(page.blocks, api, context, settings);
const variant = page.slug === explorePage.slug ? "explore" : "default";
const variant = page.slug === explorePage?.slug ? "explore" : "default";

const footer = getFooter(siteSettings, variant);
const menus = await getNavBar(
Expand Down

0 comments on commit 66db738

Please sign in to comment.