Migration 083 gives the section types that need more than blocks their own tables (hero, slides, countdown, stats, paths, featured cards, the Community blog's slots, pinned posts and feeds) and turns the front page into Home's sections: the hero, then its bands in order. Any section can be hidden. The Front page editor, its tables and the Community page's are gone; /api/front-page and /api/community-blog fold into the page's sections (sectionData.js). The admin engine reads and writes a child collection's own side tables and gated nested collections. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
26 lines
1.3 KiB
TypeScript
26 lines
1.3 KiB
TypeScript
/* ═══════════════════════════════════════════════════════════════
|
|
PAGE AT PATH: any address the record routes don't take
|
|
|
|
Pages → Page management decides what's where: the site_pages row
|
|
at this path (useSiteNav), drawn as its sections (SitePage). The
|
|
front page is the index route, SitePage too. No page there
|
|
(or a hidden one, below viewer, which isn't sent): Not found.
|
|
═══════════════════════════════════════════════════════════════ */
|
|
|
|
import { useLocation } from 'react-router-dom'
|
|
|
|
import { useSiteNav } from '../lib/useSiteNav.ts'
|
|
import NotFound from './NotFound.tsx'
|
|
import SitePage from './SitePage.tsx'
|
|
|
|
export default function PageAtPath() {
|
|
const { pathname } = useLocation()
|
|
const { ready, pageAt } = useSiteNav()
|
|
// Before the pages arrive (the dev server's first moment), nothing
|
|
// rather than a Not found that turns into the page.
|
|
if (!ready) return null
|
|
|
|
const page = pageAt(pathname)
|
|
if (!page || page.path === '/') return <NotFound />
|
|
return <SitePage key={page.id} id={page.id} />
|
|
}
|