Compare commits

...

4 commits

Author SHA1 Message Date
Zaldimmar
07c15ce96d Schedule presentation and map images for schedule entries (migration 069)
A schedule block on an event page has a Present button, opening
/events/<id>/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 <noreply@anthropic.com>
2026-10-06 04:47:25 -05:00
Zaldimmar
96b96c3e6c Group map: state hover, state subheadings, entry cards, scroll on click only
Hovering a tile outlines that state in ink while its region stays lit.
The list groups each region's groups under their state's subheading,
each entry a raised card, and leaves out the region's list of states
(its map note stays). The list no longer follows hover; clicking a
state jumps to its subheading (or its region when it has no groups),
and clicking a legend region to that region.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 04:31:19 -05:00
Zaldimmar
915a7bb570 Side nav: size the pill as the pill it is, not an ellipse
rounded-full draws straight sides with round ends, but its height was
worked out for an ellipse, so a narrow window made it about three times
the list's height, running down over the content.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 04:28:45 -05:00
Zaldimmar
de6d70a0d0 Event cards: clip sideways only, so the past events button isn't cut off on hover
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 04:14:48 -05:00
16 changed files with 833 additions and 130 deletions

View file

@ -183,6 +183,7 @@ export const blocksChild = (ownerKind) => ({
text("media"),
text("media_alt"),
text("map"),
text("map_image"),
],
},
],

View file

@ -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/<id>/present).
-- ═══════════════════════════════════════════════════════════════
ALTER TABLE content_block_items ADD COLUMN map_image TEXT;

View file

@ -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);

View file

@ -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" },

View file

@ -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,

View file

