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:
parent
3d087da005
commit
818d648e91
18 changed files with 964 additions and 35 deletions
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue