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/PageShell.tsx b/src/components/PageShell.tsx index 096f007..65f4676 100644 --- a/src/components/PageShell.tsx +++ b/src/components/PageShell.tsx @@ -107,16 +107,17 @@ export function Section({ section }: { section: ShellSection }) { const circleSize = (box: { width: number; height: number }) => Math.min(Math.max(box.width * 1.5, box.height * 1.1), 22 * 16); -/* The height an ellipse `width` wide needs to take in a box reaching +/* The height a pill `width` wide (rounded-full: straight sides, round + ends of radius r = width / 2) needs to take in a box reaching `across` and `down` from its center (or a corner it's centered on): - (across / a)^2 + (down / b)^2 <= 1. Equal to the width when a circle - that wide would do; taller when the list is too tall for one. A - box as wide as the ellipse can't be taken in, so it stops at 95% - (about three times the box's height). */ + the corner must sit inside an end's circle, so the straight part + reaches down - sqrt(r^2 - across^2). Equal to the width when a + circle that wide would do; taller when the list is too tall for + one. A box as wide as the pill can't be taken in, so it stops at 95%. */ const coverHeight = (width: number, across: number, down: number) => { - const a = width / 2; - const ratio = Math.min(across / a, 0.95); - return Math.max(width, (2 * down) / Math.sqrt(1 - ratio * ratio)); + const r = width / 2; + const ratio = Math.min(across / r, 0.95); + return Math.max(width, 2 * (down - r * Math.sqrt(1 - ratio * ratio) + r)); }; /* How far the list sits in from the column's top and left: the @@ -184,7 +185,7 @@ export default function PageShell({ title, intro, sections, sideNav = false }: P // The shape at rest: a circle centered on the list (a little left, // never left of the heading's center), CIRCLE_EDGE clear of the - // section's edge, made an ellipse as tall as it takes when the list + // section's edge, made a pill as tall as it takes when the list // is too tall for the circle (10 sections of two-line titles). // The shape at a given width: its center as near the list's as the // section's edge allows (it may run off the screen's left edge), and @@ -244,7 +245,7 @@ export default function PageShell({ title, intro, sections, sideNav = false }: P // far corner. Never wider than the column (it'd show a cut edge at // the content): held narrower by the window, it stays centered on // the header's edge (so below it, it only ever curves inward) and - // becomes an ellipse, as tall as it takes to take the list in. + // becomes a pill, as tall as it takes to take the list in. const circleBox = (() => { if (!listBox || !rest) return null; if (stuck) { 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 ? (