Present: the whole event page, in sections at its headings
The presentation (now EventPresent) cuts the event's page into sections at its Heading blocks: a section's text on one slide, then its schedules' slides, a map block's map and each location lit up, and an events block's grid and each event. One Present button on the event page replaces the schedule's. Setup lists the sections, each schedule's days and entries under its own; the address keys are now skip and hide, numbered by schedule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
818d648e91
commit
df8052c75e
9 changed files with 635 additions and 260 deletions
|
|
@ -182,7 +182,7 @@ also in `server/src/admin-schema/` and a CHECK):
|
|||
| 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 → 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. 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`). |
|
||||
| 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 `EventPresent.tsx` (which slides each kind gets; the presentation cuts the event's page into sections at its Heading blocks). 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 → 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 |
|
||||
|
|
|
|||
|
|
@ -426,7 +426,7 @@ export function metaFor(db, rawPath, user = null) {
|
|||
};
|
||||
}
|
||||
|
||||
// An event's schedule presentation (SchedulePresent.tsx): the
|
||||
// An event page's presentation (EventPresent.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$/);
|
||||
|
|
|
|||
|
|
@ -67,7 +67,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"))
|
||||
const EventPresent = lazyPage(() => import("./pages/EventPresent.tsx"))
|
||||
|
||||
/*Admin Pages*/
|
||||
const AdminLayout = lazyPage(() => import("./pages/admin/AdminLayout.tsx"))
|
||||
|
|
@ -110,12 +110,12 @@ export default function App() {
|
|||
{/* Every page of the site: Pages → Page management (PageAtPath). */}
|
||||
<Route path="*" element={<PageAtPath />} />
|
||||
</Route>
|
||||
{/* A schedule as a slideshow for a screen: full screen, no Layout. */}
|
||||
{/* An event page as a slideshow for a screen: full screen, no Layout. */}
|
||||
<Route
|
||||
path="/events/:id/present"
|
||||
element={
|
||||
<Suspense fallback={null}>
|
||||
<SchedulePresent />
|
||||
<EventPresent />
|
||||
</Suspense>
|
||||
}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@
|
|||
|
||||
import { mediaUrl } from '../lib/media.ts'
|
||||
import PeopleTiles from './PeopleTiles.tsx'
|
||||
import type { ContentBlock, ContentBlockItem } from '../lib/useContent.ts'
|
||||
import type { ContentBlock, ContentBlockItem, ItemEvent } from '../lib/useContent.ts'
|
||||
import { Anchor, Inline, Paragraphs, isExternalUrl } from './InlineText.tsx'
|
||||
import VideoPlayer from './VideoPlayer.tsx'
|
||||
import ScheduleBlock from './ScheduleBlock.tsx'
|
||||
|
|
@ -72,7 +72,6 @@ export default function ContentBlocks({
|
|||
blocks,
|
||||
accent = BRAND,
|
||||
className = '',
|
||||
presentAt,
|
||||
anchorPrefix = '',
|
||||
}: {
|
||||
blocks?: ContentBlock[] | null
|
||||
|
|
@ -80,9 +79,6 @@ export default function ContentBlocks({
|
|||
className?: string
|
||||
/** Put before each heading's id: a blog post's tab (contents.ts, splitTabs). */
|
||||
anchorPrefix?: 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
|
||||
|
|
@ -98,10 +94,6 @@ export default function ContentBlocks({
|
|||
return level
|
||||
})
|
||||
|
||||
let schedules = 0
|
||||
const presentHrefs = blocks.map((block) =>
|
||||
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] : [])))
|
||||
|
|
@ -116,7 +108,6 @@ export default function ContentBlocks({
|
|||
accent={accent}
|
||||
anchor={idAt.get(index)}
|
||||
level={levels[index]}
|
||||
presentHref={presentHrefs[index]}
|
||||
/>
|
||||
</WordMotion>
|
||||
))}
|
||||
|
|
@ -161,12 +152,19 @@ 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. */
|
||||
/* An event's type and date, eg. workshop · June 14, 2025 (shown
|
||||
capitalized), or null with neither. */
|
||||
export function eventLine(event: ItemEvent): string | null {
|
||||
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 [kind, when].filter(Boolean).join(' · ') || null
|
||||
}
|
||||
|
||||
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
|
||||
const line = eventLine(event)
|
||||
return (
|
||||
<Anchor
|
||||
href={eventHref(event.id)}
|
||||
|
|
@ -176,9 +174,9 @@ function EventCard({ item, accent }: { item: ContentBlockItem; accent: string })
|
|||
<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) && (
|
||||
{line && (
|
||||
<span className="text-xs font-semibold capitalize" style={{ color: accentText(color) }}>
|
||||
{[kind, when].filter(Boolean).join(' · ')}
|
||||
{line}
|
||||
</span>
|
||||
)}
|
||||
<span className="font-display text-base font-bold leading-snug text-ink group-hover:text-link">
|
||||
|
|
@ -223,13 +221,11 @@ 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()
|
||||
|
|
@ -439,7 +435,6 @@ function Block({
|
|||
tags={block.tags}
|
||||
intro={block.text}
|
||||
accent={accent}
|
||||
presentHref={presentHref}
|
||||
/>
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,9 @@
|
|||
the mark's own, so Layout's jump to the anchor scrolls it into
|
||||
view and focuses it.
|
||||
|
||||
MapPicture is the picture and its marks alone; the event's
|
||||
presentation (EventPresent.tsx) draws it too, with no links.
|
||||
|
||||
Reading mode (readingMode.ts) gets the list alone, no picture.
|
||||
|
||||
PageMaps holds the venues that have a map block among the blocks
|
||||
|
|
@ -20,8 +23,8 @@
|
|||
when there's a map on the page to go to.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
import { createContext, useState } from 'react'
|
||||
import { Link, useLocation } from 'react-router-dom'
|
||||
import { createContext, useState, type CSSProperties } from 'react'
|
||||
import { Link, useLocation, type To } from 'react-router-dom'
|
||||
|
||||
import { mediaUrl } from '../lib/media.ts'
|
||||
import type { Venue, VenueLocation } from '../lib/useContent.ts'
|
||||
|
|
@ -33,15 +36,138 @@ 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 const isMarked = (location: VenueLocation) => location.x != null && location.y != null
|
||||
|
||||
/* A location's number on the map and in the list: its place in the
|
||||
venue's order. */
|
||||
export const locationNumber = (venue: Venue, location: VenueLocation) => venue.locations.indexOf(location) + 1
|
||||
|
||||
/* A location's numbered dot, in the accent. */
|
||||
export function LocationNumber({
|
||||
n,
|
||||
accent,
|
||||
className = 'h-6 w-6 text-xs',
|
||||
style,
|
||||
}: {
|
||||
n: number
|
||||
accent: string
|
||||
className?: string
|
||||
style?: CSSProperties
|
||||
}) {
|
||||
return (
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className={`flex shrink-0 items-center justify-center rounded-full font-bold ${className}`}
|
||||
style={{ background: accent, color: readableOn(accent.startsWith('#') ? accent : '#000000'), ...style }}
|
||||
>
|
||||
{n}
|
||||
</span>
|
||||
)
|
||||
}
|
||||
|
||||
/* The venue's picture with its marks, `active` lit up. With `link`
|
||||
each mark is a link (and `light` its hover and focus); without,
|
||||
the marks are only drawn. `className` sizes the picture's box. */
|
||||
export function MapPicture({
|
||||
venue,
|
||||
accent,
|
||||
active,
|
||||
link,
|
||||
light,
|
||||
className = '',
|
||||
big = false,
|
||||
}: {
|
||||
venue: Venue
|
||||
accent: string
|
||||
active: string | null
|
||||
link?: (key: string) => To
|
||||
light?: (key: string) => object
|
||||
className?: string
|
||||
/** Bigger marks, for a screen across a room. */
|
||||
big?: boolean
|
||||
}) {
|
||||
const image = mediaUrl(venue.map_image)
|
||||
if (!image) return null
|
||||
return (
|
||||
<div className={`relative ${className}`}>
|
||||
<img src={image} alt={venue.map_alt || `Map of ${venue.name}`} className="block w-full" />
|
||||
{venue.locations.filter(isMarked).map((location) => {
|
||||
const on = active === location.key
|
||||
const dim = active != null && !on
|
||||
const style: CSSProperties = isBox(location)
|
||||
? {
|
||||
left: `${location.x}%`,
|
||||
top: `${location.y}%`,
|
||||
width: `${location.w}%`,
|
||||
height: `${location.h}%`,
|
||||
border: `${big ? 4 : 2}px 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,
|
||||
}
|
||||
const dot = big
|
||||
? isBox(location)
|
||||
? 'absolute top-[0.5vw] left-[0.5vw] h-[2.6vw] w-[2.6vw] text-[1.3vw]'
|
||||
: on
|
||||
? 'h-[4vw] w-[4vw] text-[2vw]'
|
||||
: 'h-[2.8vw] w-[2.8vw] text-[1.4vw]'
|
||||
: isBox(location)
|
||||
? 'absolute top-1 left-1 h-6 w-6 text-xs'
|
||||
: on
|
||||
? 'h-9 w-9 text-xs'
|
||||
: 'h-7 w-7 text-xs'
|
||||
const inside = (
|
||||
<>
|
||||
<LocationNumber
|
||||
n={locationNumber(venue, location)}
|
||||
accent={accent}
|
||||
className={`shadow ${dot}`}
|
||||
style={on ? { outline: `${big ? 4 : 3}px solid white` } : undefined}
|
||||
/>
|
||||
{on && !big && (
|
||||
<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>
|
||||
)}
|
||||
</>
|
||||
)
|
||||
return link ? (
|
||||
<Link
|
||||
key={location.key}
|
||||
id={mapAnchor(venue.id, location.key)}
|
||||
to={link(location.key)}
|
||||
aria-label={location.name}
|
||||
{...light?.(location.key)}
|
||||
className="absolute transition-opacity"
|
||||
style={style}
|
||||
>
|
||||
{inside}
|
||||
</Link>
|
||||
) : (
|
||||
<span key={location.key} aria-hidden="true" className="absolute transition-opacity duration-500" style={style}>
|
||||
{inside}
|
||||
</span>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
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 picture = !useReadingMode() && Boolean(venue.map_image)
|
||||
|
||||
const to = (key: string) => ({ search, hash: mapAnchor(venue.id, key) })
|
||||
const light = (key: string) => ({
|
||||
|
|
@ -50,68 +176,12 @@ export default function MapBlock({ venue, accent }: { venue: Venue; accent: stri
|
|||
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>
|
||||
)}
|
||||
{picture && <MapPicture venue={venue} accent={accent} active={active} link={to} light={light} className="self-start" />}
|
||||
|
||||
<figcaption className={image ? '' : 'md:col-span-2'}>
|
||||
<figcaption className={picture ? '' : '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">
|
||||
|
|
@ -119,13 +189,7 @@ export default function MapBlock({ venue, accent }: { venue: Venue; accent: stri
|
|||
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>
|
||||
<LocationNumber n={locationNumber(venue, location)} accent={accent} />
|
||||
<span className="min-w-0">
|
||||
<span className="block font-semibold" style={on ? { color: accentText(accent) } : undefined}>
|
||||
{location.name}
|
||||
|
|
@ -138,7 +202,7 @@ export default function MapBlock({ venue, accent }: { venue: Venue; accent: stri
|
|||
const rowStyle = on ? { background: withAlpha(accent, 12) } : undefined
|
||||
return (
|
||||
<li key={location.key}>
|
||||
{location.x != null && location.y != null ? (
|
||||
{isMarked(location) ? (
|
||||
<Link to={to(location.key)} {...light(location.key)} className={rowClass} style={rowStyle}>
|
||||
{row}
|
||||
</Link>
|
||||
|
|
|
|||
|
|
@ -38,8 +38,8 @@
|
|||
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
|
||||
slideshow for a screen (SchedulePresent.tsx).
|
||||
The event page's Present button shows it, with the rest of the
|
||||
page, as a slideshow for a screen (EventPresent.tsx).
|
||||
|
||||
Tabs follow the ARIA tab pattern: arrow keys move between them.
|
||||
|
||||
|
|
@ -48,7 +48,7 @@
|
|||
it, no map frame (ReadingSchedule).
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
import { CaretDown, MapPin, Presentation, Star } from '@phosphor-icons/react'
|
||||
import { CaretDown, MapPin, Star } from '@phosphor-icons/react'
|
||||
import { Fragment, createContext, useContext, useId, useState, type KeyboardEvent, type ReactNode } from 'react'
|
||||
import { Link, useLocation } from 'react-router-dom'
|
||||
|
||||
|
|
@ -475,14 +475,11 @@ export default function ScheduleBlock({
|
|||
tags = [],
|
||||
intro,
|
||||
accent,
|
||||
presentHref,
|
||||
}: {
|
||||
items: ContentBlockItem[]
|
||||
tags?: ScheduleTag[]
|
||||
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))
|
||||
|
|
@ -526,21 +523,6 @@ 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>
|
||||
)}
|
||||
|
||||
{tabs.length > 1 && (
|
||||
<div role="tablist" aria-label="Days and tags" className="flex flex-wrap gap-2">
|
||||
{tabs.map((tab, index) => {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,8 @@ import { mediaUrl } from '../lib/media.ts'
|
|||
import { eventTypeLabel } from '../lib/eventTypes.ts'
|
||||
import { occurrenceLabel, seriesLabel, seriesTimes, upcomingOccurrences } from '../lib/eventSeries.ts'
|
||||
import { capitalize } from '../lib/text.ts'
|
||||
import { accentText, readableOn, BRAND } from '../lib/color.ts'
|
||||
import { accentText, readableOn, withAlpha, BRAND } from '../lib/color.ts'
|
||||
import { Presentation } from '@phosphor-icons/react'
|
||||
|
||||
const BODY = 'var(--color-muted)'
|
||||
|
||||
|
|
@ -109,7 +110,22 @@ export default function EventDetail() {
|
|||
)}
|
||||
|
||||
<div className="max-w-3xl">
|
||||
<ContentBlocks blocks={event.blocks} accent={accent} presentAt={`/events/${encodeURIComponent(event.id)}/present`} />
|
||||
{/* The page as a slideshow for a screen (EventPresent.tsx). */}
|
||||
{event.blocks.length > 0 && (
|
||||
<div className="mb-6 flex justify-end">
|
||||
<Link
|
||||
to={`/events/${encodeURIComponent(event.id)}/present`}
|
||||
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>
|
||||
)}
|
||||
<ContentBlocks blocks={event.blocks} accent={accent} />
|
||||
</div>
|
||||
|
||||
{event.links.length > 0 && (
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* The schedule presentation's motion (SchedulePresent.tsx). The
|
||||
/* The event presentation's motion (EventPresent.tsx). The
|
||||
reduced motion rule in index.css stops all of it. */
|
||||
|
||||
.present-in {
|
||||
|
|
@ -1,16 +1,23 @@
|
|||
/* ═══════════════════════════════════════════════════════════════
|
||||
SCHEDULE PRESENTATION: /events/:id/present?block=<n>
|
||||
EVENT PRESENTATION: /events/:id/present
|
||||
|
||||
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.
|
||||
An event page's content blocks as an endless slideshow for a
|
||||
screen (digital signage), opened from the page'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 page is cut into sections at its Heading blocks (the blocks
|
||||
before the first are a section under the event's title). Each
|
||||
section, in order, gives:
|
||||
section its text blocks (everything but the kinds below) on
|
||||
one slide under its heading, scrolling if long
|
||||
schedule each schedule block's slides (below)
|
||||
venue each map block (088): the map with its locations
|
||||
place then the map once per marked location, it lit up
|
||||
cards each events block (088): its events on one slide
|
||||
event then each event alone: picture, title, card text
|
||||
and its person host
|
||||
|
||||
The slides, for each day picked, in order:
|
||||
A schedule's 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
|
||||
block a block entry (086) and its sub-items on one slide,
|
||||
|
|
@ -21,10 +28,20 @@
|
|||
tag after the days: each of the schedule's tags (087)
|
||||
and everything it's on, under each day's name
|
||||
A heading (086) is only a line on the overview; a break gets no
|
||||
spotlight. A slide with more than the screen holds waits half its
|
||||
seconds, scrolls to the end at "Scroll" seconds a screenful
|
||||
(`screen=`), then waits the other half. "Only entries tagged" (`only=<key>`) cuts every slide
|
||||
to what one tag is on, eg. for a screen outside the youth room.
|
||||
spotlight. "Only entries tagged" (`only=<key>`) cuts every
|
||||
schedule slide to what one tag is on, eg. for a screen outside the
|
||||
youth room.
|
||||
|
||||
First a setup screen: which sections, 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): `skip` the sections left out, by number; `hide` the days
|
||||
(schedule.day), entries (schedule.day.entry) and sub-items
|
||||
(schedule.day.entry.item) left out, a schedule numbered among the
|
||||
page's schedules. A slide with more than the screen holds waits
|
||||
half its seconds, scrolls to the end at "Scroll" seconds a
|
||||
screenful (`screen=`), then waits the other half.
|
||||
|
||||
Keys while playing: arrows step, Space pauses, Escape leaves full
|
||||
screen (the browser's), S goes back to the setup.
|
||||
|
|
@ -47,54 +64,99 @@ import {
|
|||
withTag,
|
||||
type Day,
|
||||
} from '../components/ScheduleBlock.tsx'
|
||||
import ContentBlocks, { eventLine } from '../components/ContentBlocks.tsx'
|
||||
import { LocationNumber, MapPicture, isMarked, locationNumber } from '../components/MapBlock.tsx'
|
||||
import { Paragraphs } from '../components/InlineText.tsx'
|
||||
import { useEvent, type ContentBlockItem, type ScheduleTag } from '../lib/useContent.ts'
|
||||
import {
|
||||
useEvent,
|
||||
type ContentBlock,
|
||||
type ContentBlockItem,
|
||||
type ScheduleTag,
|
||||
type Venue,
|
||||
type VenueLocation,
|
||||
} from '../lib/useContent.ts'
|
||||
import { mediaUrl } from '../lib/media.ts'
|
||||
import { BRAND, accentText, readableOn, withAlpha } from '../lib/color.ts'
|
||||
import { documentTitle } from '../lib/site.ts'
|
||||
import './SchedulePresent.css'
|
||||
import './EventPresent.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: 'block', label: 'Blocks', help: 'A block and the things in it, before each gets a spotlight', seconds: 15 },
|
||||
{ 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 },
|
||||
{ key: 'tag', label: 'Tag slides', help: "Each tag and everything it's on, after the days", seconds: 15 },
|
||||
{ key: 'section', label: 'Sections', help: "A section's text under its heading", seconds: 20 },
|
||||
{ key: 'overview', label: 'Day overview', help: 'A schedule day on one slide', seconds: 20 },
|
||||
{ key: 'spotlight', label: 'Entry spotlight', help: 'One schedule entry at a time, with its person', seconds: 12 },
|
||||
{ key: 'block', label: 'Blocks', help: 'A schedule block and the things in it, before each gets a spotlight', seconds: 15 },
|
||||
{ key: 'graphic', label: 'Graphics', help: "A schedule entry's graphic, full screen", seconds: 10 },
|
||||
{ key: 'map', label: 'Map images', help: "A schedule entry's own map, full screen", seconds: 10 },
|
||||
{ key: 'tag', label: 'Tag slides', help: "Each schedule tag and everything it's on, after the days", seconds: 15 },
|
||||
{ key: 'venue', label: 'Maps', help: "A map block: the venue's map with its locations", seconds: 15 },
|
||||
{ key: 'place', label: 'Map locations', help: 'The map again for each location, it lit up', seconds: 8 },
|
||||
{ key: 'cards', label: 'Event lists', help: "An events block's events on one slide", seconds: 15 },
|
||||
{ key: 'event', label: 'Event spotlight', help: 'Each event of an events block alone', seconds: 12 },
|
||||
] as const
|
||||
type Kind = (typeof KINDS)[number]['key']
|
||||
|
||||
/* Blocks with slides of their own, not a section's text, as the
|
||||
setup screen names them. */
|
||||
const OWN_SLIDES = new Map([
|
||||
['schedule', 'Schedule'],
|
||||
['map', 'Map'],
|
||||
['events', 'Events'],
|
||||
])
|
||||
/* Blocks that start a section. */
|
||||
const STARTS_SECTION = new Set(['heading', 'tab'])
|
||||
|
||||
/* Seconds a long slide takes to scroll one screenful, when unset. */
|
||||
const PER_SCREEN = 8
|
||||
/* 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
|
||||
/* A section's text is drawn at the page's size, zoomed to a screen
|
||||
this many pixels wide or more. */
|
||||
const TEXT_WIDTH = 1000
|
||||
|
||||
/* `parent` is a sub-item's block; a tag slide has its `tag` and the
|
||||
`days` it gathers from. */
|
||||
/* `label` is the top bar's right side: the day, else the section.
|
||||
The rest is what each kind draws. */
|
||||
type Slide = {
|
||||
kind: Kind
|
||||
seconds: number
|
||||
day: Day
|
||||
label: string
|
||||
day?: Day
|
||||
entry?: ContentBlockItem
|
||||
parent?: ContentBlockItem
|
||||
tag?: ScheduleTag
|
||||
days?: Day[]
|
||||
tags?: ScheduleTag[]
|
||||
blocks?: ContentBlock[]
|
||||
venue?: Venue
|
||||
location?: VenueLocation
|
||||
items?: ContentBlockItem[]
|
||||
}
|
||||
|
||||
/* An entry's key in the address: day index, a dot, entry index, and
|
||||
for a sub-item another dot and its index. */
|
||||
const entryKey = (...at: number[]) => at.join('.')
|
||||
/* A part of the page: a heading and the blocks under it. */
|
||||
type Section = { title: string; blocks: ContentBlock[] }
|
||||
/* A schedule block, numbered among the page's, with its days. */
|
||||
type Schedule = { n: number; days: Day[]; tags: ScheduleTag[] }
|
||||
|
||||
function sectionsOf(blocks: ContentBlock[], title: string): Section[] {
|
||||
const sections: Section[] = [{ title, blocks: [] }]
|
||||
for (const block of blocks) {
|
||||
if (STARTS_SECTION.has(block.type)) sections.push({ title: block.text || title, blocks: [] })
|
||||
else sections[sections.length - 1].blocks.push(block)
|
||||
}
|
||||
return sections.filter((section) => section.blocks.length)
|
||||
}
|
||||
|
||||
/* A day's, entry's or sub-item's key in the address: the schedule's
|
||||
number, the day's, then the entry's and sub-item's, dotted. */
|
||||
const key = (...at: number[]) => at.join('.')
|
||||
/* Lines on an overview: entries and sub-items. */
|
||||
const lineCount = (entries: ContentBlockItem[]) =>
|
||||
entries.reduce((n, entry) => n + 1 + (entry.kind === 'block' ? (entry.items?.length ?? 0) : 0), 0)
|
||||
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')) ?? [])
|
||||
function readSettings(params: URLSearchParams) {
|
||||
const seconds = Object.fromEntries(
|
||||
KINDS.map((kind) => {
|
||||
const value = Number(params.get(kind.key) ?? kind.seconds)
|
||||
|
|
@ -103,51 +165,48 @@ function readSettings(params: URLSearchParams, days: Day[]) {
|
|||
) as Record<Kind, number>
|
||||
const screen = Number(params.get('screen') ?? PER_SCREEN)
|
||||
return {
|
||||
pickedDays: new Set(pickedDays),
|
||||
hidden,
|
||||
skipped: new Set((list(params.get('skip')) ?? []).map(Number)),
|
||||
hidden: new Set(list(params.get('hide')) ?? []),
|
||||
seconds,
|
||||
screen: Number.isFinite(screen) && screen > 0 ? screen : PER_SCREEN,
|
||||
only: params.get('only') || null,
|
||||
}
|
||||
}
|
||||
type Settings = ReturnType<typeof readSettings>
|
||||
type Picks = Pick<Settings, 'skipped' | 'hidden' | 'seconds' | 'only'>
|
||||
|
||||
function buildSlides(
|
||||
days: Day[],
|
||||
tags: ScheduleTag[],
|
||||
{ pickedDays, hidden, seconds, only }: Pick<Settings, 'pickedDays' | 'hidden' | 'seconds' | 'only'>,
|
||||
): Slide[] {
|
||||
const slides: Slide[] = []
|
||||
function scheduleSlides(slides: Slide[], { n, days, tags }: Schedule, { hidden, seconds, only }: Picks) {
|
||||
const kept: Day[] = []
|
||||
days.forEach((all, d) => {
|
||||
if (!pickedDays.has(d)) return
|
||||
if (hidden.has(key(n, d))) return
|
||||
let entries = all.entries.flatMap((entry, e) => {
|
||||
if (hidden.has(entryKey(d, e))) return []
|
||||
if (hidden.has(key(n, d, e))) return []
|
||||
if (entry.kind !== 'block') return [entry]
|
||||
return [{ ...entry, items: (entry.items ?? []).filter((_, i) => !hidden.has(entryKey(d, e, i))) }]
|
||||
return [{ ...entry, items: (entry.items ?? []).filter((_, i) => !hidden.has(key(n, d, e, i))) }]
|
||||
})
|
||||
if (only) entries = withTag(entries, only)
|
||||
if (entries.length === 0) return
|
||||
kept.push({ name: all.name, entries })
|
||||
const day = { ...all, entries }
|
||||
if (seconds.overview) slides.push({ kind: 'overview', seconds: seconds.overview, day })
|
||||
const at = { day, label: day.name, tags }
|
||||
if (seconds.overview) slides.push({ kind: 'overview', seconds: seconds.overview, ...at })
|
||||
|
||||
const media = (entry: ContentBlockItem, parent?: ContentBlockItem) => {
|
||||
if (seconds.graphic && entry.media) slides.push({ kind: 'graphic', seconds: seconds.graphic, day, entry, parent })
|
||||
if (seconds.map && entry.map_image) slides.push({ kind: 'map', seconds: seconds.map, day, entry, parent })
|
||||
if (seconds.graphic && entry.media) slides.push({ kind: 'graphic', seconds: seconds.graphic, ...at, entry, parent })
|
||||
if (seconds.map && entry.map_image) slides.push({ kind: 'map', seconds: seconds.map, ...at, entry, parent })
|
||||
}
|
||||
for (const entry of entries) {
|
||||
if (entry.kind === 'heading') continue
|
||||
if (entry.kind === 'block') {
|
||||
if (seconds.block) slides.push({ kind: 'block', seconds: seconds.block, day, entry })
|
||||
if (seconds.block) slides.push({ kind: 'block', seconds: seconds.block, ...at, entry })
|
||||
media(entry)
|
||||
for (const item of entry.items ?? []) {
|
||||
if (seconds.spotlight) slides.push({ kind: 'spotlight', seconds: seconds.spotlight, day, entry: item, parent: entry })
|
||||
if (seconds.spotlight) slides.push({ kind: 'spotlight', seconds: seconds.spotlight, ...at, entry: item, parent: entry })
|
||||
media(item, entry)
|
||||
}
|
||||
continue
|
||||
}
|
||||
if (seconds.spotlight && entry.kind !== 'break') slides.push({ kind: 'spotlight', seconds: seconds.spotlight, day, entry })
|
||||
if (seconds.spotlight && entry.kind !== 'break') slides.push({ kind: 'spotlight', seconds: seconds.spotlight, ...at, entry })
|
||||
media(entry)
|
||||
}
|
||||
})
|
||||
|
|
@ -156,24 +215,59 @@ function buildSlides(
|
|||
for (const tag of tags) {
|
||||
if (only && tag.key !== only) continue
|
||||
const tagDays = daysWithTag(kept, tag.key)
|
||||
if (tagDays.length) slides.push({ kind: 'tag', seconds: seconds.tag, day: { name: '', entries: [] }, tag, days: tagDays })
|
||||
if (tagDays.length) slides.push({ kind: 'tag', seconds: seconds.tag, label: tag.name, tag, days: tagDays, tags })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function buildSlides(sections: Section[], schedules: Map<ContentBlock, Schedule>, picks: Picks): Slide[] {
|
||||
const { skipped, seconds } = picks
|
||||
const slides: Slide[] = []
|
||||
sections.forEach((section, s) => {
|
||||
if (skipped.has(s)) return
|
||||
const label = section.title
|
||||
const text = section.blocks.filter((block) => !OWN_SLIDES.has(block.type))
|
||||
if (seconds.section && text.length) slides.push({ kind: 'section', seconds: seconds.section, label, blocks: text })
|
||||
for (const block of section.blocks) {
|
||||
const schedule = schedules.get(block)
|
||||
if (schedule) scheduleSlides(slides, schedule, picks)
|
||||
if (block.type === 'map' && block.venue) {
|
||||
const venue = block.venue
|
||||
if (seconds.venue) slides.push({ kind: 'venue', seconds: seconds.venue, label, venue })
|
||||
if (seconds.place && venue.map_image) {
|
||||
for (const location of venue.locations.filter(isMarked)) {
|
||||
slides.push({ kind: 'place', seconds: seconds.place, label, venue, location })
|
||||
}
|
||||
}
|
||||
}
|
||||
if (block.type === 'events') {
|
||||
const items = (block.items ?? []).filter((item) => item.event)
|
||||
if (seconds.cards && items.length) slides.push({ kind: 'cards', seconds: seconds.cards, label, items })
|
||||
if (seconds.event) for (const entry of items) slides.push({ kind: 'event', seconds: seconds.event, label, entry })
|
||||
}
|
||||
}
|
||||
})
|
||||
return slides
|
||||
}
|
||||
|
||||
export default function SchedulePresent() {
|
||||
export default function EventPresent() {
|
||||
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])
|
||||
const tags = schedule?.tags ?? []
|
||||
const sections = useMemo(() => (event ? sectionsOf(event.blocks ?? [], event.title) : []), [event])
|
||||
const schedules = useMemo(() => {
|
||||
const out = new Map<ContentBlock, Schedule>()
|
||||
for (const block of event?.blocks ?? []) {
|
||||
if (block.type !== 'schedule') continue
|
||||
const days = groupByDay(block.items ?? [])
|
||||
if (days.length) out.set(block, { n: out.size, days, tags: block.tags ?? [] })
|
||||
}
|
||||
return out
|
||||
}, [event])
|
||||
|
||||
useEffect(() => {
|
||||
if (event) document.title = documentTitle(`${event.title}: schedule`)
|
||||
if (event) document.title = documentTitle(`${event.title}: present`)
|
||||
}, [event])
|
||||
|
||||
if (!event) {
|
||||
|
|
@ -193,10 +287,10 @@ export default function SchedulePresent() {
|
|||
const accent = event.color || BRAND
|
||||
const back = `/events/${encodeURIComponent(event.id)}`
|
||||
|
||||
if (!schedule || days.length === 0) {
|
||||
if (sections.length === 0) {
|
||||
return (
|
||||
<main className="min-h-screen bg-surface p-8">
|
||||
<p className="notice">This event has no schedule to present.</p>
|
||||
<p className="notice">This event has nothing on its page to present.</p>
|
||||
<a href={back} className="mt-4 inline-block text-link underline">
|
||||
Back to {event.title}
|
||||
</a>
|
||||
|
|
@ -204,22 +298,20 @@ export default function SchedulePresent() {
|
|||
)
|
||||
}
|
||||
|
||||
const settings = readSettings(params, days)
|
||||
const settings = readSettings(params)
|
||||
if (params.get('play') === '1') {
|
||||
return (
|
||||
<ScheduleTags.Provider value={tags}>
|
||||
<Player
|
||||
title={event.title}
|
||||
accent={accent}
|
||||
slides={buildSlides(days, tags, settings)}
|
||||
screen={settings.screen}
|
||||
onSetup={() => {
|
||||
const next = new URLSearchParams(params)
|
||||
next.delete('play')
|
||||
setParams(next)
|
||||
}}
|
||||
/>
|
||||
</ScheduleTags.Provider>
|
||||
<Player
|
||||
title={event.title}
|
||||
accent={accent}
|
||||
slides={buildSlides(sections, schedules, settings)}
|
||||
screen={settings.screen}
|
||||
onSetup={() => {
|
||||
const next = new URLSearchParams(params)
|
||||
next.delete('play')
|
||||
setParams(next)
|
||||
}}
|
||||
/>
|
||||
)
|
||||
}
|
||||
return (
|
||||
|
|
@ -227,14 +319,14 @@ export default function SchedulePresent() {
|
|||
title={event.title}
|
||||
back={back}
|
||||
accent={accent}
|
||||
days={days}
|
||||
tags={tags}
|
||||
sections={sections}
|
||||
schedules={schedules}
|
||||
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(','))
|
||||
const out = new URLSearchParams()
|
||||
if (next.skipped.size) out.set('skip', [...next.skipped].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('screen', String(next.screen))
|
||||
|
|
@ -253,25 +345,26 @@ function Setup({
|
|||
title,
|
||||
back,
|
||||
accent,
|
||||
days,
|
||||
tags,
|
||||
sections,
|
||||
schedules,
|
||||
settings,
|
||||
onPlay,
|
||||
}: {
|
||||
title: string
|
||||
back: string
|
||||
accent: string
|
||||
days: Day[]
|
||||
tags: ScheduleTag[]
|
||||
sections: Section[]
|
||||
schedules: Map<ContentBlock, Schedule>
|
||||
settings: Settings
|
||||
onPlay: (settings: Settings) => void
|
||||
}) {
|
||||
const [pickedDays, setPickedDays] = useState(settings.pickedDays)
|
||||
const [skipped, setSkipped] = useState(settings.skipped)
|
||||
const [hidden, setHidden] = useState(settings.hidden)
|
||||
const [seconds, setSeconds] = useState(settings.seconds)
|
||||
const [only, setOnly] = useState(settings.only)
|
||||
const [screen, setScreen] = useState(settings.screen)
|
||||
const count = buildSlides(days, tags, { pickedDays, hidden, seconds, only }).length
|
||||
const count = buildSlides(sections, schedules, { skipped, hidden, seconds, only }).length
|
||||
const tags = [...schedules.values()].flatMap((schedule) => schedule.tags)
|
||||
|
||||
const toggle = <T,>(set: Set<T>, value: T) => {
|
||||
const next = new Set(set)
|
||||
|
|
@ -285,7 +378,7 @@ function Setup({
|
|||
<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>
|
||||
<p className="text-sm font-semibold text-muted">Present the page</p>
|
||||
<h1 className="text-4xl font-bold" style={{ color: accentText(accent) }}>
|
||||
{title}
|
||||
</h1>
|
||||
|
|
@ -349,7 +442,9 @@ function Setup({
|
|||
<label className="flex flex-wrap items-center gap-4 bg-raised p-4 shadow-sm">
|
||||
<span className="flex-1">
|
||||
<span className="block font-semibold text-ink">Only entries tagged</span>
|
||||
<span className="text-sm text-muted">Every slide shows only what this tag is on, eg. for one room's screen</span>
|
||||
<span className="text-sm text-muted">
|
||||
Every schedule slide shows only what this tag is on, eg. for one room's screen
|
||||
</span>
|
||||
</span>
|
||||
<select
|
||||
value={only ?? ''}
|
||||
|
|
@ -368,43 +463,69 @@ function Setup({
|
|||
)}
|
||||
|
||||
<section>
|
||||
<h2 className="mb-4 text-2xl font-bold text-ink">Days and entries</h2>
|
||||
<h2 className="mb-4 text-2xl font-bold text-ink">Sections</h2>
|
||||
<p className="mb-4 text-sm text-muted">The page's parts, each starting at a Heading block.</p>
|
||||
<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}>
|
||||
<PickEntry
|
||||
entry={entry}
|
||||
enabled={pickedDays.has(d)}
|
||||
checked={!hidden.has(entryKey(d, e))}
|
||||
onToggle={() => setHidden(toggle(hidden, entryKey(d, e)))}
|
||||
/>
|
||||
{entry.kind === 'block' && entry.items?.length ? (
|
||||
<ul className="mt-2 space-y-2 pl-7">
|
||||
{entry.items.map((item, i) => (
|
||||
<li key={i}>
|
||||
<PickEntry
|
||||
entry={item}
|
||||
enabled={pickedDays.has(d) && !hidden.has(entryKey(d, e))}
|
||||
checked={!hidden.has(entryKey(d, e, i))}
|
||||
onToggle={() => setHidden(toggle(hidden, entryKey(d, e, i)))}
|
||||
/>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
) : null}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</fieldset>
|
||||
))}
|
||||
{sections.map((section, s) => {
|
||||
const on = !skipped.has(s)
|
||||
const kinds = [...new Set(section.blocks.map((block) => (OWN_SLIDES.get(block.type) ?? 'Text')))]
|
||||
return (
|
||||
<fieldset key={s} className="bg-raised p-4 shadow-sm">
|
||||
<legend className="sr-only">{section.title}</legend>
|
||||
<label className="flex items-baseline gap-3">
|
||||
<input type="checkbox" checked={on} onChange={() => setSkipped(toggle(skipped, s))} />
|
||||
<span className="font-bold text-ink">{section.title}</span>
|
||||
<span className="text-xs text-muted">{kinds.join(', ')}</span>
|
||||
</label>
|
||||
{section.blocks.map((block, b) => {
|
||||
const schedule = schedules.get(block)
|
||||
if (!schedule) return null
|
||||
const { n, days } = schedule
|
||||
return (
|
||||
<div key={b} className="mt-3 space-y-4 pl-7">
|
||||
{days.map((day, d) => (
|
||||
<div key={d}>
|
||||
<PickEntry
|
||||
label={day.name || 'Schedule'}
|
||||
strong
|
||||
enabled={on}
|
||||
checked={!hidden.has(key(n, d))}
|
||||
onToggle={() => setHidden(toggle(hidden, key(n, d)))}
|
||||
/>
|
||||
<ul className="mt-2 space-y-2 pl-7">
|
||||
{day.entries.map((entry, e) => (
|
||||
<li key={e}>
|
||||
<PickEntry
|
||||
entry={entry}
|
||||
enabled={on && !hidden.has(key(n, d))}
|
||||
checked={!hidden.has(key(n, d, e))}
|
||||
onToggle={() => setHidden(toggle(hidden, key(n, d, e)))}
|
||||
/>
|
||||
{entry.kind === 'block' && entry.items?.length ? (
|
||||
<ul className="mt-2 space-y-2 pl-7">
|
||||
{entry.items.map((item, i) => (
|
||||
<li key={i}>
|
||||
<PickEntry
|
||||
entry={item}
|
||||
enabled={on && !hidden.has(key(n, d)) && !hidden.has(key(n, d, e))}
|
||||
checked={!hidden.has(key(n, d, e, i))}
|
||||
onToggle={() => setHidden(toggle(hidden, key(n, d, e, i)))}
|
||||
/>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
) : null}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</fieldset>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
|
@ -412,7 +533,7 @@ function Setup({
|
|||
<button
|
||||
type="button"
|
||||
disabled={count === 0}
|
||||
onClick={() => onPlay({ pickedDays, hidden, seconds, screen, only })}
|
||||
onClick={() => onPlay({ skipped, hidden, seconds, screen, only })}
|
||||
className="btn inline-flex items-center gap-2 px-6 py-3 disabled:opacity-50"
|
||||
style={{ background: accent, color: readableOn(accent) }}
|
||||
>
|
||||
|
|
@ -431,32 +552,37 @@ function Setup({
|
|||
)
|
||||
}
|
||||
|
||||
/* One entry's checkbox on the setup screen, its kind beside it. */
|
||||
/* One checkbox on the setup screen: a schedule entry (its time and
|
||||
kind beside it) or a day (`label`, `strong`). */
|
||||
const KIND_NOTE = { block: 'Block', break: 'Break', heading: 'Heading' } as const
|
||||
|
||||
function PickEntry({
|
||||
entry,
|
||||
label,
|
||||
strong = false,
|
||||
enabled,
|
||||
checked,
|
||||
onToggle,
|
||||
}: {
|
||||
entry: ContentBlockItem
|
||||
entry?: ContentBlockItem
|
||||
label?: string
|
||||
strong?: boolean
|
||||
enabled: boolean
|
||||
checked: boolean
|
||||
onToggle: () => void
|
||||
}) {
|
||||
const note = entry.kind && entry.kind !== 'entry' ? KIND_NOTE[entry.kind] : null
|
||||
const note = entry?.kind && entry.kind !== 'entry' ? KIND_NOTE[entry.kind] : null
|
||||
return (
|
||||
<label className={`flex items-baseline gap-3 ${enabled ? '' : 'opacity-50'}`}>
|
||||
<input type="checkbox" disabled={!enabled} checked={checked} onChange={onToggle} />
|
||||
<span className="w-32 shrink-0 text-sm text-muted">{entry.time}</span>
|
||||
<span className={entry.kind === 'heading' ? 'font-semibold' : ''}>
|
||||
{entry.featured && (
|
||||
{entry && <span className="w-32 shrink-0 text-sm text-muted">{entry.time}</span>}
|
||||
<span className={strong || entry?.kind === 'heading' ? 'font-semibold text-ink' : ''}>
|
||||
{entry?.featured && (
|
||||
<span className="mr-1 text-link">
|
||||
<FeaturedStar />
|
||||
</span>
|
||||
)}
|
||||
{entry.text}
|
||||
{entry ? entry.text : label}
|
||||
</span>
|
||||
{note && <span className="text-xs text-muted">{note}</span>}
|
||||
</label>
|
||||
|
|
@ -557,7 +683,7 @@ function Player({
|
|||
<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>
|
||||
<span>{slide.label === title ? '' : slide.label}</span>
|
||||
</div>
|
||||
|
||||
{/* Keyed by index, so every slide's entrance animation plays. */}
|
||||
|
|
@ -565,7 +691,9 @@ function Player({
|
|||
<SlideTime.Provider
|
||||
value={{ wait: slide.seconds / 2, screen, paused, scrolls: (s) => setScroll({ index, seconds: s }) }}
|
||||
>
|
||||
<SlideView slide={slide} accent={accent} />
|
||||
<ScheduleTags.Provider value={slide.tags ?? []}>
|
||||
<SlideView slide={slide} accent={accent} />
|
||||
</ScheduleTags.Provider>
|
||||
</SlideTime.Provider>
|
||||
</div>
|
||||
|
||||
|
|
@ -676,6 +804,40 @@ function Scroll({ center = false, className = '', children }: {
|
|||
)
|
||||
}
|
||||
|
||||
/* A slide's big title. */
|
||||
function SlideTitle({ children, color }: { children: ReactNode; color: string }) {
|
||||
return (
|
||||
<Rise>
|
||||
<h1 className="mb-[3vh] text-[clamp(2rem,5vw,6rem)] font-bold leading-none" style={{ color }}>
|
||||
{children}
|
||||
</h1>
|
||||
</Rise>
|
||||
)
|
||||
}
|
||||
|
||||
/* A picture's width over its height, once it has loaded (0 before). */
|
||||
function useRatio(src: string | null) {
|
||||
const [ratio, setRatio] = useState(0)
|
||||
useEffect(() => {
|
||||
if (!src) return
|
||||
const img = new Image()
|
||||
img.onload = () => setRatio(img.naturalWidth / (img.naturalHeight || 1))
|
||||
img.src = src
|
||||
}, [src])
|
||||
return ratio
|
||||
}
|
||||
|
||||
/* A venue's map at the most the slide holds: as wide as it can be
|
||||
without being taller than `vh` of the screen. */
|
||||
function SlideMap({ venue, accent, active, vh }: { venue: Venue; accent: string; active: string | null; vh: number }) {
|
||||
const ratio = useRatio(mediaUrl(venue.map_image))
|
||||
return (
|
||||
<div style={{ width: ratio ? `min(100%, ${ratio * vh}vh)` : '100%' }}>
|
||||
<MapPicture venue={venue} accent={accent} active={active} big />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
/* An overview's rows: each entry, a block's sub-items under it.
|
||||
`start` is the first row's place in the slide's entrance. */
|
||||
function OverviewEntries({ entries, accent, start = 1 }: { entries: ContentBlockItem[]; accent: string; start?: number }) {
|
||||
|
|
@ -755,16 +917,178 @@ function SlideView({ slide, accent }: { slide: Slide; accent: string }) {
|
|||
const tags = useContext(ScheduleTags)
|
||||
const color = accentText(accent)
|
||||
|
||||
if (slide.kind === 'section') {
|
||||
// The page's own blocks, zoomed up from the page's size. The
|
||||
// zoom is inside Scroll, so it measures what the screen shows.
|
||||
const zoom = Math.max(1, window.innerWidth / TEXT_WIDTH)
|
||||
return (
|
||||
<div className="flex h-full flex-col">
|
||||
<SlideTitle color={color}>{slide.label}</SlideTitle>
|
||||
<Rise order={1} className="flex min-h-0 flex-1 flex-col">
|
||||
<Scroll>
|
||||
<div style={{ zoom }}>
|
||||
<ContentBlocks blocks={slide.blocks} accent={accent} />
|
||||
</div>
|
||||
</Scroll>
|
||||
</Rise>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
if (slide.kind === 'venue') {
|
||||
const venue = slide.venue!
|
||||
return (
|
||||
<div className="flex h-full gap-[4vw]">
|
||||
{venue.map_image && (
|
||||
<Rise className="min-w-0 flex-[2]">
|
||||
<SlideMap venue={venue} accent={accent} active={null} vh={78} />
|
||||
</Rise>
|
||||
)}
|
||||
<div className="flex min-w-0 flex-1 flex-col">
|
||||
<SlideTitle color={color}>{venue.name}</SlideTitle>
|
||||
<Scroll>
|
||||
<ol className="space-y-[1.5vh]">
|
||||
{venue.locations.map((location, i) => (
|
||||
<li key={location.key}>
|
||||
<Rise order={i + 1} from="right" className="flex items-start gap-[1vw]">
|
||||
<LocationNumber n={locationNumber(venue, location)} accent={accent} className="h-[2.6vw] w-[2.6vw] text-[1.3vw]" />
|
||||
<span>
|
||||
<span className="block text-[clamp(1.1rem,2vw,2.6rem)] font-bold leading-tight text-ink">{location.name}</span>
|
||||
{location.detail && (
|
||||
<span className="block text-[clamp(0.9rem,1.4vw,1.8rem)] text-muted">{location.detail}</span>
|
||||
)}
|
||||
</span>
|
||||
</Rise>
|
||||
</li>
|
||||
))}
|
||||
</ol>
|
||||
</Scroll>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
if (slide.kind === 'place') {
|
||||
const venue = slide.venue!
|
||||
const location = slide.location!
|
||||
return (
|
||||
<div className="flex h-full items-center gap-[4vw]">
|
||||
<Rise className="min-w-0 flex-[2]">
|
||||
<SlideMap venue={venue} accent={accent} active={location.key} vh={78} />
|
||||
</Rise>
|
||||
<div className="min-w-0 flex-1">
|
||||
<Rise from="right">
|
||||
<LocationNumber n={locationNumber(venue, location)} accent={accent} className="h-[6vw] w-[6vw] text-[3vw]" />
|
||||
</Rise>
|
||||
<Rise order={1} from="right">
|
||||
<h1 className="mt-[2vh] text-[clamp(2.4rem,5vw,6.5rem)] font-bold leading-[1.05] text-ink">{location.name}</h1>
|
||||
</Rise>
|
||||
{location.detail && (
|
||||
<Rise order={2} from="right">
|
||||
<p className="mt-[1.5vh] text-[clamp(1.1rem,2.2vw,2.8rem)] text-muted">{location.detail}</p>
|
||||
</Rise>
|
||||
)}
|
||||
<Rise order={3} from="right">
|
||||
<p className="mt-[3vh] text-[clamp(1rem,1.8vw,2.2rem)] font-semibold" style={{ color }}>
|
||||
{venue.name}
|
||||
</p>
|
||||
</Rise>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
if (slide.kind === 'cards') {
|
||||
const items = slide.items ?? []
|
||||
return (
|
||||
<div className="flex h-full flex-col">
|
||||
<SlideTitle color={color}>{slide.label}</SlideTitle>
|
||||
<Scroll>
|
||||
<ul className={`grid gap-[2vw] ${items.length > 4 ? 'grid-cols-3' : 'grid-cols-2'}`}>
|
||||
{items.map((item, i) => {
|
||||
const image = mediaUrl(item.event!.image)
|
||||
return (
|
||||
<li key={i}>
|
||||
<Rise order={i + 1} className="h-full bg-raised shadow-md">
|
||||
{image && <img src={image} alt="" className="aspect-video w-full object-cover" />}
|
||||
<div className="p-[1.5vw]">
|
||||
{eventLine(item.event!) && (
|
||||
<p className="text-[clamp(0.9rem,1.4vw,1.8rem)] font-semibold capitalize" style={{ color }}>
|
||||
{eventLine(item.event!)}
|
||||
</p>
|
||||
)}
|
||||
<p className="text-[clamp(1.2rem,2.2vw,2.8rem)] font-bold leading-tight text-ink">
|
||||
{item.text || item.event!.title}
|
||||
</p>
|
||||
{item.person && (
|
||||
<p className="mt-[0.5vh] text-[clamp(0.9rem,1.4vw,1.8rem)] text-muted">{item.person.name}</p>
|
||||
)}
|
||||
</div>
|
||||
</Rise>
|
||||
</li>
|
||||
)
|
||||
})}
|
||||
</ul>
|
||||
</Scroll>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const entry = slide.entry!
|
||||
|
||||
if (slide.kind === 'event') {
|
||||
const event = entry.event!
|
||||
const image = mediaUrl(event.image)
|
||||
const blurb = entry.detail || event.blurb
|
||||
return (
|
||||
<div className="flex h-full items-center gap-[5vw]">
|
||||
{image && (
|
||||
<Rise from="left" className="w-[42vw] shrink-0">
|
||||
<img src={image} alt="" className="aspect-video w-full object-cover shadow-lg" />
|
||||
</Rise>
|
||||
)}
|
||||
<Scroll center className="min-w-0 self-stretch">
|
||||
{eventLine(event) && (
|
||||
<Rise from="right">
|
||||
<p className="text-[clamp(1.2rem,2.4vw,3rem)] font-semibold capitalize" style={{ color }}>
|
||||
{eventLine(event)}
|
||||
</p>
|
||||
</Rise>
|
||||
)}
|
||||
<Rise order={1} from="right">
|
||||
<h1 className="mt-[1vh] text-[clamp(2.4rem,5vw,6.5rem)] font-bold leading-[1.05] text-ink">
|
||||
{entry.text || event.title}
|
||||
</h1>
|
||||
</Rise>
|
||||
{blurb && (
|
||||
<Rise order={2} from="right">
|
||||
<div className="mt-[3vh] space-y-3 text-[clamp(1rem,1.8vw,2.2rem)] leading-snug text-muted">
|
||||
<Paragraphs text={blurb} accent={accent} />
|
||||
</div>
|
||||
</Rise>
|
||||
)}
|
||||
{entry.person && (
|
||||
<Rise order={3} from="right" className="mt-[3vh] flex items-center gap-[1.5vw]">
|
||||
<Avatar person={entry.person} size="h-[6vw] w-[6vw] text-[1.6vw]" />
|
||||
<span>
|
||||
<span className="block text-[clamp(1.1rem,2vw,2.6rem)] font-bold text-ink">{entry.person.name}</span>
|
||||
{entry.person.tagline && (
|
||||
<span className="block text-[clamp(0.9rem,1.4vw,1.8rem)] text-muted">{entry.person.tagline}</span>
|
||||
)}
|
||||
</span>
|
||||
</Rise>
|
||||
)}
|
||||
</Scroll>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
if (slide.kind === 'overview') {
|
||||
const entries = slide.day.entries
|
||||
const entries = slide.day!.entries
|
||||
const two = lineCount(entries) > 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>
|
||||
<SlideTitle color={color}>{slide.day!.name || 'Schedule'}</SlideTitle>
|
||||
<Scroll>
|
||||
<ul className={`grid content-start gap-x-[4vw] ${two ? 'grid-cols-2' : 'grid-cols-1'}`}>
|
||||
<OverviewEntries entries={entries} accent={accent} />
|
||||
|
|
@ -782,11 +1106,7 @@ function SlideView({ slide, accent }: { slide: Slide; accent: string }) {
|
|||
let order = 1
|
||||
return (
|
||||
<div className="flex h-full flex-col">
|
||||
<Rise>
|
||||
<h1 className="mb-[3vh] text-[clamp(2rem,5vw,6rem)] font-bold leading-none" style={{ color: accentText(tagColor) }}>
|
||||
{tag.name}
|
||||
</h1>
|
||||
</Rise>
|
||||
<SlideTitle color={accentText(tagColor)}>{tag.name}</SlideTitle>
|
||||
<Scroll>
|
||||
<ul className={`grid content-start gap-x-[4vw] ${two ? 'grid-cols-2' : 'grid-cols-1'}`}>
|
||||
{tagDays.map((day, d) => {
|
||||
|
|
@ -811,15 +1131,13 @@ function SlideView({ slide, accent }: { slide: Slide; accent: string }) {
|
|||
)
|
||||
}
|
||||
|
||||
const entry = slide.entry!
|
||||
|
||||
if (slide.kind === 'block') {
|
||||
const items = entry.items ?? []
|
||||
return (
|
||||
<div className="flex h-full flex-col">
|
||||
<Rise>
|
||||
<p className="text-[clamp(1.2rem,2.4vw,3rem)] font-semibold" style={{ color }}>
|
||||
{[slide.day.name, entry.time].filter(Boolean).join(' · ')}
|
||||
{[slide.day!.name, entry.time].filter(Boolean).join(' · ')}
|
||||
</p>
|
||||
</Rise>
|
||||
<Rise order={1}>
|
||||
|
|
@ -915,7 +1233,7 @@ function SlideView({ slide, accent }: { slide: Slide; accent: string }) {
|
|||
<Scroll center className="min-w-0 self-stretch">
|
||||
<Rise from="right">
|
||||
<p className="text-[clamp(1.2rem,2.4vw,3rem)] font-semibold" style={{ color }}>
|
||||
{[slide.day.name, slide.parent?.text, entry.time].filter(Boolean).join(' · ')}
|
||||
{[slide.day!.name, slide.parent?.text, entry.time].filter(Boolean).join(' · ')}
|
||||
</p>
|
||||
</Rise>
|
||||
<Rise order={1} from="right">
|
||||
Loading…
Add table
Add a link
Reference in a new issue