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
|
|
@ -1,129 +0,0 @@
|
|||
/* ═══════════════════════════════════════════════════════════════
|
||||
HOME: /
|
||||
|
||||
Not a PageShell page: the front page has no title bar, and each
|
||||
band draws its own heading in its own style.
|
||||
|
||||
Driven by the admin's Front page editor through GET /front-page.
|
||||
The hero comes first, always. After it, the bands in the order
|
||||
the admin dragged them into, minus any they hid. Which component
|
||||
draws a band is decided here, in SECTIONS, keyed on the same list
|
||||
the CHECK on front_page_sections holds, the database says "retreats,
|
||||
third, called National Retreats"; this file says what a retreats
|
||||
band looks like.
|
||||
|
||||
A band with nothing to show draws nothing: the countdown with no
|
||||
upcoming event, the numbers with no numbers, the timeline with
|
||||
nothing featured, the pathfinder with no paths, the featured band
|
||||
with no cards.
|
||||
|
||||
If /front-page fails, the hero still draws (empty) and the error
|
||||
takes the place of the bands, with a retry. There's deliberately
|
||||
no default page to fall back to: it would look fine and hide a
|
||||
broken server.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
import { useEffect, type ReactNode } from 'react'
|
||||
|
||||
import HeroStage from './sections/home/HeroStage.tsx'
|
||||
import NextEventCountdown from './sections/home/NextEventCountdown.tsx'
|
||||
import RetreatsBand from './sections/home/RetreatsBand.tsx'
|
||||
import CalendarBand from './sections/home/CalendarBand.tsx'
|
||||
import StatsBand from './sections/home/StatsBand.tsx'
|
||||
import FeaturedBand from './sections/home/FeaturedBand.tsx'
|
||||
import FeaturedTimelineRail from './sections/home/FeaturedTimelineRail.tsx'
|
||||
import Pathfinder from './sections/home/Pathfinder.tsx'
|
||||
import { get } from '../lib/api.ts'
|
||||
import { documentTitle } from '../lib/site.ts'
|
||||
import {
|
||||
useFrontPage,
|
||||
type FrontPage,
|
||||
type FrontPageSection,
|
||||
type FrontPageSectionKey,
|
||||
} from '../lib/useFrontPage.ts'
|
||||
import { FRONT_PAGE_BANDS, bandShows } from '../lib/frontPageBands.ts'
|
||||
import './sections/home/home.css'
|
||||
|
||||
type BandProps = {
|
||||
page: FrontPage
|
||||
section: FrontPageSection
|
||||
title: string
|
||||
/** Position among the visible bands, 0 = straight after the hero. */
|
||||
position: number
|
||||
}
|
||||
|
||||
/* How each band renders. Its anchor, its heading when the admin
|
||||
gave it none, and whether it has anything to draw are
|
||||
frontPageBands.ts's, which the nav and footer read too; #connect is
|
||||
what the hero's second button points at out of the box. */
|
||||
const id = (key: FrontPageSectionKey) => FRONT_PAGE_BANDS[key].id ?? undefined
|
||||
|
||||
const BANDS: Record<FrontPageSectionKey, (props: BandProps) => ReactNode> = {
|
||||
countdown: ({ page, position }) => <NextEventCountdown event={page.countdown!} overlap={position === 0} />,
|
||||
retreats: ({ section, title }) => <RetreatsBand id={id('retreats')!} title={title} blurb={section.blurb} />,
|
||||
calendar: ({ section, title }) => <CalendarBand id={id('calendar')!} title={title} blurb={section.blurb} />,
|
||||
stats: ({ page, section, title }) => (
|
||||
<StatsBand id={id('stats')!} title={title} blurb={section.blurb} stats={page.stats} />
|
||||
),
|
||||
timeline: ({ section, title }) => <FeaturedTimelineRail id={id('timeline')!} title={title} blurb={section.blurb} />,
|
||||
connect: ({ page, section, title }) => (
|
||||
<Pathfinder id={id('connect')!} title={title} blurb={section.blurb} paths={page.paths} />
|
||||
),
|
||||
featured: ({ page, section, title }) => (
|
||||
<FeaturedBand id={id('featured')!} title={title} blurb={section.blurb} cards={page.featured} columns={page.featured_columns} />
|
||||
),
|
||||
}
|
||||
|
||||
export default function Home() {
|
||||
const { data: page, error, reload } = useFrontPage()
|
||||
|
||||
// The bands below ask for the timeline once the front page has said
|
||||
// which of them to show. Start it now, alongside it: api.ts hands the
|
||||
// same request to the band when it mounts, so the page waits for one
|
||||
// round trip instead of two. Events aren't fetched ahead: each band
|
||||
// asks the server for only its own, so there's no one list to start.
|
||||
useEffect(() => {
|
||||
get('/history').catch(() => {})
|
||||
}, [])
|
||||
|
||||
// Back to the site name when a visitor returns here from a page.
|
||||
useEffect(() => {
|
||||
document.title = documentTitle()
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<>
|
||||
<HeroStage hero={page?.hero ?? null} />
|
||||
|
||||
{error && (
|
||||
<section className="px-6 py-24 text-center">
|
||||
<p className="text-danger">Couldn’t load the front page. {error}</p>
|
||||
<button
|
||||
type="button"
|
||||
onClick={reload}
|
||||
className="mt-4 btn border border-brand px-5 py-2 text-link hover:bg-tint"
|
||||
>
|
||||
Try again
|
||||
</button>
|
||||
</section>
|
||||
)}
|
||||
|
||||
{page?.sections.map((section, position) => {
|
||||
const render = BANDS[section.section]
|
||||
// A key the CHECK has gained since this file was written, or a
|
||||
// band with nothing to draw.
|
||||
if (!render || !bandShows(page, section.section)) return null
|
||||
return (
|
||||
<div key={section.section}>
|
||||
{render({
|
||||
page,
|
||||
section,
|
||||
title: section.title || FRONT_PAGE_BANDS[section.section].title,
|
||||
position,
|
||||
})}
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
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 of its own (Home.tsx). No page there
|
||||
front page is the index route, SitePage too. No page there
|
||||
(or a hidden one, below viewer, which isn't sent): Not found.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,21 @@
|
|||
/* ═══════════════════════════════════════════════════════════════
|
||||
SITE PAGE: /community, /retreats, /resources, /organization,
|
||||
/history
|
||||
SITE PAGE: every page of the site, the front page included
|
||||
|
||||
Each is a list of sections built in the admin (Pages → the page,
|
||||
GET /site-pages/:id). A section is its heading, then its own
|
||||
content blocks, then its preset if it has one: a prebuilt part of
|
||||
the site, from PRESETS below. A section with neither says it's
|
||||
coming (ComingSoon) rather than showing a heading over nothing.
|
||||
Each is a list of sections built in the admin (Pages → Page
|
||||
management, GET /site-pages/:id). A section is its heading, then
|
||||
its own content blocks, then its preset if it has one: a prebuilt
|
||||
part of the site, from PRESETS below. A section with neither says
|
||||
it's coming (ComingSoon) rather than showing a heading over
|
||||
nothing. A band (the hero, the countdown, the numbers...:
|
||||
sections/Bands.tsx) draws itself, heading and all.
|
||||
|
||||
Two layouts:
|
||||
the front page no title bar: the bands one after another, as
|
||||
they always were, and any other section as a
|
||||
band of its own in the same style
|
||||
any other page PageShell: the title and intro, then each
|
||||
section under its heading (a band without one,
|
||||
since it draws its own)
|
||||
|
||||
The title and intro are its site_pages row's (Pages → Page
|
||||
management), which also give the search metadata.
|
||||
|
|
@ -16,6 +25,8 @@ import { useEffect } from 'react'
|
|||
import { useLocation } from 'react-router-dom'
|
||||
|
||||
import PageShell from '../components/PageShell.tsx'
|
||||
import { documentTitle } from '../lib/site.ts'
|
||||
import { bandFor, UNLISTED_PRESETS } from './sections/Bands.tsx'
|
||||
import ComingSoon from '../components/ComingSoon.tsx'
|
||||
import ContentBlocks from '../components/ContentBlocks.tsx'
|
||||
import { useSiteNav } from '../lib/useSiteNav.ts'
|
||||
|
|
@ -45,9 +56,10 @@ const PROGRAM_START_YEAR = 2000
|
|||
const NO_EVENT_REQUEST_SCOPES = ['national']
|
||||
|
||||
const PRESETS: Record<string, (section: SitePageSection) => Record<string, any>> = {
|
||||
community_blog: () => ({
|
||||
community_blog: (section) => ({
|
||||
Component: CommunityBlog,
|
||||
request: { type: 'blog', label: 'Write for the blog' },
|
||||
props: { blog: section.data },
|
||||
}),
|
||||
group_map: (section) => ({
|
||||
Component: OrgListMap,
|
||||
|
|
@ -103,12 +115,16 @@ const PRESETS: Record<string, (section: SitePageSection) => Record<string, any>>
|
|||
qr_maker: () => ({ Component: QrSection }),
|
||||
}
|
||||
|
||||
/* The front page's id (site_pages). */
|
||||
export const HOME = 'home'
|
||||
|
||||
export default function SitePage({ id }: { id: string }) {
|
||||
const { data: page, loading, error } = useSitePage(id)
|
||||
const { data: page, loading, error, reload } = 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 (id === HOME) return <FrontPage sections={page?.sections ?? null} error={error} reload={reload} />
|
||||
if (page) return <Sections title={PAGE.title} intro={PAGE.description ?? undefined} sections={page.sections} />
|
||||
|
||||
return (
|
||||
|
|
@ -136,8 +152,21 @@ function Sections({ title, intro, sections }: { title: string; intro?: string; s
|
|||
}, [hash])
|
||||
|
||||
const manifest = useSectionManifest(
|
||||
sections.map((section) => {
|
||||
sections.map((section, index) => {
|
||||
const accent = ACCENTS[section.accent ?? 'teal'] ?? BRAND
|
||||
// A band draws itself, heading and all: no heading of the shell's.
|
||||
const band = bandFor(section)
|
||||
if (band) {
|
||||
const node = band(section, { afterHero: sections[index - 1]?.preset === 'hero' })
|
||||
return {
|
||||
id: section.anchor,
|
||||
title: section.title,
|
||||
accent,
|
||||
bare: true,
|
||||
unlisted: UNLISTED_PRESETS.includes(section.preset ?? ''),
|
||||
Component: () => node,
|
||||
}
|
||||
}
|
||||
const preset = section.preset ? PRESETS[section.preset]?.(section) : null
|
||||
return {
|
||||
id: section.anchor,
|
||||
|
|
@ -155,6 +184,72 @@ function Sections({ title, intro, sections }: { title: string; intro?: string; s
|
|||
return <PageShell sideNav title={title} intro={intro} sections={manifest} />
|
||||
}
|
||||
|
||||
/* The front page: its bands one after another, under no title bar. A
|
||||
section that isn't a band is one in the same style: its heading,
|
||||
then its blocks and preset. If the page can't load, the error
|
||||
takes the bands' place, with a retry: there's deliberately no
|
||||
default page to fall back to, which would hide a broken server. */
|
||||
function FrontPage({ sections, error, reload }: { sections: SitePageSection[] | null; error: string | null; reload: () => void }) {
|
||||
const { hash } = useLocation()
|
||||
useEffect(() => {
|
||||
if (hash) jumpTo(decodeURIComponent(hash.slice(1)))
|
||||
}, [hash, sections])
|
||||
|
||||
// Back to the site name when a visitor returns here from a page.
|
||||
useEffect(() => {
|
||||
document.title = documentTitle()
|
||||
}, [])
|
||||
|
||||
if (error) {
|
||||
return (
|
||||
<section className="px-6 py-24 text-center">
|
||||
<p className="text-danger">Couldn’t load the front page. {error}</p>
|
||||
<button type="button" onClick={reload} className="mt-4 btn border border-brand px-5 py-2 text-link hover:bg-tint">
|
||||
Try again
|
||||
</button>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
if (!sections) return null
|
||||
|
||||
return (
|
||||
<>
|
||||
{sections.map((section, index) => {
|
||||
const band = bandFor(section)
|
||||
return (
|
||||
<div key={section.anchor}>
|
||||
{band ? band(section, { afterHero: sections[index - 1]?.preset === 'hero' }) : <PlainBand section={section} />}
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
/* A section on the front page that isn't a band: the bands' heading,
|
||||
then its blocks and preset as on any page. */
|
||||
function PlainBand({ section }: { section: SitePageSection }) {
|
||||
const accent = ACCENTS[section.accent ?? 'teal'] ?? BRAND
|
||||
const preset = section.preset ? PRESETS[section.preset]?.(section) : null
|
||||
const views = preset?.views
|
||||
return (
|
||||
<section id={section.anchor} className="py-24">
|
||||
<div className="mx-auto mb-12 max-w-6xl px-6">
|
||||
<h2 className="font-display text-4xl font-bold text-ink md:text-5xl">{section.title}</h2>
|
||||
{section.blurb && <p className="mt-3 max-w-xl text-lg text-muted">{section.blurb}</p>}
|
||||
</div>
|
||||
<SectionBody
|
||||
blocks={section.blocks}
|
||||
title={section.title}
|
||||
Preset={preset?.Component}
|
||||
presetProps={preset?.props}
|
||||
accent={accent}
|
||||
{...(views ? { view: views.default } : {})}
|
||||
/>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
function SectionBody({ blocks, title, Preset, presetProps, ...rest }: any) {
|
||||
if (!blocks.length && !Preset) return <ComingSoon what={`our ${title}`} />
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
74
src/pages/sections/Bands.tsx
Normal file
74
src/pages/sections/Bands.tsx
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
/* ═══════════════════════════════════════════════════════════════
|
||||
BANDS
|
||||
|
||||
The section types that draw a whole band of their own, heading
|
||||
included, in the front page's style (083: they were the front
|
||||
page's, and go on any page now): the hero, the countdown, the
|
||||
calendar, the numbers, featured cards, the pathfinder, and the
|
||||
timeline's rail of featured moments (a timeline section opened as
|
||||
'carousel'). SitePage.tsx draws them as they are on the front
|
||||
page, and without its own heading on any other page.
|
||||
|
||||
Each takes the section (its anchor, title, blurb) and what its
|
||||
type shows (`data`, server/src/sectionData.js). A band with
|
||||
nothing to show draws nothing: the countdown with no upcoming
|
||||
event, the numbers with no numbers, the pathfinder with no paths,
|
||||
featured cards with no cards.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
import type { ReactNode } from 'react'
|
||||
|
||||
import HeroStage from './home/HeroStage.tsx'
|
||||
import NextEventCountdown from './home/NextEventCountdown.tsx'
|
||||
import CalendarBand from './home/CalendarBand.tsx'
|
||||
import StatsBand from './home/StatsBand.tsx'
|
||||
import FeaturedBand from './home/FeaturedBand.tsx'
|
||||
import FeaturedTimelineRail from './home/FeaturedTimelineRail.tsx'
|
||||
import Pathfinder from './home/Pathfinder.tsx'
|
||||
import type { SitePageSection } from '../../lib/useSitePages.ts'
|
||||
import './home/home.css'
|
||||
|
||||
type BandContext = {
|
||||
/** The section before it is a hero: a countdown overlaps its foot. */
|
||||
afterHero: boolean
|
||||
}
|
||||
|
||||
type Band = (section: SitePageSection, context: BandContext) => ReactNode
|
||||
|
||||
const BANDS: Record<string, Band> = {
|
||||
hero: (section) => <HeroStage hero={section.data ?? null} />,
|
||||
countdown: (section, { afterHero }) =>
|
||||
section.data ? <NextEventCountdown event={section.data} overlap={afterHero} /> : null,
|
||||
calendar: (section) => <CalendarBand id={section.anchor} title={section.title} blurb={section.blurb} />,
|
||||
stats: (section) =>
|
||||
section.data?.length ? (
|
||||
<StatsBand id={section.anchor} title={section.title} blurb={section.blurb} stats={section.data} />
|
||||
) : null,
|
||||
featured_cards: (section) =>
|
||||
section.data?.cards?.length ? (
|
||||
<FeaturedBand
|
||||
id={section.anchor}
|
||||
title={section.title}
|
||||
blurb={section.blurb}
|
||||
cards={section.data.cards}
|
||||
columns={section.data.columns}
|
||||
/>
|
||||
) : null,
|
||||
connect: (section) =>
|
||||
section.data?.length ? (
|
||||
<Pathfinder id={section.anchor} title={section.title} blurb={section.blurb} paths={section.data} />
|
||||
) : null,
|
||||
}
|
||||
|
||||
/* The band a section draws, or undefined when its type isn't one
|
||||
(it's its blocks and preset, in a plain section). */
|
||||
export function bandFor(section: SitePageSection): Band | undefined {
|
||||
if (section.preset === 'timeline' && section.view === 'carousel') {
|
||||
return () => <FeaturedTimelineRail id={section.anchor} title={section.title} blurb={section.blurb} />
|
||||
}
|
||||
return section.preset ? BANDS[section.preset] : undefined
|
||||
}
|
||||
|
||||
/* Section types the menus don't list: the hero and the countdown are
|
||||
the top of a page, not places to jump to. */
|
||||
export const UNLISTED_PRESETS = ['hero', 'countdown']
|
||||
|
|
@ -21,7 +21,7 @@ import PlatformIcon from '../../components/PlatformIcon.tsx'
|
|||
import { blogHref } from '../../lib/hrefs.ts'
|
||||
import { mediaUrl } from '../../lib/media.ts'
|
||||
import { preview } from '../../lib/text.ts'
|
||||
import { postDate, useCommunityBlog, type BlogPostSummary } from '../../lib/useBlog.ts'
|
||||
import { postDate, type BlogPostSummary, type CommunityBlog as CommunityBlogData } from '../../lib/useBlog.ts'
|
||||
import HomeLink from './home/HomeLink.tsx'
|
||||
import { accentText, BRAND } from '../../lib/color.ts'
|
||||
import { useSmallImage } from '../../lib/useSmallImage.ts'
|
||||
|
|
@ -83,25 +83,10 @@ function Subheading({ children, accent }: { children: string; accent: string })
|
|||
)
|
||||
}
|
||||
|
||||
export default function CommunityBlog({ accent = BRAND }: { accent?: string }) {
|
||||
const { data: blog, loading, error, reload } = useCommunityBlog()
|
||||
|
||||
if (!blog) {
|
||||
return (
|
||||
<div className="mx-auto max-w-6xl px-6 text-muted">
|
||||
{loading ? (
|
||||
'Loading…'
|
||||
) : (
|
||||
<>
|
||||
Couldn’t load the blog. {error}{' '}
|
||||
<button type="button" onClick={reload} className="underline" style={{ color: accentText(accent) }}>
|
||||
Try again
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
/* Its posts come with the page (the section's data), so there's no
|
||||
loading here: the page has it or the page says it couldn't load. */
|
||||
export default function CommunityBlog({ blog, accent = BRAND }: { blog?: CommunityBlogData | null; accent?: string }) {
|
||||
if (!blog) return null
|
||||
|
||||
const { internal, external } = blog
|
||||
const hasInternal = internal.posts.length > 0
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
import FeaturedCards from '../../../components/FeaturedCards.tsx'
|
||||
import type { FeaturedCard, FeaturedColumns } from '../../../lib/useFrontPage.ts'
|
||||
import type { FeaturedCard, FeaturedColumns } from '../../../lib/sectionTypes.ts'
|
||||
|
||||
type FeaturedBandProps = {
|
||||
id: string
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ import { focusOnMount } from '../../../lib/focus.ts'
|
|||
import { useReadingMode } from '../../../lib/readingMode.ts'
|
||||
import { eventHref } from '../../../lib/hrefs.ts'
|
||||
import { seriesLabel } from '../../../lib/eventSeries.ts'
|
||||
import type { Hero, HeroBackdrop, HeroEvent, HeroFeature, HeroSlide } from '../../../lib/useFrontPage.ts'
|
||||
import type { Hero, HeroBackdrop, HeroEvent, HeroFeature, HeroSlide } from '../../../lib/sectionTypes.ts'
|
||||
|
||||
const DEEP = '#001011'
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import { Link } from 'react-router-dom'
|
|||
|
||||
import { eventHref } from '../../../lib/hrefs.ts'
|
||||
import { upcomingOccurrences } from '../../../lib/eventSeries.ts'
|
||||
import type { CountdownEvent } from '../../../lib/useFrontPage.ts'
|
||||
import type { CountdownEvent } from '../../../lib/sectionTypes.ts'
|
||||
import { withAlpha, accentText, BRAND } from '../../../lib/color.ts'
|
||||
import { useReadingMode } from '../../../lib/readingMode.ts'
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
The connect section as a question rather than a wall of forms:
|
||||
pick what you're here for, and that path's actions arrive. Paths
|
||||
and actions are the admin's (Front page → Find your way in);
|
||||
and actions are the admin's (a Connect nav section's paths, Pages → Page management);
|
||||
a path with no actions never reaches this component.
|
||||
|
||||
The choices are a real tablist: arrow keys move between them,
|
||||
|
|
@ -28,7 +28,7 @@ import { ArrowRight, ArrowUpRight, BookOpen, Dot, CalendarBlank, ChatCircle, Com
|
|||
import { useId, useRef, useState, type CSSProperties, type KeyboardEvent } from 'react'
|
||||
|
||||
import HomeLink, { isExternal } from './HomeLink.tsx'
|
||||
import type { FrontPagePath } from '../../../lib/useFrontPage.ts'
|
||||
import type { SectionPath } from '../../../lib/sectionTypes.ts'
|
||||
import { ACCENTS, accentText, readableOn } from '../../../lib/color.ts'
|
||||
import { useReadingMode } from '../../../lib/readingMode.ts'
|
||||
|
||||
|
|
@ -36,7 +36,7 @@ type PathfinderProps = {
|
|||
id: string
|
||||
title: string
|
||||
blurb?: string | null
|
||||
paths: FrontPagePath[]
|
||||
paths: SectionPath[]
|
||||
}
|
||||
|
||||
/* One accent per position, cycling. Paths are data; color is
|
||||
|
|
|
|||
|
|
@ -1,41 +0,0 @@
|
|||
/* ═══════════════════════════════════════════════════════════════
|
||||
RETREATS BAND
|
||||
|
||||
The National Retreats carousel from the Retreats page, as-is:
|
||||
same component, same filter, so an event edited in the admin
|
||||
shows up identically in both places. This file only adds the
|
||||
front page's heading and a way through to the full page.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
import { ArrowRight } from '@phosphor-icons/react'
|
||||
import { Link } from 'react-router-dom'
|
||||
|
||||
import EventListCards from '../EventList-Cards.tsx'
|
||||
import { accentText, BRAND } from '../../../lib/color.ts'
|
||||
|
||||
|
||||
type RetreatsBandProps = { id: string; title: string; blurb?: string | null }
|
||||
|
||||
export default function RetreatsBand({ id, title, blurb }: RetreatsBandProps) {
|
||||
return (
|
||||
<section id={id} className="overflow-hidden py-24">
|
||||
<div className="mx-auto mb-12 flex max-w-6xl flex-wrap items-end gap-6 px-6">
|
||||
<div>
|
||||
<h2 className="font-display text-4xl font-bold text-ink md:text-5xl">
|
||||
{title}
|
||||
</h2>
|
||||
{blurb && <p className="mt-3 max-w-xl text-lg text-muted">{blurb}</p>}
|
||||
</div>
|
||||
<Link
|
||||
to="/retreats"
|
||||
className="ml-auto btn border px-5 py-2 text-sm transition-colors hover:bg-surface"
|
||||
style={{ borderColor: BRAND, color: accentText(BRAND) }}
|
||||
>
|
||||
All retreats <ArrowRight size="1em" weight="bold" className="inline align-[-0.125em]" aria-hidden="true" />
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
<EventListCards scope="national" type="retreat" view="carousel" accent={BRAND} />
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
|
||||
import type { FrontPageStat } from '../../../lib/useFrontPage.ts'
|
||||
import type { SectionStat } from '../../../lib/sectionTypes.ts'
|
||||
import { prefersLessMotion } from '../../../lib/motion.ts'
|
||||
import { useReadingMode } from '../../../lib/readingMode.ts'
|
||||
|
||||
|
|
@ -22,7 +22,7 @@ type StatsBandProps = {
|
|||
id: string
|
||||
title: string
|
||||
blurb?: string | null
|
||||
stats: FrontPageStat[]
|
||||
stats: SectionStat[]
|
||||
}
|
||||
|
||||
export default function StatsBand({ id, title, blurb, stats }: StatsBandProps) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue