Navigation: section dropdowns, a side nav, Home's sections from the front page

- The header's second strip is gone: each top link drops down its
  page's sections on hover or keyboard focus.
- Retreats, Community, Resources, Organization and History get the
  admin editors' "On this page" column (SectionNav), sticky at the
  left from lg up, with the section being read lit.
- Home's sections in the dropdown, mobile menu, footer site map, the
  feedback form and the QR maker are the bands the front page is
  showing, in its order and under its headings (navSections.ts,
  frontPageBands.ts, which Home.tsx now draws from too).
- Resources comes before Organization in the nav and footer.
- The Organization page draws from its own editor's content.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-09-30 23:37:36 -05:00
parent 43797f38bc
commit ed0f12022f
16 changed files with 283 additions and 237 deletions

38
src/lib/frontPageBands.ts Normal file
View file

@ -0,0 +1,38 @@
/* ═══════════════════════════════════════════════════════════════
FRONT PAGE BANDS
Each band the front page can show (front_page_sections.section):
the anchor it sits at, and the heading it gets when the admin gives
it none. Home.tsx draws the bands; the nav and footer list the ones
the front page is showing (navSections.ts). The countdown has no
anchor: it's a card under the hero, not a section to jump to.
═══════════════════════════════════════════════════════════════ */
import type { FrontPage, FrontPageSectionKey } from './useFrontPage.ts'
export const FRONT_PAGE_BANDS: Record<FrontPageSectionKey, { id: string | null; title: string }> = {
countdown: { id: null, title: 'Next up' },
retreats: { id: 'retreats', title: 'National Retreats' },
calendar: { id: 'calendar', title: 'What’s on' },
stats: { id: 'numbers', title: 'By the numbers' },
timeline: { id: 'story', title: 'Our story so far' },
connect: { id: 'connect', title: 'Find your way in' },
featured: { id: 'featured', title: 'Featured' },
}
/* Whether a band has anything to draw: Home.tsx leaves out a band
with nothing in it, and so does the nav. */
export function bandShows(page: FrontPage, key: FrontPageSectionKey): boolean {
switch (key) {
case 'countdown':
return Boolean(page.countdown)
case 'stats':
return page.stats.length > 0
case 'connect':
return page.paths.length > 0
case 'featured':
return page.featured.length > 0
default:
return true
}
}

34
src/lib/navSections.ts Normal file
View file

@ -0,0 +1,34 @@
/* ═══════════════════════════════════════════════════════════════
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.
═══════════════════════════════════════════════════════════════ */
import { useCallback } from 'react'
import { PAGE_SECTIONS } from '../navConfig.ts'
import { useFrontPage } from './useFrontPage.ts'
import { FRONT_PAGE_BANDS, bandShows } from './frontPageBands.ts'
export type NavSection = { label: string; hash: string }
export function useNavSections(): (path: string) => NavSection[] {
const { data: page } = useFrontPage()
return useCallback(
(path: string) => {
if (path !== '/') return PAGE_SECTIONS[path] ?? []
if (!page) return []
return page.sections.flatMap((section) => {
const band = FRONT_PAGE_BANDS[section.section]
if (!band?.id || !bandShows(page, section.section)) return []
return [{ label: section.title || band.title, hash: `#${band.id}` }]
})
},
[page],
)
}