Page editors: Retreats, Community, Resources, Organization and History built from sections
Each page is now a list of sections edited in Admin → Pages: a title (30 characters at most, for the side nav), URL ID, blurb and accent, its own content blocks, and an optional preset (Community blog, groups map, region list, partner cards, events, timeline, NGU's details). Migration 056 seeds every page as the code drew it and moves the Organization editor's blocks and volunteering into its sections. The Community blog's settings move into the Community editor. The header, footer and side nav read each page's sections from the API. The admin engine reads and writes nested collections to any depth. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
4a1d6fd6e9
commit
9daf7b1a4f
29 changed files with 972 additions and 938 deletions
|
|
@ -2,15 +2,16 @@
|
|||
NAV SECTIONS: the sections listed under each page in the header's
|
||||
dropdowns, the mobile menu and the footer's site map
|
||||
|
||||
The static pages' lists are PAGE_SECTIONS in navConfig.ts. The
|
||||
front page's comes from the front page itself: the bands it is
|
||||
showing, in the admin's order, each under its heading (Front page
|
||||
→ Sections), so hiding a band or renaming it changes the menus too.
|
||||
Every page's list comes from the page itself, so adding, moving
|
||||
or renaming a section changes the menus too: the site pages'
|
||||
sections (Pages → each page, GET /site-pages), and the front
|
||||
page's bands it is showing, in the admin's order, each under its
|
||||
heading (Front page → Sections).
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
import { useCallback } from 'react'
|
||||
|
||||
import { PAGE_SECTIONS } from '../navConfig.ts'
|
||||
import { useSitePageHeadings } from './useSitePages.ts'
|
||||
import { useFrontPage } from './useFrontPage.ts'
|
||||
import { FRONT_PAGE_BANDS, bandShows } from './frontPageBands.ts'
|
||||
|
||||
|
|
@ -18,10 +19,16 @@ export type NavSection = { label: string; hash: string }
|
|||
|
||||
export function useNavSections(): (path: string) => NavSection[] {
|
||||
const { data: page } = useFrontPage()
|
||||
const { data: sitePages } = useSitePageHeadings()
|
||||
|
||||
return useCallback(
|
||||
(path: string) => {
|
||||
if (path !== '/') return PAGE_SECTIONS[path] ?? []
|
||||
if (path !== '/') {
|
||||
return (sitePages?.[path.slice(1)] ?? []).map((section) => ({
|
||||
label: section.title,
|
||||
hash: `#${section.anchor}`,
|
||||
}))
|
||||
}
|
||||
if (!page) return []
|
||||
return page.sections.flatMap((section) => {
|
||||
const band = FRONT_PAGE_BANDS[section.section]
|
||||
|
|
@ -29,6 +36,6 @@ export function useNavSections(): (path: string) => NavSection[] {
|
|||
return [{ label: section.title || band.title, hash: `#${band.id}` }]
|
||||
})
|
||||
},
|
||||
[page],
|
||||
[page, sitePages],
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue