v1.14.2-present: event schedules, venues and map blocks, Present mode and its phone remote #33
18 changed files with 964 additions and 35 deletions
|
|
@ -181,8 +181,8 @@ also in `server/src/admin-schema/` and a CHECK):
|
||||||
| Links → Kind (on organizations, events, people, teams) | action, social, website, email | no | `splitLinks` in `server/src/shape.js` |
|
| Links → Kind (on organizations, events, people, teams) | action, social, website, email | no | `splitLinks` in `server/src/shape.js` |
|
||||||
| Links → Platform | instagram, facebook, discord, youtube, tiktok, x, substack, spotify, linkedin | **yes**, `PLATFORMS` | `PlatformIcon.tsx` draws the icon on the button. **No CHECK and no `enumeration`**: the column is plain text, so adding one is an entry in `PLATFORMS` (`src/lib/platforms.ts`) and its icon in `src/components/PlatformIcon.tsx`, no migration. |
|
| Links → Platform | instagram, facebook, discord, youtube, tiktok, x, substack, spotify, linkedin | **yes**, `PLATFORMS` | `PlatformIcon.tsx` draws the icon on the button. **No CHECK and no `enumeration`**: the column is plain text, so adding one is an entry in `PLATFORMS` (`src/lib/platforms.ts`) and its icon in `src/components/PlatformIcon.tsx`, no migration. |
|
||||||
| Content blocks → Shown in (slot) | card, body | **yes** | `paragraphs()` in `server/src/shape.js` (card), `ContentBlocks.tsx` (body) |
|
| Content blocks → Shown in (slot) | card, body | **yes** | `paragraphs()` in `server/src/shape.js` (card), `ContentBlocks.tsx` (body) |
|
||||||
| Content blocks → Type | heading, subheading, paragraph, list, links, quote, image, divider, video, button, callout, schedule, table | **yes**, `BLOCK_TYPES` (with each type's description) | `ContentBlocks.tsx` (one renderer per type). Which fields each type shows is `when` on the fields in `blocksChild` (`src/lib/adminSchema/shared.ts`). |
|
| Content blocks → Type | heading, subheading, paragraph, list, links, quote, image, divider, video, button, callout, schedule, table, cards, people, map, events | **yes**, `BLOCK_TYPES` (with each type's description) | `ContentBlocks.tsx` (one renderer per type). Which fields each type shows is `when` on the fields in `blocksChild` (`src/lib/adminSchema/shared.ts`). |
|
||||||
| Content blocks → Schedule items → Type | (blank: normal entry), block, break, heading | **yes**, migration 086 | `SCHEDULE_KINDS` in `src/lib/adminSchema/shared.ts`; drawn by `ScheduleBlock.tsx` and `SchedulePresent.tsx` (which slides each kind gets). A block's sub-items are `content_block_subitems`. A schedule's own tags (087) are `content_block_tags`, rows of the block typed in the admin (not a fixed list); entries name them by `tag_key`, made in the admin as the tag is added. |
|
| Content blocks → Schedule items → Type | (blank: normal entry), block, break, heading | **yes**, migration 086 | `SCHEDULE_KINDS` in `src/lib/adminSchema/shared.ts`; drawn by `ScheduleBlock.tsx` and `SchedulePresent.tsx` (which slides each kind gets). A block's sub-items are `content_block_subitems`. A schedule's own tags (087) are `content_block_tags`, rows of the block typed in the admin (not a fixed list); entries name them by `tag_key`, made in the admin as the tag is added. A schedule's Venue (088) lends its locations (Data → Venues, `venue_locations`) to its entries' Map location, named by `location_key` the same way; an entry's Event (a workshop) fills what it leaves blank in `shape.js` (`attachEvents`). |
|
||||||
| Timeline → Kind (+ list filter) | milestone, event, organization, award, people | no | `KIND_NAMES` in `src/pages/sections/history/TimelineEntry.tsx` |
|
| Timeline → Kind (+ list filter) | milestone, event, organization, award, people | no | `KIND_NAMES` in `src/pages/sections/history/TimelineEntry.tsx` |
|
||||||
| Timeline → Points at (+ list filter) | event, organization, award, person, team | no | `refHref` in `src/lib/hrefs.ts` |
|
| Timeline → Points at (+ list filter) | event, organization, award, person, team | no | `refHref` in `src/lib/hrefs.ts` |
|
||||||
| Timeline → Precision (and on events/orgs) | year, month, day | no | the history page's grouping |
|
| Timeline → Precision (and on events/orgs) | year, month, day | no | the history page's grouping |
|
||||||
|
|
@ -272,7 +272,7 @@ A Numbers section's "Number Source" dropdown works the same way:
|
||||||
| The icons a Connect nav section's path can pick | `src/data/pathIcons.ts` (keys and labels) **and** `ICONS` in `src/pages/sections/home/Pathfinder.tsx` (the Phosphor icon for each key) | Add a line to both. A path saved with an emoji from before the list shows it as it is. |
|
| The icons a Connect nav section's path can pick | `src/data/pathIcons.ts` (keys and labels) **and** `ICONS` in `src/pages/sections/home/Pathfinder.tsx` (the Phosphor icon for each key) | Add a line to both. A path saved with an emoji from before the list shows it as it is. |
|
||||||
| A page section's accent color | `BRAND` and `ACCENTS` in `src/lib/color.ts` | Pages pick from these (`accent: ACCENTS.green`); add a color there, not a hex in a page. Each is readable as text on white and the tints. |
|
| A page section's accent color | `BRAND` and `ACCENTS` in `src/lib/color.ts` | Pages pick from these (`accent: ACCENTS.green`); add a color there, not a hex in a page. Each is readable as text on white and the tints. |
|
||||||
| The palette (the 16-color grid the theme is drawn from) | `PALETTE` in `src/lib/color.ts` | Four families, a column each. `PALETTE_LIGHT` / `PALETTE_DARK` are the fills things colored by data use (a person's initials tile, `paletteFill`); the page background's layers (how many circles, their sizes and parallax speeds) are `LAYERS` in `src/components/PageBackdrop.tsx` and its shades are in `PageBackdrop.css`; the admin home's two alternating group colors are `BLOCK_COLORS` in `src/pages/admin/AdminHome.tsx`. |
|
| The palette (the 16-color grid the theme is drawn from) | `PALETTE` in `src/lib/color.ts` | Four families, a column each. `PALETTE_LIGHT` / `PALETTE_DARK` are the fills things colored by data use (a person's initials tile, `paletteFill`); the page background's layers (how many circles, their sizes and parallax speeds) are `LAYERS` in `src/components/PageBackdrop.tsx` and its shades are in `PageBackdrop.css`; the admin home's two alternating group colors are `BLOCK_COLORS` in `src/pages/admin/AdminHome.tsx`. |
|
||||||
| The accessibility panel's choices (bottom right of every public page) | `SETTINGS` in `src/components/AccessibilityPanel.tsx`; the color blind modes are `VISIONS` and `SWAPS` in `src/lib/color.ts` | Each choice is an attribute on `<html>` styled in `src/index.css`, and `index.html` sets it again before the first paint, so a new one goes in all three. A color blind mode replaces all three color families, teal, green and amber (`SWAPS`, picked by simulating each type: see the comment there), in code, in data colors as they load (`src/lib/api.ts`, never under /admin), in CSS (the `--pal-*` variables in `src/index.css`, which hold the same values as `SWAPS`: change both) and in the theme tokens drawn from them. A palette hex in a component or CSS file should be `var(--pal-<family>-<shade>)` (eg. `var(--pal-amber-2)`), or a color blind mode won't reach it. Reading mode is `src/components/ReaderView.tsx`, which reads the hidden page and writes out its headings, paragraphs, links and described pictures. A part it can't read well (a carousel, tabs, details behind a click, a map) draws its own text version when `useReadingMode()` (`src/lib/readingMode.ts`) is on: the hero, pathfinder, stats, history rail, event lists, calendar (the next six weeks), featured cards, org lists and groups map, history timeline, schedule, people tiles and video player; the countdown draws nothing. A new component with any of those should do the same. Something saved or sent (the newsletter's colors) is a stored hex, which is never swapped. |
|
| The accessibility panel's choices (bottom right of every public page) | `SETTINGS` in `src/components/AccessibilityPanel.tsx`; the color blind modes are `VISIONS` and `SWAPS` in `src/lib/color.ts` | Each choice is an attribute on `<html>` styled in `src/index.css`, and `index.html` sets it again before the first paint, so a new one goes in all three. A color blind mode replaces all three color families, teal, green and amber (`SWAPS`, picked by simulating each type: see the comment there), in code, in data colors as they load (`src/lib/api.ts`, never under /admin), in CSS (the `--pal-*` variables in `src/index.css`, which hold the same values as `SWAPS`: change both) and in the theme tokens drawn from them. A palette hex in a component or CSS file should be `var(--pal-<family>-<shade>)` (eg. `var(--pal-amber-2)`), or a color blind mode won't reach it. Reading mode is `src/components/ReaderView.tsx`, which reads the hidden page and writes out its headings, paragraphs, links and described pictures. A part it can't read well (a carousel, tabs, details behind a click, a map) draws its own text version when `useReadingMode()` (`src/lib/readingMode.ts`) is on: the hero, pathfinder, stats, history rail, event lists, calendar (the next six weeks), featured cards, org lists and groups map, history timeline, schedule, map block (its list alone), people tiles and video player; the countdown draws nothing. A new component with any of those should do the same. Something saved or sent (the newsletter's colors) is a stored hex, which is never swapped. |
|
||||||
| Privacy Policy and Terms wording | the database (082) | Admin → Pages → Page management → Privacy Policy or Terms of Service: their sections' blocks, and the "Last updated" date in the section's blurb whenever the wording changes. The privacy contact email is in the policy's text. The Privacy page must stay true of the code: what the feedback form stores, what the browser keeps, which embeds wait for a click. |
|
| Privacy Policy and Terms wording | the database (082) | Admin → Pages → Page management → Privacy Policy or Terms of Service: their sections' blocks, and the "Last updated" date in the section's blurb whenever the wording changes. The privacy contact email is in the policy's text. The Privacy page must stay true of the code: what the feedback form stores, what the browser keeps, which embeds wait for a click. |
|
||||||
| Event type labels and plurals (public site) | `src/lib/eventTypes.ts` | Also the order of the type filter chips. |
|
| Event type labels and plurals (public site) | `src/lib/eventTypes.ts` | Also the order of the type filter chips. |
|
||||||
| Event and person role labels (public site) | `ROLE_LABEL` in `src/pages/EventDetail.tsx` and `src/pages/PersonDetail.tsx` | |
|
| Event and person role labels (public site) | `ROLE_LABEL` in `src/pages/EventDetail.tsx` and `src/pages/PersonDetail.tsx` | |
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,7 @@ import { tags } from "./admin-schema/tags.js";
|
||||||
import { contactTypes } from "./admin-schema/contactTypes.js";
|
import { contactTypes } from "./admin-schema/contactTypes.js";
|
||||||
import { redirects } from "./admin-schema/redirects.js";
|
import { redirects } from "./admin-schema/redirects.js";
|
||||||
import { pages } from "./admin-schema/sitePages.js";
|
import { pages } from "./admin-schema/sitePages.js";
|
||||||
|
import { venues } from "./admin-schema/venues.js";
|
||||||
|
|
||||||
export const ENTITIES = {
|
export const ENTITIES = {
|
||||||
organizations,
|
organizations,
|
||||||
|
|
@ -73,6 +74,7 @@ export const ENTITIES = {
|
||||||
tags,
|
tags,
|
||||||
contact_types: contactTypes,
|
contact_types: contactTypes,
|
||||||
redirects,
|
redirects,
|
||||||
|
venues,
|
||||||
teams,
|
teams,
|
||||||
awards,
|
awards,
|
||||||
timeline,
|
timeline,
|
||||||
|
|
@ -106,6 +108,15 @@ export const OPTION_QUERIES = {
|
||||||
contact_types: "SELECT id, name AS label FROM contact_types ORDER BY sort_order, name",
|
contact_types: "SELECT id, name AS label FROM contact_types ORDER BY sort_order, name",
|
||||||
// Link fields with `redirects: true` pick from these (068).
|
// Link fields with `redirects: true` pick from these (068).
|
||||||
redirects: "SELECT id, id || ' (' || target_url || ')' AS label FROM redirects ORDER BY id",
|
redirects: "SELECT id, id || ' (' || target_url || ')' AS label FROM redirects ORDER BY id",
|
||||||
|
// A map block's venue; its locations ride along (as JSON) for a
|
||||||
|
// schedule's entries to pick from and for the block's preview.
|
||||||
|
venues: `
|
||||||
|
SELECT v.id, v.name AS label, v.map_image, v.map_alt,
|
||||||
|
(SELECT json_group_array(json_object('key', l.location_key, 'name', l.name, 'detail', l.detail,
|
||||||
|
'x', l.x, 'y', l.y, 'w', l.w, 'h', l.h))
|
||||||
|
FROM (SELECT * FROM venue_locations WHERE venue_id = v.id ORDER BY sort_order) l) AS locations
|
||||||
|
FROM venues v
|
||||||
|
ORDER BY v.name`,
|
||||||
blog_posts: "SELECT id, title AS label FROM blog_posts ORDER BY published_on DESC, title",
|
blog_posts: "SELECT id, title AS label FROM blog_posts ORDER BY published_on DESC, title",
|
||||||
// Navigation's Under page: a page by its address (080).
|
// Navigation's Under page: a page by its address (080).
|
||||||
site_pages: "SELECT path AS id, title || ' (' || path || ')' AS label FROM site_pages ORDER BY sort_order, title",
|
site_pages: "SELECT path AS id, title || ' (' || path || ')' AS label FROM site_pages ORDER BY sort_order, title",
|
||||||
|
|
|
||||||
|
|
@ -154,6 +154,9 @@ export const blocksChild = (ownerKind) => ({
|
||||||
"people",
|
"people",
|
||||||
// A blog post's tab (079): its text is the tab's title.
|
// A blog post's tab (079): its text is the tab's title.
|
||||||
"tab",
|
"tab",
|
||||||
|
// A venue's map, and event cards (088).
|
||||||
|
"map",
|
||||||
|
"events",
|
||||||
],
|
],
|
||||||
{ required: true },
|
{ required: true },
|
||||||
),
|
),
|
||||||
|
|
@ -170,6 +173,8 @@ export const blocksChild = (ownerKind) => ({
|
||||||
int("word_seconds"),
|
int("word_seconds"),
|
||||||
// People blocks only (054): whose team's tiles to show.
|
// People blocks only (054): whose team's tiles to show.
|
||||||
text("team_id"),
|
text("team_id"),
|
||||||
|
// Map and schedule blocks (088): whose map and locations.
|
||||||
|
text("venue_id"),
|
||||||
],
|
],
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
|
|
@ -198,6 +203,10 @@ export const blocksChild = (ownerKind) => ({
|
||||||
bool("featured"),
|
bool("featured"),
|
||||||
// The block's tags it has, by key, comma-separated (087).
|
// The block's tags it has, by key, comma-separated (087).
|
||||||
text("tags"),
|
text("tags"),
|
||||||
|
// A workshop or other event it is, and its place on the
|
||||||
|
// block's venue map (088).
|
||||||
|
text("event_id"),
|
||||||
|
text("location_key"),
|
||||||
],
|
],
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
|
|
@ -223,6 +232,8 @@ export const blocksChild = (ownerKind) => ({
|
||||||
text("map_image"),
|
text("map_image"),
|
||||||
bool("featured"),
|
bool("featured"),
|
||||||
text("tags"),
|
text("tags"),
|
||||||
|
text("event_id"),
|
||||||
|
text("location_key"),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
|
||||||
44
server/src/admin-schema/venues.js
Normal file
44
server/src/admin-schema/venues.js
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
import { text, real } from "./columns.js";
|
||||||
|
|
||||||
|
/* ── Venues (088_venues.sql) ─────────────────────────────────────
|
||||||
|
|
||||||
|
A place we gather, with its map picture and the locations marked
|
||||||
|
on it. Map blocks draw it, and schedule entries link to its
|
||||||
|
locations. Its own entity because content_blocks.venue_id points
|
||||||
|
at it; nothing points at a location's row, entries name one by
|
||||||
|
location_key, so the locations can be replaced wholesale. */
|
||||||
|
|
||||||
|
export const venues = {
|
||||||
|
key: "venues",
|
||||||
|
table: "venues",
|
||||||
|
idColumn: "id",
|
||||||
|
idKind: "slug",
|
||||||
|
|
||||||
|
list: {
|
||||||
|
columns: ["id", "name", "address"],
|
||||||
|
filters: [],
|
||||||
|
search: ["name", "id", "address"],
|
||||||
|
order: "name",
|
||||||
|
},
|
||||||
|
|
||||||
|
columns: [text("name", { required: true }), text("address"), text("map_image"), text("map_alt")],
|
||||||
|
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
key: "locations",
|
||||||
|
table: "venue_locations",
|
||||||
|
owner: { column: "venue_id" },
|
||||||
|
order: "sort_order",
|
||||||
|
columns: [
|
||||||
|
// Made by the admin as the row is added, so it isn't input.
|
||||||
|
text("location_key", { required: true, seeded: true }),
|
||||||
|
text("name", { required: true }),
|
||||||
|
text("detail"),
|
||||||
|
real("x"),
|
||||||
|
real("y"),
|
||||||
|
real("w"),
|
||||||
|
real("h"),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
125
server/src/migrations/088_venues.sql
Normal file
125
server/src/migrations/088_venues.sql
Normal file
|
|
@ -0,0 +1,125 @@
|
||||||
|
-- ═══════════════════════════════════════════════════════════════
|
||||||
|
-- 088 VENUES, MAP BLOCKS AND EVENT BLOCKS
|
||||||
|
--
|
||||||
|
-- Data → Venues: a place we gather (a camp, a church), with one map
|
||||||
|
-- picture and its marked locations, each a pin (x, y) or a box
|
||||||
|
-- (x, y, w, h), in percent of the picture from its top left.
|
||||||
|
--
|
||||||
|
-- A 'map' content block draws a venue's map with its locations
|
||||||
|
-- listed beside it; a schedule block names a venue too, and its
|
||||||
|
-- entries and sub-items pick one of its locations (location_key),
|
||||||
|
-- which links to the map block on the same page, the location
|
||||||
|
-- lit up. The venue's locations are rewritten on every save, so an
|
||||||
|
-- entry names one by `location_key` (made in the admin when the
|
||||||
|
-- location is added), as schedule tags do (087).
|
||||||
|
--
|
||||||
|
-- An 'events' content block shows events as cards, an item each
|
||||||
|
-- (event_id); a schedule entry or sub-item can name an event too
|
||||||
|
-- (a workshop), and takes what it leaves blank from it.
|
||||||
|
--
|
||||||
|
-- content_blocks.type's CHECK can't change in place, so the table
|
||||||
|
-- is rebuilt (as in 079), then its index and owner trigger made
|
||||||
|
-- again.
|
||||||
|
-- ═══════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
CREATE TABLE venues (
|
||||||
|
id TEXT PRIMARY KEY
|
||||||
|
CONSTRAINT "A venue's URL ID can use only lowercase letters, numbers and hyphens, eg. camp-hebron."
|
||||||
|
CHECK (id <> '' AND id NOT GLOB '*[^a-z0-9-]*'),
|
||||||
|
name TEXT NOT NULL,
|
||||||
|
address TEXT,
|
||||||
|
map_image TEXT, -- an upload
|
||||||
|
map_alt TEXT
|
||||||
|
) STRICT;
|
||||||
|
|
||||||
|
CREATE TABLE venue_locations (
|
||||||
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
venue_id TEXT NOT NULL REFERENCES venues (id) ON DELETE CASCADE,
|
||||||
|
sort_order INTEGER NOT NULL DEFAULT 0,
|
||||||
|
location_key TEXT NOT NULL,
|
||||||
|
name TEXT NOT NULL,
|
||||||
|
detail TEXT,
|
||||||
|
x REAL CHECK (x BETWEEN 0 AND 100),
|
||||||
|
y REAL CHECK (y BETWEEN 0 AND 100),
|
||||||
|
w REAL CHECK (w > 0 AND w <= 100), -- null: a pin
|
||||||
|
h REAL CHECK (h > 0 AND h <= 100),
|
||||||
|
UNIQUE (venue_id, location_key)
|
||||||
|
) STRICT;
|
||||||
|
|
||||||
|
ALTER TABLE content_block_items ADD COLUMN event_id TEXT
|
||||||
|
REFERENCES events (id) ON DELETE SET NULL;
|
||||||
|
ALTER TABLE content_block_items ADD COLUMN location_key TEXT;
|
||||||
|
ALTER TABLE content_block_subitems ADD COLUMN event_id TEXT
|
||||||
|
REFERENCES events (id) ON DELETE SET NULL;
|
||||||
|
ALTER TABLE content_block_subitems ADD COLUMN location_key TEXT;
|
||||||
|
|
||||||
|
CREATE TABLE content_blocks_new (
|
||||||
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
owner_kind TEXT NOT NULL
|
||||||
|
CHECK (owner_kind IN ('organization', 'event', 'person', 'team', 'blog_post', 'page_section',
|
||||||
|
'newsletter')),
|
||||||
|
owner_id TEXT NOT NULL,
|
||||||
|
slot TEXT NOT NULL DEFAULT 'body' CHECK (slot IN ('card', 'body', 'both')),
|
||||||
|
sort_order INTEGER NOT NULL DEFAULT 0,
|
||||||
|
|
||||||
|
type TEXT NOT NULL
|
||||||
|
CHECK (type IN ('heading', 'subheading', 'paragraph',
|
||||||
|
'list', 'links', 'quote', 'image', 'divider',
|
||||||
|
'video', 'button', 'callout', 'schedule', 'table', 'cards',
|
||||||
|
'people', 'tab', 'map', 'events')),
|
||||||
|
text TEXT,
|
||||||
|
media TEXT,
|
||||||
|
href TEXT,
|
||||||
|
alt TEXT,
|
||||||
|
cite TEXT,
|
||||||
|
team_id TEXT REFERENCES teams (id) ON DELETE SET NULL,
|
||||||
|
captions TEXT,
|
||||||
|
word_motion TEXT CHECK (word_motion IN ('slide', 'flip', 'fade', 'type', 'mirror')),
|
||||||
|
word_direction TEXT CHECK (word_direction IN ('top', 'bottom')),
|
||||||
|
word_seconds INTEGER CHECK (word_seconds BETWEEN 1 AND 20),
|
||||||
|
-- Map and schedule blocks: whose map, and whose locations.
|
||||||
|
venue_id TEXT REFERENCES venues (id) ON DELETE SET NULL
|
||||||
|
) STRICT;
|
||||||
|
|
||||||
|
INSERT INTO content_blocks_new
|
||||||
|
(id, owner_kind, owner_id, slot, sort_order, type, text, media, href, alt, cite, team_id, captions,
|
||||||
|
word_motion, word_direction, word_seconds)
|
||||||
|
SELECT id, owner_kind, owner_id, slot, sort_order, type, text, media, href, alt, cite, team_id, captions,
|
||||||
|
word_motion, word_direction, word_seconds
|
||||||
|
FROM content_blocks;
|
||||||
|
|
||||||
|
PRAGMA legacy_alter_table = ON;
|
||||||
|
DROP TABLE content_blocks;
|
||||||
|
ALTER TABLE content_blocks_new RENAME TO content_blocks;
|
||||||
|
PRAGMA legacy_alter_table = OFF;
|
||||||
|
|
||||||
|
CREATE INDEX content_blocks_owner_idx
|
||||||
|
ON content_blocks (owner_kind, owner_id, slot, sort_order);
|
||||||
|
|
||||||
|
CREATE TRIGGER content_blocks_owner_exists
|
||||||
|
BEFORE INSERT ON content_blocks
|
||||||
|
BEGIN
|
||||||
|
SELECT CASE
|
||||||
|
WHEN new.owner_kind = 'event'
|
||||||
|
AND NOT EXISTS (SELECT 1 FROM events WHERE id = new.owner_id)
|
||||||
|
THEN RAISE(ABORT, 'content_blocks: no such event')
|
||||||
|
WHEN new.owner_kind = 'organization'
|
||||||
|
AND NOT EXISTS (SELECT 1 FROM organizations WHERE id = new.owner_id)
|
||||||
|
THEN RAISE(ABORT, 'content_blocks: no such organization')
|
||||||
|
WHEN new.owner_kind = 'person'
|
||||||
|
AND NOT EXISTS (SELECT 1 FROM people WHERE id = new.owner_id)
|
||||||
|
THEN RAISE(ABORT, 'content_blocks: no such person')
|
||||||
|
WHEN new.owner_kind = 'team'
|
||||||
|
AND NOT EXISTS (SELECT 1 FROM teams WHERE id = new.owner_id)
|
||||||
|
THEN RAISE(ABORT, 'content_blocks: no such team')
|
||||||
|
WHEN new.owner_kind = 'blog_post'
|
||||||
|
AND NOT EXISTS (SELECT 1 FROM blog_posts WHERE id = new.owner_id)
|
||||||
|
THEN RAISE(ABORT, 'content_blocks: no such blog post')
|
||||||
|
WHEN new.owner_kind = 'page_section'
|
||||||
|
AND NOT EXISTS (SELECT 1 FROM page_sections WHERE CAST(id AS TEXT) = new.owner_id)
|
||||||
|
THEN RAISE(ABORT, 'content_blocks: no such page section')
|
||||||
|
WHEN new.owner_kind = 'newsletter'
|
||||||
|
AND NOT EXISTS (SELECT 1 FROM newsletters WHERE CAST(id AS TEXT) = new.owner_id)
|
||||||
|
THEN RAISE(ABORT, 'content_blocks: no such newsletter')
|
||||||
|
END;
|
||||||
|
END;
|
||||||
|
|
@ -79,6 +79,7 @@ const MEMBERS = ["showcase-member-1", "showcase-member-2", "showcase-member-3"];
|
||||||
const EVENT = "showcase-event";
|
const EVENT = "showcase-event";
|
||||||
const SERIES = "showcase-series";
|
const SERIES = "showcase-series";
|
||||||
const PAST = "showcase-past-event";
|
const PAST = "showcase-past-event";
|
||||||
|
const VENUE = "showcase-venue";
|
||||||
|
|
||||||
/* ── Content ───────────────────────────────────────────────── */
|
/* ── Content ───────────────────────────────────────────────── */
|
||||||
|
|
||||||
|
|
@ -87,21 +88,24 @@ const PAST = "showcase-past-event";
|
||||||
a description, graphic and map, one linked, a heading, a featured
|
a description, graphic and map, one linked, a heading, a featured
|
||||||
entry, a block with sub-items, a break, typed and picked times,
|
entry, a block with sub-items, a break, typed and picked times,
|
||||||
tags (one a tab of its own in its color, one with No tab), and one
|
tags (one a tab of its own in its color, one with No tab), and one
|
||||||
with no day (it lands in a tab of its own). */
|
with no day (it lands in a tab of its own). Its venue's locations
|
||||||
|
(088) are picked on some entries, one with no typed Location, and
|
||||||
|
one sub-item is the showcase workshop, filled in from it. */
|
||||||
const SCHEDULE = [
|
const SCHEDULE = [
|
||||||
"schedule",
|
"schedule",
|
||||||
{ text: "The weekend at a glance. Tap an entry for more." },
|
{ text: "The weekend at a glance. Tap an entry for more.", venue_id: VENUE },
|
||||||
[
|
[
|
||||||
{ day: "Friday", start_time: "16:00", text: "Arrivals and check-in", location: "Front desk", tags: "showcase-youth,showcase-all" },
|
{ day: "Friday", start_time: "16:00", text: "Arrivals and check-in", location: "Front desk", tags: "showcase-youth,showcase-all" },
|
||||||
{ day: "Friday", kind: "heading", text: "Evening", detail: "A heading across the day" },
|
{ day: "Friday", kind: "heading", text: "Evening", detail: "A heading across the day" },
|
||||||
{ day: "Friday", time: "7:00 to 8:30pm", text: "Opening session", location: "Main Hall", person_id: "showcase-person", detail: "Welcome and worship", description: "The **opening session** sets the theme for the weekend.\n\nBring a notebook.", media: "/uploads/showcase.jpg", map: "Camp Hebron, Halifax PA", map_image: "/uploads/showcase.jpg" },
|
{ day: "Friday", time: "7:00 to 8:30pm", text: "Opening session", location_key: "hall", person_id: "showcase-person", detail: "Welcome and worship", description: "The **opening session** sets the theme for the weekend.\n\nBring a notebook.", media: "/uploads/showcase.jpg", map: "Camp Hebron, Halifax PA", map_image: "/uploads/showcase.jpg" },
|
||||||
{ day: "Saturday", start_time: "08:00", end_time: "09:00", kind: "break", text: "Breakfast", location: "Dining hall" },
|
{ day: "Saturday", start_time: "08:00", end_time: "09:00", kind: "break", text: "Breakfast", location: "Dining hall" },
|
||||||
{ day: "Saturday", start_time: "09:00", end_time: "10:30", kind: "block", text: "Workshops", location: "Classrooms", detail: "Pick one of three", items: [
|
{ day: "Saturday", start_time: "09:00", end_time: "10:30", kind: "block", text: "Workshops", location: "Classrooms", detail: "Pick one of three", items: [
|
||||||
{ start_time: "09:00", end_time: "09:45", text: "Leading worship", location: "Room A", person_id: "showcase-member-2", url: "/blog/content-block-showcase" },
|
{ start_time: "09:00", end_time: "09:45", text: "Leading worship", location: "Room A", location_key: "rooma", person_id: "showcase-member-2", url: "/blog/content-block-showcase" },
|
||||||
|
{ start_time: "09:00", end_time: "09:45", text: "Showcase Past Workshop", event_id: PAST, location_key: "rooma" },
|
||||||
{ start_time: "09:00", end_time: "09:45", text: "Speaking with confidence", location: "Room B", featured: 1, tags: "showcase-youth", description: "A featured sub-item that folds out." },
|
{ start_time: "09:00", end_time: "09:45", text: "Speaking with confidence", location: "Room B", featured: 1, tags: "showcase-youth", description: "A featured sub-item that folds out." },
|
||||||
{ time: "After the first round", text: "Open questions", location: "Room C" },
|
{ time: "After the first round", text: "Open questions", location: "Room C" },
|
||||||
] },
|
] },
|
||||||
{ day: "Saturday", start_time: "19:00", featured: 1, tags: "showcase-youth", text: "Talent night", location: "Main Hall", person_id: "showcase-member-3", description: "Sign up at the front desk by noon." },
|
{ day: "Saturday", start_time: "19:00", featured: 1, tags: "showcase-youth", text: "Talent night", location: "Main Hall", location_key: "hall", person_id: "showcase-member-3", description: "Sign up at the front desk by noon." },
|
||||||
{ day: "Sunday", time: "10:00am", text: "Closing service", location: "Chapel", map: "Main Street, Halifax PA" },
|
{ day: "Sunday", time: "10:00am", text: "Closing service", location: "Chapel", map: "Main Street, Halifax PA" },
|
||||||
{ time: "Any time", text: "Quiet room open", location: "Library", detail: "An entry with no day" },
|
{ time: "Any time", text: "Quiet room open", location: "Library", detail: "An entry with no day" },
|
||||||
],
|
],
|
||||||
|
|
@ -141,6 +145,13 @@ const ALL_BLOCKS = [
|
||||||
["image", { media: IMAGE, alt: "The same picture, linked", href: "/history" }],
|
["image", { media: IMAGE, alt: "The same picture, linked", href: "/history" }],
|
||||||
["subheading", { text: "Schedule" }],
|
["subheading", { text: "Schedule" }],
|
||||||
SCHEDULE,
|
SCHEDULE,
|
||||||
|
["subheading", { text: "Map" }],
|
||||||
|
["map", { venue_id: VENUE }],
|
||||||
|
["subheading", { text: "Events" }],
|
||||||
|
["events", {}, [
|
||||||
|
{ event_id: PAST, text: "Showcase Past Workshop" },
|
||||||
|
{ event_id: "showcase-event", text: "A card with its own title", detail: "And its own text in place of the event's." },
|
||||||
|
]],
|
||||||
["subheading", { text: "Video" }],
|
["subheading", { text: "Video" }],
|
||||||
["video", { href: "https://www.youtube.com/watch?v=dQw4w9WgXcQ", text: "A YouTube video, with its own thumbnail" }],
|
["video", { href: "https://www.youtube.com/watch?v=dQw4w9WgXcQ", text: "A YouTube video, with its own thumbnail" }],
|
||||||
["video", { href: "https://vimeo.com/76979871", media: IMAGE, text: "A Vimeo video with an uploaded still" }],
|
["video", { href: "https://vimeo.com/76979871", media: IMAGE, text: "A Vimeo video with an uploaded still" }],
|
||||||
|
|
@ -255,6 +266,7 @@ tx(db, () => {
|
||||||
db.prepare(`DELETE FROM awards WHERE id LIKE 'showcase-%'`).run();
|
db.prepare(`DELETE FROM awards WHERE id LIKE 'showcase-%'`).run();
|
||||||
db.prepare(`DELETE FROM affiliations WHERE person_id LIKE 'showcase-%' OR org_id LIKE 'showcase-%'`).run();
|
db.prepare(`DELETE FROM affiliations WHERE person_id LIKE 'showcase-%' OR org_id LIKE 'showcase-%'`).run();
|
||||||
db.prepare(`DELETE FROM teams WHERE id LIKE 'showcase-%'`).run();
|
db.prepare(`DELETE FROM teams WHERE id LIKE 'showcase-%'`).run();
|
||||||
|
db.prepare(`DELETE FROM venues WHERE id LIKE 'showcase-%'`).run();
|
||||||
db.prepare(`DELETE FROM people WHERE id LIKE 'showcase-%'`).run();
|
db.prepare(`DELETE FROM people WHERE id LIKE 'showcase-%'`).run();
|
||||||
db.prepare(`DELETE FROM organizations WHERE id = ?`).run(GROUP);
|
db.prepare(`DELETE FROM organizations WHERE id = ?`).run(GROUP);
|
||||||
db.prepare(`DELETE FROM organizations WHERE id LIKE 'showcase-%'`).run();
|
db.prepare(`DELETE FROM organizations WHERE id LIKE 'showcase-%'`).run();
|
||||||
|
|
@ -412,7 +424,6 @@ tx(db, () => {
|
||||||
{ kind: "social", platform: "instagram", label: "@showcaseretreat", url: "https://instagram.com/showcaseretreat" },
|
{ kind: "social", platform: "instagram", label: "@showcaseretreat", url: "https://instagram.com/showcaseretreat" },
|
||||||
]);
|
]);
|
||||||
blocks("event", EVENT, "both", cardText("event"));
|
blocks("event", EVENT, "both", cardText("event"));
|
||||||
blocks("event", EVENT, "body", [...pageBody("event"), ["heading", { text: "Schedule" }], SCHEDULE]);
|
|
||||||
|
|
||||||
insert("events", {
|
insert("events", {
|
||||||
id: SERIES,
|
id: SERIES,
|
||||||
|
|
@ -458,6 +469,23 @@ tx(db, () => {
|
||||||
insert("event_people", { event_id: PAST, person_id: PERSON, role: "host", is_public: 1, sort_order: 0 });
|
insert("event_people", { event_id: PAST, person_id: PERSON, role: "host", is_public: 1, sort_order: 0 });
|
||||||
blocks("event", PAST, "card", cardText("past event"));
|
blocks("event", PAST, "card", cardText("past event"));
|
||||||
|
|
||||||
|
/* ── Venue (088): a pin, a box and an unmarked location ── */
|
||||||
|
insert("venues", { id: VENUE, name: "Showcase Retreat Center", address: "123 Example Road, Exampletown PA", map_image: IMAGE });
|
||||||
|
[
|
||||||
|
{ location_key: "hall", name: "Main Hall", detail: "Sessions and talent night", x: 30, y: 40 },
|
||||||
|
{ location_key: "rooma", name: "Room A", detail: "Workshops", x: 55, y: 20, w: 25, h: 30 },
|
||||||
|
{ location_key: "desk", name: "Front desk", detail: "Not marked on the map" },
|
||||||
|
].forEach((location, i) => insert("venue_locations", { venue_id: VENUE, sort_order: i, ...location }));
|
||||||
|
|
||||||
|
// The retreat's page, after the workshop and venue its schedule names.
|
||||||
|
blocks("event", EVENT, "body", [
|
||||||
|
...pageBody("event"),
|
||||||
|
["heading", { text: "Schedule" }],
|
||||||
|
SCHEDULE,
|
||||||
|
["heading", { text: "Map" }],
|
||||||
|
["map", { venue_id: VENUE }],
|
||||||
|
]);
|
||||||
|
|
||||||
/* ── Award ── */
|
/* ── Award ── */
|
||||||
insert("awards", {
|
insert("awards", {
|
||||||
id: AWARD,
|
id: AWARD,
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ export function loadBlocks(db, ownerKind, ids, slot = "body") {
|
||||||
|
|
||||||
const blockRows = db
|
const blockRows = db
|
||||||
.prepare(
|
.prepare(
|
||||||
`SELECT id, owner_id, type, text, media, href, alt, cite, captions, team_id,
|
`SELECT id, owner_id, type, text, media, href, alt, cite, captions, team_id, venue_id,
|
||||||
word_motion, word_direction, word_seconds
|
word_motion, word_direction, word_seconds
|
||||||
FROM content_blocks
|
FROM content_blocks
|
||||||
WHERE owner_kind = ? AND slot IN (?, 'both') AND owner_id IN (${placeholders(ids.length)})
|
WHERE owner_kind = ? AND slot IN (?, 'both') AND owner_id IN (${placeholders(ids.length)})
|
||||||
|
|
@ -92,6 +92,7 @@ export function loadBlocks(db, ownerKind, ids, slot = "body") {
|
||||||
cite: row.cite,
|
cite: row.cite,
|
||||||
captions: row.captions,
|
captions: row.captions,
|
||||||
team_id: row.team_id,
|
team_id: row.team_id,
|
||||||
|
venue_id: row.venue_id,
|
||||||
// Its rotating words' motion (084), when it has its own.
|
// Its rotating words' motion (084), when it has its own.
|
||||||
words: row.word_motion || row.word_direction || row.word_seconds
|
words: row.word_motion || row.word_direction || row.word_seconds
|
||||||
? { motion: row.word_motion, direction: row.word_direction, seconds: row.word_seconds }
|
? { motion: row.word_motion, direction: row.word_direction, seconds: row.word_seconds }
|
||||||
|
|
@ -109,6 +110,7 @@ export function loadBlocks(db, ownerKind, ids, slot = "body") {
|
||||||
|
|
||||||
const ENTRY_FIELDS = `i.text, i.detail, i.url, i.start_time, i.end_time, i.time, i.location,
|
const ENTRY_FIELDS = `i.text, i.detail, i.url, i.start_time, i.end_time, i.time, i.location,
|
||||||
i.description, i.media, i.media_alt, i.map, i.map_image, i.featured, i.tags,
|
i.description, i.media, i.media_alt, i.map, i.map_image, i.featured, i.tags,
|
||||||
|
i.event_id, i.location_key,
|
||||||
p.id AS person_id, p.display_name AS person_name,
|
p.id AS person_id, p.display_name AS person_name,
|
||||||
p.photo AS person_photo, p.tagline AS person_tagline`;
|
p.photo AS person_photo, p.tagline AS person_tagline`;
|
||||||
|
|
||||||
|
|
@ -172,9 +174,107 @@ export function loadBlocks(db, ownerKind, ids, slot = "body") {
|
||||||
block.items.forEach(cut);
|
block.items.forEach(cut);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
attachVenues(db, [...byId.values()]);
|
||||||
|
attachEvents(db, [...byId.values()]);
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* A map or schedule block's venue (088), its locations in order,
|
||||||
|
and each entry's location_key made its place on it: `place` is
|
||||||
|
the location, and the location's name stands in for a blank
|
||||||
|
typed Location. A key the venue no longer has is dropped. */
|
||||||
|
function attachVenues(db, blocks) {
|
||||||
|
const ids = [...new Set(blocks.map((block) => block.venue_id).filter(Boolean))];
|
||||||
|
if (ids.length === 0) return;
|
||||||
|
const venues = new Map(
|
||||||
|
db
|
||||||
|
.prepare(`SELECT id, name, address, map_image, map_alt FROM venues WHERE id IN (${placeholders(ids.length)})`)
|
||||||
|
.all(...ids)
|
||||||
|
.map((row) => [row.id, { ...row, locations: [] }]),
|
||||||
|
);
|
||||||
|
const locationRows = db
|
||||||
|
.prepare(
|
||||||
|
`SELECT venue_id, location_key AS key, name, detail, x, y, w, h
|
||||||
|
FROM venue_locations
|
||||||
|
WHERE venue_id IN (${placeholders(ids.length)})
|
||||||
|
ORDER BY venue_id, sort_order`,
|
||||||
|
)
|
||||||
|
.all(...ids);
|
||||||
|
for (const { venue_id, ...location } of locationRows) venues.get(venue_id)?.locations.push(location);
|
||||||
|
|
||||||
|
for (const block of blocks) {
|
||||||
|
const venue = venues.get(block.venue_id);
|
||||||
|
block.venue = venue ?? null;
|
||||||
|
const place = (entry) => {
|
||||||
|
const location = venue?.locations.find((l) => l.key === entry.location_key) ?? null;
|
||||||
|
entry.place = location ? { venue_id: venue.id, key: location.key, name: location.name } : null;
|
||||||
|
if (location && !entry.location) entry.location = location.name;
|
||||||
|
entry.items?.forEach(place);
|
||||||
|
};
|
||||||
|
block.items.forEach(place);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The events named by items (088): an events block's cards, and a
|
||||||
|
schedule entry or sub-item that is a workshop, which takes what
|
||||||
|
it leaves blank from its event: the link, the description (its
|
||||||
|
card text), the graphic (its photo) and the person (a person
|
||||||
|
host). An unpublished event is no event. */
|
||||||
|
function attachEvents(db, blocks) {
|
||||||
|
const entries = [];
|
||||||
|
const walk = (entry) => {
|
||||||
|
entries.push(entry);
|
||||||
|
entry.items?.forEach(walk);
|
||||||
|
};
|
||||||
|
blocks.forEach((block) => block.items.forEach(walk));
|
||||||
|
const ids = [...new Set(entries.map((entry) => entry.event_id).filter(Boolean))];
|
||||||
|
if (ids.length === 0) return;
|
||||||
|
|
||||||
|
const rows = db
|
||||||
|
.prepare(
|
||||||
|
`SELECT e.id, e.title, e.tagline, e.event_type, e.starts_on, e.ends_on, e.date_label,
|
||||||
|
e.effective_color AS color, COALESCE(e.card_image, e.photo) AS image, e.photo_alt,
|
||||||
|
p.id AS person_id, p.display_name AS person_name, p.photo AS person_photo,
|
||||||
|
p.tagline AS person_tagline
|
||||||
|
FROM v_events e
|
||||||
|
LEFT JOIN v_people_public p ON e.host_kind = 'person' AND p.id = e.host_id AND p.is_published = 1
|
||||||
|
WHERE e.is_published = 1 AND e.id IN (${placeholders(ids.length)})`,
|
||||||
|
)
|
||||||
|
.all(...ids);
|
||||||
|
const cards = loadBlocks(db, "event", rows.map((row) => row.id), "card");
|
||||||
|
const events = new Map(rows.map((row) => [row.id, row]));
|
||||||
|
|
||||||
|
for (const entry of entries) {
|
||||||
|
const row = events.get(entry.event_id);
|
||||||
|
if (!row) {
|
||||||
|
entry.event = null;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const blurb = paragraphs(cards.get(row.id) ?? []).join("\n\n") || row.tagline || null;
|
||||||
|
entry.event = {
|
||||||
|
id: row.id,
|
||||||
|
title: row.title,
|
||||||
|
event_type: row.event_type,
|
||||||
|
starts_on: row.starts_on,
|
||||||
|
ends_on: row.ends_on,
|
||||||
|
date_label: row.date_label,
|
||||||
|
color: row.color,
|
||||||
|
image: row.image,
|
||||||
|
blurb,
|
||||||
|
};
|
||||||
|
entry.url ||= `/events/${row.id}`;
|
||||||
|
entry.description ||= blurb;
|
||||||
|
if (!entry.media && row.image) {
|
||||||
|
entry.media = row.image;
|
||||||
|
entry.media_alt = row.photo_alt;
|
||||||
|
}
|
||||||
|
if (!entry.person && row.person_id) {
|
||||||
|
entry.person = { id: row.person_id, name: row.person_name, photo: row.person_photo, tagline: row.person_tagline };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* A schedule entry or sub-item as the page gets it. `time` is what
|
/* A schedule entry or sub-item as the page gets it. `time` is what
|
||||||
to show: the typed override, else the picked times (086). An
|
to show: the typed override, else the picked times (086). An
|
||||||
unpublished person comes back as no person. */
|
unpublished person comes back as no person. */
|
||||||
|
|
@ -194,6 +294,8 @@ function scheduleEntry(row) {
|
||||||
map_image: row.map_image,
|
map_image: row.map_image,
|
||||||
featured: row.featured === 1,
|
featured: row.featured === 1,
|
||||||
tags: row.tags ? row.tags.split(",").filter(Boolean) : [],
|
tags: row.tags ? row.tags.split(",").filter(Boolean) : [],
|
||||||
|
event_id: row.event_id,
|
||||||
|
location_key: row.location_key,
|
||||||
person: row.person_id
|
person: row.person_id
|
||||||
? {
|
? {
|
||||||
id: row.person_id,
|
id: row.person_id,
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,12 @@
|
||||||
people team_id's members as people tiles, then
|
people team_id's members as people tiles, then
|
||||||
items as more tiles: person, text their
|
items as more tiles: person, text their
|
||||||
title (an unpublished person is left out)
|
title (an unpublished person is left out)
|
||||||
|
map venue: its map, locations marked and
|
||||||
|
listed (MapBlock); a schedule's places
|
||||||
|
link to it
|
||||||
|
events items as event cards: event (from
|
||||||
|
event_id), text the title shown, detail
|
||||||
|
in place of the event's card text
|
||||||
divider nothing
|
divider nothing
|
||||||
|
|
||||||
"Formatted" is InlineText.tsx: **bold**, *italic*, [text](url),
|
"Formatted" is InlineText.tsx: **bold**, *italic*, [text](url),
|
||||||
|
|
@ -50,6 +56,9 @@ import type { ContentBlock, ContentBlockItem } from '../lib/useContent.ts'
|
||||||
import { Anchor, Inline, Paragraphs, isExternalUrl } from './InlineText.tsx'
|
import { Anchor, Inline, Paragraphs, isExternalUrl } from './InlineText.tsx'
|
||||||
import VideoPlayer from './VideoPlayer.tsx'
|
import VideoPlayer from './VideoPlayer.tsx'
|
||||||
import ScheduleBlock from './ScheduleBlock.tsx'
|
import ScheduleBlock from './ScheduleBlock.tsx'
|
||||||
|
import MapBlock, { PageMaps } from './MapBlock.tsx'
|
||||||
|
import { eventHref } from '../lib/hrefs.ts'
|
||||||
|
import { occurrenceLabel } from '../lib/eventSeries.ts'
|
||||||
import { accentText, BRAND } from '../lib/color.ts'
|
import { accentText, BRAND } from '../lib/color.ts'
|
||||||
import { headingAnchors } from '../lib/contents.ts'
|
import { headingAnchors } from '../lib/contents.ts'
|
||||||
import { SITE_NAME } from '../lib/site.ts'
|
import { SITE_NAME } from '../lib/site.ts'
|
||||||
|
|
@ -94,7 +103,11 @@ export default function ContentBlocks({
|
||||||
presentAt && block.type === 'schedule' ? `${presentAt}?block=${schedules++}` : undefined,
|
presentAt && block.type === 'schedule' ? `${presentAt}?block=${schedules++}` : undefined,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// The venues mapped here, for a schedule's places to link to.
|
||||||
|
const maps = new Set(blocks.flatMap((block) => (block.type === 'map' && block.venue ? [block.venue.id] : [])))
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<PageMaps.Provider value={maps}>
|
||||||
<div className={`space-y-6 ${className}`}>
|
<div className={`space-y-6 ${className}`}>
|
||||||
{blocks.map((block, index) => (
|
{blocks.map((block, index) => (
|
||||||
<WordMotion key={block.id ?? index} settings={block.words}>
|
<WordMotion key={block.id ?? index} settings={block.words}>
|
||||||
|
|
@ -108,6 +121,7 @@ export default function ContentBlocks({
|
||||||
</WordMotion>
|
</WordMotion>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
</PageMaps.Provider>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -144,6 +158,40 @@ function LinkCard({ item }: { item: ContentBlockItem }) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* One event card (088): the event's picture, its type and date,
|
||||||
|
its title (or the item's text) and card text (or the item's
|
||||||
|
detail); the whole card links to the event. */
|
||||||
|
function EventCard({ item, accent }: { item: ContentBlockItem; accent: string }) {
|
||||||
|
const event = item.event!
|
||||||
|
const img = useSmallImage(mediaUrl(event.image))
|
||||||
|
const color = event.color || accent
|
||||||
|
const when = event.date_label || (event.starts_on ? occurrenceLabel(event.starts_on) : null)
|
||||||
|
const kind = event.event_type && event.event_type !== 'other' ? event.event_type : null
|
||||||
|
return (
|
||||||
|
<Anchor
|
||||||
|
href={eventHref(event.id)}
|
||||||
|
className="group flex h-full flex-col overflow-hidden border border-brand/15 bg-raised shadow-sm transition-shadow hover:shadow-lg"
|
||||||
|
>
|
||||||
|
{!img.failed && (
|
||||||
|
<img src={img.src} alt="" loading="lazy" onError={img.onError} className="aspect-video w-full object-cover" />
|
||||||
|
)}
|
||||||
|
<span className="flex flex-1 flex-col gap-1 p-4">
|
||||||
|
{(kind || when) && (
|
||||||
|
<span className="text-xs font-semibold capitalize" style={{ color: accentText(color) }}>
|
||||||
|
{[kind, when].filter(Boolean).join(' · ')}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
<span className="font-display text-base font-bold leading-snug text-ink group-hover:text-link">
|
||||||
|
{item.text || event.title}
|
||||||
|
</span>
|
||||||
|
{(item.detail || event.blurb) && (
|
||||||
|
<span className="line-clamp-3 text-sm leading-snug text-body">{item.detail || event.blurb}</span>
|
||||||
|
)}
|
||||||
|
</span>
|
||||||
|
</Anchor>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
/* A table block's text as rows of cells: one row per line, cells
|
/* A table block's text as rows of cells: one row per line, cells
|
||||||
split by "|" (a literal bar is "\|"), blank lines skipped. A
|
split by "|" (a literal bar is "\|"), blank lines skipped. A
|
||||||
leading and trailing bar, as in Markdown, is allowed. */
|
leading and trailing bar, as in Markdown, is allowed. */
|
||||||
|
|
@ -395,6 +443,24 @@ function Block({
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
case 'map':
|
||||||
|
if (!block.venue) return null
|
||||||
|
return <MapBlock venue={block.venue} accent={accent} />
|
||||||
|
|
||||||
|
case 'events': {
|
||||||
|
const events = (block.items ?? []).filter((item) => item.event)
|
||||||
|
if (events.length === 0) return null
|
||||||
|
return (
|
||||||
|
<ul className="grid gap-4 sm:grid-cols-2 lg:grid-cols-3">
|
||||||
|
{events.map((item, i) => (
|
||||||
|
<li key={i}>
|
||||||
|
<EventCard item={item} accent={accent} />
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
case 'people': {
|
case 'people': {
|
||||||
const picked = (block.items ?? [])
|
const picked = (block.items ?? [])
|
||||||
.filter((item) => item.person)
|
.filter((item) => item.person)
|
||||||
|
|
|
||||||
155
src/components/MapBlock.tsx
Normal file
155
src/components/MapBlock.tsx
Normal file
|
|
@ -0,0 +1,155 @@
|
||||||
|
/* ═══════════════════════════════════════════════════════════════
|
||||||
|
MAP BLOCK
|
||||||
|
|
||||||
|
The 'map' content block (088): a venue's map picture with its
|
||||||
|
locations marked on it, each a numbered pin or a box, and the
|
||||||
|
locations listed beside it (under it on a phone).
|
||||||
|
|
||||||
|
One picture, the marks drawn over it in percent of its size, so
|
||||||
|
they stay on their places at any width. A location is lit up
|
||||||
|
(in the accent, the rest dimmed) while its row or mark is hovered
|
||||||
|
or focused, and when the address points at it: #map-<venue>-<key>,
|
||||||
|
the link a schedule entry's place makes (mapAnchor). That id is
|
||||||
|
the mark's own, so Layout's jump to the anchor scrolls it into
|
||||||
|
view and focuses it.
|
||||||
|
|
||||||
|
Reading mode (readingMode.ts) gets the list alone, no picture.
|
||||||
|
|
||||||
|
PageMaps holds the venues that have a map block among the blocks
|
||||||
|
drawn together (ContentBlocks), so a schedule's places link only
|
||||||
|
when there's a map on the page to go to.
|
||||||
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
||||||
|
import { createContext, useState } from 'react'
|
||||||
|
import { Link, useLocation } from 'react-router-dom'
|
||||||
|
|
||||||
|
import { mediaUrl } from '../lib/media.ts'
|
||||||
|
import type { Venue, VenueLocation } from '../lib/useContent.ts'
|
||||||
|
import { accentText, readableOn, withAlpha } from '../lib/color.ts'
|
||||||
|
import { useReadingMode } from '../lib/readingMode.ts'
|
||||||
|
|
||||||
|
export const PageMaps = createContext<Set<string>>(new Set())
|
||||||
|
|
||||||
|
export const mapAnchor = (venueId: string, key: string) => `map-${venueId}-${key}`
|
||||||
|
|
||||||
|
const isBox = (location: VenueLocation) => location.w != null && location.h != null
|
||||||
|
|
||||||
|
export default function MapBlock({ venue, accent }: { venue: Venue; accent: string }) {
|
||||||
|
const { hash, search } = useLocation()
|
||||||
|
const [hovered, setHovered] = useState<string | null>(null)
|
||||||
|
const marked = venue.locations.filter((location) => location.x != null && location.y != null)
|
||||||
|
const fromHash = venue.locations.find((location) => hash === `#${mapAnchor(venue.id, location.key)}`)?.key ?? null
|
||||||
|
const active = hovered ?? fromHash
|
||||||
|
const image = useReadingMode() ? null : mediaUrl(venue.map_image)
|
||||||
|
const fill = accent.startsWith('#') ? accent : '#000000'
|
||||||
|
|
||||||
|
const to = (key: string) => ({ search, hash: mapAnchor(venue.id, key) })
|
||||||
|
const light = (key: string) => ({
|
||||||
|
onMouseEnter: () => setHovered(key),
|
||||||
|
onMouseLeave: () => setHovered(null),
|
||||||
|
onFocus: () => setHovered(key),
|
||||||
|
onBlur: () => setHovered(null),
|
||||||
|
})
|
||||||
|
const number = (location: VenueLocation) => venue.locations.indexOf(location) + 1
|
||||||
|
|
||||||
|
return (
|
||||||
|
<figure className="grid gap-6 md:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]">
|
||||||
|
{image && (
|
||||||
|
<div className="relative self-start">
|
||||||
|
<img src={image} alt={venue.map_alt || `Map of ${venue.name}`} className="block w-full" />
|
||||||
|
{marked.map((location) => {
|
||||||
|
const on = active === location.key
|
||||||
|
const dim = active != null && !on
|
||||||
|
return (
|
||||||
|
<Link
|
||||||
|
key={location.key}
|
||||||
|
id={mapAnchor(venue.id, location.key)}
|
||||||
|
to={to(location.key)}
|
||||||
|
aria-label={location.name}
|
||||||
|
{...light(location.key)}
|
||||||
|
className="absolute transition-opacity"
|
||||||
|
style={
|
||||||
|
isBox(location)
|
||||||
|
? {
|
||||||
|
left: `${location.x}%`,
|
||||||
|
top: `${location.y}%`,
|
||||||
|
width: `${location.w}%`,
|
||||||
|
height: `${location.h}%`,
|
||||||
|
border: `2px solid ${accent}`,
|
||||||
|
background: withAlpha(accent, on ? 35 : 12),
|
||||||
|
opacity: dim ? 0.35 : 1,
|
||||||
|
}
|
||||||
|
: {
|
||||||
|
left: `${location.x}%`,
|
||||||
|
top: `${location.y}%`,
|
||||||
|
transform: 'translate(-50%, -50%)',
|
||||||
|
opacity: dim ? 0.35 : 1,
|
||||||
|
zIndex: on ? 1 : undefined,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
aria-hidden="true"
|
||||||
|
className={`flex items-center justify-center rounded-full text-xs font-bold shadow ${
|
||||||
|
isBox(location) ? 'absolute top-1 left-1 h-6 w-6' : on ? 'h-9 w-9' : 'h-7 w-7'
|
||||||
|
}`}
|
||||||
|
style={{ background: accent, color: readableOn(fill), outline: on ? '3px solid white' : undefined }}
|
||||||
|
>
|
||||||
|
{number(location)}
|
||||||
|
</span>
|
||||||
|
{on && (
|
||||||
|
<span
|
||||||
|
aria-hidden="true"
|
||||||
|
className="absolute top-full left-1/2 mt-1 -translate-x-1/2 whitespace-nowrap bg-raised px-2 py-0.5 text-xs font-semibold text-ink shadow"
|
||||||
|
>
|
||||||
|
{location.name}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</Link>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<figcaption className={image ? '' : 'md:col-span-2'}>
|
||||||
|
<p className="font-display font-bold text-ink">{venue.name}</p>
|
||||||
|
{venue.address && <p className="text-sm text-muted">{venue.address}</p>}
|
||||||
|
<ol className="mt-3 space-y-1">
|
||||||
|
{venue.locations.map((location) => {
|
||||||
|
const on = active === location.key
|
||||||
|
const row = (
|
||||||
|
<>
|
||||||
|
<span
|
||||||
|
aria-hidden="true"
|
||||||
|
className="flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-xs font-bold"
|
||||||
|
style={{ background: accent, color: readableOn(fill) }}
|
||||||
|
>
|
||||||
|
{number(location)}
|
||||||
|
</span>
|
||||||
|
<span className="min-w-0">
|
||||||
|
<span className="block font-semibold" style={on ? { color: accentText(accent) } : undefined}>
|
||||||
|
{location.name}
|
||||||
|
</span>
|
||||||
|
{location.detail && <span className="block text-sm text-muted">{location.detail}</span>}
|
||||||
|
</span>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
const rowClass = 'flex items-start gap-3 px-2 py-1.5 text-body'
|
||||||
|
const rowStyle = on ? { background: withAlpha(accent, 12) } : undefined
|
||||||
|
return (
|
||||||
|
<li key={location.key}>
|
||||||
|
{location.x != null && location.y != null ? (
|
||||||
|
<Link to={to(location.key)} {...light(location.key)} className={rowClass} style={rowStyle}>
|
||||||
|
{row}
|
||||||
|
</Link>
|
||||||
|
) : (
|
||||||
|
<div className={rowClass}>{row}</div>
|
||||||
|
)}
|
||||||
|
</li>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</ol>
|
||||||
|
</figcaption>
|
||||||
|
</figure>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
@ -32,6 +32,12 @@
|
||||||
day's name. A tagged entry comes whole; an untagged block comes
|
day's name. A tagged entry comes whole; an untagged block comes
|
||||||
with only its tagged sub-items. A tag on nothing draws no tab.
|
with only its tagged sub-items. A tag on nothing draws no tab.
|
||||||
|
|
||||||
|
An entry's place on the block's venue (088) links to the map
|
||||||
|
block on the same page, the location lit up there (MapBlock);
|
||||||
|
with no map of that venue on the page it's plain text. An entry
|
||||||
|
that is an event (a workshop) has already taken what it left
|
||||||
|
blank from it (shape.js).
|
||||||
|
|
||||||
On an event page a Present button opens the schedule as a
|
On an event page a Present button opens the schedule as a
|
||||||
slideshow for a screen (SchedulePresent.tsx).
|
slideshow for a screen (SchedulePresent.tsx).
|
||||||
|
|
||||||
|
|
@ -42,9 +48,9 @@
|
||||||
it, no map frame (ReadingSchedule).
|
it, no map frame (ReadingSchedule).
|
||||||
═══════════════════════════════════════════════════════════════ */
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
||||||
import { CaretDown, Presentation, Star } from '@phosphor-icons/react'
|
import { CaretDown, MapPin, Presentation, Star } from '@phosphor-icons/react'
|
||||||
import { Fragment, createContext, useContext, useId, useState, type KeyboardEvent, type ReactNode } from 'react'
|
import { Fragment, createContext, useContext, useId, useState, type KeyboardEvent, type ReactNode } from 'react'
|
||||||
import { Link } from 'react-router-dom'
|
import { Link, useLocation } from 'react-router-dom'
|
||||||
|
|
||||||
import { personHref } from '../lib/hrefs.ts'
|
import { personHref } from '../lib/hrefs.ts'
|
||||||
import { mediaUrl, initials } from '../lib/media.ts'
|
import { mediaUrl, initials } from '../lib/media.ts'
|
||||||
|
|
@ -54,6 +60,7 @@ import { withAlpha, accentText, readableOn } from '../lib/color.ts'
|
||||||
import { useSmallImage } from '../lib/useSmallImage.ts'
|
import { useSmallImage } from '../lib/useSmallImage.ts'
|
||||||
import { focusOnMount } from '../lib/focus.ts'
|
import { focusOnMount } from '../lib/focus.ts'
|
||||||
import { useReadingMode } from '../lib/readingMode.ts'
|
import { useReadingMode } from '../lib/readingMode.ts'
|
||||||
|
import { PageMaps, mapAnchor } from './MapBlock.tsx'
|
||||||
|
|
||||||
const BODY = 'var(--color-muted)'
|
const BODY = 'var(--color-muted)'
|
||||||
const WEEKDAYS = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday']
|
const WEEKDAYS = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday']
|
||||||
|
|
@ -136,6 +143,26 @@ function todayIndex(days: Day[]): number {
|
||||||
return found >= 0 ? found : 0
|
return found >= 0 ? found : 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* An entry's location, linked to its place on a map block on the
|
||||||
|
page when there is one (088). */
|
||||||
|
function Place({ entry, accent }: { entry: ContentBlockItem; accent: string }) {
|
||||||
|
const maps = useContext(PageMaps)
|
||||||
|
const { search } = useLocation()
|
||||||
|
if (!entry.location) return null
|
||||||
|
if (!entry.place || !maps.has(entry.place.venue_id)) return <span>{entry.location}</span>
|
||||||
|
return (
|
||||||
|
<Link
|
||||||
|
to={{ search, hash: mapAnchor(entry.place.venue_id, entry.place.key) }}
|
||||||
|
className="inline-flex items-center gap-1 underline-offset-2 hover:underline"
|
||||||
|
style={{ color: accentText(accent) }}
|
||||||
|
>
|
||||||
|
<MapPin aria-hidden="true" weight="bold" className="h-4 w-4 shrink-0" />
|
||||||
|
{entry.location}
|
||||||
|
<span className="sr-only">, on the map</span>
|
||||||
|
</Link>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
/* An entry's own map image says what it maps. */
|
/* An entry's own map image says what it maps. */
|
||||||
export const mapAlt = (entry: ContentBlockItem) => `Map: ${entry.map?.trim() || entry.location || entry.text}`
|
export const mapAlt = (entry: ContentBlockItem) => `Map: ${entry.map?.trim() || entry.location || entry.text}`
|
||||||
|
|
||||||
|
|
@ -240,7 +267,7 @@ function Entry({ entry, accent, sub = false }: { entry: ContentBlockItem; accent
|
||||||
</p>
|
</p>
|
||||||
{(entry.location || entry.person) && (
|
{(entry.location || entry.person) && (
|
||||||
<p className="mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-sm" style={{ color: BODY }}>
|
<p className="mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-sm" style={{ color: BODY }}>
|
||||||
{entry.location && <span>{entry.location}</span>}
|
<Place entry={entry} accent={accent} />
|
||||||
{entry.person && (
|
{entry.person && (
|
||||||
<span className="inline-flex items-center gap-2">
|
<span className="inline-flex items-center gap-2">
|
||||||
<Avatar person={entry.person} size="h-6 w-6" />
|
<Avatar person={entry.person} size="h-6 w-6" />
|
||||||
|
|
|
||||||
130
src/components/admin/MapMarkerInput.tsx
Normal file
130
src/components/admin/MapMarkerInput.tsx
Normal file
|
|
@ -0,0 +1,130 @@
|
||||||
|
/* A venue location's mark on the venue's map (088), for the
|
||||||
|
`mapMarker` widget (fields.tsx): click the picture for a pin, drag
|
||||||
|
for a box. Saved as x, y (and w, h for a box) in percent of the
|
||||||
|
picture from its top left, one decimal, through onPatch. The
|
||||||
|
numbers under it set the same thing by keyboard. */
|
||||||
|
|
||||||
|
import { useRef, useState, type PointerEvent } from "react";
|
||||||
|
|
||||||
|
type Mark = { x: number | null; y: number | null; w: number | null; h: number | null };
|
||||||
|
|
||||||
|
const round = (n: number) => Math.round(Math.min(100, Math.max(0, n)) * 10) / 10;
|
||||||
|
// Moved less than this (percent) between press and release: a click.
|
||||||
|
const CLICK = 1.5;
|
||||||
|
|
||||||
|
export default function MapMarkerInput({ image, row, locked, onPatch }: any) {
|
||||||
|
const box = useRef<HTMLDivElement>(null);
|
||||||
|
const [drag, setDrag] = useState<{ x0: number; y0: number; x1: number; y1: number } | null>(null);
|
||||||
|
const mark: Mark = { x: row.x ?? null, y: row.y ?? null, w: row.w ?? null, h: row.h ?? null };
|
||||||
|
|
||||||
|
const at = (e: PointerEvent) => {
|
||||||
|
const r = box.current!.getBoundingClientRect();
|
||||||
|
return { x: round(((e.clientX - r.left) / r.width) * 100), y: round(((e.clientY - r.top) / r.height) * 100) };
|
||||||
|
};
|
||||||
|
|
||||||
|
const up = (e: PointerEvent) => {
|
||||||
|
if (!drag) return;
|
||||||
|
const { x, y } = at(e);
|
||||||
|
setDrag(null);
|
||||||
|
if (Math.abs(x - drag.x0) < CLICK && Math.abs(y - drag.y0) < CLICK) {
|
||||||
|
onPatch({ x: drag.x0, y: drag.y0, w: null, h: null });
|
||||||
|
} else {
|
||||||
|
onPatch({
|
||||||
|
x: Math.min(x, drag.x0),
|
||||||
|
y: Math.min(y, drag.y0),
|
||||||
|
w: round(Math.abs(x - drag.x0)),
|
||||||
|
h: round(Math.abs(y - drag.y0)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const shown = drag
|
||||||
|
? {
|
||||||
|
x: Math.min(drag.x0, drag.x1),
|
||||||
|
y: Math.min(drag.y0, drag.y1),
|
||||||
|
w: Math.abs(drag.x1 - drag.x0),
|
||||||
|
h: Math.abs(drag.y1 - drag.y0),
|
||||||
|
}
|
||||||
|
: mark;
|
||||||
|
|
||||||
|
const number = (key: keyof Mark, label: string) => (
|
||||||
|
<label className="flex items-center gap-1">
|
||||||
|
{label}
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
min={0}
|
||||||
|
max={100}
|
||||||
|
step={0.1}
|
||||||
|
value={mark[key] ?? ""}
|
||||||
|
disabled={locked}
|
||||||
|
onChange={(e) => onPatch({ [key]: e.target.value === "" ? null : round(Number(e.target.value)) })}
|
||||||
|
className="w-20 border border-muted/25 bg-surface px-2 py-1 text-body"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{image ? (
|
||||||
|
<div
|
||||||
|
ref={box}
|
||||||
|
className={`relative select-none ${locked ? "" : "cursor-crosshair"}`}
|
||||||
|
onPointerDown={(e) => {
|
||||||
|
if (locked) return;
|
||||||
|
e.currentTarget.setPointerCapture(e.pointerId);
|
||||||
|
const { x, y } = at(e);
|
||||||
|
setDrag({ x0: x, y0: y, x1: x, y1: y });
|
||||||
|
}}
|
||||||
|
onPointerMove={(e) => drag && setDrag({ ...drag, x1: at(e).x, y1: at(e).y })}
|
||||||
|
onPointerUp={up}
|
||||||
|
>
|
||||||
|
<img src={image} alt="" draggable={false} className="block w-full" />
|
||||||
|
{shown.x != null && shown.y != null && (
|
||||||
|
<span
|
||||||
|
aria-hidden="true"
|
||||||
|
className="pointer-events-none absolute"
|
||||||
|
style={
|
||||||
|
shown.w && shown.h
|
||||||
|
? {
|
||||||
|
left: `${shown.x}%`,
|
||||||
|
top: `${shown.y}%`,
|
||||||
|
width: `${shown.w}%`,
|
||||||
|
height: `${shown.h}%`,
|
||||||
|
border: "2px solid var(--color-action)",
|
||||||
|
background: "color-mix(in srgb, var(--color-action) 20%, transparent)",
|
||||||
|
}
|
||||||
|
: {
|
||||||
|
left: `${shown.x}%`,
|
||||||
|
top: `${shown.y}%`,
|
||||||
|
width: 16,
|
||||||
|
height: 16,
|
||||||
|
transform: "translate(-50%, -50%)",
|
||||||
|
borderRadius: "50%",
|
||||||
|
background: "var(--color-action)",
|
||||||
|
outline: "2px solid white",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<p className="notice p-3 text-sm text-muted">Add the venue's map above, then mark this location on it.</p>
|
||||||
|
)}
|
||||||
|
<div className="mt-2 flex flex-wrap items-center gap-3 text-xs text-muted">
|
||||||
|
{number("x", "Left %")}
|
||||||
|
{number("y", "Top %")}
|
||||||
|
{number("w", "Width %")}
|
||||||
|
{number("h", "Height %")}
|
||||||
|
{mark.x != null && !locked && (
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => onPatch({ x: null, y: null, w: null, h: null })}
|
||||||
|
className="text-link hover:underline"
|
||||||
|
>
|
||||||
|
Clear mark
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -77,6 +77,15 @@
|
||||||
Data → Links/redirects (the `redirects` options) that fills the
|
Data → Links/redirects (the `redirects` options) that fills the
|
||||||
field with the short link's full address, <site>/go/<URL ID>.
|
field with the short link's full address, <site>/go/<URL ID>.
|
||||||
|
|
||||||
|
`fills: "text"` on a select fills that field of the row, while
|
||||||
|
it's empty, with the picked option's label.
|
||||||
|
|
||||||
|
`widget: "mapMarker"` (on `x`) marks a venue's location on the
|
||||||
|
map picture its parent row holds in `imageFrom`: a click is a
|
||||||
|
pin (x, y), a drag a box (x, y, w, h), in percent (MapMarkerInput
|
||||||
|
below). `lends` gets the form's options too, so a block can lend
|
||||||
|
its venue's locations from the venues list.
|
||||||
|
|
||||||
`widget: "testNotice"` is a text box of email addresses with a
|
`widget: "testNotice"` is a text box of email addresses with a
|
||||||
"Send a test notice" button (TestNoticeInput below), for Site
|
"Send a test notice" button (TestNoticeInput below), for Site
|
||||||
settings → Notices.
|
settings → Notices.
|
||||||
|
|
@ -114,6 +123,9 @@ import ContentBlocks from "../ContentBlocks.tsx";
|
||||||
import { FILTER_FROM, OptionFilter, narrow } from "../OptionFilter.tsx";
|
import { FILTER_FROM, OptionFilter, narrow } from "../OptionFilter.tsx";
|
||||||
import { ImageInput, LinkPreviewInput } from "./MediaLibrary.tsx";
|
import { ImageInput, LinkPreviewInput } from "./MediaLibrary.tsx";
|
||||||
import { ChooseFileButton } from "./DriveFiles.tsx";
|
import { ChooseFileButton } from "./DriveFiles.tsx";
|
||||||
|
import MapMarkerInput from "./MapMarkerInput.tsx";
|
||||||
|
import { venueFromOption } from "../../lib/adminSchema/shared.ts";
|
||||||
|
import { mediaUrl } from "../../lib/media.ts";
|
||||||
import { siteUrl } from "../../lib/site.ts";
|
import { siteUrl } from "../../lib/site.ts";
|
||||||
|
|
||||||
/* Live previews a collection can name with `preview`. Each gets the
|
/* Live previews a collection can name with `preview`. Each gets the
|
||||||
|
|
@ -122,21 +134,25 @@ const PREVIEWS = {
|
||||||
// The form holds an entry's person as person_id; the renderer wants
|
// The form holds an entry's person as person_id; the renderer wants
|
||||||
// the person, so it's looked up in the select options (a name, no
|
// the person, so it's looked up in the select options (a name, no
|
||||||
// photo: the options carry no more).
|
// photo: the options carry no more).
|
||||||
contentBlock: (row, options) => (
|
// A venue and an item's event and map location come from the
|
||||||
<ContentBlocks
|
// options the same way (088): an event as its title only.
|
||||||
blocks={[
|
contentBlock: (row, options) => {
|
||||||
{
|
const venue = venueFromOption(options?.venues?.find((v) => v.id === row.venue_id));
|
||||||
...row,
|
const shape = (item) => {
|
||||||
items: (row.items ?? []).map((item) => {
|
const person = item.person_id ? options?.people?.find((p) => p.id === item.person_id) : null;
|
||||||
const person = item.person_id
|
const event = item.event_id ? options?.events?.find((e) => e.id === item.event_id) : null;
|
||||||
? options?.people?.find((p) => p.id === item.person_id)
|
const location = venue?.locations.find((l) => l.key === item.location_key);
|
||||||
: null;
|
return {
|
||||||
return { ...item, person: person ? { id: person.id, name: person.label } : null };
|
...item,
|
||||||
}),
|
person: person ? { id: person.id, name: person.label } : null,
|
||||||
|
event: event ? { id: event.id, title: event.label } : null,
|
||||||
|
place: location ? { venue_id: venue!.id, key: location.key, name: location.name } : null,
|
||||||
|
location: item.location || location?.name,
|
||||||
|
items: (item.items ?? []).map(shape),
|
||||||
|
};
|
||||||
|
};
|
||||||
|
return <ContentBlocks blocks={[{ ...row, venue, items: (row.items ?? []).map(shape) }]} />;
|
||||||
},
|
},
|
||||||
]}
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const input =
|
const input =
|
||||||
|
|
@ -282,7 +298,7 @@ function Checklist({ id, options, value, disabled, empty, onChange }: {
|
||||||
|
|
||||||
/* ── Field ───────────────────────────────────────────────────── */
|
/* ── Field ───────────────────────────────────────────────────── */
|
||||||
|
|
||||||
export function Field({ field, value, row, options, error, onChange, onPatch }: any) {
|
export function Field({ field, value, row, parentRow, options, error, onChange, onPatch }: any) {
|
||||||
const id = `f-${field.path.replace(/\./g, "-")}`;
|
const id = `f-${field.path.replace(/\./g, "-")}`;
|
||||||
const widget = field.widget ?? "text";
|
const widget = field.widget ?? "text";
|
||||||
// readOnly may be a test of the row (a core page's address).
|
// readOnly may be a test of the row (a core page's address).
|
||||||
|
|
@ -397,6 +413,14 @@ export function Field({ field, value, row, options, error, onChange, onPatch }:
|
||||||
)}
|
)}
|
||||||
<select
|
<select
|
||||||
{...common}
|
{...common}
|
||||||
|
onChange={(e) => {
|
||||||
|
// `fills`: a pick also fills that empty field of the
|
||||||
|
// row with the option's label (a workshop's title).
|
||||||
|
const picked = e.target.value;
|
||||||
|
const label = list?.find(([optionId]) => String(optionId) === picked)?.[1];
|
||||||
|
if (field.fills && picked && !row?.[field.fills] && onPatch) onPatch({ [field.path]: picked, [field.fills]: label });
|
||||||
|
else onChange(picked);
|
||||||
|
}}
|
||||||
disabled={locked}
|
disabled={locked}
|
||||||
className={`${locked ? inputLocked : common.className} ${
|
className={`${locked ? inputLocked : common.className} ${
|
||||||
orphaned && !locked ? inputError : ""
|
orphaned && !locked ? inputError : ""
|
||||||
|
|
@ -440,6 +464,13 @@ export function Field({ field, value, row, options, error, onChange, onPatch }:
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
onPatch={onPatch}
|
onPatch={onPatch}
|
||||||
/>
|
/>
|
||||||
|
) : widget === "mapMarker" ? (
|
||||||
|
<MapMarkerInput
|
||||||
|
image={field.imageFrom ? mediaUrl(parentRow?.[field.imageFrom]) : null}
|
||||||
|
row={row}
|
||||||
|
locked={locked}
|
||||||
|
onPatch={onPatch}
|
||||||
|
/>
|
||||||
) : widget === "testNotice" ? (
|
) : widget === "testNotice" ? (
|
||||||
<TestNoticeInput
|
<TestNoticeInput
|
||||||
id={id}
|
id={id}
|
||||||
|
|
@ -805,6 +836,7 @@ export function Repeater({
|
||||||
key={field.path}
|
key={field.path}
|
||||||
field={field}
|
field={field}
|
||||||
row={row}
|
row={row}
|
||||||
|
parentRow={parentRow}
|
||||||
value={row[field.path]}
|
value={row[field.path]}
|
||||||
options={options}
|
options={options}
|
||||||
error={errors?.[`${errorPrefix}${index}.${field.path}`]}
|
error={errors?.[`${errorPrefix}${index}.${field.path}`]}
|
||||||
|
|
@ -821,7 +853,7 @@ export function Repeater({
|
||||||
<Repeater
|
<Repeater
|
||||||
spec={nested}
|
spec={nested}
|
||||||
rows={row[nested.key]}
|
rows={row[nested.key]}
|
||||||
options={spec.lends ? { ...options, ...spec.lends(row) } : options}
|
options={spec.lends ? { ...options, ...spec.lends(row, options) } : options}
|
||||||
errors={errors}
|
errors={errors}
|
||||||
errorPrefix={`${errorPrefix}${index}.${nested.key}.`}
|
errorPrefix={`${errorPrefix}${index}.${nested.key}.`}
|
||||||
parentRow={row}
|
parentRow={row}
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ import { tags } from "./adminSchema/tags.ts";
|
||||||
import { contactTypes } from "./adminSchema/contactTypes.ts";
|
import { contactTypes } from "./adminSchema/contactTypes.ts";
|
||||||
import { redirects } from "./adminSchema/redirects.ts";
|
import { redirects } from "./adminSchema/redirects.ts";
|
||||||
import { pages } from "./adminSchema/sitePages.ts";
|
import { pages } from "./adminSchema/sitePages.ts";
|
||||||
|
import { venues } from "./adminSchema/venues.ts";
|
||||||
|
|
||||||
export const ADMIN_ENTITIES: Record<string, any> = {
|
export const ADMIN_ENTITIES: Record<string, any> = {
|
||||||
organizations,
|
organizations,
|
||||||
|
|
@ -42,6 +43,7 @@ export const ADMIN_ENTITIES: Record<string, any> = {
|
||||||
tags,
|
tags,
|
||||||
contact_types: contactTypes,
|
contact_types: contactTypes,
|
||||||
redirects,
|
redirects,
|
||||||
|
venues,
|
||||||
teams,
|
teams,
|
||||||
awards,
|
awards,
|
||||||
timeline,
|
timeline,
|
||||||
|
|
|
||||||
|
|
@ -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."],
|
["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."],
|
["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."],
|
["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."],
|
["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"] };
|
export const NOT_CARD_ITEM = { scope: "parent", path: "type", value: ["list", "links", "schedule"] };
|
||||||
/* An item that's a person on a people block. */
|
/* An item that's a person on a people block. */
|
||||||
export const PEOPLE_ITEM = { scope: "parent", path: "type", value: "people" };
|
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;
|
export const blockTypeLabel = (type) => BLOCK_TYPES.find(([value]) => value === type)?.[1] ?? type;
|
||||||
|
|
||||||
|
|
@ -417,8 +455,10 @@ const TAGS_FIELD = {
|
||||||
block's day. */
|
block's day. */
|
||||||
const SUB_ITEM_FIELDS = [
|
const SUB_ITEM_FIELDS = [
|
||||||
...scheduleTimeFields(),
|
...scheduleTimeFields(),
|
||||||
|
eventField(),
|
||||||
{ path: "text", label: "Title", required: true },
|
{ 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",
|
path: "person_id",
|
||||||
label: "Person",
|
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.",
|
help: "Shows the team's members as tiles, its leads first. People added as items show after it.",
|
||||||
when: { path: "type", value: "people" },
|
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"] }),
|
...wordFields("", "", { path: "type", value: ["heading", "subheading", "paragraph", "callout", "quote"] }),
|
||||||
],
|
],
|
||||||
// A schedule's tags, for its entries' and sub-items' Tags (087).
|
// A schedule's tags, for its entries' and sub-items' Tags (087).
|
||||||
lends: (row) => ({
|
lends: (row, options) => ({
|
||||||
scheduleTags: (row.tags ?? [])
|
scheduleTags: (row.tags ?? [])
|
||||||
.filter((tag) => tag.name?.trim())
|
.filter((tag) => tag.name?.trim())
|
||||||
.map((tag) => ({ id: tag.tag_key, label: tag.name })),
|
.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: [
|
children: [
|
||||||
{
|
{
|
||||||
|
|
@ -573,7 +629,7 @@ export const blocksChild = {
|
||||||
key: "items",
|
key: "items",
|
||||||
label: "Items",
|
label: "Items",
|
||||||
addLabel: "Add item",
|
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",
|
title: (row) => [row.day, row.time || row.start_time, row.text].filter(Boolean).join(" · ") || "New item",
|
||||||
blank: { text: "" },
|
blank: { text: "" },
|
||||||
fields: [
|
fields: [
|
||||||
|
|
@ -613,11 +669,28 @@ export const blocksChild = {
|
||||||
help: "Shown as a tile with their photo, linked to their page",
|
help: "Shown as a tile with their photo, linked to their page",
|
||||||
when: PEOPLE_ITEM,
|
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",
|
path: "location",
|
||||||
label: "Location",
|
label: "Location",
|
||||||
help: "eg. Main Hall",
|
help: "eg. Main Hall. Default: the map location's name",
|
||||||
when: SCHEDULE_ENTRY,
|
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: "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: "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: "url", label: "URL", help: "Blank for plain text. Link buttons need one.", files: true, when: NOT_CARD_ITEM },
|
||||||
{
|
{
|
||||||
path: "media",
|
path: "media",
|
||||||
|
|
|
||||||
72
src/lib/adminSchema/venues.ts
Normal file
72
src/lib/adminSchema/venues.ts
Normal 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.",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
@ -43,6 +43,8 @@ export type ContentBlock = {
|
||||||
| 'tab'
|
| 'tab'
|
||||||
| 'cards'
|
| 'cards'
|
||||||
| 'people'
|
| 'people'
|
||||||
|
| 'map'
|
||||||
|
| 'events'
|
||||||
text?: string | null
|
text?: string | null
|
||||||
media?: string | null
|
media?: string | null
|
||||||
href?: string | null
|
href?: string | null
|
||||||
|
|
@ -57,6 +59,43 @@ export type ContentBlock = {
|
||||||
items?: ContentBlockItem[]
|
items?: ContentBlockItem[]
|
||||||
/** A schedule's own tags (087). */
|
/** A schedule's own tags (087). */
|
||||||
tags?: ScheduleTag[]
|
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. */
|
/** A schedule's tag (087). `tab` is whether it gets a tab of its own. */
|
||||||
|
|
@ -89,6 +128,11 @@ export type ContentBlockItem = {
|
||||||
items?: ContentBlockItem[]
|
items?: ContentBlockItem[]
|
||||||
/** Its block's tags it has, by key (087). */
|
/** Its block's tags it has, by key (087). */
|
||||||
tags?: string[]
|
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 = {
|
export type Link = {
|
||||||
|
|
|
||||||
|
|
@ -587,6 +587,7 @@ export default function EntityEdit() {
|
||||||
options={options}
|
options={options}
|
||||||
errors={errors}
|
errors={errors}
|
||||||
errorPrefix={`${child.key}.`}
|
errorPrefix={`${child.key}.`}
|
||||||
|
parentRow={form}
|
||||||
className=""
|
className=""
|
||||||
onChange={(rows) => setForm((prev) => ({ ...prev, [child.key]: rows }))}
|
onChange={(rows) => setForm((prev) => ({ ...prev, [child.key]: rows }))}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,11 @@ export const DATA_NAV = {
|
||||||
label: "Tags",
|
label: "Tags",
|
||||||
blurb: "Descriptors for organizations and events, eg. Online, In-Person. Who carries a tag is edited on the record.",
|
blurb: "Descriptors for organizations and events, eg. Online, In-Person. Who carries a tag is edited on the record.",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
to: "/admin/venues",
|
||||||
|
label: "Venues",
|
||||||
|
blurb: "Places we gather, each with a map and its locations marked, for map blocks and schedules.",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
to: "/admin/redirects",
|
to: "/admin/redirects",
|
||||||
label: "Links/redirects",
|
label: "Links/redirects",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue