Replace the front page with an admin-driven home

The home page is rebuilt from scratch and configured from a new
Front page tab in the admin, backed by migration 017 and served by
GET /api/front-page.

Hero: brand, photos (crossfading slideshow with progress and pause)
or livestream (YouTube/Facebook/Vimeo embed with a LIVE badge),
switched by hand. After it, bands the admin can reorder, retitle or
hide: a countdown to the next event (series-aware), the National
Retreats carousel, a numbers band (typed in or counted from the
database), a horizontal rail of featured timeline entries, and a
"Find your way in" pathfinder replacing the old connect section.

The CRUD engine gains a `singleton` flag: the entity has one row,
made by its migration, and create and delete are refused. The list
screen opens that row and the editor drops the slug, back link and
delete. shapeSeries moves to shape.js so /front-page can share it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-09-25 05:37:42 -05:00
parent b4b013209b
commit 6a69084de2
25 changed files with 2299 additions and 494 deletions

View file

@ -941,7 +941,201 @@ const timeline = {
],
};
export const ADMIN_ENTITIES = { organizations, events, people, teams, awards, timeline };
/* ── Front page ──────────────────────────────────────────────────
One record (see the singleton note in server/src/admin-schema.js).
The groups are the hero; the collections below are the rest of
the page. Photos and the livestream are editable whatever the
mode, so either can be ready before the switch is flipped.
Section keys and stat sources are the CHECK lists in migration
017. The labels here are what the admin reads; the values are
what the page and the API key on. */
const FRONT_PAGE_SECTIONS = [
["countdown", "Countdown to the next event"],
["retreats", "National Retreats carousel"],
["stats", "Numbers"],
["timeline", "Featured timeline"],
["connect", "Find your way in"],
];
const STAT_SOURCES = [
["manual", "Typed in — shows Value"],
["years_since", "Years since — Value is the year"],
["regions", "Count: published regions"],
["chapters", "Count: published chapters"],
["partners", "Count: published partners"],
["events_held", "Count: past events"],
["retreats_held", "Count: past retreats"],
["people", "Count: published people"],
["awards_given", "Count: public awards given"],
];
const frontPage = {
key: "front_page",
label: "Front page",
singular: "front page",
idLabel: "Page",
singleton: "home",
list: { columns: [], filters: [] },
groups: [
{
legend: "Hero",
note: "The first thing a visitor sees. Blank buttons don't render.",
fields: [
{
path: "hero_mode",
label: "Mode",
widget: "select",
options: [
["brand", "Brand — animated colour, no media"],
["photos", "Photos — cycles through the photos below"],
["livestream", "Livestream — embeds the stream with a LIVE badge"],
],
blankLabel: "— brand —",
help: "Switch to Livestream when you go live, and back when you're done",
},
{ path: "eyebrow", label: "Eyebrow", help: "Small line above the headline" },
{ path: "headline", label: "Headline", full: true },
{ path: "subhead", label: "Subhead", widget: "textarea", full: true },
{ path: "primary_label", label: "Main button label" },
{ path: "primary_url", label: "Main button link", help: "/retreats, #connect or a full URL" },
{ path: "secondary_label", label: "Second button label" },
{ path: "secondary_url", label: "Second button link" },
],
},
{
legend: "Photos and livestream",
fields: [
{
path: "slide_seconds",
label: "Seconds per photo",
widget: "number",
help: "Photos mode. 3 to 60",
},
{
path: "livestream_url",
label: "Livestream link",
full: true,
help: "A YouTube, Facebook or Vimeo link, or any embed URL",
},
{ path: "livestream_title", label: "Livestream title", full: true },
],
},
{
legend: "Countdown",
fields: [
{
path: "countdown_event_id",
label: "Count down to",
widget: "select",
optionsFrom: "events",
blankLabel: "— the next upcoming event —",
help: "Leave blank almost always. A pinned event that's over falls back to the next one",
},
],
},
],
children: [
{
key: "sections",
label: "Page sections",
note: "Drag to reorder. Each section can appear once; leave one out to drop it.",
addLabel: "Add section",
title: (row) =>
FRONT_PAGE_SECTIONS.find(([key]) => key === row.section)?.[1] ?? "New section",
blank: { section: "", title: "", blurb: "" },
fields: [
{
path: "section",
label: "Section",
widget: "select",
options: FRONT_PAGE_SECTIONS,
required: true,
},
{ path: "title", label: "Heading", help: "Blank for the section's own" },
{ path: "blurb", label: "Blurb", full: true },
{ path: "is_hidden", label: "Hidden", widget: "checkbox", help: "Hide for now" },
],
},
{
key: "slides",
label: "Hero photos",
note: "Shown in Photos mode, in this order.",
addLabel: "Add photo",
title: (row) => row.caption || row.media || "New photo",
blank: { media: "", alt: "", caption: "" },
fields: [
{ path: "media", label: "Photo", required: true, help: "Filename in public/front-page/, or a URL" },
{ path: "alt", label: "Description", help: "For screen readers" },
{ path: "caption", label: "Caption", full: true },
{ path: "link_url", label: "Link", help: "Optional; makes the caption a link" },
],
},
{
key: "stats",
label: "Numbers",
note: "Counts update themselves. A typed-in number with no value is left out.",
addLabel: "Add number",
title: (row) => row.label || "New number",
blank: { label: "", source: "", value: "" },
fields: [
{ path: "label", label: "Label", required: true },
{
path: "source",
label: "Where it comes from",
widget: "select",
options: STAT_SOURCES,
blankLabel: "— typed in —",
},
{ path: "value", label: "Value", help: "Typed in: the number. Years since: the year" },
{ path: "suffix", label: "Suffix", help: "+, k, % …" },
{ path: "note", label: "Note", full: true },
],
},
{
key: "paths",
label: "Find your way in",
note: "Each path is a choice a visitor can pick; its actions appear when they do.",
addLabel: "Add path",
title: (row) => [row.icon, row.label].filter(Boolean).join(" ") || "New path",
blank: { label: "", icon: "", blurb: "" },
fields: [
{ path: "label", label: "Label", required: true, help: "Attend, Serve…" },
{ path: "icon", label: "Icon", help: "One emoji" },
{ path: "blurb", label: "Blurb", full: true },
],
children: [
{
key: "actions",
label: "Actions",
addLabel: "Add action",
title: (row) => row.label || "New action",
blank: { label: "", url: "" },
fields: [
{ path: "label", label: "Label", required: true },
{ path: "url", label: "Link", required: true },
{ path: "description", label: "Description", full: true },
],
},
],
},
],
};
export const ADMIN_ENTITIES = {
organizations,
events,
people,
teams,
awards,
timeline,
front_page: frontPage,
};
export function slugify(value) {
return String(value ?? "")