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
|
|
@ -1,10 +1,8 @@
|
|||
import PageShell from "../components/PageShell.tsx";
|
||||
import { sitePage } from "../lib/site.ts";
|
||||
import type { PageText } from "./fixedPages.ts";
|
||||
import FeedbackForm from "./sections/FeedbackForm.tsx";
|
||||
import { BRAND } from "../lib/color.ts"
|
||||
|
||||
/* Title and intro: site.json, which also gives the search metadata. */
|
||||
const PAGE = sitePage("/feedback");
|
||||
|
||||
/* ═══════════════════════════════════════════════════════════════
|
||||
Feedback page.
|
||||
|
|
@ -36,11 +34,12 @@ const SECTIONS = [
|
|||
},
|
||||
];
|
||||
|
||||
export default function Feedback() {
|
||||
/* Its title and intro: its site_pages row (Pages → Page management). */
|
||||
export default function Feedback({ page: PAGE }: { page: PageText }) {
|
||||
return (
|
||||
<PageShell
|
||||
title={PAGE.title}
|
||||
intro={PAGE.description}
|
||||
intro={PAGE.description ?? undefined}
|
||||
sections={SECTIONS}
|
||||
/>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
import { useEffect } from "react";
|
||||
import PageShell from "../components/PageShell.tsx";
|
||||
import { sitePage } from "../lib/site.ts";
|
||||
import type { PageText } from "./fixedPages.ts";
|
||||
import { BRAND } from "../lib/color.ts"
|
||||
|
||||
/* Title and intro: site.json, which also gives the search metadata. */
|
||||
const PAGE = sitePage("/give");
|
||||
|
||||
const GIVING_URL =
|
||||
"https://ngu.churchcenteronline.com/giving?open-in-church-center-modal=true";
|
||||
|
|
@ -72,7 +70,8 @@ function GivingPanel() {
|
|||
PAGE
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
export default function GivingPage() {
|
||||
/* Its title and intro: its site_pages row (Pages → Page management). */
|
||||
export default function GivingPage({ page: PAGE }: { page: PageText }) {
|
||||
useChurchCenterModal();
|
||||
|
||||
const sections = [
|
||||
|
|
@ -89,7 +88,7 @@ export default function GivingPage() {
|
|||
return (
|
||||
<PageShell
|
||||
title={PAGE.title}
|
||||
intro={PAGE.description}
|
||||
intro={PAGE.description ?? undefined}
|
||||
sections={sections}
|
||||
/>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
NOT FOUND: any address no route matches
|
||||
|
||||
Rather than a dead end, the closest pages to the address that
|
||||
failed: the static pages (site.json's) and every public, listed
|
||||
failed: the site's pages (Page management's) and every public, listed
|
||||
record (GET /directory), scored by suggest.ts against the
|
||||
address. So /organisation offers Organization, /retreat offers
|
||||
Retreats, and an old /chapters/lynnwood offers the Lynnwood group.
|
||||
|
|
@ -18,8 +18,7 @@ import { useMemo } from 'react'
|
|||
import { Link, useLocation } from 'react-router-dom'
|
||||
|
||||
import PageShell from '../components/PageShell.tsx'
|
||||
import { useSiteNav } from '../lib/useSiteNav.ts'
|
||||
import { SITE_PAGES } from '../lib/site.ts'
|
||||
import { useSiteNav, type SitePageInfo } from '../lib/useSiteNav.ts'
|
||||
import { useDirectory, type Directory } from '../lib/useContent.ts'
|
||||
import { blogHref, eventHref, orgHref, personHref, teamHref, awardHref } from '../lib/hrefs.ts'
|
||||
import { suggest, type Candidate } from '../lib/suggest.ts'
|
||||
|
|
@ -36,12 +35,12 @@ const ORG_KIND_LABEL: Record<string, string> = {
|
|||
/* 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,
|
||||
function candidates(directory: Directory | null, sitePages: SitePageInfo[]): Candidate[] {
|
||||
const pages: Candidate[] = sitePages.filter((page) => !page.hidden && page.path !== '/').map((page) => ({
|
||||
href: page.path,
|
||||
label: page.title,
|
||||
detail: 'Page',
|
||||
keys: [path.slice(1), page.title],
|
||||
keys: [page.path.slice(1), page.title],
|
||||
}))
|
||||
if (!directory) return pages
|
||||
|
||||
|
|
@ -66,10 +65,10 @@ function candidates(directory: Directory | null, isHidden: (path: string) => boo
|
|||
export default function NotFound() {
|
||||
const { pathname } = useLocation()
|
||||
const { data: directory, loading } = useDirectory()
|
||||
const { main: pages, isHidden } = useSiteNav()
|
||||
const { main: pages, pages: sitePages } = useSiteNav()
|
||||
const matches = useMemo(
|
||||
() => suggest(pathname, candidates(directory ?? null, isHidden)),
|
||||
[pathname, directory, isHidden],
|
||||
() => suggest(pathname, candidates(directory ?? null, sitePages)),
|
||||
[pathname, directory, sitePages],
|
||||
)
|
||||
const reading = useReadingMode()
|
||||
|
||||
|
|
|
|||
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} />
|
||||
}
|
||||
|
|
@ -3,12 +3,11 @@ import { Link } from "react-router-dom";
|
|||
import LegalText, { type LegalPart } from "../components/LegalText.tsx";
|
||||
import PageShell from "../components/PageShell.tsx";
|
||||
import { DATA_REQUEST } from "../data/feedbackTypes.ts";
|
||||
import { PRIVACY_EMAIL, sitePage } from "../lib/site.ts";
|
||||
import { PRIVACY_EMAIL } from "../lib/site.ts";
|
||||
import type { PageText } from "./fixedPages.ts";
|
||||
import FeedbackForm from "./sections/FeedbackForm.tsx";
|
||||
import { BRAND } from "../lib/color.ts"
|
||||
|
||||
/* Title and intro: site.json, which also gives the search metadata. */
|
||||
const PAGE = sitePage("/privacy");
|
||||
|
||||
/* ═══════════════════════════════════════════════════════════════
|
||||
Privacy policy, cookie notice included.
|
||||
|
|
@ -210,6 +209,7 @@ const SECTIONS = [
|
|||
},
|
||||
];
|
||||
|
||||
export default function PrivacyPage() {
|
||||
return <PageShell title={PAGE.title} intro={PAGE.description} sections={SECTIONS} />;
|
||||
/* Its title and intro: its site_pages row (Pages → Page management). */
|
||||
export default function PrivacyPage({ page: PAGE }: { page: PageText }) {
|
||||
return <PageShell title={PAGE.title} intro={PAGE.description ?? undefined} sections={SECTIONS} />;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
import PageShell from '../components/PageShell.tsx'
|
||||
import { sitePage } from '../lib/site.ts'
|
||||
import type { PageText } from './fixedPages.ts'
|
||||
import QrCodeMaker from './sections/QrCodeMaker.tsx'
|
||||
import { BRAND } from '../lib/color.ts'
|
||||
|
||||
/* Title and intro: site.json, which also gives the search metadata. */
|
||||
const PAGE = sitePage('/qr')
|
||||
|
||||
/* ═══════════════════════════════════════════════════════════════
|
||||
QR CODES PAGE: /qr
|
||||
|
|
@ -30,11 +28,12 @@ const SECTIONS = [
|
|||
},
|
||||
]
|
||||
|
||||
export default function QrCodes() {
|
||||
/* Its title and intro: its site_pages row (Pages → Page management). */
|
||||
export default function QrCodes({ page: PAGE }: { page: PageText }) {
|
||||
return (
|
||||
<PageShell
|
||||
title={PAGE.title}
|
||||
intro={PAGE.description}
|
||||
intro={PAGE.description ?? undefined}
|
||||
sections={SECTIONS}
|
||||
/>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
import PageShell from "../components/PageShell.tsx";
|
||||
import { sitePage } from "../lib/site.ts";
|
||||
import type { PageText } from "./fixedPages.ts";
|
||||
import RequestForm from "./sections/RequestForm.tsx";
|
||||
import { BRAND } from "../lib/color.ts";
|
||||
|
||||
/* Title and intro: site.json, which also gives the search metadata. */
|
||||
const PAGE = sitePage("/request");
|
||||
|
||||
/* ═══════════════════════════════════════════════════════════════
|
||||
Request page: ask for something to be added to the site or
|
||||
|
|
@ -27,6 +25,7 @@ const SECTIONS = [
|
|||
},
|
||||
];
|
||||
|
||||
export default function Request() {
|
||||
return <PageShell title={PAGE.title} intro={PAGE.description} sections={SECTIONS} />;
|
||||
/* Its title and intro: its site_pages row (Pages → Page management). */
|
||||
export default function Request({ page: PAGE }: { page: PageText }) {
|
||||
return <PageShell title={PAGE.title} intro={PAGE.description ?? undefined} sections={SECTIONS} />;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@
|
|||
the site, from PRESETS below. A section with neither says it's
|
||||
coming (ComingSoon) rather than showing a heading over nothing.
|
||||
|
||||
The title and intro are site.json's, which also gives the search
|
||||
metadata.
|
||||
The title and intro are its site_pages row's (Pages → Page
|
||||
management), which also give the search metadata.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
import { useEffect } from 'react'
|
||||
|
|
@ -18,7 +18,7 @@ import { useLocation } from 'react-router-dom'
|
|||
import PageShell from '../components/PageShell.tsx'
|
||||
import ComingSoon from '../components/ComingSoon.tsx'
|
||||
import ContentBlocks from '../components/ContentBlocks.tsx'
|
||||
import { sitePage } from '../lib/site.ts'
|
||||
import { useSiteNav } from '../lib/useSiteNav.ts'
|
||||
import { useSectionManifest } from '../lib/sections.tsx'
|
||||
import { useSitePage, type SitePageSection } from '../lib/useSitePages.ts'
|
||||
import { useHistory } from '../lib/useHistory.ts'
|
||||
|
|
@ -97,10 +97,12 @@ const PRESETS: Record<string, (section: SitePageSection) => Record<string, any>>
|
|||
}
|
||||
|
||||
export default function SitePage({ id }: { id: string }) {
|
||||
const PAGE = sitePage(`/${id}`)
|
||||
const { data: page, loading, error } = useSitePage(id)
|
||||
// Its title and intro: its own data, or the nav's until that comes.
|
||||
const known = useSiteNav().pages.find((p) => p.id === id)
|
||||
const PAGE = { title: page?.title ?? known?.title ?? '', description: page?.description ?? known?.description ?? undefined }
|
||||
|
||||
if (page) return <Sections title={PAGE.title} intro={PAGE.description} sections={page.sections} />
|
||||
if (page) return <Sections title={PAGE.title} intro={PAGE.description ?? undefined} sections={page.sections} />
|
||||
|
||||
return (
|
||||
<>
|
||||
|
|
|
|||
|
|
@ -2,11 +2,9 @@ import { Link } from "react-router-dom";
|
|||
|
||||
import LegalText, { type LegalPart } from "../components/LegalText.tsx";
|
||||
import PageShell from "../components/PageShell.tsx";
|
||||
import { sitePage } from "../lib/site.ts";
|
||||
import type { PageText } from "./fixedPages.ts";
|
||||
import { BRAND } from "../lib/color.ts"
|
||||
|
||||
/* Title and intro: site.json, which also gives the search metadata. */
|
||||
const PAGE = sitePage("/terms");
|
||||
|
||||
/* Change the date when the wording changes. */
|
||||
const LAST_UPDATED = "September 28, 2026";
|
||||
|
|
@ -88,6 +86,7 @@ const SECTIONS = [
|
|||
},
|
||||
];
|
||||
|
||||
export default function TermsPage() {
|
||||
return <PageShell title={PAGE.title} intro={PAGE.description} sections={SECTIONS} />;
|
||||
/* Its title and intro: its site_pages row (Pages → Page management). */
|
||||
export default function TermsPage({ page: PAGE }: { page: PageText }) {
|
||||
return <PageShell title={PAGE.title} intro={PAGE.description ?? undefined} sections={SECTIONS} />;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,9 @@
|
|||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
import { ArrowRight, ArrowUpRight } from "@phosphor-icons/react";
|
||||
import { useEffect, useState } from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import { get } from "../../lib/api.ts";
|
||||
import { useAuth } from "../../lib/auth.tsx";
|
||||
import { useWideAdminPage } from "../../lib/adminWidth.tsx";
|
||||
import { SITE_VERSION, VERSION_NAME } from "../../lib/version.ts";
|
||||
|
|
@ -40,6 +42,8 @@ const tintOf = (color: string) => `color-mix(in srgb, ${color} 12%, var(--color-
|
|||
|
||||
function NavCard({ item, color }) {
|
||||
const to = target(item);
|
||||
// The group's banner (Page management): the whole row, a stronger fill.
|
||||
const banner = Boolean(item.banner);
|
||||
|
||||
// Drop the child that just repeats the card's own destination:
|
||||
// "All organizations" under Organizations.
|
||||
|
|
@ -47,11 +51,13 @@ function NavCard({ item, color }) {
|
|||
|
||||
return (
|
||||
<div
|
||||
className="group relative flex flex-col border-l-4 p-5 shadow-sm transition-shadow hover:shadow-md"
|
||||
style={{ borderColor: color, background: tintOf(color) }}
|
||||
className={`group relative flex flex-col border-l-4 p-5 shadow-sm transition-shadow hover:shadow-md ${
|
||||
banner ? "sm:col-span-2 xl:col-span-3" : ""
|
||||
}`}
|
||||
style={{ borderColor: color, background: banner ? `color-mix(in srgb, ${color} 22%, var(--color-surface))` : tintOf(color) }}
|
||||
>
|
||||
<div className="flex items-baseline gap-3">
|
||||
<h3 className="text-base font-bold text-link">
|
||||
<h3 className={`font-bold text-link ${banner ? "text-lg" : "text-base"}`}>
|
||||
<Link
|
||||
to={to}
|
||||
className="after:absolute after:inset-0 after:content-['']"
|
||||
|
|
@ -127,10 +133,33 @@ const QUICK_ADD = [
|
|||
{ to: "/admin/timeline/new", label: "New timeline entry" },
|
||||
];
|
||||
|
||||
/* A card per page (Pages → Page management), in its order: the
|
||||
front page's opens Front page, the others their page. */
|
||||
function usePageCards() {
|
||||
const [cards, setCards] = useState<any[]>([]);
|
||||
useEffect(() => {
|
||||
get("/admin/pages?limit=200", { ttl: 0 })
|
||||
.then((list) =>
|
||||
setCards(
|
||||
list.rows.map((page) => ({
|
||||
to: page.id === "home" ? "/admin/front_page" : `/admin/pages/${page.id}`,
|
||||
label: page.title,
|
||||
blurb: [page.path, page.is_hidden ? "Hidden" : null, page.is_disabled ? "Disabled" : null]
|
||||
.filter(Boolean)
|
||||
.join(" · "),
|
||||
})),
|
||||
),
|
||||
)
|
||||
.catch(() => setCards([]));
|
||||
}, []);
|
||||
return cards;
|
||||
}
|
||||
|
||||
export default function AdminHome() {
|
||||
const { user } = useAuth();
|
||||
const role = ROLE_LABELS[user?.role] ?? user?.role;
|
||||
useWideAdminPage();
|
||||
const pageCards = usePageCards();
|
||||
|
||||
return (
|
||||
<div className="grid gap-8 lg:grid-cols-[1fr_17rem] lg:items-start">
|
||||
|
|
@ -142,9 +171,16 @@ export default function AdminHome() {
|
|||
|
||||
{GROUPS.map(({ nav, color }) => (
|
||||
<CardBlock key={nav.label} title={nav.label} blurb={nav.blurb} color={color}>
|
||||
{visibleItems(nav.children, user).map((item) => (
|
||||
<NavCard key={item.to} item={item} color={color} />
|
||||
))}
|
||||
{visibleItems(nav.children, user)
|
||||
.filter((item) => !item.menuOnly)
|
||||
.flatMap((item) =>
|
||||
// Every page gets a card of its own after the banner.
|
||||
item.banner
|
||||
? [<NavCard key={item.to} item={item} color={color} />, ...pageCards.map((card) => (
|
||||
<NavCard key={card.to} item={card} color={color} />
|
||||
))]
|
||||
: [<NavCard key={item.to} item={item} color={color} />],
|
||||
)}
|
||||
</CardBlock>
|
||||
))}
|
||||
|
||||
|
|
|
|||
|
|
@ -418,7 +418,9 @@ export default function EntityEdit() {
|
|||
}
|
||||
}
|
||||
|
||||
const visible = (when) => !when || getPath(form, when.path) === when.value;
|
||||
// A gate is a field's value, or a test of the whole form (a page's
|
||||
// id deciding it has sections: sitePages.ts).
|
||||
const visible = (when) => !when || (when.test ? when.test(form) : getPath(form, when.path) === when.value);
|
||||
|
||||
const groups = manifest.groups.filter((group) => visible(group.when));
|
||||
const shownChildren = children.filter((child) => visible(child.when));
|
||||
|
|
|
|||
|
|
@ -120,49 +120,30 @@ export const PAGES_NAV = {
|
|||
label: "Pages",
|
||||
blurb: "What a page shows and in what order.",
|
||||
children: [
|
||||
// The header's and footer's links, page titles and hidden pages.
|
||||
// The banner on the admin home: every page, new ones, the menus.
|
||||
// Each page's own card follows it there (AdminHome.tsx).
|
||||
{
|
||||
to: "/admin/navigation",
|
||||
label: "Navigation",
|
||||
blurb: "The header's pages and buttons, the footer's links, each page's title and intro, and which pages are hidden.",
|
||||
to: "/admin/pages",
|
||||
label: "Page management",
|
||||
blurb: "Every page of the site: make new ones, change an address, title or intro, and hide or disable any of them. Then each page's sections.",
|
||||
banner: true,
|
||||
children: [
|
||||
{ to: "/admin/pages/new", label: "New page" },
|
||||
{ to: "/admin/navigation", label: "Menus (Navigation)" },
|
||||
],
|
||||
},
|
||||
// One record, not a list: the item opens it directly.
|
||||
// One record, not a list: the item opens it directly. On the
|
||||
// admin home, the Home page's own card goes here instead.
|
||||
{
|
||||
to: "/admin/front_page",
|
||||
label: "Front page",
|
||||
blurb: "The hero, its photos or livestream, and which bands the home page draws.",
|
||||
},
|
||||
// The site's own pages, in the header's order: each is its
|
||||
// sections, built in the editor (sitePages.ts).
|
||||
{
|
||||
to: "/admin/retreats_page",
|
||||
label: "Retreats",
|
||||
blurb: "Its sections: the event carousels and grids, and anything else written for it.",
|
||||
menuOnly: true,
|
||||
},
|
||||
{
|
||||
to: "/admin/community_page",
|
||||
label: "Community",
|
||||
blurb: "Its sections: the blog (and its pinned posts and feeds), groups map, regions and partners.",
|
||||
},
|
||||
{
|
||||
to: "/admin/resources_page",
|
||||
label: "Resources",
|
||||
blurb: "Its sections and their content.",
|
||||
},
|
||||
{
|
||||
to: "/admin/organization_page",
|
||||
label: "Organization",
|
||||
blurb: "Mission, vision and values, the leadership teams and volunteering, details and contact.",
|
||||
},
|
||||
{
|
||||
to: "/admin/history_page",
|
||||
label: "History",
|
||||
blurb: "Its sections: the timeline (its entries are under Data), and anything else.",
|
||||
},
|
||||
{
|
||||
to: "/admin/shop_page",
|
||||
label: "Shop",
|
||||
blurb: "The shop's intro page: its sections and the links out to the store.",
|
||||
to: "/admin/navigation",
|
||||
label: "Navigation",
|
||||
blurb: "The header's pages and buttons and the footer's links.",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
|
|
|||
23
src/pages/fixedPages.ts
Normal file
23
src/pages/fixedPages.ts
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
/* ═══════════════════════════════════════════════════════════════
|
||||
FIXED PAGES
|
||||
|
||||
The pages the site still draws in code, by their site_pages id
|
||||
(Pages → Page management can rename, move, hide or disable them,
|
||||
not delete them: server/src/admin-schema/sitePages.js,
|
||||
FIXED_PAGES). Every other page is its sections (SitePage.tsx).
|
||||
Each takes its title and intro from its row. The front page is
|
||||
the index route of its own (Home.tsx).
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
import { lazy, type ComponentType } from 'react'
|
||||
|
||||
export type PageText = { title: string; description: string | null }
|
||||
|
||||
export const FIXED_PAGES: Record<string, ComponentType<{ page: PageText }>> = {
|
||||
give: lazy(() => import('./Giving.tsx')),
|
||||
feedback: lazy(() => import('./Feedback.tsx')),
|
||||
request: lazy(() => import('./Request.tsx')),
|
||||
qr: lazy(() => import('./QrCodes.tsx')),
|
||||
privacy: lazy(() => import('./Privacy.tsx')),
|
||||
terms: lazy(() => import('./Terms.tsx')),
|
||||
}
|
||||
|
|
@ -186,7 +186,7 @@ export function TilePicker({
|
|||
|
||||
function LocationPicker({ page, section, onPageChange, onSectionChange }) {
|
||||
const sectionsOf = useNavSections();
|
||||
const { pages } = useSiteNav();
|
||||
const { pageLinks: pages } = useSiteNav();
|
||||
const sections = page === SITE_WIDE ? [] : sectionsOf(page);
|
||||
|
||||
return (
|
||||
|
|
@ -253,7 +253,7 @@ function describeLocation(page, section, sectionsOf: (path: string) => NavSectio
|
|||
|
||||
export default function FeedbackForm({ fixedType }: { fixedType?: string } = {}) {
|
||||
const sectionsOf = useNavSections();
|
||||
const { pages } = useSiteNav();
|
||||
const { pageLinks: pages } = useSiteNav();
|
||||
const request = fixedType === DATA_REQUEST.id;
|
||||
const [type, setType] = useState<any>(fixedType ?? null);
|
||||
const [page, setPage] = useState(SITE_WIDE);
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ type Group = { label?: string; choices: Choice[] }
|
|||
on the site rather than an anchor on one of them (Give, not
|
||||
Contact Us). */
|
||||
function mainPages(nav: ReturnType<typeof useSiteNav>): Choice[] {
|
||||
const pages = nav.pages.map((p) => ({ path: p.path, label: p.label }))
|
||||
const pages = nav.pageLinks.map((p) => ({ path: p.path, label: p.label }))
|
||||
const known = new Set(pages.map((p) => p.path))
|
||||
for (const action of nav.actions) {
|
||||
if (!action.path.startsWith('/') || action.path.includes('#') || known.has(action.path)) continue
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue