Page management, step 1: every page in a registry, new pages, hidden and disabled
Migration 080 makes site_pages the list of every page: address, title, intro, Hidden, Disabled (out of menus, sitemap and search) and card order. site.json's pages and Navigation's page list move into it. Pages -> Page management (one editor in place of six) makes new pages of sections at any free address; the admin home opens Pages with a banner and a card per page. A catch-all route draws whatever page is at an address; the fixed pages take their words from the registry and can't be deleted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
56acedf926
commit
1342691f49
36 changed files with 584 additions and 405 deletions
31
src/pages/PageAtPath.tsx
Normal file
31
src/pages/PageAtPath.tsx
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
/* ═══════════════════════════════════════════════════════════════
|
||||
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) is drawn by its code when it's one of
|
||||
the fixed pages (fixedPages.ts), or as its sections (SitePage).
|
||||
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 { FIXED_PAGES } from './fixedPages.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 />
|
||||
|
||||
const Fixed = FIXED_PAGES[page.id]
|
||||
if (Fixed) return <Fixed key={page.id} page={page} />
|
||||
return <SitePage key={page.id} id={page.id} />
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue