Venues, map blocks and event blocks; schedule entries link to them

Data → Venues: a map picture with its locations marked as pins or
boxes (088). A Map block draws a venue with its locations listed;
a schedule names a venue and its entries pick a location, linking to
the map on the page with it lit up. Entries and sub-items can name
an event (a workshop) and take what they leave blank from it, and an
Events block shows event cards.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-11-09 03:21:18 -06:00
parent 3d087da005
commit 818d648e91
18 changed files with 964 additions and 35 deletions

View file

@ -33,6 +33,7 @@ import { tags } from "./adminSchema/tags.ts";
import { contactTypes } from "./adminSchema/contactTypes.ts";
import { redirects } from "./adminSchema/redirects.ts";
import { pages } from "./adminSchema/sitePages.ts";
import { venues } from "./adminSchema/venues.ts";
export const ADMIN_ENTITIES: Record<string, any> = {
organizations,
@ -42,6 +43,7 @@ export const ADMIN_ENTITIES: Record<string, any> = {
tags,
contact_types: contactTypes,
redirects,
venues,
teams,
awards,
timeline,

View file

@ -309,6 +309,8 @@ export const BLOCK_TYPES = [
["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."],
["divider", "Divider", "A thin line between parts."],
];
@ -336,6 +338,42 @@ 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" };
/* 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;
@ -417,8 +455,10 @@ const TAGS_FIELD = {
block's day. */
const SUB_ITEM_FIELDS = [
...scheduleTimeFields(),
eventField(),
{ path: "text", label: "Title", required: true },
{ path: "location", label: "Location", help: "eg. Room B" },
placeField(),
{ path: "location", label: "Location", help: "eg. Room B. Default: the map location's name" },
{
path: "person_id",
label: "Person",
@ -546,13 +586,29 @@ export const blocksChild = {
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) => ({
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: [
{
@ -573,7 +629,7 @@ export const blocksChild = {
key: "items",
label: "Items",
addLabel: "Add item",
when: { path: "type", value: ["list", "links", "schedule", "cards", "people"] },
when: { path: "type", value: ["list", "links", "schedule", "cards", "people", "events"] },
title: (row) => [row.day, row.time || row.start_time, row.text].filter(Boolean).join(" · ") || "New item",
blank: { text: "" },
fields: [
@ -613,11 +669,28 @@ export const blocksChild = {
help: "Shown as a tile with their photo, linked to their page",
when: PEOPLE_ITEM,
},
{ path: "text", label: "Text", required: true, help: "Schedules: the entry's title. Cards: the card's title. People: their title on the tile, eg. Speaker" },
{
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,
},
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",
},
placeField(SCHEDULE_ENTRY),
{
path: "location",
label: "Location",
help: "eg. Main Hall",
help: "eg. Main Hall. Default: the map location's name",
when: SCHEDULE_ENTRY,
},
{
@ -631,6 +704,7 @@ export const blocksChild = {
},
{ 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",

View file

@ -0,0 +1,72 @@
/* ── Venues (088_venues.sql) ─────────────────────────────────────
Data → Venues: a place we gather, with one map picture and the
locations marked on it (a pin or a box each). A Map content block
draws it; a schedule block names it, and its entries pick one of
its locations, linking to the map. Server side:
server/src/admin-schema/venues.js. */
import { mediaUrl } from "../media.ts";
export const venues = {
key: "venues",
label: "Venues",
singular: "venue",
idLabel: "URL ID",
slugFrom: "name",
list: {
columns: [
{ key: "name", label: "Name", primary: true },
{ key: "address", label: "Address" },
],
filters: [],
},
groups: [
{
legend: "Venue",
fields: [
{ path: "name", label: "Name", required: true, help: "eg. Camp Hebron" },
{ path: "address", label: "Address", help: "Shown over the list of locations. Optional." },
{
path: "map_image",
label: "Map",
widget: "image",
crop: "free",
resolve: mediaUrl,
full: true,
help: "One picture of the whole place, eg. the camp's site plan. Locations are marked on it below.",
},
{
path: "map_alt",
label: "Map description",
full: true,
help: "For screen readers. Default: Map of <name>.",
},
],
},
],
children: [
{
key: "locations",
label: "Locations",
addLabel: "Add location",
note: "The places on the map, in the order they're listed. Schedule entries pick one of these.",
title: (row) => row.name || "New location",
blank: () => ({ location_key: crypto.randomUUID().slice(0, 8) }),
fields: [
{ path: "name", label: "Name", required: true, help: "eg. Main Hall" },
{ path: "detail", label: "Detail", help: "A line under the name, eg. Upstairs, by the dining hall" },
{
path: "x",
label: "On the map",
widget: "mapMarker",
imageFrom: "map_image",
full: true,
help: "Click the map for a pin, or drag out a box for an area. Default: listed, not marked.",
},
],
},
],
};

View file

@ -43,6 +43,8 @@ export type ContentBlock = {
| 'tab'
| 'cards'
| 'people'
| 'map'
| 'events'
text?: string | null
media?: string | null
href?: string | null
@ -57,6 +59,43 @@ export type ContentBlock = {
items?: ContentBlockItem[]
/** A schedule's own tags (087). */
tags?: ScheduleTag[]
/** A map or schedule block's venue (088). */
venue_id?: string | null
venue?: Venue | null
}
/** A venue (088): its map picture and the locations marked on it,
* each a pin (x, y) or a box (x, y, w, h), in percent. */
export type Venue = {
id: string
name: string
address?: string | null
map_image?: string | null
map_alt?: string | null
locations: VenueLocation[]
}
export type VenueLocation = {
key: string
name: string
detail?: string | null
x?: number | null
y?: number | null
w?: number | null
h?: number | null
}
/** An event an item names (088): an events block's card, or the
* workshop a schedule entry is. */
export type ItemEvent = {
id: string
title: string
event_type?: string | null
starts_on?: string | null
ends_on?: string | null
date_label?: string | null
color?: string | null
image?: string | null
blurb?: string | null
}
/** A schedule's tag (087). `tab` is whether it gets a tab of its own. */
@ -89,6 +128,11 @@ export type ContentBlockItem = {
items?: ContentBlockItem[]
/** Its block's tags it has, by key (087). */
tags?: string[]
/** The event it is, and its place on the block's venue (088). */
event_id?: string | null
event?: ItemEvent | null
location_key?: string | null
place?: { venue_id: string; key: string; name: string } | null
}
export type Link = {