Page management, step 3: section types with their own settings; the front page as sections
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>
This commit is contained in:
parent
f33c0008fe
commit
f1a0b06ac2
46 changed files with 1525 additions and 1339 deletions
|
|
@ -133,8 +133,7 @@ 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. */
|
||||
/* A card per page (Pages → Page management), in its order. */
|
||||
function usePageCards() {
|
||||
const [cards, setCards] = useState<any[]>([]);
|
||||
useEffect(() => {
|
||||
|
|
@ -142,7 +141,7 @@ function usePageCards() {
|
|||
.then((list) =>
|
||||
setCards(
|
||||
list.rows.map((page) => ({
|
||||
to: page.id === "home" ? "/admin/front_page" : `/admin/pages/${page.id}`,
|
||||
to: `/admin/pages/${page.id}`,
|
||||
label: page.title,
|
||||
blurb: [page.path, page.is_hidden ? "Hidden" : null, page.is_disabled ? "Disabled" : null]
|
||||
.filter(Boolean)
|
||||
|
|
@ -172,7 +171,6 @@ export default function AdminHome() {
|
|||
{GROUPS.map(({ nav, color }) => (
|
||||
<CardBlock key={nav.label} title={nav.label} blurb={nav.blurb} 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
|
||||
|
|
|
|||
|
|
@ -35,7 +35,8 @@ import { blocksChild, BLOCK_TYPES } from '../../lib/adminSchema/shared.ts'
|
|||
import { Repeater } from '../../components/admin/fields.tsx'
|
||||
import NewsletterRecipients from '../../components/admin/NewsletterRecipients.tsx'
|
||||
import { useEvents } from '../../lib/eventData.ts'
|
||||
import { useFrontPage, type FeaturedCard } from '../../lib/useFrontPage.ts'
|
||||
import type { FeaturedCard } from '../../lib/sectionTypes.ts'
|
||||
import { useSitePage } from '../../lib/useSitePages.ts'
|
||||
import type { BlogPostRecord } from '../../lib/useBlog.ts'
|
||||
import { blogHref, eventHref, refHref } from '../../lib/hrefs.ts'
|
||||
import { mediaUrl } from '../../lib/media.ts'
|
||||
|
|
@ -274,8 +275,11 @@ export default function AdminNewsletter() {
|
|||
const [message, setMessage] = useState<{ tone: 'ok' | 'error'; text: string } | null>(null)
|
||||
|
||||
const { events, loading: eventsLoading } = useEvents({ status: 'upcoming' })
|
||||
const { data: frontPage } = useFrontPage()
|
||||
const cards = frontPage?.featured ?? []
|
||||
// The front page's featured cards: its featured card sections'.
|
||||
const { data: frontPage } = useSitePage('home')
|
||||
const cards: FeaturedCard[] = (frontPage?.sections ?? [])
|
||||
.filter((section) => section.preset === 'featured_cards')
|
||||
.flatMap((section) => section.data?.cards ?? [])
|
||||
|
||||
useEffect(() => {
|
||||
get('/admin/blog_posts?is_published=1&is_listed=1&limit=200', { ttl: 0 })
|
||||
|
|
|
|||
|
|
@ -128,18 +128,11 @@ export const PAGES_NAV = {
|
|||
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/home", label: "Front page" },
|
||||
{ to: "/admin/pages/new", label: "New page" },
|
||||
{ to: "/admin/navigation", label: "Menus (Navigation)" },
|
||||
],
|
||||
},
|
||||
// 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.",
|
||||
menuOnly: true,
|
||||
},
|
||||
{
|
||||
to: "/admin/navigation",
|
||||
label: "Navigation",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue