From 07c15ce96d251dca5d45c7577b54821e35353ceb Mon Sep 17 00:00:00 2001 From: Zaldimmar Date: Tue, 6 Oct 2026 04:47:25 -0500 Subject: [PATCH] Schedule presentation and map images for schedule entries (migration 069) A schedule block on an event page has a Present button, opening /events//present in a new tab: a setup screen (days, entries, seconds for each kind of slide) and then an endless full screen slideshow of day overviews, entry spotlights with their person, graphics and map images, its settings kept in the address so a signage screen can bookmark it. Schedule entries take a Map image (069), shown in the fold-out in place of the Google map and as a slide in the presentation. Co-Authored-By: Claude Opus 5.5 --- server/src/admin-schema/columns.js | 1 + .../src/migrations/069_schedule_map_image.sql | 10 + server/src/pageMeta.js | 15 + server/src/seed-showcase.js | 2 +- server/src/shape.js | 3 +- src/App.tsx | 10 + src/components/ContentBlocks.tsx | 22 +- src/components/ScheduleBlock.tsx | 66 ++- src/lib/adminSchema/shared.ts | 9 + src/lib/useContent.ts | 2 + src/pages/EventDetail.tsx | 2 +- src/pages/SchedulePresent.css | 40 ++ src/pages/SchedulePresent.tsx | 550 ++++++++++++++++++ 13 files changed, 710 insertions(+), 22 deletions(-) create mode 100644 server/src/migrations/069_schedule_map_image.sql create mode 100644 src/pages/SchedulePresent.css create mode 100644 src/pages/SchedulePresent.tsx diff --git a/server/src/admin-schema/columns.js b/server/src/admin-schema/columns.js index bb96ef9..4673345 100644 --- a/server/src/admin-schema/columns.js +++ b/server/src/admin-schema/columns.js @@ -183,6 +183,7 @@ export const blocksChild = (ownerKind) => ({ text("media"), text("media_alt"), text("map"), + text("map_image"), ], }, ], diff --git a/server/src/migrations/069_schedule_map_image.sql b/server/src/migrations/069_schedule_map_image.sql new file mode 100644 index 0000000..25c5e36 --- /dev/null +++ b/server/src/migrations/069_schedule_map_image.sql @@ -0,0 +1,10 @@ +-- ═══════════════════════════════════════════════════════════════ +-- 069 SCHEDULE MAP IMAGE +-- +-- A schedule entry's own map picture (an upload), eg. a drawn map of +-- the camp with the room marked. Shown in the entry's fold-out in +-- place of the Google map, and as a slide in the schedule +-- presentation (/events//present). +-- ═══════════════════════════════════════════════════════════════ + +ALTER TABLE content_block_items ADD COLUMN map_image TEXT; diff --git a/server/src/pageMeta.js b/server/src/pageMeta.js index 3fbe257..2d9bc72 100644 --- a/server/src/pageMeta.js +++ b/server/src/pageMeta.js @@ -400,6 +400,21 @@ export function metaFor(db, rawPath) { return { ...meta, title: titled(site, page.title), description: plainText(page.description) ?? meta.description }; } + // An event's schedule presentation (SchedulePresent.tsx): the + // event's own title and preview, kept out of search, pointing + // search engines at the event page. + const present = pathname.match(/^\/events\/([^/]+)\/present$/); + if (present) { + let id; + try { + id = decodeURIComponent(present[1]); + } catch { + return notFound(meta); + } + const event = eventMeta(site, db, id, { ...meta, canonical: `${origin(site)}/events/${present[1]}` }); + return event.status === 200 ? { ...event, noindex: true, jsonLd: null } : event; + } + const match = pathname.match(/^\/(events|regions|groups|partners|organizations|teams|awards|people|blog|directory)\/([^/]+)$/); if (!match) return notFound(meta); diff --git a/server/src/seed-showcase.js b/server/src/seed-showcase.js index 6b66af4..26ee185 100644 --- a/server/src/seed-showcase.js +++ b/server/src/seed-showcase.js @@ -91,7 +91,7 @@ const SCHEDULE = [ { text: "The weekend at a glance. Tap an entry for more." }, [ { day: "Friday", time: "4:00pm", text: "Arrivals and check-in", location: "Front desk" }, - { 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" }, + { 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: "Saturday", time: "9:00am", text: "Workshops", location: "Classrooms", person_id: "showcase-member-2", detail: "Pick one of three", url: "/blog/content-block-showcase" }, { day: "Saturday", time: "7:00pm", text: "Talent night", location: "Main 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" }, diff --git a/server/src/shape.js b/server/src/shape.js index 51acb01..4548776 100644 --- a/server/src/shape.js +++ b/server/src/shape.js @@ -101,7 +101,7 @@ export function loadBlocks(db, ownerKind, ids, slot = "body") { const itemRows = db .prepare( `SELECT i.block_id, i.text, i.detail, i.url, - i.day, i.time, i.location, i.description, i.media, i.media_alt, i.map, + i.day, i.time, i.location, i.description, i.media, i.media_alt, i.map, i.map_image, p.id AS person_id, p.display_name AS person_name, p.photo AS person_photo, p.tagline AS person_tagline FROM content_block_items i @@ -126,6 +126,7 @@ export function loadBlocks(db, ownerKind, ids, slot = "body") { media: row.media, media_alt: row.media_alt, map: row.map, + map_image: row.map_image, person: row.person_id ? { id: row.person_id, diff --git a/src/App.tsx b/src/App.tsx index af3fa83..5f3fc56 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -70,6 +70,7 @@ const AwardDetail = lazyPage(() => import("./pages/AwardDetail.tsx")) const PersonDetail = lazyPage(() => import("./pages/PersonDetail.tsx")) const BlogPost = lazyPage(() => import("./pages/BlogPost.tsx")) const DirectoryPage = lazyPage(() => import("./pages/DirectoryPage.tsx")) +const SchedulePresent = lazyPage(() => import("./pages/SchedulePresent.tsx")) /*Admin Pages*/ const AdminLayout = lazyPage(() => import("./pages/admin/AdminLayout.tsx")) @@ -113,6 +114,15 @@ export default function App() { } /> } /> + {/* A schedule as a slideshow for a screen: full screen, no Layout. */} + + + + } + /> diff --git a/src/components/ContentBlocks.tsx b/src/components/ContentBlocks.tsx index d0f6cbf..e432181 100644 --- a/src/components/ContentBlocks.tsx +++ b/src/components/ContentBlocks.tsx @@ -62,10 +62,14 @@ export default function ContentBlocks({ blocks, accent = BRAND, className = '', + presentAt, }: { blocks?: ContentBlock[] | null accent?: string className?: string + /** An event page's presentation route: each schedule gets a Present + * button to it, `?block=` naming which schedule (from 0). */ + presentAt?: string }) { if (!blocks?.length) return null // Headings get ids so a post's contents (PostContents) and a shared @@ -81,10 +85,22 @@ export default function ContentBlocks({ return level }) + let schedules = 0 + const presentHrefs = blocks.map((block) => + presentAt && block.type === 'schedule' ? `${presentAt}?block=${schedules++}` : undefined, + ) + return (
{blocks.map((block, index) => ( - + ))}
) @@ -154,11 +170,13 @@ function Block({ accent, anchor, level, + presentHref, }: { block: ContentBlock accent: string anchor?: string level: 3 | 4 | 5 + presentHref?: string }) { const text = block.text ?? '' const reading = useReadingMode() @@ -359,7 +377,7 @@ function Block({ case 'schedule': if (!block.items?.length) return null - return + return case 'people': { const picked = (block.items ?? []) diff --git a/src/components/ScheduleBlock.tsx b/src/components/ScheduleBlock.tsx index 5458b7c..733a11d 100644 --- a/src/components/ScheduleBlock.tsx +++ b/src/components/ScheduleBlock.tsx @@ -15,7 +15,11 @@ A row folds out when it has anything more to show: a description, a graphic, a map, or a person (their photo, tagline and a link to their page). The map is Google's key-free embed of - the place typed in, with a link out to the full map. + the place typed in, with a link out to the full map; an entry's + own map image (069) shows instead, the link out kept. + + On an event page a Present button opens the schedule as a + slideshow for a screen (SchedulePresent.tsx). Tabs follow the ARIA tab pattern: arrow keys move between them. @@ -24,7 +28,7 @@ it, no map frame (ReadingSchedule). ═══════════════════════════════════════════════════════════════ */ -import { CaretDown } from '@phosphor-icons/react' +import { CaretDown, Presentation } from '@phosphor-icons/react' import { Fragment, useId, useState, type KeyboardEvent, type ReactNode } from 'react' import { Link } from 'react-router-dom' @@ -40,9 +44,9 @@ import { useReadingMode } from '../lib/readingMode.ts' const BODY = 'var(--color-muted)' const WEEKDAYS = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'] -type Day = { name: string; entries: ContentBlockItem[] } +export type Day = { name: string; entries: ContentBlockItem[] } -function groupByDay(items: ContentBlockItem[]): Day[] { +export function groupByDay(items: ContentBlockItem[]): Day[] { const days: Day[] = [] for (const item of items) { const name = item.day?.trim() ?? '' @@ -67,12 +71,15 @@ function todayIndex(days: Day[]): number { return found >= 0 ? found : 0 } +/* An entry's own map image says what it maps. */ +export const mapAlt = (entry: ContentBlockItem) => `Map: ${entry.map?.trim() || entry.location || entry.text}` + const mapEmbed = (place: string) => `https://maps.google.com/maps?q=${encodeURIComponent(place)}&output=embed&maptype=satellite` const mapLink = (place: string) => `https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(place)}` -function Avatar({ person, size }: { person: NonNullable; size: string }) { +export function Avatar({ person, size }: { person: NonNullable; size: string }) { const img = useSmallImage(mediaUrl(person.photo)) return !img.failed ? ( @@ -93,7 +100,8 @@ function Entry({ entry, accent }: { entry: ContentBlockItem; accent: string }) { const panelId = useId() const graphic = mediaUrl(entry.media) const place = entry.map?.trim() - const more = Boolean(entry.description || graphic || place || entry.person) + const mapImage = mediaUrl(entry.map_image) + const more = Boolean(entry.description || graphic || place || mapImage || entry.person) const title = entry.url ? ( @@ -181,9 +189,11 @@ function Entry({ entry, accent }: { entry: ContentBlockItem; accent: string }) { {graphic && {entry.media_alt} - {place && ( + {(place || mapImage) && (
- {showMap ? ( + {mapImage ? ( + {mapAlt(entry)} + ) : showMap && place ? (