Finish the audit leftovers

- One mediaUrl in media.ts instead of 12 identical aliases and a
  kind map; orgPath builds on hrefs.ts's orgHref
- One Logo component (hides itself or shows a fallback when the file
  is missing) for event cards, org lists and chapter marks
- useHistory is a thin wrapper over useRecord
- adminSchema.ts split into adminSchema/, one file per entity plus
  shared.ts; the registry is unchanged (checked by loading both)
- JS smooth scrolls respect reduced motion (lib/motion.ts)
- Content-Security-Policy in Report-Only, with /api/csp-report logging
  what it would block

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-09-28 22:49:07 -05:00
parent c74ad746f5
commit e4a9c96f7e
42 changed files with 1968 additions and 2043 deletions

View file

@ -0,0 +1,54 @@
import { mediaUrl } from "../media.ts";
import { PUBLISH_FIELDS } from "./shared.ts";
/* ── Awards ──────────────────────────────────────────────────── */
export const awards = {
key: "awards",
label: "Awards",
singular: "award",
idLabel: "URL ID",
slugFrom: "name",
list: {
columns: [
{ key: "name", label: "Name", primary: true },
{ key: "org_id", label: "Awarded by" },
{ key: "description", label: "Description" },
{ key: "is_published", label: "Live", widget: "bool" },
{ key: "is_listed", label: "Listed", widget: "bool" },
],
filters: [
{ key: "org_id", label: "Awarded by", optionsFrom: "organizations" },
{ key: "is_published", label: "Published", options: [["1", "Live"], ["0", "Hidden"]] },
{ key: "is_listed", label: "Listed", options: [["1", "Listed"], ["0", "Link only"]] },
],
},
groups: [
{
legend: "Identity",
note:
"An award exists whether or not anyone has received it. " +
"Who received it is edited on the person.",
fields: [
{
path: "org_id",
label: "Awarded by",
widget: "select",
optionsFrom: "organizations",
blankLabel: "- unattributed -",
help: "The organization that gives this award",
},
{ path: "name", label: "Name", required: true },
{ path: "description", label: "Description", widget: "textarea", full: true },
{ path: "logo", label: "Logo", widget: "image", resolve: mediaUrl, full: true },
],
},
{
legend: "Publishing",
note: "An unpublished award is a draft: off the site, and a 404 at its own page.",
fields: PUBLISH_FIELDS,
},
],
};

184
src/lib/adminSchema/blog.ts Normal file
View file

@ -0,0 +1,184 @@
import { preview } from "../text.ts";
import { mediaUrl } from "../media.ts";
import { PUBLISHED_FIELD, LISTED_FIELD, FEATURED_KINDS, featuredCardsChild, blocksChild } from "./shared.ts";
/* ── Blog (031_blog.sql) ─────────────────────────────────────────
Posts at /blog/:id, and the Community page's blog section. The
section's community posts reuse the featured cards, limited to
links: a pinned Substack post is a link card, and Fetch preview
fills it from the post. */
/* A post's body is the content blocks without the card/body choice:
a post only has a body. */
const blogBlocksChild = {
...blocksChild,
label: "Post body",
note: "The post, top to bottom. The first paragraph doubles as the excerpt when that's left blank.",
fields: blocksChild.fields.filter((field) => field.path !== "slot"),
};
export const blogPosts = {
key: "blog_posts",
label: "Blog posts",
singular: "blog post",
idLabel: "URL ID",
slugFrom: "title",
list: {
columns: [
{ key: "title", label: "Title", primary: true },
{ key: "published_on", label: "Date" },
{ key: "tags", label: "Tags" },
{ key: "is_published", label: "Live", widget: "bool" },
{ key: "is_listed", label: "Listed", widget: "bool" },
],
filters: [
{ key: "is_published", label: "Published", options: [["1", "Live"], ["0", "Draft"]] },
{ key: "is_listed", label: "Listed", options: [["1", "Listed"], ["0", "Link only"]] },
],
},
groups: [
{
legend: "Post",
fields: [
{ path: "title", label: "Title", required: true, full: true },
{ path: "published_on", label: "Date", widget: "date", help: "Newest first on the Community page" },
{ path: "tags", label: "Tags", help: "Comma separated, eg. Reflection, Event recap" },
{
path: "excerpt",
label: "Excerpt",
widget: "textarea",
full: true,
help: "A sentence or two for the card. Default: the body's first paragraph.",
},
{ path: "cover_image", label: "Cover image", widget: "image", resolve: mediaUrl, full: true },
{
path: "cover_alt",
label: "Cover description",
full: true,
help: "For screen readers: what the cover shows. Default: skipped as decoration.",
},
],
},
{
legend: "Guest author",
note: "For a writer with no People record. People who wrote it go under Authors below; both can be set.",
fields: [
{ path: "guest_author", label: "Name" },
{ path: "guest_photo", label: "Photo", widget: "image", resolve: mediaUrl, full: true },
],
},
{
legend: "Publishing",
note: "A new post is a draft until Published is ticked. Unlisted posts keep their page and can still be pinned.",
fields: [PUBLISHED_FIELD, LISTED_FIELD],
},
],
children: [
{
key: "authors",
label: "Authors",
note: "Shown as person tiles at the end of the post, in this order.",
addLabel: "Add author",
title: (row, options) =>
options?.people?.find((p) => p.id === row.person_id)?.label ?? "New author",
blank: { person_id: "" },
fields: [
{
path: "person_id",
label: "Person",
widget: "select",
optionsFrom: "people",
required: true,
},
],
},
blogBlocksChild,
],
};
export const communityPage = {
key: "community_page",
label: "Community blog section",
singular: "community blog section",
idLabel: "Page",
singleton: "community",
list: { columns: [], filters: [] },
groups: [
{
legend: "Section",
note: "The first section of the Community page.",
fields: [
{ path: "blog_title", label: "Heading", help: "Default: Community Blog" },
{ path: "blog_blurb", label: "Blurb", widget: "textarea", full: true },
],
},
{
legend: "Our posts",
note: "Pinned posts first, then the newest published, listed posts, up to the number of slots.",
fields: [
{ path: "internal_title", label: "Heading", help: "Default: From NGU" },
{ path: "internal_slots", label: "Slots", widget: "number", help: "0 to 12. Default: 3" },
],
},
{
legend: "Community posts",
note: "Pinned cards first, then the newest items from the feeds below, up to the number of slots.",
fields: [
{ path: "external_title", label: "Heading", help: "Default: From our community" },
{ path: "external_slots", label: "Slots", widget: "number", help: "0 to 12. Default: 3" },
{ path: "external_url", label: "Button link", help: "eg. https://ngu.substack.com", full: true },
{ path: "external_label", label: "Button text", help: "Default: Read more on Substack" },
],
},
],
children: [
{
key: "pinned_posts",
label: "Pinned posts (ours)",
note: "Always shown, before the newest.",
addLabel: "Pin a post",
title: (row, options) =>
options?.blog_posts?.find((p) => p.id === row.post_id)?.label ?? "New pin",
blank: { post_id: "" },
fields: [
{
path: "post_id",
label: "Post",
widget: "select",
optionsFrom: "blog_posts",
required: true,
},
],
},
{
...featuredCardsChild,
label: "Pinned community posts",
note: "Always shown, before the feeds' newest. Paste a post's link and press Fetch preview.",
addLabel: "Pin a post",
blank: { kind: "", url: "", title: "" },
fields: featuredCardsChild.fields.map((field) =>
field.path === "kind"
? { ...field, options: FEATURED_KINDS.filter(([kind]) => kind !== "record") }
: field,
),
},
{
key: "feeds",
label: "Feeds",
note: "RSS or Atom feeds whose newest posts fill the community slots. Read about every 30 minutes.",
addLabel: "Add feed",
title: (row) => row.label || row.url || "New feed",
blank: { url: "", label: "" },
fields: [
{ path: "url", label: "Feed URL", required: true, full: true, help: "eg. https://ngu.substack.com/feed" },
{ path: "label", label: "Source name", help: "Shown on its cards. Default: the feed's own title" },
],
},
],
};

View file

@ -0,0 +1,203 @@
import { mediaUrl } from "../media.ts";
import { PLACE_FIELDS, PUBLISHED_FIELD, LISTED_FIELD, timelineGroup, timelineDetailGroup, linksChild, hostsChild, blocksChild } from "./shared.ts";
/* ── Events ──────────────────────────────────────────────────── */
/* The panel the Series checkbox opens. Starts and Ends above stay
the series' bounds (the first meeting and the last day it can
meet), so nothing here repeats them. */
const SERIES_WEEKDAYS = [
["sun", "Sunday"],
["mon", "Monday"],
["tue", "Tuesday"],
["wed", "Wednesday"],
["thu", "Thursday"],
["fri", "Friday"],
["sat", "Saturday"],
];
const seriesGroup = {
legend: "Series",
when: { path: "is_series", value: 1 },
note:
"Starts is the first meeting and anchors the schedule; Ends, if set, is the last " +
"day it can meet. The weekdays only apply to a weekly series; with none ticked it " +
"meets on the start date's day. Leave Date label blank and the site describes " +
"the schedule itself.",
fields: [
{
path: "series_frequency",
label: "Repeats",
widget: "select",
options: [
["weekly", "Weekly, on the days ticked below"],
["monthly_date", "Monthly, on the day of the start date (eg. the 13th)"],
["monthly_weekday", "Monthly, on the weekday of the start date (eg. 2nd Tuesday)"],
],
blankLabel: "Default: weekly",
},
{
path: "series_interval",
label: "Every",
widget: "number",
help: "1 for every week or month, 2 for every other, and so on",
},
{ path: "series_start_time", label: "Start time", widget: "time" },
{ path: "series_end_time", label: "End time", widget: "time" },
{
path: "series_count",
label: "Number of meetings",
widget: "number",
help: "Stops after this many. Blank to run until Ends, or indefinitely",
},
...SERIES_WEEKDAYS.map(([day, name]) => ({
path: `series_${day}`,
label: name,
widget: "checkbox",
help: `Meets on ${name}s`,
})),
],
};
export const events = {
key: "events",
label: "Events",
singular: "event",
idLabel: "URL ID",
slugFrom: "title",
list: {
columns: [
{ key: "title", label: "Title", primary: true },
{ key: "scope_id", label: "Scope" },
{ key: "event_type", label: "Type" },
{ key: "date_label", label: "Dates" },
{ key: "status", label: "Status" },
{ key: "is_published", label: "Live", widget: "bool" },
{ key: "is_listed", label: "Listed", widget: "bool" },
],
filters: [
{ key: "scope_id", label: "Scope", optionsFrom: "event_scopes" },
{
key: "event_type",
label: "Type",
options: ["retreat", "class", "workshop", "meeting", "other"],
},
{ key: "status", label: "Status", options: ["upcoming", "past", "cancelled"] },
{ key: "is_published", label: "Published", options: [["1", "Live"], ["0", "Hidden"]] },
{ key: "is_listed", label: "Listed", options: [["1", "Listed"], ["0", "Link only"]] },
],
},
groups: [
{
legend: "Identity",
fields: [
{
path: "scope_id",
label: "Scope",
widget: "select",
optionsFrom: "event_scopes",
required: true,
help: "Whose gathering this is.",
},
{
path: "event_type",
label: "Type",
widget: "select",
options: ["retreat", "class", "workshop", "meeting", "other"],
required: true,
help: "What kind of gathering. Independent of the scope",
},
{ path: "title", label: "Title", required: true },
{ path: "theme", label: "Theme" },
{ path: "tagline", label: "Tagline", full: true },
],
},
{
legend: "When",
fields: [
{ path: "starts_on", label: "Starts", widget: "date" },
{ path: "ends_on", label: "Ends", widget: "date" },
{
path: "date_label",
label: "Date label",
help: "Text override of what the card shows (eg. March/April 2026)",
},
{
path: "status",
label: "Status",
widget: "select",
options: ["upcoming", "past", "cancelled"],
blankLabel: "Default: derive from end date",
},
{
path: "is_series",
label: "Series",
widget: "checkbox",
help: "Repeats on a schedule, such as a weekly class, a monthly meeting",
},
],
},
seriesGroup,
{ legend: "Where", fields: PLACE_FIELDS },
{
legend: "Appearance",
fields: [
{ path: "event_logo", label: "Event logo", widget: "image", resolve: mediaUrl, full: true },
{ path: "org_logo", label: "Org logo override", widget: "image", resolve: mediaUrl, full: true },
{ path: "color", label: "Colour", widget: "color" },
{
path: "card_image",
label: "Card background",
widget: "image",
resolve: mediaUrl,
full: true,
help: "A photo behind the event's card, faded so the text stays readable.",
},
],
},
timelineGroup("event"),
timelineDetailGroup("event"),
{ legend: "Publishing", fields: [PUBLISHED_FIELD, LISTED_FIELD] },
],
children: [
hostsChild,
{
key: "event_people",
label: "People at this event",
addLabel: "Add person",
title: (row, options) =>
options?.people?.find((p) => p.id === row.person_id)?.label ?? "New person",
blank: { person_id: "", role: "speaker", is_public: 1 },
fields: [
{
path: "person_id",
label: "Person",
widget: "select",
optionsFrom: "people",
required: true,
},
{
path: "role",
label: "Role",
widget: "select",
options: [
"speaker",
"leader",
"facilitator",
"host",
"musician",
"volunteer",
"attendee",
],
},
{ path: "title", label: "Title", help: "eg. Keynote Speaker" },
{ path: "is_public", label: "Show on the site", widget: "checkbox" },
],
},
linksChild,
blocksChild,
],
};

View file

@ -0,0 +1,244 @@
import { mediaUrl } from "../media.ts";
import { featuredCardsChild } from "./shared.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"],
["chapters", "Count: chapters"],
["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 colour 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_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: "Heading Override" },
{ 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.icon, row.label].filter(Boolean).join(" ") || "New path",
blank: { label: "", icon: "", blurb: "" },
fields: [
{ path: "label", label: "Label", required: true, help: "eg. Attend, Serve…" },
{ path: "icon", label: "Icon", help: "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 },
],
},
],
},
],
};

View file

@ -0,0 +1,107 @@
import { mediaUrl } from "../media.ts";
import { PLACE_FIELDS, PUBLISH_FIELDS, timelineGroup, timelineDetailGroup, linksChild, blocksChild } from "./shared.ts";
/* ── Organizations ───────────────────────────────────────────── */
export const organizations = {
key: "organizations",
label: "Organizations",
singular: "organization",
idLabel: "URL ID",
slugFrom: "name",
list: {
columns: [
{ key: "name", label: "Name", primary: true },
{ key: "kind", label: "Kind" },
{ key: "locality", label: "City" },
{ key: "state_code", label: "State" },
{ key: "is_published", label: "Live", widget: "bool" },
{ key: "is_listed", label: "Listed", widget: "bool" },
],
filters: [
{ key: "kind", label: "Kind", options: ["national", "region", "chapter", "partner"] },
{ key: "is_published", label: "Published", options: [["1", "Live"], ["0", "Hidden"]] },
{ key: "is_listed", label: "Listed", options: [["1", "Listed"], ["0", "Link only"]] },
],
},
groups: [
{
legend: "Identity",
fields: [
{
path: "kind",
label: "Kind",
widget: "select",
options: ["national", "region", "chapter", "partner"],
required: true,
help: "Changing this swaps which extra fields apply",
},
{ path: "name", label: "Name", required: true },
{ path: "short_name", label: "Short name" },
{ path: "tagline", label: "Tagline", full: true },
{ path: "color", label: "Colour", widget: "color" },
{ path: "logo", label: "Logo", widget: "image", resolve: mediaUrl, full: true },
],
},
{
legend: "Region",
when: { path: "kind", value: "region" },
fields: [
{
path: "region.scope",
label: "Scope",
widget: "select",
options: ["domestic", "international", "virtual"],
required: true,
},
{ path: "region.map_note", label: "Map note", full: true },
],
},
{
legend: "Chapter",
when: { path: "kind", value: "chapter" },
fields: [
{
path: "chapter.region_id",
label: "Region",
widget: "select",
optionsFrom: "regions",
blankLabel: "Default: none",
},
{ path: "chapter.meets", label: "Meets", help: "2nd Sundays, 6:00pm" },
{ path: "chapter.started", label: "Started", help: "Since 2021" },
],
},
{ legend: "Place", fields: PLACE_FIELDS },
timelineGroup("organization"),
timelineDetailGroup("organization"),
{ legend: "Publishing", fields: PUBLISH_FIELDS },
],
children: [
{
key: "region_areas",
label: "Map areas",
when: { path: "kind", value: "region" },
addLabel: "Add area",
title: (row) => row.area_code || "New area",
blank: { area_code: "", share: 1 },
fields: [
{ path: "area_code", label: "Area code", required: true, help: "Two letter state code or Country name" },
{ path: "share", label: "Share", widget: "number", help: "1 for the whole tile, 0.5 for half" },
{
path: "edge",
label: "Edge",
widget: "select",
options: ["top", "bottom"],
blankLabel: "Default: whole tile",
},
{ path: "note", label: "Note", help: "details to explain why it's half or other note" },
],
},
linksChild,
blocksChild,
],
};

View file

@ -0,0 +1,148 @@
import { mediaUrl } from "../media.ts";
import { PUBLISHED_FIELD, LISTED_FIELD, AFFILIATION_ROLE_FIELDS, linksChild, blocksChild } from "./shared.ts";
/* ── People ──────────────────────────────────────────────────── */
export const people = {
key: "people",
label: "People",
singular: "person",
idLabel: "URL ID",
slugFrom: "display_name",
list: {
columns: [
{ key: "display_name", label: "Name", primary: true },
{ key: "tagline", label: "Tagline" },
{ key: "locality", label: "City" },
{ key: "is_published", label: "Live", widget: "bool" },
{ key: "is_listed", label: "Listed", widget: "bool" },
],
filters: [
{ key: "is_published", label: "Published", options: [["1", "Live"], ["0", "Hidden"]] },
{ key: "is_listed", label: "Listed", options: [["1", "Listed"], ["0", "Link only"]] },
],
},
groups: [
{
legend: "Identity",
fields: [
{ path: "display_name", label: "Display name", required: true },
{ path: "sort_name", label: "Sort name", help: "Doe, Jane" },
{ path: "pronouns", label: "Pronouns" },
{ path: "tagline", label: "Tagline", full: true },
{ path: "photo", label: "Photo", widget: "image", resolve: mediaUrl, full: true },
{
path: "primary_org_id",
label: "Home organization",
widget: "select",
optionsFrom: "organizations",
blankLabel: "Default: none",
help: "Optional. Shown above their bio",
},
{
path: "bio",
label: "Bio",
widget: "textarea",
full: true,
help: "Leave a blank line between paragraphs",
},
],
},
{
legend: "Public contact",
fields: [
{ path: "public_email", label: "Email", help: "Printed on the site" },
{ path: "public_phone", label: "Phone" },
{ path: "locality", label: "City" },
{ path: "state_code", label: "State" },
{ path: "country", label: "Country" },
{ path: "location_label", label: "Display location" },
],
},
{
legend: "Private",
note: "Never sent to the public site. Only admins see this.",
fields: [
{ path: "private.birth_date", label: "Birth date", widget: "date" },
{ path: "private.private_email", label: "Email" },
{ path: "private.private_phone", label: "Phone" },
{ path: "private.address", label: "Address", full: true },
{ path: "private.notes", label: "Notes", widget: "textarea", full: true },
],
},
{
legend: "Publishing",
note: "Unpublished people are invisible everywhere.",
fields: [PUBLISHED_FIELD, LISTED_FIELD],
},
],
children: [
{
key: "affiliations",
label: "Roles and organizations",
addLabel: "Add role",
note:
"Where someone appears within a team is set on that team's page, " +
"not by the order of this list.",
title: (row, options) =>
[row.title, options?.organizations?.find((o) => o.id === row.org_id)?.label]
.filter(Boolean)
.join(" · ") || "New role",
blank: { org_id: "", role: "member", is_public: 1, is_owner: 0 },
fields: [
{
path: "org_id",
label: "Organization",
widget: "select",
optionsFrom: "organizations",
required: true,
},
{
path: "team_id",
label: "Team",
widget: "select",
optionsFrom: "teams",
blankLabel: "Default: none",
// A team belongs to an org; offering one from another
// org would fail the composite foreign key on save.
filterBy: (option, row) => option.org_id === row.org_id,
help: "Only teams of the chosen organization",
},
...AFFILIATION_ROLE_FIELDS,
],
},
{
key: "person_awards",
label: "Awards",
addLabel: "Add award",
title: (row, options) =>
options?.awards?.find((a) => a.id === row.award_id)?.label ?? "New award",
blank: { award_id: "", is_public: 1 },
fields: [
{
path: "award_id",
label: "Award",
widget: "select",
optionsFrom: "awards",
required: true,
help: "Labelled with the organization that gives it",
},
{
path: "event_id",
label: "Presented at",
widget: "select",
optionsFrom: "events",
blankLabel: "Default: none",
},
{ path: "awarded_on", label: "Date", widget: "date" },
{ path: "citation", label: "Citation", widget: "textarea", full: true },
{ path: "is_public", label: "Public", widget: "checkbox" },
],
},
linksChild,
blocksChild,
],
};