@ -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() {
<Route path="terms" element={<Terms />} />
<Route path="*" element={<NotFound />} />
</Route>
{/* A schedule as a slideshow for a screen: full screen, no Layout. */}
<Route
path="/events/:id/present"
element={
<Suspense fallback={null}>
<SchedulePresent />
</Suspense>
}
/>
<Route
element={
<AuthProvider>

View file

@ -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=<n>` 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 (
<div className={`space-y-6 ${className}`}>
{blocks.map((block, index) => (
<Block key={block.id ?? index} block={block} accent={accent} anchor={idAt.get(index)} level={levels[index]} />
<Block
key={block.id ?? index}
block={block}
accent={accent}
anchor={idAt.get(index)}
level={levels[index]}
presentHref={presentHrefs[index]}
/>
))}
</div>
)
@ -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 <ScheduleBlock items={block.items} intro={block.text} accent={accent} />
return <ScheduleBlock items={block.items} intro={block.text} accent={accent} presentHref={presentHref} />
case 'people': {
const picked = (block.items ?? [])

View file

@ -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) {

View file

@ -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<ContentBlockItem['person']>; size: string }) {
export function Avatar({ person, size }: { person: NonNullable<ContentBlockItem['person']>; size: string }) {
const img = useSmallImage(mediaUrl(person.photo))
return !img.failed ? (
<img src={img.src} alt="" onError={img.onError} className={`${size} shrink-0 object-cover`} />
@ -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 ? (
<Anchor href={entry.url} className="underline-offset-2 hover:underline" style={{ color: accentText(accent) }}>
@ -181,9 +189,11 @@ function Entry({ entry, accent }: { entry: ContentBlockItem; accent: string }) {
{graphic && <img src={graphic} alt={entry.media_alt ?? ""} loading="lazy" className="w-full" />}
{place && (
{(place || mapImage) && (
<div>
{showMap ? (
{mapImage ? (
<img src={mapImage} alt={mapAlt(entry)} loading="lazy" className="w-full" />
) : showMap && place ? (
<iframe
ref={focusOnMount}
src={mapEmbed(place)}
@ -203,6 +213,7 @@ function Entry({ entry, accent }: { entry: ContentBlockItem; accent: string }) {
<span className="text-xs">{place}, from Google Maps</span>
</button>
)}
{place && (
<a
href={mapLink(place)}
target="_blank"
@ -212,6 +223,7 @@ function Entry({ entry, accent }: { entry: ContentBlockItem; accent: string }) {
>
Open in Google Maps
</a>
)}
</div>
)}
</div>
@ -233,6 +245,7 @@ function ReadingSchedule({ days, intro, accent }: { days: Day[]; intro?: string
{day.entries.map((entry, i) => {
const graphic = mediaUrl(entry.media)
const place = entry.map?.trim()
const mapImage = mediaUrl(entry.map_image)
const parts: ReactNode[] = [
entry.time,
entry.url ? <Anchor href={entry.url}>{entry.text}</Anchor> : entry.text,
@ -253,6 +266,7 @@ function ReadingSchedule({ days, intro, accent }: { days: Day[]; intro?: string
{entry.person?.tagline && <p>{entry.person.tagline}</p>}
{entry.description && <Paragraphs text={entry.description} accent={accent} />}
{graphic && <img src={graphic} alt={entry.media_alt ?? ''} />}
{mapImage && <img src={mapImage} alt={mapAlt(entry)} />}
{place && (
<p>
<a href={mapLink(place)}>Open {place} in Google Maps</a>
@ -272,10 +286,13 @@ export default function ScheduleBlock({
items,
intro,
accent,
presentHref,
}: {
items: ContentBlockItem[]
intro?: string | null
accent: string
/** Where the Present button goes; no button without it. */
presentHref?: string
}) {
const days = groupByDay(items)
const [active, setActive] = useState(() => todayIndex(days))
@ -309,6 +326,21 @@ export default function ScheduleBlock({
</div>
)}
{presentHref && (
<div className="flex justify-end">
<Link
to={presentHref}
target="_blank"
className="btn inline-flex items-center gap-2 border px-4 py-2 text-sm transition-colors hover:bg-tint"
style={{ borderColor: `${withAlpha(accent, 33)}`, color: accentText(accent) }}
>
<Presentation aria-hidden="true" weight="bold" className="h-4 w-4" />
Present
<span className="sr-only">(opens in a new tab)</span>
</Link>
</div>
)}
{days.length > 1 && (
<div role="tablist" aria-label="Days" className="flex flex-wrap gap-2">
{days.map((day, index) => {

View file

@ -518,6 +518,15 @@ export const blocksChild = {
help: "Optional, in the fold-out: a place or address for a Google map, eg. Camp Hebron, Halifax PA",
when: SCHEDULE_ENTRY,
},
{
path: "map_image",
label: "Map image",
widget: "image",
resolve: mediaUrl,
full: true,
help: "Optional: your own map, eg. the camp with the room marked. Shown in the fold-out in place of the Google map (which stays a link), and as a slide when the schedule is presented.",
when: SCHEDULE_ENTRY,
},
],
},
],

View file

@ -67,6 +67,8 @@ export type ContentBlockItem = {
/** The graphic's alt text; blank means decorative. */
media_alt?: string | null
map?: string | null
/** The entry's own map picture (069), shown in place of Google's. */
map_image?: string | null
person?: { id: string; name: string; photo?: string | null; tagline?: string | null } | null
}

View file

@ -114,7 +114,7 @@ export default function EventDetail() {
))}
<div className="max-w-3xl">
<ContentBlocks blocks={event.blocks} accent={accent} />
<ContentBlocks blocks={event.blocks} accent={accent} presentAt={`/events/${encodeURIComponent(event.id)}/present`} />
</div>
{event.links.length > 0 && (

View file

@ -0,0 +1,40 @@
/* The schedule presentation's motion (SchedulePresent.tsx). The
reduced motion rule in index.css stops all of it. */
.present-in {
animation: present-in 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.present-from-below {
--present-from: translateY(2rem);
}
.present-from-left {
--present-from: translateX(-3rem);
}
.present-from-right {
--present-from: translateX(3rem);
}
@keyframes present-in {
from {
opacity: 0;
transform: var(--present-from);
}
to {
opacity: 1;
transform: none;
}
}
/* The bar along the bottom: fills over the slide's seconds (set
inline as animation-duration). */
.present-timer {
animation: present-timer linear both;
}
@keyframes present-timer {
from {
width: 0;
}
to {
width: 100%;
}
}

View file

@ -0,0 +1,550 @@
/* ═══════════════════════════════════════════════════════════════
SCHEDULE PRESENTATION: /events/:id/present?block=<n>
An event's schedule block as an endless slideshow for a screen
(digital signage), opened from the block's Present button. Outside
the site's Layout: no header, footer or backdrop.
First a setup screen: which days and entries, and how many seconds
each kind of slide stays up (0 leaves that kind out). Play writes
the choices into the address, so a signage device can bookmark it
and start the same way every time (`play=1` skips the setup).
The slides, for each day picked, in order:
overview the day's picked entries on one slide
spotlight one entry: its person beside title, time and place
graphic an entry's graphic, full screen
map an entry's own map image (069), full screen
Keys while playing: arrows step, Space pauses, Escape leaves full
screen (the browser's), S goes back to the setup.
═══════════════════════════════════════════════════════════════ */
import { ArrowsOut, CaretLeft, CaretRight, Gear, Pause, Play } from '@phosphor-icons/react'
import { useEffect, useMemo, useRef, useState, type ReactNode } from 'react'
import { useParams, useSearchParams } from 'react-router-dom'
import PageState from '../components/PageState.tsx'
import { Avatar, groupByDay, mapAlt, type Day } from '../components/ScheduleBlock.tsx'
import { Paragraphs } from '../components/InlineText.tsx'
import { useEvent, type ContentBlockItem } from '../lib/useContent.ts'
import { mediaUrl } from '../lib/media.ts'
import { BRAND, accentText, readableOn } from '../lib/color.ts'
import { documentTitle } from '../lib/site.ts'
import './SchedulePresent.css'
/* Each kind of slide, its address key and seconds when unset. */
const KINDS = [
{ key: 'overview', label: 'Day overview', help: 'The whole day on one slide', seconds: 20 },
{ key: 'spotlight', label: 'Entry spotlight', help: 'One entry at a time, with its person', seconds: 12 },
{ key: 'graphic', label: 'Graphics', help: "An entry's graphic, full screen", seconds: 10 },
{ key: 'map', label: 'Map images', help: "An entry's own map, full screen", seconds: 10 },
] as const
type Kind = (typeof KINDS)[number]['key']
/* An overview with more entries than this goes to two columns. */
const ONE_COLUMN = 8
/* How long the controls stay up after the pointer last moved (ms). */
const CONTROLS_FOR = 2500
type Slide = { kind: Kind; seconds: number; day: Day; entry?: ContentBlockItem }
/* An entry's key in the address: day index, a dot, entry index. */
const entryKey = (day: number, entry: number) => `${day}.${entry}`
const list = (value: string | null) => (value ? value.split(',').filter(Boolean) : null)
function readSettings(params: URLSearchParams, days: Day[]) {
const pickedDays = list(params.get('days'))?.map(Number) ?? days.map((_, i) => i)
const hidden = new Set(list(params.get('hide')) ?? [])
const seconds = Object.fromEntries(
KINDS.map((kind) => {
const value = Number(params.get(kind.key) ?? kind.seconds)
return [kind.key, Number.isFinite(value) && value > 0 ? value : 0]
}),
) as Record<Kind, number>
return { pickedDays: new Set(pickedDays), hidden, seconds }
}
type Settings = ReturnType<typeof readSettings>
function buildSlides(days: Day[], { pickedDays, hidden, seconds }: Settings): Slide[] {
const slides: Slide[] = []
days.forEach((all, d) => {
if (!pickedDays.has(d)) return
const day = { ...all, entries: all.entries.filter((_, e) => !hidden.has(entryKey(d, e))) }
if (day.entries.length === 0) return
if (seconds.overview) slides.push({ kind: 'overview', seconds: seconds.overview, day })
for (const entry of day.entries) {
if (seconds.spotlight) slides.push({ kind: 'spotlight', seconds: seconds.spotlight, day, entry })
if (seconds.graphic && entry.media) slides.push({ kind: 'graphic', seconds: seconds.graphic, day, entry })
if (seconds.map && entry.map_image) slides.push({ kind: 'map', seconds: seconds.map, day, entry })
}
})
return slides
}
export default function SchedulePresent() {
const { id } = useParams()
const [params, setParams] = useSearchParams()
const { data: event, loading, error, notFound, reload } = useEvent(id)
const blockIndex = Number(params.get('block') ?? 0)
const schedule = event?.blocks?.filter((block) => block.type === 'schedule')[blockIndex]
const days = useMemo(() => groupByDay(schedule?.items ?? []), [schedule])
useEffect(() => {
if (event) document.title = documentTitle(`${event.title}: schedule`)
}, [event])
if (!event) {
return (
<PageState
loading={loading}
error={error}
notFound={notFound}
onRetry={reload}
noun="retreat"
backTo="/retreats"
backLabel="All retreats"
/>
)
}
const accent = event.color || BRAND
const back = `/events/${encodeURIComponent(event.id)}`
if (!schedule || days.length === 0) {
return (
<main className="min-h-screen bg-surface p-8">
<p className="notice">This event has no schedule to present.</p>
<a href={back} className="mt-4 inline-block text-link underline">
Back to {event.title}
</a>
</main>
)
}
const settings = readSettings(params, days)
if (params.get('play') === '1') {
return (
<Player
title={event.title}
accent={accent}
slides={buildSlides(days, settings)}
onSetup={() => {
const next = new URLSearchParams(params)
next.delete('play')
setParams(next)
}}
/>
)
}
return (
<Setup
title={event.title}
back={back}
accent={accent}
days={days}
settings={settings}
onPlay={(next) => {
// Full screen needs the click itself, so it's asked for here.
document.documentElement.requestFullscreen?.().catch(() => {})
const out = new URLSearchParams({ block: String(blockIndex) })
if (next.pickedDays.size < days.length) out.set('days', [...next.pickedDays].sort((a, b) => a - b).join(','))
if (next.hidden.size) out.set('hide', [...next.hidden].join(','))
for (const kind of KINDS) out.set(kind.key, String(next.seconds[kind.key]))
out.set('play', '1')
setParams(out)
}}
/>
)
}
/* ── Setup ──────────────────────────────────────────────────── */
function Setup({
title,
back,
accent,
days,
settings,
onPlay,
}: {
title: string
back: string
accent: string
days: Day[]
settings: Settings
onPlay: (settings: Settings) => void
}) {
const [pickedDays, setPickedDays] = useState(settings.pickedDays)
const [hidden, setHidden] = useState(settings.hidden)
const [seconds, setSeconds] = useState(settings.seconds)
const count = buildSlides(days, { pickedDays, hidden, seconds }).length
const toggle = <T,>(set: Set<T>, value: T) => {
const next = new Set(set)
if (next.has(value)) next.delete(value)
else next.add(value)
return next
}
return (
<main className="min-h-screen bg-surface text-body">
<div className="h-2" style={{ background: accent }} />
<div className="mx-auto max-w-4xl space-y-10 px-6 py-12">
<header>
<p className="text-sm font-semibold text-muted">Present the schedule</p>
<h1 className="text-4xl font-bold" style={{ color: accentText(accent) }}>
{title}
</h1>
<p className="mt-2 text-muted">
Pick what to show and for how long, then Play. It loops until you stop it. Bookmark the address after
pressing Play to start a screen the same way next time.
</p>
</header>
<section>
<h2 className="mb-4 text-2xl font-bold text-ink">Slides</h2>
<div className="grid gap-4 sm:grid-cols-2">
{KINDS.map((kind) => (
<label key={kind.key} className="flex items-center gap-4 bg-raised p-4 shadow-sm">
<span className="flex-1">
<span className="block font-semibold text-ink">{kind.label}</span>
<span className="text-sm text-muted">{kind.help}</span>
</span>
<input
type="number"
min={0}
max={600}
value={seconds[kind.key]}
onChange={(e) => setSeconds({ ...seconds, [kind.key]: Math.max(0, Number(e.target.value) || 0) })}
className="w-20 border border-muted/25 bg-surface px-2 py-1 text-right"
aria-describedby={`${kind.key}-unit`}
/>
<span id={`${kind.key}-unit`} className="text-sm text-muted">
sec
</span>
</label>
))}
</div>
<p className="mt-2 text-sm text-muted">0 leaves that kind of slide out.</p>
</section>
<section>
<h2 className="mb-4 text-2xl font-bold text-ink">Days and entries</h2>
<div className="space-y-6">
{days.map((day, d) => (
<fieldset key={d} className="bg-raised p-4 shadow-sm">
<legend className="sr-only">{day.name || 'Schedule'}</legend>
<label className="flex items-center gap-3 font-bold text-ink">
<input type="checkbox" checked={pickedDays.has(d)} onChange={() => setPickedDays(toggle(pickedDays, d))} />
{day.name || 'Schedule'}
</label>
<ul className="mt-3 space-y-2 pl-7">
{day.entries.map((entry, e) => (
<li key={e}>
<label className={`flex items-baseline gap-3 ${pickedDays.has(d) ? '' : 'opacity-50'}`}>
<input
type="checkbox"
disabled={!pickedDays.has(d)}
checked={!hidden.has(entryKey(d, e))}
onChange={() => setHidden(toggle(hidden, entryKey(d, e)))}
/>
<span className="w-32 shrink-0 text-sm text-muted">{entry.time}</span>
<span>{entry.text}</span>
</label>
</li>
))}
</ul>
</fieldset>
))}
</div>
</section>
<div className="flex flex-wrap items-center gap-4">
<button
type="button"
disabled={count === 0}
onClick={() => onPlay({ pickedDays, hidden, seconds })}
className="btn inline-flex items-center gap-2 px-6 py-3 disabled:opacity-50"
style={{ background: accent, color: readableOn(accent) }}
>
<Play aria-hidden="true" weight="fill" className="h-5 w-5" />
Play
</button>
<span className="text-sm text-muted">
{count === 0 ? 'Nothing picked to show.' : `${count} slide${count === 1 ? '' : 's'} in the loop`}
</span>
<a href={back} className="ml-auto text-sm text-link underline">
Back to the event
</a>
</div>
</div>
</main>
)
}
/* ── Player ─────────────────────────────────────────────────── */
function Player({
title,
accent,
slides,
onSetup,
}: {
title: string
accent: string
slides: Slide[]
onSetup: () => void
}) {
const [index, setIndex] = useState(0)
const [paused, setPaused] = useState(false)
const [controls, setControls] = useState(true)
const hideTimer = useRef(0)
const slide = slides[index % Math.max(slides.length, 1)]
const step = (by: number) => setIndex((i) => (i + by + slides.length) % slides.length)
// The next slide when this one's time is up.
useEffect(() => {
if (paused || !slide) return
const timer = window.setTimeout(() => step(1), slide.seconds * 1000)
return () => window.clearTimeout(timer)
}, [index, paused, slide?.seconds, slides.length])
useEffect(() => {
const onKey = (e: KeyboardEvent) => {
if (e.key === 'ArrowRight') step(1)
else if (e.key === 'ArrowLeft') step(-1)
else if (e.key === ' ') setPaused((p) => !p)
else if (e.key === 's' || e.key === 'S') onSetup()
else return
e.preventDefault()
}
window.addEventListener('keydown', onKey)
return () => window.removeEventListener('keydown', onKey)
})
// Keeps a signage screen from going to sleep, where the browser can.
useEffect(() => {
let lock: { release: () => Promise<void> } | null = null
const ask = () => {
if (document.visibilityState !== 'visible') return
;(navigator as any).wakeLock
?.request('screen')
.then((l: typeof lock) => (lock = l))
.catch(() => {})
}
ask()
document.addEventListener('visibilitychange', ask)
return () => {
document.removeEventListener('visibilitychange', ask)
lock?.release().catch(() => {})
}
}, [])
// The controls show while the pointer moves, then get out of the way.
const wake = () => {
setControls(true)
window.clearTimeout(hideTimer.current)
hideTimer.current = window.setTimeout(() => setControls(false), CONTROLS_FOR)
}
useEffect(() => {
wake()
return () => window.clearTimeout(hideTimer.current)
}, [])
if (!slide) {
return (
<main className="flex min-h-screen flex-col items-center justify-center gap-4 bg-surface">
<p className="notice">Nothing picked to show.</p>
<button type="button" onClick={onSetup} className="btn border border-muted/25 px-5 py-2">
Back to setup
</button>
</main>
)
}
const control = 'btn flex h-12 w-12 items-center justify-center bg-raised text-ink shadow-md'
return (
<main
onMouseMove={wake}
className={`present relative flex h-screen flex-col overflow-hidden bg-surface text-body ${controls ? '' : 'cursor-none'}`}
>
<div className="h-3 shrink-0" style={{ background: accent }} />
<div className="flex shrink-0 items-baseline justify-between gap-6 px-[4vw] pt-[2vh] text-[clamp(1rem,1.6vw,2rem)] text-muted">
<span className="font-semibold">{title}</span>
<span>{slide.day.name}</span>
</div>
{/* Keyed by index, so every slide's entrance animation plays. */}
<div key={index} className="min-h-0 flex-1 px-[4vw] py-[3vh]">
<SlideView slide={slide} accent={accent} />
</div>
{/* How long this slide has left. */}
<div className="h-1.5 shrink-0" style={{ background: `color-mix(in srgb, ${accent} 20%, transparent)` }}>
<div
key={`${index}-${paused}`}
className={paused ? 'h-full w-0' : 'present-timer h-full'}
style={{ background: accent, animationDuration: `${slide.seconds}s` }}
/>
</div>
<div
className={`absolute bottom-6 left-1/2 flex -translate-x-1/2 items-center gap-3 transition-opacity duration-300 ${
controls ? 'opacity-100' : 'pointer-events-none opacity-0'
}`}
>
<button type="button" onClick={() => step(-1)} className={control} aria-label="Previous slide">
<CaretLeft weight="bold" className="h-5 w-5" aria-hidden="true" />
</button>
<button type="button" onClick={() => setPaused((p) => !p)} className={control} aria-label={paused ? 'Play' : 'Pause'}>
{paused ? (
<Play weight="fill" className="h-5 w-5" aria-hidden="true" />
) : (
<Pause weight="bold" className="h-5 w-5" aria-hidden="true" />
)}
</button>
<button type="button" onClick={() => step(1)} className={control} aria-label="Next slide">
<CaretRight weight="bold" className="h-5 w-5" aria-hidden="true" />
</button>
<span className="bg-raised px-3 py-2 text-sm text-muted shadow-md">
{index + 1} / {slides.length}
</span>
<button
type="button"
onClick={() => document.documentElement.requestFullscreen?.().catch(() => {})}
className={control}
aria-label="Full screen"
>
<ArrowsOut weight="bold" className="h-5 w-5" aria-hidden="true" />
</button>
<button type="button" onClick={onSetup} className={control} aria-label="Back to setup">
<Gear weight="bold" className="h-5 w-5" aria-hidden="true" />
</button>
</div>
</main>
)
}
/* ── Slides ─────────────────────────────────────────────────── */
/* Fades and rises in after `order` steps, so a slide's parts arrive
one after another. */
function Rise({ order = 0, from = 'below', className = '', children }: {
order?: number
from?: 'below' | 'left' | 'right'
className?: string
children: ReactNode
}) {
return (
<div className={`present-in present-from-${from} ${className}`} style={{ animationDelay: `${order * 120}ms` }}>
{children}
</div>
)
}
function SlideView({ slide, accent }: { slide: Slide; accent: string }) {
const color = accentText(accent)
if (slide.kind === 'overview') {
const entries = slide.day.entries
const two = entries.length > ONE_COLUMN
return (
<div className="flex h-full flex-col">
<Rise>
<h1 className="mb-[3vh] text-[clamp(2rem,5vw,6rem)] font-bold leading-none" style={{ color }}>
{slide.day.name || 'Schedule'}
</h1>
</Rise>
<ul className={`grid min-h-0 flex-1 content-start gap-x-[4vw] ${two ? 'grid-cols-2' : 'grid-cols-1'}`}>
{entries.map((entry, i) => (
<li key={i}>
<Rise order={i + 1} from="left" className="flex items-baseline gap-[2vw] border-b border-brand/15 py-[1.2vh]">
<span className="w-[12vw] shrink-0 text-[clamp(1rem,1.8vw,2.4rem)] font-semibold" style={{ color }}>
{entry.time}
</span>
<span className="min-w-0 flex-1">
<span className="block text-[clamp(1.2rem,2.4vw,3rem)] font-bold leading-tight text-ink">
{entry.text}
</span>
{(entry.location || entry.person) && (
<span className="mt-1 flex flex-wrap items-center gap-x-[1.5vw] text-[clamp(0.9rem,1.4vw,1.8rem)] text-muted">
{entry.location && <span>{entry.location}</span>}
{entry.person && <span>{entry.person.name}</span>}
</span>
)}
</span>
</Rise>
</li>
))}
</ul>
</div>
)
}
const entry = slide.entry!
if (slide.kind === 'graphic' || slide.kind === 'map') {
const src = mediaUrl(slide.kind === 'map' ? entry.map_image : entry.media)
const alt = slide.kind === 'map' ? mapAlt(entry) : (entry.media_alt ?? '')
return (
<div className="flex h-full flex-col gap-[2vh]">
<Rise className="min-h-0 flex-1">
<img src={src ?? ''} alt={alt} className="h-full w-full object-contain" />
</Rise>
<Rise order={2} className="flex items-baseline gap-[2vw] text-[clamp(1.2rem,2.2vw,2.8rem)]">
<span className="font-semibold" style={{ color }}>
{entry.time}
</span>
<span className="font-bold text-ink">{entry.text}</span>
{slide.kind === 'map' && (entry.map || entry.location) && (
<span className="text-muted">{entry.map || entry.location}</span>
)}
</Rise>
</div>
)
}
// Spotlight: the person on the left, when there is one.
return (
<div className="flex h-full items-center gap-[5vw]">
{entry.person && (
<Rise from="left" className="flex w-[28vw] shrink-0 flex-col items-center text-center">
<Avatar person={entry.person} size="aspect-square w-full text-[4vw]" />
<p className="mt-[2vh] text-[clamp(1.4rem,2.6vw,3.2rem)] font-bold text-ink">{entry.person.name}</p>
{entry.person.tagline && (
<p className="text-[clamp(1rem,1.6vw,2rem)] text-muted">{entry.person.tagline}</p>
)}
</Rise>
)}
<div className="min-w-0 flex-1">
<Rise from="right">
<p className="text-[clamp(1.2rem,2.4vw,3rem)] font-semibold" style={{ color }}>
{[slide.day.name, entry.time].filter(Boolean).join(' · ')}
</p>
</Rise>
<Rise order={1} from="right">
<h1 className="mt-[1vh] text-[clamp(2.4rem,5.5vw,7rem)] font-bold leading-[1.05] text-ink">{entry.text}</h1>
</Rise>
{entry.location && (
<Rise order={2} from="right">
<p className="mt-[2vh] text-[clamp(1.2rem,2.4vw,3rem)] text-body">{entry.location}</p>
</Rise>
)}
{entry.detail && (
<Rise order={3} from="right">
<p className="mt-[1vh] text-[clamp(1rem,2vw,2.4rem)] text-muted">{entry.detail}</p>
</Rise>
)}
{entry.description && (
<Rise order={4} from="right">
<div className="mt-[3vh] line-clamp-6 space-y-3 text-[clamp(1rem,1.8vw,2.2rem)] leading-snug text-muted">
<Paragraphs text={entry.description} accent={accent} />
</div>
</Rise>
)}
</div>
</div>
)
}

View file

@ -592,7 +592,7 @@ export default function EventListCards({
}
return (
<div className="overflow-hidden">
<div className="overflow-x-clip">
{mixed && (
<TypeFilter
types={availableTypes}

View file

@ -1,5 +1,5 @@
import { CaretRight, MagnifyingGlass, X } from '@phosphor-icons/react';
import { Fragment, useEffect, useMemo, useRef, useState } from "react";
import { Fragment, useMemo, useRef, useState } from "react";
import { useCommunity } from "../../lib/useCommunity.ts";
import { useOrganization } from "../../lib/useContent.ts";
import { Link } from "react-router-dom";
@ -157,6 +157,7 @@ function Tile({
count = 0,
selected,
hovered,
hoveredArea,
setSelected,
setHovered,
onPick,
@ -168,19 +169,23 @@ function Tile({
const ids = slices.map(s => s.regionId);
const active = ids.includes(selected) || ids.includes(hovered);
const dimmed = selected && !ids.includes(selected);
// The state under the pointer, outlined in ink over its region's
// color, so both read at once.
const here = hoveredArea === code;
const clipId = `clip-${code}`;
// Solid, never see-through: a tile with no groups, or one dimmed
// while another region is picked, is its color mixed toward the
// page's rather than faded, so the backdrop doesn't show through.
const strength = dimmed ? (count ? 35 : 15) : count ? 100 : active ? 50 : 28;
const strength = dimmed ? (count ? 35 : 15) : count ? 100 : here ? 70 : active ? 50 : 28;
const tileFill = (color: string) => `color-mix(in srgb, ${color} ${strength}%, var(--color-surface))`;
// Clicking a shared tile cycles through its regions and then
// clears, so every slice is reachable without a second control.
const cycle = () => {
onPick?.(code);
const at = ids.indexOf(selected);
setSelected(at === ids.length - 1 ? null : ids[at + 1]);
const next = at === ids.length - 1 ? null : ids[at + 1];
onPick?.(code, next);
setSelected(next);
};
const name = `${AREA_NAMES[code] || code}: ${slices.map(s => s.name).join(" / ")}${
@ -193,14 +198,14 @@ function Tile({
return (
<g
onClick={cycle}
onMouseEnter={() => setHovered(primary.regionId)}
onMouseEnter={() => setHovered(primary.regionId, code)}
onMouseLeave={() => setHovered(null)}
{...(count
? {
role: "button",
tabIndex: 0,
"aria-label": name,
onFocus: () => setHovered(primary.regionId),
onFocus: () => setHovered(primary.regionId, code),
onBlur: () => setHovered(null),
onKeyDown: (e) => {
if (e.key !== "Enter" && e.key !== " ") return;
@ -241,9 +246,9 @@ function Tile({
width={width}
height={size}
fill="none"
stroke={active ? colorOf(primary) : "var(--color-surface)"}
strokeOpacity={active ? 1 : 0.55}
strokeWidth={active ? 4 : 2}
stroke={here ? "var(--color-ink)" : active ? colorOf(primary) : "var(--color-surface)"}
strokeOpacity={active || here ? 1 : 0.55}
strokeWidth={here ? 6 : active ? 4 : 2}
className="transition-all duration-200"
/>
@ -304,11 +309,14 @@ function RegionMap({ slices, groupCounts, ...props }: any) {
);
}
function LegendButton({ region, selected, setSelected, hovered, setHovered }) {
function LegendButton({ region, selected, setSelected, hovered, setHovered, onPickRegion }) {
const on = selected === region.id || hovered === region.id;
return (
<button
onClick={() => setSelected(selected === region.id ? null : region.id)}
onClick={() => {
if (selected !== region.id) onPickRegion(region.id);
setSelected(selected === region.id ? null : region.id);
}}
onMouseEnter={() => setHovered(region.id)}
onMouseLeave={() => setHovered(null)}
onFocus={() => setHovered(region.id)}
@ -386,9 +394,19 @@ function RegionBlock({
setHovered,
indent,
regionRefs,
groupRefs,
stateRefs,
}) {
const on = selected === region.id;
// Each state with groups, by name, its groups under it; groups with
// no state (online, or not placed) last, with no subheading.
const areas = new Map<string, any[]>();
for (const c of groups) {
const code = c.area_code ?? "";
areas.set(code, [...(areas.get(code) ?? []), c]);
}
const byArea = [...areas].sort(([a], [b]) =>
!a ? 1 : !b ? -1 : (AREA_NAMES[a] || a).localeCompare(AREA_NAMES[b] || b),
);
return (
<div
@ -428,13 +446,20 @@ function RegionBlock({
No groups yet. Interested in starting one?
</p>
) : (
<ul className="ml-5 mb-4 flex flex-col gap-3">
{groups.map(c => (
<div className="ml-5 mb-4 flex flex-col gap-4">
{byArea.map(([code, list]) => (
<div key={code} ref={el => { if (code) stateRefs.current[`${region.id}:${code}`] = el; }}>
{code && (
<h5 className="mb-2 text-xs font-bold uppercase tracking-wide" style={{ color: MUTED }}>
{AREA_NAMES[code] || code}
</h5>
)}
<ul className="flex flex-col gap-3">
{list.map(c => (
<li
key={c.id}
ref={el => groupRefs && (groupRefs.current[c.id] = el)}
className="pl-3 flex items-start gap-3"
style={{ borderLeft: `2px solid ${colorOf(region)}` }}
className="bg-raised shadow-sm p-3 flex items-start gap-3"
style={{ borderLeft: `3px solid ${colorOf(region)}` }}
>
<div className="min-w-0 flex-1">
<p className="font-bold">{c.name}</p>
@ -479,6 +504,9 @@ function RegionBlock({
</li>
))}
</ul>
</div>
))}
</div>
)}
</div>
);
@ -865,26 +893,20 @@ export default function OrgListMap({ view = "map", accent = FALLBACK_COLOR }) {
const [selected, setSelected] = useState<any>(null);
const [hovered, setHovered] = useState<any>(null);
const [hoveredArea, setHoveredArea] = useState<any>(null);
const [openId, setOpenId] = useState<any>(null); // no card open on arrival
const [query, setQuery] = useState("");
const reading = useReadingMode();
// The list scrolls itself to whatever the map or legend points at.
// The list scrolls itself to whatever the map or legend is clicked
// on (never on hover: it would jump around as the pointer crosses).
const listRef = useRef<any>(null);
const regionRefs = useRef<any>({});
const groupRefs = useRef<any>({});
const stateRefs = useRef<any>({});
// Where the latest hover came from. The list follows the map and
// the legend, but hovering the list itself must not move it: the
// row would slide out from under the pointer.
const hoverFromList = useRef(false);
const hoverOnMap = id => {
hoverFromList.current = false;
setHovered(id);
};
const hoverInList = id => {
hoverFromList.current = true;
const hoverOn = (id, code = null) => {
setHovered(id);
setHoveredArea(code);
};
const scrollListTo = el => {
@ -896,30 +918,21 @@ export default function OrgListMap({ view = "map", accent = FALLBACK_COLOR }) {
box.scrollTo({ top: el.offsetTop - 8, behavior: scrollBehavior() });
};
// Hovering or selecting a region on the map or legend brings its
// block into view. After a hover in the list, nothing scrolls: not
// on the way in, and not back to the selection on the way out.
useEffect(() => {
if (hoverFromList.current) return;
const id = hovered || selected;
if (id) scrollListTo(regionRefs.current[id]);
}, [hovered, selected]);
const pickRegion = id => scrollListTo(regionRefs.current[id]);
// Clicking a tile jumps to its first group when it has one,
// otherwise to the region it belongs to.
const pickArea = code => {
const group = groups.find(c => c.area_code === code);
if (group && groupRefs.current[group.id]) {
return scrollListTo(groupRefs.current[group.id]);
}
const region = regionsForArea(code)[0];
if (region) scrollListTo(regionRefs.current[region.id]);
// Clicking a tile jumps to the state's subheading under the region
// it selects when the state has groups there, otherwise to that
// region. Clicked back to no selection: the state under whichever
// region has its groups, else its first region.
const pickArea = (code, regionId) => {
const id = regionId ?? groups.find(c => c.area_code === code)?.region_id ?? regionsForArea(code)[0]?.id;
if (!id) return;
scrollListTo(stateRefs.current[`${id}:${code}`] ?? regionRefs.current[id]);
};
/* The list column, built only when what it shows changes: hovering
a map tile or legend entry changes `hovered`, which no row reads,
so hundreds of groups aren't drawn again for every tile crossed.
hoverInList only touches a ref and a state setter, both stable. */
so hundreds of groups aren't drawn again for every tile crossed. */
const list = useMemo(() => {
const match = matcher(query);
const block = (region, indent) => {
@ -930,13 +943,13 @@ export default function OrgListMap({ view = "map", accent = FALLBACK_COLOR }) {
key={region.id}
region={region}
groups={inRegion}
subtext={subtextFor(region)}
subtext={region.map_note}
indent={indent}
regionRefs={regionRefs}
groupRefs={groupRefs}
stateRefs={stateRefs}
selected={selected}
setSelected={setSelected}
setHovered={hoverInList}
setHovered={setHovered}
/>
);
};
@ -976,7 +989,7 @@ export default function OrgListMap({ view = "map", accent = FALLBACK_COLOR }) {
)}
</>
);
}, [domestic, international, virtual, groupsIn, subtextFor, selected, query]);
}, [domestic, international, virtual, groupsIn, selected, query]);
const shell = children => (
<div className="mx-auto px-8 md:px-12" style={{ maxWidth: CONTENT_MAX }}>
@ -1023,7 +1036,7 @@ export default function OrgListMap({ view = "map", accent = FALLBACK_COLOR }) {
);
}
const shared = { selected, setSelected, hovered, setHovered: hoverOnMap };
const shared = { selected, setSelected, hovered, hoveredArea, setHovered: hoverOn };
const onMapIds = new Set(regionAreas.map(a => a.region_id));
return (
@ -1046,6 +1059,7 @@ export default function OrgListMap({ view = "map", accent = FALLBACK_COLOR }) {
domestic={domestic}
international={international}
onMapIds={onMapIds}
onPickRegion={pickRegion}
{...shared}
/>
<p className="text-sm mt-4" style={{ color: MUTED }}>