diff --git a/sites/dev/components/header.mjs b/sites/dev/components/header.mjs index 97c79abe9b7..2b4aee12980 100644 --- a/sites/dev/components/header.mjs +++ b/sites/dev/components/header.mjs @@ -81,9 +81,9 @@ export const Header = ({ app, setSearch }) => { onClick={() => setSearch(true)} > - + / - + diff --git a/sites/dev/components/navigation/primary.mjs b/sites/dev/components/navigation/primary.mjs index 91be4405114..42ddd463d59 100644 --- a/sites/dev/components/navigation/primary.mjs +++ b/sites/dev/components/navigation/primary.mjs @@ -157,9 +157,11 @@ export const Icons = ({ flex flex-col items-center`, linkStyle = {}, }) => { - if (!app.navigation) return null + console.log(app.state) + if (!app.state?.nav) return null + const output = [] - for (const page of order(app.navigation)) { + for (const page of order(app.state.nav)) { output.push(
  • diff --git a/sites/dev/lib/load-navigation.mjs b/sites/dev/lib/load-navigation.mjs index 0807131b749..b2be2f3fdba 100644 --- a/sites/dev/lib/load-navigation.mjs +++ b/sites/dev/lib/load-navigation.mjs @@ -37,13 +37,14 @@ const createSections = () => { export const loadNavigation = (path = []) => { // Creat crumbs array const crumbs = createCrumbs(path) + const sections = createSections() return { path, slug: path.join('/'), crumbs, - sections: createSections(), - nav: path.length > 1 ? get(pbn.en, path[0]) : pbn.en[path[0]], - title: crumbs.slice(-1)[0].t, + sections, + nav: path.length > 1 ? get(pbn.en, path[0]) : path.length === 0 ? sections : pbn.en[path[0]], + title: crumbs.length > 0 ? crumbs.slice(-1)[0].t : '', } } diff --git a/sites/dev/pages/index.mjs b/sites/dev/pages/index.mjs index 9526ab7ab57..015b4496937 100644 --- a/sites/dev/pages/index.mjs +++ b/sites/dev/pages/index.mjs @@ -6,7 +6,7 @@ import { serverSideTranslations } from 'next-i18next/serverSideTranslations' import Head from 'next/head' import { PageWrapper } from 'shared/components/wrappers/page.mjs' import { BareLayout } from 'site/components/layouts/bare.mjs' -import { Icons } from 'shared/components/navigation/primary.mjs' +import { Icons } from 'site/components/navigation/primary.mjs' import { Highlight } from 'shared/components/mdx/highlight.mjs' import { Popout } from 'shared/components/popout.mjs' import { WebLink } from 'shared/components/web-link.mjs' @@ -14,8 +14,8 @@ import { PageLink } from 'shared/components/page-link.mjs' const title = 'Welcome to FreeSewing.dev' -const HomePage = () => { - const app = useApp() +const HomePage = (props) => { + const app = useApp(props) return ( @@ -71,7 +71,6 @@ const HomePage = () => { {
    { // Force update of navigation info (nav, title, crumbs) on each page change - if (path.length > 0) setState({ ...state, ...loadNavigation(path) }) + if (path) setState({ ...state, ...loadNavigation(path) }) }, [path, state.slug, state.title]) /*