View file

@ -0,0 +1,446 @@
/* 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" },
{ path: "is_online", label: "Online", widget: "checkbox" },
];
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",
resolve: mediaUrl,
full: true,
help: "Default: the record's own picture, or for a YouTube video, its thumbnail.",
},
],
};
/* 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 colour when the event sets
neither, so the order here is data rather than a display choice.
A person supplies neither: there is no colour on a person and a
headshot is not a logo, so a person-hosted event with no colour
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.",
},
],
};
/* 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."],
["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" };
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"];
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,
};
export const TEXT_LABEL = { button: "Label", image: "Caption", video: "Caption", schedule: "Intro" };
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",
};
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 (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: "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,
when: { path: "type", value: ["paragraph", "button", "image", "video"] },
help: (row) => HREF_HELP[row?.type],
},
{
path: "media",
label: "Image",
widget: "image",
resolve: mediaUrl,
full: true,
when: { path: "type", value: ["image", "video"] },
help: (row) =>
row?.type === "video" ? "Still shown before it plays. Default: YouTube's own thumbnail." : undefined,
},
{
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",
},
],
children: [
{
key: "items",
label: "Items",
addLabel: "Add item",
when: { path: "type", value: ["list", "links", "schedule"] },
title: (row) => [row.day, row.time, row.text].filter(Boolean).join(" · ") || "New item",
blank: { text: "" },
fields: [
{
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,
},
{ path: "time", label: "Time", help: "eg. 7:00pm, or 9:00 to 10:30am", when: SCHEDULE_ENTRY },
{ path: "text", label: "Text", required: true, help: "Schedules: the entry's title" },
{
path: "location",
label: "Location",
help: "eg. Main Hall",
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" },
{ path: "url", label: "URL", help: "Blank for plain text. Link buttons need one." },
{
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",
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,
},
],
},
],
};

View file

@ -0,0 +1,120 @@
import siteConfiguration from "../../../site.json";
import { mediaUrl } from "../media.ts";
/* ── Site settings (035_site_settings.sql) ───────────────────────
Overrides for site.json, superadmins only: every blank falls back
to what site.json says, which is shown as the default. */
const SITE_PAGES: [string, string][] = Object.entries(siteConfiguration.pages).map(
([path, page]) => [path, `${page.title} (${path})`],
);
export const siteSettings = {
key: "site_settings",
label: "Site settings",
singular: "site settings",
idLabel: "Settings",
singleton: "site",
writeRole: "superadmin",
list: { columns: [], filters: [] },
groups: [
{
legend: "The site",
note: "Anything left blank uses site.json, so the build and these settings agree until you change one.",
fields: [
{ path: "site_name", label: "Site name", help: `Default: ${siteConfiguration.title}` },
{
path: "description",
label: "Description",
widget: "textarea",
full: true,
help: "Search engines and link previews show this for pages without their own. Default: site.json's, or the front page's subhead.",
},
{
path: "preview_image",
label: "Preview image",
widget: "image",
resolve: mediaUrl,
full: true,
help: "Shown when a page without its own image is shared. 1200 × 630 works everywhere.",
},
],
},
{
legend: "Icons",
fields: [
{
path: "favicon",
label: "Favicon",
widget: "image",
resolve: mediaUrl,
full: true,
help: "The browser-tab icon: a square PNG (512px) or an SVG. Keep original when uploading an SVG.",
},
{
path: "apple_touch_icon",
label: "Home-screen icon",
widget: "image",
resolve: mediaUrl,
full: true,
help: "For iPhones saving the site to their home screen: a square PNG, 180px, no transparency.",
},
],
},
{
legend: "Search engines",
fields: [
{
path: "indexing",
label: "Let search engines list this site",
widget: "select",
options: [
["on", "On: pages can appear in Google"],
["off", "Off: hidden from search (use on the dev server)"],
],
blankLabel: `Default: site.json (${siteConfiguration.robots?.index === false ? "off" : "on"})`,
help: "Applies to this server's database only, so dev can be off while production is on.",
},
],
},
{
legend: "Privacy",
fields: [
{
path: "privacy_email",
label: "Privacy contact email",
help: `The Privacy page gives this for privacy questions and data requests, eg. privacy@nextgenerationofunity.org. ${
siteConfiguration.privacyEmail ? `Default: ${siteConfiguration.privacyEmail}` : "Default: none, the page offers its request form only"
}.`,
},
],
},
],
children: [
{
key: "pages",
label: "Page titles and intros",
note: "Change a static page's heading and intro, which are also its search title and description. Blank fields keep site.json's.",
addLabel: "Change a page",
title: (row) => SITE_PAGES.find(([path]) => path === row.path)?.[1] ?? "New page",
blank: { path: "", title: "", description: "" },
fields: [
{ path: "path", label: "Page", widget: "select", options: SITE_PAGES, required: true },
{
path: "title",
label: "Title",
help: (row) => (row?.path ? `Default: ${siteConfiguration.pages[row.path]?.title ?? ""}` : undefined),
},
{
path: "description",
label: "Intro",
widget: "textarea",
full: true,
help: (row) => (row?.path ? `Default: ${siteConfiguration.pages[row.path]?.description ?? ""}` : undefined),
},
],
},
],
};

