/* ═══════════════════════════════════════════════════════════════
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
return
}