Video blocks get a Captions field and the hero a Video captions field, each a WebVTT upload drawn as <track kind="captions" default> on a video file. The media library takes .vtt (sniffed by its WEBVTT header, kept as is, always in /uploads/captions/) with its own tab. Newsletter parts leave the field out. nginx needs text/vtt in mime.types: docs/media-uploads.md, step 5. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
260 lines
9 KiB
TypeScript
260 lines
9 KiB
TypeScript
import { mediaUrl } from "../media.ts";
|
|
import { featuredCardsChild } from "./shared.ts";
|
|
import { PATH_ICONS } from "../../data/pathIcons.ts";
|
|
|
|
/* ── 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, the livestream and the featured video are
|
|
editable whatever the mode, so each can be ready before the
|
|
switch is flipped.
|
|
|
|
Section keys and stat sources are the CHECK lists on
|
|
front_page_sections and front_page_stats. The labels here are what the admin reads; the values are
|
|
what the page and the API key on. */
|
|
|
|
const FRONT_PAGE_SECTIONS = [
|
|
["countdown", "Event Countdown"],
|
|
["retreats", "Events Carousel (National Retreats)"],
|
|
["calendar", "Event Calendar"],
|
|
["stats", "Stats"],
|
|
["timeline", "Featured Timeline"],
|
|
["connect", "Connect Nav"],
|
|
["featured", "Featured Content"],
|
|
];
|
|
|
|
const STAT_SOURCES = [
|
|
["manual", "Print Value Field"],
|
|
["years_since", "Years Since Value"],
|
|
["regions", "Count: regions"],
|
|
["groups", "Count: groups"],
|
|
["partners", "Count: partners"],
|
|
["events_held", "Count: past events"],
|
|
["retreats_held", "Count: past retreats"],
|
|
["people", "Count: people in database"],
|
|
["awards_given", "Count: public awards given"],
|
|
];
|
|
|
|
export const frontPage = {
|
|
key: "front_page",
|
|
label: "Front page",
|
|
singular: "front page",
|
|
idLabel: "Page",
|
|
singleton: "home",
|
|
|
|
list: { columns: [], filters: [] },
|
|
|
|
groups: [
|
|
{
|
|
legend: "Hero - Primary Section",
|
|
note: "The first thing a visitor sees. Blank buttons don't render.",
|
|
fields: [
|
|
{
|
|
path: "hero_backdrop",
|
|
label: "Background",
|
|
widget: "select",
|
|
options: [
|
|
["brand", "Brand: animated color and the dove"],
|
|
["photos", "Photos: cycles through the photos below"],
|
|
],
|
|
blankLabel: "Default: brand",
|
|
help: "Photos with none added shows the brand background",
|
|
},
|
|
{
|
|
path: "hero_feature",
|
|
label: "Feature",
|
|
widget: "select",
|
|
options: [
|
|
["none", "Nothing: No additional overlay"],
|
|
["livestream", "Livestream: the stream, with a LIVE badge"],
|
|
["video", "Featured video: click to play"],
|
|
["event", "Featured event: an event's card"],
|
|
],
|
|
blankLabel: "Default: nothing",
|
|
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: "/page, #section-id or a full URL" },
|
|
{ path: "secondary_label", label: "Second button label" },
|
|
{ path: "secondary_url", label: "Second button link" },
|
|
],
|
|
},
|
|
{
|
|
legend: "Photos, livestream, video and event",
|
|
fields: [
|
|
{
|
|
path: "slide_seconds",
|
|
label: "Seconds per photo",
|
|
widget: "number",
|
|
help: "Photos Background. Set from 3 to 60 seconds",
|
|
},
|
|
{
|
|
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 },
|
|
{
|
|
path: "video_url",
|
|
label: "Featured video",
|
|
full: true,
|
|
help:
|
|
"A YouTube, Vimeo or Facebook link, or a video file: a filename in " +
|
|
"the uploads folder, or a link ending in .mp4 or .webm",
|
|
},
|
|
{
|
|
path: "video_captions",
|
|
label: "Video captions",
|
|
widget: "image",
|
|
folder: "captions",
|
|
resolve: mediaUrl,
|
|
full: true,
|
|
help: "A WebVTT (.vtt) file, for a video file; YouTube, Vimeo and Facebook show their own. Default: none.",
|
|
},
|
|
{ path: "video_title", label: "Video title", full: true, help: "Shown after \"Featured video\" above the headline" },
|
|
{
|
|
path: "hero_event_id",
|
|
label: "Featured event",
|
|
widget: "select",
|
|
optionsFrom: "events",
|
|
blankLabel: "Default: the countdown's event",
|
|
full: true,
|
|
help: "For the Featured event feature. A pinned event that's over falls back to the countdown's",
|
|
},
|
|
],
|
|
},
|
|
{
|
|
legend: "Countdown",
|
|
fields: [
|
|
{
|
|
path: "countdown_event_id",
|
|
label: "Count down to",
|
|
widget: "select",
|
|
optionsFrom: "events",
|
|
blankLabel: "Default: the next upcoming event",
|
|
help: "Leave blank almost always. A pinned event that's over falls back to the next one",
|
|
},
|
|
{
|
|
path: "countdown_scope_id",
|
|
label: "Only this scope",
|
|
widget: "select",
|
|
optionsFrom: "event_scopes",
|
|
blankLabel: "Default: any scope",
|
|
help: "Narrows the next upcoming event. Ignored when an event is pinned above",
|
|
},
|
|
{
|
|
path: "countdown_event_type",
|
|
label: "Only this type",
|
|
widget: "select",
|
|
options: [
|
|
["retreat", "Retreat"],
|
|
["class", "Class"],
|
|
["workshop", "Workshop"],
|
|
["meeting", "Meeting"],
|
|
["other", "Other"],
|
|
],
|
|
blankLabel: "Default: any type",
|
|
help: "Combines with the scope: National + Retreat counts down to the next national retreat",
|
|
},
|
|
],
|
|
},
|
|
],
|
|
|
|
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: "Default: the band's own name. Up to about 60 characters fit." },
|
|
{ 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, widget: "image", resolve: mediaUrl, full: true },
|
|
{ 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: "Number Source",
|
|
widget: "select",
|
|
options: STAT_SOURCES,
|
|
blankLabel: "Default: Print Value",
|
|
},
|
|
{ path: "value", label: "Value", help: "The number thats printed" },
|
|
{ path: "suffix", label: "Suffix", help: "+, k, % …" },
|
|
{ path: "note", label: "Note", full: true },
|
|
],
|
|
},
|
|
featuredCardsChild,
|
|
{
|
|
key: "paths",
|
|
label: "Connect Nav",
|
|
note: "Each path is a choice a visitor can pick; its actions appear when they do.",
|
|
addLabel: "Add path",
|
|
title: (row) => row.label || "New path",
|
|
blank: { label: "", icon: "", blurb: "" },
|
|
fields: [
|
|
{ path: "label", label: "Label", required: true, help: "eg. Attend, Serve…" },
|
|
{
|
|
path: "icon",
|
|
label: "Icon",
|
|
widget: "select",
|
|
options: PATH_ICONS,
|
|
blankLabel: "Default: a dot",
|
|
},
|
|
{ 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 },
|
|
],
|
|
},
|
|
],
|
|
},
|
|
],
|
|
};
|