View file

@ -0,0 +1,83 @@
import { mediaUrl } from "../media.ts";
import { PUBLISH_FIELDS, AFFILIATION_ROLE_FIELDS, linksChild, blocksChild } from "./shared.ts";
/* ── Teams ───────────────────────────────────────────────────── */
export const teams = {
key: "teams",
label: "Teams",
singular: "team",
idLabel: "URL ID",
// teams.id is a global primary key, not scoped to the org, so
// 'board' can only exist once across the whole site. Composing
// the slug from both fields is what keeps NGU's board and the
// Northwest's board from colliding.
slugFrom: ["org_id", "name"],
list: {
columns: [
{ key: "name", label: "Name", primary: true },
{ key: "org_id", label: "Organization" },
{ key: "tagline", label: "Tagline" },
{ key: "is_published", label: "Live", widget: "bool" },
{ key: "is_listed", label: "Listed", widget: "bool" },
],
filters: [
{ key: "org_id", label: "Organization", optionsFrom: "organizations" },
{ key: "is_published", label: "Published", options: [["1", "Live"], ["0", "Hidden"]] },
{ key: "is_listed", label: "Listed", options: [["1", "Listed"], ["0", "Link only"]] },
],
},
groups: [
{
legend: "Identity",
note:
"Pick the organization first: the id is built from it, " +
"and it can't be changed once anyone is filed under this team.",
fields: [
{
path: "org_id",
label: "Organization",
widget: "select",
optionsFrom: "organizations",
required: true,
help: "Who this team belongs to",
},
{ path: "name", label: "Name", required: true, help: "Board, Leadership Team" },
{ path: "tagline", label: "Tagline", full: true },
{ path: "color", label: "Colour", widget: "color" },
{ path: "logo", label: "Logo", widget: "image", resolve: mediaUrl, full: true },
],
},
{ legend: "Publishing", fields: PUBLISH_FIELDS },
],
children: [
{
key: "members",
label: "Members",
addLabel: "Add member",
note:
"This order is the order they appear on the site. Owners are " +
"still listed first, in this order among themselves.",
title: (row, options) =>
[options?.people?.find((p) => p.id === row.person_id)?.label, row.title]
.filter(Boolean)
.join(" · ") || "New member",
blank: { person_id: "", role: "member", is_public: 1, is_owner: 0 },
fields: [
{
path: "person_id",
label: "Person",
widget: "select",
optionsFrom: "people",
required: true,
},
...AFFILIATION_ROLE_FIELDS,
],
},
linksChild,
blocksChild,
],
};

