Navigation in the admin: header and footer links, page titles, hidden pages, Shop

Pages -> Navigation (migration 075) edits the header's pages and buttons
and the footer's links; navConfig.ts is now only the defaults. Page titles
and intros move there from Site settings. A hidden page answers Not found
below viewer (server and app) and is out of the menus and sitemap; signed
in, it shows with a bar. Adds a /shop page of sections, hidden, with its
header button.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aidan Dona 2026-10-16 18:01:02 -05:00
parent b49497cc59
commit 0cc2a3f721
30 changed files with 716 additions and 216 deletions

View file

@ -18,7 +18,7 @@ import { useMemo } from 'react'
import { Link, useLocation } from 'react-router-dom'
import PageShell from '../components/PageShell.tsx'
import { PAGE_LINKS } from '../navConfig.ts'
import { useSiteNav } from '../lib/useSiteNav.ts'
import { SITE_PAGES } from '../lib/site.ts'
import { useDirectory, type Directory } from '../lib/useContent.ts'
import { blogHref, eventHref, orgHref, personHref, teamHref, awardHref } from '../lib/hrefs.ts'
@ -33,10 +33,11 @@ const ORG_KIND_LABEL: Record<string, string> = {
partner: 'Partner',
}
/* Everything an address could have meant: the static pages, then
each kind of record, with the words to match it by. */
function candidates(directory: Directory | null): Candidate[] {
const pages: Candidate[] = Object.entries(SITE_PAGES).map(([path, page]) => ({
/* Everything an address could have meant: the static pages (not the
hidden ones), then each kind of record, with the words to match
it by. */
function candidates(directory: Directory | null, isHidden: (path: string) => boolean): Candidate[] {
const pages: Candidate[] = Object.entries(SITE_PAGES).filter(([path]) => !isHidden(path)).map(([path, page]) => ({
href: path,
label: page.title,
detail: 'Page',
@ -65,7 +66,11 @@ function candidates(directory: Directory | null): Candidate[] {
export default function NotFound() {
const { pathname } = useLocation()
const { data: directory, loading } = useDirectory()
const matches = useMemo(() => suggest(pathname, candidates(directory ?? null)), [pathname, directory])
const { main: pages, isHidden } = useSiteNav()
const matches = useMemo(
() => suggest(pathname, candidates(directory ?? null, isHidden)),
[pathname, directory, isHidden],
)
const reading = useReadingMode()
return (
@ -118,7 +123,7 @@ export default function NotFound() {
accent: ACCENTS.green,
content: (
<div className="mx-auto flex max-w-6xl flex-wrap gap-3 px-6">
{PAGE_LINKS.map((page) => (
{pages.map((page) => (
<Link
key={page.path}
to={page.path}