- media_dark (102): shown in place of the image while the site is dark, the block's alt text and caption shared - Present: pictures beside text centered on the slide's height, and a section of only pictures centered both ways Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
928 lines
34 KiB
TypeScript
928 lines
34 KiB
TypeScript
/* Field sets, groups and child collections shared by several entity
|
|
manifests (adminSchema.ts has the overview). */
|
|
|
|
import { preview } from "../text.ts";
|
|
import { PLATFORMS } from "../platforms.ts";
|
|
import { FORMATTING_HELP } from "../../components/InlineText.tsx";
|
|
import { mediaUrl } from "../media.ts";
|
|
|
|
export const PLACE_FIELDS = [
|
|
{ path: "venue", label: "Venue" },
|
|
{ path: "address", label: "Address", full: true },
|
|
{ path: "locality", label: "City" },
|
|
{ path: "state_code", label: "State", help: "Two letters, US only" },
|
|
{ path: "country", label: "Country", help: "Defaults to US" },
|
|
{ path: "location_label", label: "Display location", help: "Overrides the line built from city and state" },
|
|
{ path: "latitude", label: "Latitude", widget: "number" },
|
|
{ path: "longitude", label: "Longitude", widget: "number" },
|
|
];
|
|
|
|
export const PUBLISHED_FIELD = { path: "is_published", label: "Published", widget: "checkbox" };
|
|
|
|
/* Only means anything on a published record. Unticked, its own page
|
|
still works but the site's lists, counts and the QR page leave it
|
|
out. See 027_listed.sql for exactly which. */
|
|
export const LISTED_FIELD = {
|
|
path: "is_listed",
|
|
label: "Listed",
|
|
widget: "checkbox",
|
|
help: "Unticked: only reachable by its link",
|
|
};
|
|
|
|
/* For entities whose lists the site orders by hand. Events sort by
|
|
date and people by sort_name, so they take the first two alone. */
|
|
export const PUBLISH_FIELDS = [
|
|
PUBLISHED_FIELD,
|
|
LISTED_FIELD,
|
|
{ path: "sort_order", label: "Sort order", widget: "number" },
|
|
];
|
|
|
|
/* The parts of an affiliation that read the same from either end:
|
|
the person's list of roles, and the team's list of members. */
|
|
export const AFFILIATION_ROLE_FIELDS = [
|
|
{ path: "title", label: "Title", help: "eg. Board Chair, Team Lead" },
|
|
{
|
|
path: "role",
|
|
label: "Role",
|
|
widget: "select",
|
|
options: ["lead", "board", "staff", "volunteer", "member"],
|
|
},
|
|
{ path: "is_owner", label: "Owner", widget: "checkbox", help: "Listed first (can be more than one)" },
|
|
{ path: "started_on", label: "Started", widget: "date" },
|
|
{ path: "ended_on", label: "Ended", widget: "date", help: "Blank means current" },
|
|
{ path: "is_public", label: "Public", widget: "checkbox" },
|
|
];
|
|
|
|
/* The timeline panel that appears on an event or organization once the
|
|
box is ticked. Paths are prefixed with the extension key, exactly as
|
|
'region.scope' and 'private.notes' are.
|
|
|
|
Everything here is an override. Left blank, the history page falls
|
|
back to the record's own title, date and logo through v_timeline,
|
|
which is the point of referencing rather than copying. */
|
|
export const timelineExtensionFields = (noun) => [
|
|
{
|
|
path: "timeline.occurred_on",
|
|
label: "Date on the timeline",
|
|
help: `Blank uses the ${noun}'s own date. Partial dates are fine: 2012, 2012-06`,
|
|
},
|
|
{
|
|
path: "timeline.precision",
|
|
label: "Date precision",
|
|
widget: "select",
|
|
options: ["year", "month", "day"],
|
|
help: "How much of the date to trust. 'year' files it under 'Elsewhere in 2012'",
|
|
},
|
|
{
|
|
path: "timeline.title",
|
|
label: "Title override",
|
|
full: true,
|
|
help: `Blank uses the ${noun}'s name`,
|
|
},
|
|
{
|
|
path: "timeline.blurb",
|
|
label: "Blurb override",
|
|
widget: "textarea",
|
|
full: true,
|
|
help: `Blank uses the ${noun}'s tagline`,
|
|
},
|
|
{ path: "timeline.meta", label: "Secondary line", help: "Region, venue, recipient" },
|
|
{
|
|
path: "timeline.link_url",
|
|
label: "Link override",
|
|
help: `Blank links to the ${noun}'s own page`,
|
|
},
|
|
{
|
|
path: "timeline.is_featured",
|
|
label: "Featured",
|
|
widget: "checkbox",
|
|
help: "Shown large, above the month list for its year",
|
|
},
|
|
{ path: "timeline.is_published", label: "Visible on the history page", widget: "checkbox" },
|
|
{ path: "timeline.sort_order", label: "Sort order", widget: "number" },
|
|
];
|
|
|
|
/* The checkbox itself, plus the panel it gates. One entry in `groups`. */
|
|
export const timelineGroup = (noun) => ({
|
|
legend: "Timeline",
|
|
note:
|
|
`Adds this ${noun} to the history page. Nothing is copied, the entry ` +
|
|
`reads this record, so editing it here updates the timeline too.`,
|
|
fields: [
|
|
{
|
|
path: "in_timeline",
|
|
label: "On the timeline",
|
|
widget: "checkbox",
|
|
help: "Show this on the history page",
|
|
},
|
|
],
|
|
});
|
|
|
|
export const timelineDetailGroup = (noun) => ({
|
|
legend: "Timeline entry",
|
|
when: { path: "in_timeline", value: 1 },
|
|
note: "Every field here is optional. Blank means \u201cuse the record's own value\u201d.",
|
|
fields: timelineExtensionFields(noun),
|
|
});
|
|
|
|
/* Featured cards (030_featured_cards.sql), a front page collection
|
|
now and the Community blog's next, so it's written once. Fields
|
|
show by kind; switching kind clears the ones that stop applying
|
|
(see `when` in fields.tsx). */
|
|
export const FEATURED_KINDS = [
|
|
["record", "A page on this site (event, org, person…)"],
|
|
["link", "A link (article, post, any URL)"],
|
|
["video", "A video (YouTube, Vimeo, Facebook)"],
|
|
];
|
|
|
|
export const featuredCardsChild = {
|
|
key: "featured_cards",
|
|
label: "Featured cards",
|
|
note: "Shown by the Featured Content section, in this order.",
|
|
addLabel: "Add card",
|
|
title: (row, options) =>
|
|
row.title ||
|
|
options?.record_refs?.find((o) => o.kind === row.ref_kind && o.id === row.ref_id)?.label ||
|
|
row.url ||
|
|
"New card",
|
|
blank: { kind: "", ref_kind: "", ref_id: "", url: "", title: "" },
|
|
fields: [
|
|
{
|
|
path: "kind",
|
|
label: "Card type",
|
|
widget: "select",
|
|
options: FEATURED_KINDS,
|
|
required: true,
|
|
},
|
|
{
|
|
path: "ref_kind",
|
|
label: "Record type",
|
|
widget: "select",
|
|
options: ["event", "organization", "person", "team", "award"],
|
|
required: true,
|
|
when: { path: "kind", value: "record" },
|
|
},
|
|
{
|
|
path: "ref_id",
|
|
label: "Record",
|
|
widget: "select",
|
|
optionsFrom: "record_refs",
|
|
filterBy: (option, row) => option.kind === row.ref_kind,
|
|
required: true,
|
|
when: { path: "kind", value: "record" },
|
|
help: "Its title, picture and link fill the card. Anything typed below overrides them.",
|
|
},
|
|
{
|
|
path: "url",
|
|
label: "URL",
|
|
widget: "linkPreview",
|
|
previewWhen: { path: "kind", value: "link" },
|
|
required: true,
|
|
full: true,
|
|
when: { path: "kind", value: ["link", "video"] },
|
|
},
|
|
{ path: "eyebrow", label: "Label", help: "Small text above the title, eg. Article, Watch" },
|
|
{ path: "title", label: "Title" },
|
|
{ path: "blurb", label: "Blurb", widget: "textarea", full: true },
|
|
{
|
|
path: "image",
|
|
label: "Image",
|
|
widget: "image",
|
|
crop: "free",
|
|
resolve: mediaUrl,
|
|
full: true,
|
|
frameFrom: "url",
|
|
frameWhen: { path: "kind", value: "video" },
|
|
help: "Default: the record's own picture, or for a YouTube video, its thumbnail. For a video, Frame at takes a still from it instead.",
|
|
},
|
|
],
|
|
};
|
|
|
|
/* An organization's or event's tags (070_tags.sql): Online,
|
|
In-Person and whatever else Data → Tags holds. */
|
|
export const tagsChild = {
|
|
key: "tags",
|
|
label: "Tags",
|
|
note: "Shown on its page, eg. Online or In-Person. Tags are made under Data → Tags.",
|
|
addLabel: "Add tag",
|
|
title: (row, options) => options?.tags?.find((t) => t.id === row.tag_id)?.label ?? "New tag",
|
|
blank: { tag_id: "" },
|
|
fields: [{ path: "tag_id", label: "Tag", widget: "select", optionsFrom: "tags", required: true }],
|
|
};
|
|
|
|
/* The two collections every entity carries. */
|
|
export const linksChild = {
|
|
key: "links",
|
|
label: "Links and socials",
|
|
addLabel: "Add link",
|
|
title: (row) => row.label || row.url || "New link",
|
|
blank: { kind: "action", label: "", url: "", is_primary: 0 },
|
|
fields: [
|
|
{
|
|
path: "kind",
|
|
label: "Kind",
|
|
widget: "select",
|
|
options: ["action", "social", "website", "email"],
|
|
},
|
|
{
|
|
path: "platform",
|
|
label: "Platform",
|
|
widget: "select",
|
|
options: PLATFORMS.map((platform) => [platform.id, platform.label]),
|
|
blankLabel: "Default: no icon",
|
|
help: "Shows the platform's icon on the button.",
|
|
},
|
|
{ path: "label", label: "Label", required: true },
|
|
{ path: "url", label: "URL", required: true, full: true },
|
|
{ path: "is_primary", label: "Primary", widget: "checkbox" },
|
|
],
|
|
};
|
|
|
|
/* Hosts. One row is one host, ordered, and each is either an
|
|
organization or a person, never both, which the CHECK on
|
|
event_hosts enforces and this form can only ask nicely about.
|
|
|
|
The first row supplies the logo and color when the event sets
|
|
neither, so the order here is data rather than a display choice.
|
|
|
|
An organization host can name a team (any organization's) to show
|
|
in its place: the event page reads "Hosted by" that team, linked
|
|
to its page, while the logo and color still come from the
|
|
organization.
|
|
A person supplies neither: there is no color on a person and a
|
|
headshot is not a logo, so a person-hosted event with no color
|
|
of its own falls through to the section default. */
|
|
export const hostsChild = {
|
|
key: "event_hosts",
|
|
label: "Hosts",
|
|
addLabel: "Add host",
|
|
title: (row, options) =>
|
|
options?.organizations?.find((o) => o.id === row.org_id)?.label ??
|
|
options?.people?.find((p) => p.id === row.person_id)?.label ??
|
|
"New host",
|
|
blank: { org_id: "", person_id: "" },
|
|
fields: [
|
|
{
|
|
path: "org_id",
|
|
label: "Organization",
|
|
widget: "select",
|
|
optionsFrom: "organizations",
|
|
blankLabel: "Default: none",
|
|
help: "Host Organization"
|
|
},
|
|
{
|
|
path: "person_id",
|
|
label: "Person",
|
|
widget: "select",
|
|
optionsFrom: "people",
|
|
blankLabel: "Default: none",
|
|
help: "Use if the host is an individual, choose between person and org host, not both.",
|
|
},
|
|
{
|
|
path: "team_id",
|
|
label: "Shown as team",
|
|
widget: "select",
|
|
optionsFrom: "teams",
|
|
blankLabel: "Default: the organization",
|
|
help: "Optional: a team to name as the host instead, eg. the retreat team. Any organization's team.",
|
|
when: { path: "org_id", filled: true },
|
|
},
|
|
],
|
|
};
|
|
|
|
/* Content blocks. The type decides which fields appear (`when`),
|
|
what the text box is for (`help` as a function), and whether the
|
|
block has items; the preview under each open block is the site's
|
|
own renderer. Types and what they read: ContentBlocks.tsx. */
|
|
export const BLOCK_TYPES = [
|
|
["paragraph", "Paragraph", "Body text. Formatting: " + FORMATTING_HELP],
|
|
["heading", "Heading", "A section heading."],
|
|
["subheading", "Subheading", "A smaller heading under a heading."],
|
|
["callout", "Callout", "A note or announcement in a tinted box. Formatting: " + FORMATTING_HELP],
|
|
["quote", "Quote", "A quotation, with who said it. Formatting: " + FORMATTING_HELP],
|
|
["list", "List", "Bulleted items, each optionally linked, with an optional detail."],
|
|
["links", "Link buttons", "A row of outlined buttons, one per item."],
|
|
["button", "Button", "One filled call-to-action button, eg. Register, Donate."],
|
|
["image", "Image", "A picture, with alt text and an optional caption and link."],
|
|
["video", "Video", "A YouTube, Vimeo or Facebook video, or a video file, played in place."],
|
|
["schedule", "Schedule", "Entries in one tab per day, each folding out for more. The text is an optional intro."],
|
|
["table", "Table", "A grid of text, eg. a comparison chart: one row per line, cells split by |, the first row the header."],
|
|
["cards", "Link cards", "Cards with a picture, title and description, each a link to a page or a file, like a link shared in a chat; up to three in a row. Paste a link and press Fetch preview, or Choose a file."],
|
|
["people", "People", "People tiles: a team's members, or people picked one by one as items (each with their title), or both."],
|
|
["map", "Map", "A venue's map with its locations marked and listed beside it (Data → Venues). A schedule on the same page with the same venue links its locations here."],
|
|
["events", "Events", "Event cards, eg. the workshops on offer: picture, type, date, title and card text, each linking to the event's page."],
|
|
["organizations", "Organizations", "Organization cards, as on the Partners page: picked one by one as items, or every listed one of a kind."],
|
|
["divider", "Divider", "A thin line between parts."],
|
|
];
|
|
|
|
/* An item field that only a schedule's entries have. */
|
|
export const SCHEDULE_ENTRY = { scope: "parent", path: "type", value: "schedule" };
|
|
/* A schedule entry's kinds (086); blank is a normal entry. */
|
|
export const SCHEDULE_KINDS = [
|
|
["block", "Block, with sub-items"],
|
|
["break", "Break or meal"],
|
|
["heading", "Heading"],
|
|
];
|
|
/* Picked times and the typed override, on an entry and a sub-item. */
|
|
const scheduleTimeFields = (when?: any) => [
|
|
{ path: "start_time", label: "Starts", widget: "time", when },
|
|
{ path: "end_time", label: "Ends", widget: "time", help: "Optional", when },
|
|
{
|
|
path: "time",
|
|
label: "Display as",
|
|
help: "Default: the times picked, eg. 7:00pm or 9:00 to 10:30am. Type here to show something else, eg. After dinner.",
|
|
when,
|
|
},
|
|
];
|
|
/* Item fields for a link card, and for every other kind of item. */
|
|
export const CARD_ITEM = { scope: "parent", path: "type", value: "cards" };
|
|
export const NOT_CARD_ITEM = { scope: "parent", path: "type", value: ["list", "links", "schedule"] };
|
|
/* An item that's a person on a people block. */
|
|
export const PEOPLE_ITEM = { scope: "parent", path: "type", value: "people" };
|
|
/* An item that's an event card on an events block (088). */
|
|
export const EVENT_ITEM = { scope: "parent", path: "type", value: "events" };
|
|
/* An item that's an organization on an organizations block (093). */
|
|
export const ORG_ITEM = { scope: "parent", path: "type", value: "organizations" };
|
|
|
|
/* A venues option (the /admin/options query) as a Venue: its
|
|
locations arrive as JSON. */
|
|
export const venueFromOption = (option) =>
|
|
option
|
|
? {
|
|
id: option.id,
|
|
name: option.label,
|
|
map_image: option.map_image,
|
|
map_alt: option.map_alt,
|
|
locations: JSON.parse(option.locations || "[]"),
|
|
}
|
|
: null;
|
|
|
|
/* A schedule entry's or sub-item's workshop and place (088). */
|
|
const eventField = (when?: any) => ({
|
|
path: "event_id",
|
|
label: "Event",
|
|
widget: "select",
|
|
optionsFrom: "events",
|
|
fills: "text",
|
|
blankLabel: "Default: none",
|
|
help: "Optional: a workshop or other event this is. Its title fills an empty Title; its card text, photo, person host and page fill what's left blank here.",
|
|
when,
|
|
});
|
|
const placeField = (when?: any) => ({
|
|
path: "location_key",
|
|
label: "Map location",
|
|
widget: "select",
|
|
optionsFrom: "mapLocations",
|
|
blankLabel: "Default: none",
|
|
help: "One of the block's venue's locations (the block's Venue, Data → Venues). Links to the map on the page and fills an empty Location.",
|
|
when,
|
|
});
|
|
|
|
export const blockTypeLabel = (type) => BLOCK_TYPES.find(([value]) => value === type)?.[1] ?? type;
|
|
|
|
export const TEXT_TYPES = ["paragraph", "heading", "subheading", "callout", "quote", "button", "image", "video", "schedule", "table"];
|
|
|
|
export const TEXT_HELP = {
|
|
paragraph: FORMATTING_HELP,
|
|
callout: FORMATTING_HELP,
|
|
quote: FORMATTING_HELP,
|
|
button: "The button's label, eg. Register now",
|
|
image: "Caption shown under the image. Optional.",
|
|
video: "Caption shown under the video. Optional.",
|
|
schedule: "Optional intro above the tabs. " + FORMATTING_HELP,
|
|
table:
|
|
"One row per line; cells split by |. The first row is the header. eg. Platform | Price | Best for. " +
|
|
"Cells take the same formatting as a paragraph. A | inside a cell is written \|.",
|
|
};
|
|
|
|
export const TEXT_LABEL = { button: "Label", image: "Caption", video: "Caption", schedule: "Intro", table: "Rows" };
|
|
|
|
export const HREF_HELP = {
|
|
paragraph: "Optional. Makes the whole paragraph one link. For a link inside the text, use [text](url).",
|
|
button: "Where the button goes, eg. /give or https://…",
|
|
image: "Optional. Makes the image a link.",
|
|
video: "The video's page, eg. https://www.youtube.com/watch?v=…, or a video file",
|
|
};
|
|
|
|
/* Rotating words (084): text typed as {Next|Now|Rising} cycles
|
|
through its choices. These pick how, for a block or a hero; Site
|
|
settings → Animated words holds the defaults. */
|
|
export const WORD_MOTIONS = [
|
|
["slide", "Slide"],
|
|
["flip", "Flip, like a card"],
|
|
["fade", "Fade"],
|
|
["type", "Type, letter by letter"],
|
|
["mirror", "Mirror, turning round"],
|
|
];
|
|
export const WORD_DIRECTIONS = [
|
|
["bottom", "From the bottom"],
|
|
["top", "From the top"],
|
|
];
|
|
export const WORD_HELP = "Type choices in braces to rotate them, eg. {Next|Now|Rising} Generation of {Unity|New Thought}.";
|
|
|
|
/* The three fields, under `prefix` (eg. "hero."), shown `when`. */
|
|
export const wordFields = (prefix: string, label: string, when?: any) => [
|
|
{
|
|
path: `${prefix}word_motion`,
|
|
label: label ? `${label}rotating words` : "Rotating words",
|
|
widget: "select",
|
|
options: WORD_MOTIONS,
|
|
blankLabel: "Default: the site's (Site settings → Animated words)",
|
|
help: WORD_HELP,
|
|
when,
|
|
},
|
|
{
|
|
path: `${prefix}word_direction`,
|
|
label: label ? `${label}words come in` : "Words come in",
|
|
widget: "select",
|
|
options: WORD_DIRECTIONS,
|
|
blankLabel: "Default: the site's",
|
|
help: "For Slide and Flip",
|
|
when,
|
|
},
|
|
{ path: `${prefix}word_seconds`, label: label ? `${label}seconds per word` : "Seconds per word", widget: "number", help: "1 to 20. Default: the site's", when },
|
|
];
|
|
|
|
/* An entry's or sub-item's tags (087): the block's, lent by
|
|
blocksChild. */
|
|
const TAGS_FIELD = {
|
|
path: "tags",
|
|
label: "Tags",
|
|
widget: "checklist",
|
|
optionsFrom: "scheduleTags",
|
|
full: true,
|
|
emptyNote: "No tags yet: add them under the block's Tags.",
|
|
};
|
|
|
|
/* A block entry's sub-item (086): an entry's fields, under its
|
|
block's day. */
|
|
const SUB_ITEM_FIELDS = [
|
|
...scheduleTimeFields(),
|
|
eventField(),
|
|
{ path: "text", label: "Title", required: true },
|
|
placeField(),
|
|
{ path: "location", label: "Location", help: "eg. Room B. Default: the map location's name" },
|
|
{
|
|
path: "person_id",
|
|
label: "Person",
|
|
widget: "select",
|
|
optionsFrom: "people",
|
|
blankLabel: "Default: none",
|
|
help: "Who hosts or speaks: shown with their photo, linked to their page",
|
|
},
|
|
{ path: "detail", label: "Detail", help: "A line under the title" },
|
|
{ path: "url", label: "URL", help: "Optional: makes the title a link", files: true },
|
|
{ path: "description", label: "More", widget: "textarea", full: true, help: "Shown when it's folded out. " + FORMATTING_HELP },
|
|
{ path: "media", label: "Graphic", widget: "image", crop: "free", resolve: mediaUrl, full: true, help: "Optional, in the fold-out" },
|
|
{
|
|
path: "media_alt",
|
|
label: "Graphic description",
|
|
full: true,
|
|
help: "For screen readers: what the graphic shows. Default: skipped as decoration.",
|
|
},
|
|
{ path: "map", label: "Map", full: true, help: "Optional: a place or address for a Google map" },
|
|
{
|
|
path: "map_image",
|
|
label: "Map image",
|
|
widget: "image",
|
|
crop: "free",
|
|
resolve: mediaUrl,
|
|
full: true,
|
|
help: "Optional: your own map, shown in place of the Google map and as a slide when presented",
|
|
},
|
|
{ path: "featured", label: "Featured", widget: "checkbox", help: "Makes it stand out" },
|
|
TAGS_FIELD,
|
|
];
|
|
|
|
/* An event's blocks' presentation fields (095), EventPresent.tsx. */
|
|
export const PRESENT_BLOCK_FIELDS = [
|
|
{
|
|
path: "present_show",
|
|
label: "Shown",
|
|
widget: "select",
|
|
options: [
|
|
["page", "Only on the page"],
|
|
["presentation", "Only in the presentation"],
|
|
],
|
|
blankLabel: "Default: on the page and in the presentation",
|
|
help: "Only in the presentation keeps it off the page, eg. a welcome line for the screen.",
|
|
},
|
|
{
|
|
path: "present_text",
|
|
label: "Presentation text",
|
|
widget: "textarea",
|
|
full: true,
|
|
when: { path: "type", value: TEXT_TYPES },
|
|
help: "Shown in place of the text when the page is presented, eg. a shorter heading. Default: the text.",
|
|
},
|
|
{
|
|
path: "present_map_split",
|
|
label: "A slide per section",
|
|
widget: "checkbox",
|
|
help: "Presented: each of the sections below gets its own map slide with only its locations. Default: one map slide with every location.",
|
|
when: { path: "type", value: "map" },
|
|
},
|
|
{
|
|
path: "present_map_no_list",
|
|
label: "Map only",
|
|
widget: "checkbox",
|
|
help: "Presented: no locations list beside the map, so the map fills the slide.",
|
|
when: { path: "type", value: "map" },
|
|
},
|
|
{
|
|
path: "present_map_no_details",
|
|
label: "No location details",
|
|
widget: "checkbox",
|
|
help: "Presented: each location's name only, without its detail line.",
|
|
when: { path: "type", value: "map" },
|
|
},
|
|
{
|
|
path: "present_places",
|
|
label: "Location slides",
|
|
widget: "select",
|
|
options: [
|
|
["picked", "Only the locations picked below"],
|
|
["none", "None"],
|
|
],
|
|
blankLabel: "Default: each marked location, lit up on the map",
|
|
when: { path: "type", value: "map" },
|
|
},
|
|
{
|
|
path: "present_place_keys",
|
|
label: "Locations with a slide",
|
|
widget: "checklist",
|
|
optionsFrom: "mapLocations",
|
|
full: true,
|
|
when: { path: "present_places", value: "picked" },
|
|
emptyNote: "No locations yet: pick the block's Venue, and give it locations under Data → Venues.",
|
|
},
|
|
];
|
|
|
|
export const blocksChild = {
|
|
key: "content_blocks",
|
|
label: "Content blocks",
|
|
addLabel: "Add block",
|
|
preview: "contentBlock",
|
|
title: (row) => {
|
|
const label = blockTypeLabel(row.type) || "Block";
|
|
const text = preview(row.text || row.href || row.media || "", 40);
|
|
return text ? `${label}: ${text}` : label;
|
|
},
|
|
blank: { slot: "body", type: "paragraph", text: "" },
|
|
fields: [
|
|
{
|
|
path: "slot",
|
|
label: "Shown in",
|
|
widget: "select",
|
|
options: [
|
|
["body", "The page"],
|
|
["card", "The card only (paragraphs only)"],
|
|
["both", "The card and the page"],
|
|
],
|
|
help: "The card is the record's card in lists and carousels, and takes paragraphs only.",
|
|
},
|
|
{
|
|
path: "type",
|
|
label: "Type",
|
|
widget: "select",
|
|
options: BLOCK_TYPES.map(([value, label]) => [value, label]),
|
|
help: (row) => BLOCK_TYPES.find(([value]) => value === row?.type)?.[2],
|
|
},
|
|
{
|
|
path: "text",
|
|
label: (row) => TEXT_LABEL[row?.type] ?? "Text",
|
|
widget: "textarea",
|
|
full: true,
|
|
when: { path: "type", value: TEXT_TYPES },
|
|
help: (row) => TEXT_HELP[row?.type],
|
|
},
|
|
{
|
|
path: "org_kind",
|
|
label: "List",
|
|
widget: "select",
|
|
options: [
|
|
["partner", "Partners"],
|
|
["region", "Regions"],
|
|
["group", "Groups"],
|
|
["ministry", "Ministries"],
|
|
],
|
|
blankLabel: "Default: only the organizations picked below",
|
|
help: "Every published, listed one of this kind, by name. Organizations picked as items replace this list.",
|
|
when: { path: "type", value: "organizations" },
|
|
},
|
|
{
|
|
path: "list_style",
|
|
label: "Style",
|
|
widget: "select",
|
|
options: [["plain", "Plain text, gray detail"]],
|
|
blankLabel: "Default: bold text, normal detail",
|
|
when: { path: "type", value: "list" },
|
|
},
|
|
{
|
|
path: "cite",
|
|
label: "Attribution",
|
|
help: "Who said it, eg. Jane Doe, Retreat 2024",
|
|
full: true,
|
|
when: { path: "type", value: "quote" },
|
|
},
|
|
{
|
|
path: "href",
|
|
label: "Link",
|
|
full: true,
|
|
files: true,
|
|
filesWhen: { path: "type", value: ["paragraph", "button", "image"] },
|
|
when: { path: "type", value: ["paragraph", "button", "image", "video"] },
|
|
help: (row) => HREF_HELP[row?.type],
|
|
},
|
|
{
|
|
path: "media",
|
|
label: "Image",
|
|
widget: "image",
|
|
crop: "free",
|
|
resolve: mediaUrl,
|
|
full: true,
|
|
when: { path: "type", value: ["image", "video"] },
|
|
frameFrom: "href",
|
|
frameWhen: { path: "type", value: "video" },
|
|
help: (row) =>
|
|
row?.type === "video"
|
|
? "Still shown before it plays. Default: YouTube's own thumbnail. Frame at takes a still from a YouTube or Facebook video."
|
|
: undefined,
|
|
},
|
|
{
|
|
path: "captions",
|
|
label: "Captions",
|
|
widget: "image",
|
|
folder: "captions",
|
|
resolve: mediaUrl,
|
|
full: true,
|
|
when: { path: "type", value: "video" },
|
|
help: "A WebVTT (.vtt) file, for an uploaded video; YouTube, Vimeo and Facebook show their own. Default: none.",
|
|
},
|
|
{
|
|
path: "media_dark",
|
|
label: "Dark theme image",
|
|
widget: "image",
|
|
crop: "free",
|
|
resolve: mediaUrl,
|
|
full: true,
|
|
when: { path: "type", value: "image" },
|
|
help: "Shown in place of the image while the site is dark, eg. a chart drawn light on dark. Same alt text and caption. Default: the image above in both themes.",
|
|
},
|
|
{
|
|
path: "image_size",
|
|
label: "Size",
|
|
widget: "select",
|
|
options: [
|
|
["small", "Small (up to 20rem)"],
|
|
["medium", "Medium (up to 32rem)"],
|
|
["large", "Large (up to 48rem)"],
|
|
],
|
|
blankLabel: "Default: the column's full width",
|
|
help: "A smaller one is centered. Never wider than the column.",
|
|
when: { path: "type", value: "image" },
|
|
},
|
|
{
|
|
path: "alt",
|
|
label: "Alt text",
|
|
full: true,
|
|
when: { path: "type", value: "image" },
|
|
help: "Describes the picture for someone who can't see it, eg. Campers around a fire at dusk",
|
|
},
|
|
{
|
|
path: "team_id",
|
|
label: "Team",
|
|
widget: "select",
|
|
optionsFrom: "teams",
|
|
blankLabel: "Default: none, just the people below",
|
|
help: "Shows the team's members as tiles, its leads first. People added as items show after it.",
|
|
when: { path: "type", value: "people" },
|
|
},
|
|
{
|
|
path: "venue_id",
|
|
label: "Venue",
|
|
widget: "select",
|
|
optionsFrom: "venues",
|
|
blankLabel: "Default: none",
|
|
help: (row) =>
|
|
row?.type === "map"
|
|
? "Whose map to show (Data → Venues). Without one the block shows nothing."
|
|
: "Optional: the venue whose locations entries pick from (Data → Venues). With a Map block of it on the page, they link to it.",
|
|
when: { path: "type", value: ["map", "schedule"] },
|
|
},
|
|
...wordFields("", "", { path: "type", value: ["heading", "subheading", "paragraph", "callout", "quote"] }),
|
|
],
|
|
// A schedule's tags, for its entries' and sub-items' Tags (087).
|
|
lends: (row, options) => ({
|
|
scheduleTags: (row.tags ?? [])
|
|
.filter((tag) => tag.name?.trim())
|
|
.map((tag) => ({ id: tag.tag_key, label: tag.name })),
|
|
// Its venue's locations, for entries' Map location (088).
|
|
mapLocations: (venueFromOption(options?.venues?.find((v) => v.id === row.venue_id))?.locations ?? []).map(
|
|
(location) => ({ id: location.key, label: location.name }),
|
|
),
|
|
}),
|
|
children: [
|
|
{
|
|
key: "tags",
|
|
label: "Tags",
|
|
addLabel: "Add tag",
|
|
note: "Tag entries with these, eg. Youth or Worship. Each tag is a tab of its own gathering the entries it's on, and can be shown alone or as a slide when the schedule is presented.",
|
|
when: { path: "type", value: "schedule" },
|
|
title: (row) => row.name || "New tag",
|
|
blank: () => ({ tag_key: crypto.randomUUID().slice(0, 8) }),
|
|
fields: [
|
|
{ path: "name", label: "Name", required: true, help: "eg. Youth" },
|
|
{ path: "color", label: "Color", widget: "color", help: "Default: the event's color" },
|
|
{ path: "no_tab", label: "No tab", widget: "checkbox", help: "Leave it out of the tabs (it still shows on entries)" },
|
|
],
|
|
},
|
|
{
|
|
key: "map_sections",
|
|
label: "Sections",
|
|
addLabel: "Add section",
|
|
note: "Optional: group the venue's locations for this page, eg. Main spaces, Small group spaces. Visitors can pick one to see only its places on the map. With sections, only the locations they hold are shown. The venue itself is unchanged.",
|
|
when: { path: "type", value: "map" },
|
|
title: (row) => row.name || "New section",
|
|
blank: { name: "" },
|
|
fields: [
|
|
{ path: "name", label: "Name", required: true, help: "eg. Main spaces" },
|
|
{
|
|
path: "location_keys",
|
|
label: "Locations",
|
|
widget: "checklist",
|
|
optionsFrom: "mapLocations",
|
|
full: true,
|
|
emptyNote: "No locations yet: pick the block's Venue, and give it locations under Data → Venues.",
|
|
},
|
|
],
|
|
},
|
|
{
|
|
key: "items",
|
|
label: "Items",
|
|
addLabel: "Add item",
|
|
when: { path: "type", value: ["list", "links", "schedule", "cards", "people", "events", "organizations"] },
|
|
title: (row) => [row.day, row.time || row.start_time, row.text].filter(Boolean).join(" · ") || "New item",
|
|
blank: { text: "" },
|
|
fields: [
|
|
{
|
|
path: "kind",
|
|
label: "Type",
|
|
widget: "select",
|
|
options: SCHEDULE_KINDS,
|
|
blankLabel: "Default: Normal entry",
|
|
help: "A block holds several things in one time frame, each a sub-item with its own time. A break is a quieter row (a meal, free time). A heading labels part of the day, eg. Evening sessions.",
|
|
when: SCHEDULE_ENTRY,
|
|
},
|
|
{
|
|
path: "day",
|
|
label: "Day",
|
|
help: "The tab it's under, eg. Friday. Entries with the same day share a tab, in this order.",
|
|
when: SCHEDULE_ENTRY,
|
|
},
|
|
...scheduleTimeFields(SCHEDULE_ENTRY),
|
|
// A card: the link first, so Fetch preview can fill the rest.
|
|
{
|
|
path: "url",
|
|
label: "Link",
|
|
widget: "linkPreview",
|
|
previewFills: { title: "text", blurb: "detail", image: "media" },
|
|
files: true,
|
|
full: true,
|
|
help: "A page on this site (eg. /retreats), anywhere else, or a file (Choose a file). Fetch preview fills the title, description and picture from a page; a file fills its name and first-page picture.",
|
|
when: CARD_ITEM,
|
|
},
|
|
{
|
|
path: "person_id",
|
|
label: "Person",
|
|
widget: "select",
|
|
optionsFrom: "people",
|
|
required: true,
|
|
help: "Shown as a tile with their photo, linked to their page",
|
|
when: PEOPLE_ITEM,
|
|
},
|
|
{
|
|
path: "event_id",
|
|
label: "Event",
|
|
widget: "select",
|
|
optionsFrom: "events",
|
|
fills: "text",
|
|
required: true,
|
|
help: "The event the card shows and links to. An unpublished one is left out.",
|
|
when: EVENT_ITEM,
|
|
},
|
|
{
|
|
path: "org_id",
|
|
label: "Organization",
|
|
widget: "select",
|
|
optionsFrom: "block_orgs",
|
|
fills: "text",
|
|
required: true,
|
|
help: "Shown as its card, in this order. An unpublished one is left out.",
|
|
when: ORG_ITEM,
|
|
},
|
|
eventField(SCHEDULE_ENTRY),
|
|
{
|
|
path: "text",
|
|
label: "Text",
|
|
required: true,
|
|
help: "Schedules: the entry's title. Cards: the card's title. Events: the title shown, filled from the event. People: their title on the tile, eg. Speaker. Organizations: filled from it, only the admin shows it",
|
|
},
|
|
placeField(SCHEDULE_ENTRY),
|
|
{
|
|
path: "location",
|
|
label: "Location",
|
|
help: "eg. Main Hall. Default: the map location's name",
|
|
when: SCHEDULE_ENTRY,
|
|
},
|
|
{
|
|
path: "person_id",
|
|
label: "Person",
|
|
widget: "select",
|
|
optionsFrom: "people",
|
|
blankLabel: "Default: none",
|
|
help: "Who hosts or speaks: shown with their photo, linked to their page",
|
|
when: SCHEDULE_ENTRY,
|
|
},
|
|
{ path: "detail", label: "Detail", help: "A line under the text. Lists: shown after the text", when: NOT_CARD_ITEM },
|
|
{ path: "detail", label: "Description", widget: "textarea", full: true, when: CARD_ITEM },
|
|
{ path: "detail", label: "Card text", widget: "textarea", full: true, help: "Default: the event's card text", when: EVENT_ITEM },
|
|
{ path: "url", label: "URL", help: "Blank for plain text. Link buttons need one.", files: true, when: NOT_CARD_ITEM },
|
|
{
|
|
path: "media",
|
|
label: "Picture",
|
|
widget: "image",
|
|
crop: 16 / 9,
|
|
resolve: mediaUrl,
|
|
full: true,
|
|
help: "Optional. Default: none, the card is text only.",
|
|
when: CARD_ITEM,
|
|
},
|
|
{
|
|
path: "description",
|
|
label: "More",
|
|
widget: "textarea",
|
|
full: true,
|
|
help: "Shown when the entry is folded out. " + FORMATTING_HELP,
|
|
when: SCHEDULE_ENTRY,
|
|
},
|
|
{
|
|
path: "media",
|
|
label: "Graphic",
|
|
widget: "image",
|
|
crop: "free",
|
|
resolve: mediaUrl,
|
|
full: true,
|
|
help: "Optional, in the fold-out: a map of the site, a slide, a poster",
|
|
when: SCHEDULE_ENTRY,
|
|
},
|
|
{
|
|
path: "media_alt",
|
|
label: "Graphic description",
|
|
full: true,
|
|
help: "For screen readers: what the graphic shows, eg. a map of the camp. Default: skipped as decoration.",
|
|
when: SCHEDULE_ENTRY,
|
|
},
|
|
{
|
|
path: "map",
|
|
label: "Map",
|
|
full: true,
|
|
help: "Optional, in the fold-out: a place or address for a Google map, eg. Camp Hebron, Halifax PA",
|
|
when: SCHEDULE_ENTRY,
|
|
},
|
|
{
|
|
path: "map_image",
|
|
label: "Map image",
|
|
widget: "image",
|
|
crop: "free",
|
|
resolve: mediaUrl,
|
|
full: true,
|
|
help: "Optional: your own map, eg. the camp with the room marked. Shown in the fold-out in place of the Google map (which stays a link), and as a slide when the schedule is presented.",
|
|
when: SCHEDULE_ENTRY,
|
|
},
|
|
{ path: "featured", label: "Featured", widget: "checkbox", help: "Makes the row stand out", when: SCHEDULE_ENTRY },
|
|
{ ...TAGS_FIELD, when: SCHEDULE_ENTRY },
|
|
{
|
|
path: "featured",
|
|
label: "Featured",
|
|
widget: "checkbox",
|
|
help: "Shows it opened in full above the cards, under the heading and subheading below",
|
|
when: EVENT_ITEM,
|
|
},
|
|
{ path: "heading", label: "Heading", help: "Featured only, eg. This year's keynote. Default: none", when: EVENT_ITEM },
|
|
{ path: "subheading", label: "Subheading", help: "Featured only: a line under the heading. Default: none", full: true, when: EVENT_ITEM },
|
|
],
|
|
children: [
|
|
{
|
|
key: "items",
|
|
label: "Sub-items",
|
|
addLabel: "Add sub-item",
|
|
when: { path: "kind", value: "block" },
|
|
title: (row) => [row.time || row.start_time, row.text].filter(Boolean).join(" · ") || "New sub-item",
|
|
blank: { text: "" },
|
|
fields: SUB_ITEM_FIELDS,
|
|
},
|
|
],
|
|
},
|
|
],
|
|
};
|