View file

@ -0,0 +1,152 @@
/* ── Timeline ─────────────────────────────────────────── */
// The only entity with no slug: the table assigns the id, because an
// entry referencing an event has no name of its own and one gets
// created every time somebody ticks a checkbox. `idKind: "auto"` tells
// EntityEdit to show the id rather than ask for it.
//
// Most rows here are created from an event or organization page, not
// this one. What this page is for: hand-authored milestones with no
// record behind them, 'people' entries about a team forming, and fixing
// up the entries the checkboxes made.
export const timeline = {
key: "timeline",
label: "Timeline",
singular: "entry",
idLabel: "Entry",
idKind: "auto",
titleFrom: "title",
list: {
columns: [
{ key: "title", label: "Title", primary: true },
{ key: "occurred_on", label: "Date" },
{ key: "kind", label: "Kind" },
{ key: "ref_id", label: "References" },
{ key: "is_featured", label: "Featured", widget: "bool" },
{ key: "is_published", label: "Live", widget: "bool" },
],
filters: [
{
key: "kind",
label: "Kind",
options: ["milestone", "event", "organization", "award", "people"],
},
{
key: "ref_kind",
label: "References",
options: ["event", "organization", "award", "person", "team"],
},
{ key: "is_featured", label: "Featured", options: [["1", "Featured"], ["0", "Normal"]] },
{ key: "is_published", label: "Published", options: [["1", "Live"], ["0", "Hidden"]] },
],
},
groups: [
{
legend: "What this is",
note:
"An entry either points at a record or stands on its own. " +
"Pointing at one means its title, date and logo come from that " +
"record and nothing is copied, so editing the record updates this.",
fields: [
{
path: "kind",
label: "Kind",
widget: "select",
options: ["milestone", "event", "organization", "award", "people"],
required: true,
help: "Drives the marker and the layout. 'people' renders a roster",
},
{
path: "ref_kind",
label: "Points at",
widget: "select",
options: ["event", "organization", "award", "person", "team"],
blankLabel: "Default: nothing",
help: "Changing this leaves the record below orphaned, pick a new one",
},
{
path: "ref_id",
label: "Record",
widget: "select",
optionsFrom: "record_refs",
blankLabel: "Default: none",
// One flat list of every referenceable row, narrowed to the
// kind chosen above. Five dropdowns of which four are always
// wrong would be worse.
filterBy: (option, row) => option.kind === row.ref_kind,
help: "Only records of the kind chosen above",
},
],
},
{
legend: "When",
note:
"Blank takes the referenced record's own date. Precision is what " +
"says how much of the date to believe, a backfilled entry that " +
"only knows the year should say so.",
fields: [
{
path: "occurred_on",
label: "Date",
help: "2012, 2012-06 or 2012-06-14",
},
{
path: "precision",
label: "Precision",
widget: "select",
options: ["year", "month", "day"],
},
],
},
{
legend: "Text",
note: "All optional. Blank uses the referenced record's own wording.",
fields: [
{ path: "title", label: "Title", full: true },
{ path: "blurb", label: "Blurb", widget: "textarea", full: true },
{ path: "meta", label: "Secondary line", help: "Region, venue, recipient" },
{ path: "link_url", label: "Link", help: "Blank links to the record's own page" },
],
},
{
legend: "Publishing",
fields: [
{
path: "is_featured",
label: "Featured",
widget: "checkbox",
help: "Shown large, above the month list for its year",
},
{ path: "is_published", label: "Published", widget: "checkbox" },
{ path: "sort_order", label: "Sort order", widget: "number" },
],
},
],
children: [
{
key: "people",
label: "People",
addLabel: "Add person",
note:
"For an entry about people. A 'people' entry pointing at a team " +
"already shows that team's members, this is for the cases where " +
"the list is editorial rather than structural.",
title: (row, options) =>
options?.people?.find((p) => p.id === row.person_id)?.label ?? "New person",
blank: { person_id: "" },
fields: [
{
path: "person_id",
label: "Person",
widget: "select",
optionsFrom: "people",
required: true,
},
{ path: "note", label: "Note", help: "Founding lead, first chair" },
],
},
],
};