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. |
|
| Links → Platform | instagram, facebook, discord, youtube, tiktok, x, substack, spotify, linkedin | **yes**, `PLATFORMS` | `PlatformIcon.tsx` draws the icon on the button. **No CHECK and no `enumeration`**: the column is plain text, so adding one is an entry in `PLATFORMS` (`src/lib/platforms.ts`) and its icon in `src/components/PlatformIcon.tsx`, no migration. |
|
||||||
| Content blocks → Shown in (slot) | card, body | **yes** | `paragraphs()` in `server/src/shape.js` (card), `ContentBlocks.tsx` (body) |
|
| Content blocks → Shown in (slot) | card, body | **yes** | `paragraphs()` in `server/src/shape.js` (card), `ContentBlocks.tsx` (body) |
|
||||||
| Content blocks → Type | heading, subheading, paragraph, list, links, quote, image, divider, video, button, callout, schedule, table, 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 → 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 → Kind (+ list filter) | milestone, event, organization, award, people | no | `KIND_NAMES` in `src/pages/sections/history/TimelineEntry.tsx` |
|
||||||
| Timeline → Points at (+ list filter) | event, organization, award, person, team | no | `refHref` in `src/lib/hrefs.ts` |
|
| Timeline → Points at (+ list filter) | event, organization, award, person, team | no | `refHref` in `src/lib/hrefs.ts` |
|
||||||
| Timeline → Precision (and on events/orgs) | year, month, day | no | the history page's grouping |
|
| Timeline → Precision (and on events/orgs) | year, month, day | no | the history page's grouping |
|
||||||
|
|
|
||||||
|
|
@ -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
|
// event's own title and preview, kept out of search, pointing
|
||||||
// search engines at the event page.
|
// search engines at the event page.
|
||||||
const present = pathname.match(/^\/events\/([^/]+)\/present$/);
|
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 PersonDetail = lazyPage(() => import("./pages/PersonDetail.tsx"))
|
||||||
const BlogPost = lazyPage(() => import("./pages/BlogPost.tsx"))
|
const BlogPost = lazyPage(() => import("./pages/BlogPost.tsx"))
|
||||||
const DirectoryPage = lazyPage(() => import("./pages/DirectoryPage.tsx"))
|
const DirectoryPage = lazyPage(() => import("./pages/DirectoryPage.tsx"))
|
||||||
const SchedulePresent = lazyPage(() => import("./pages/SchedulePresent.tsx"))
|
const EventPresent = lazyPage(() => import("./pages/EventPresent.tsx"))
|
||||||
|
|
||||||
/*Admin Pages*/
|
/*Admin Pages*/
|
||||||
const AdminLayout = lazyPage(() => import("./pages/admin/AdminLayout.tsx"))
|
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). */}
|
{/* Every page of the site: Pages → Page management (PageAtPath). */}
|
||||||
<Route path="*" element={<PageAtPath />} />
|
<Route path="*" element={<PageAtPath />} />
|
||||||
</Route>
|
</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
|
<Route
|
||||||
path="/events/:id/present"
|
path="/events/:id/present"
|
||||||
element={
|
element={
|
||||||
<Suspense fallback={null}>
|
<Suspense fallback={null}>
|
||||||
<SchedulePresent />
|
<EventPresent />
|
||||||
</Suspense>
|
</Suspense>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@
|
||||||
|
|
||||||
import { mediaUrl } from '../lib/media.ts'
|
import { mediaUrl } from '../lib/media.ts'
|
||||||
import PeopleTiles from './PeopleTiles.tsx'
|
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 { Anchor, Inline, Paragraphs, isExternalUrl } from './InlineText.tsx'
|
||||||
import VideoPlayer from './VideoPlayer.tsx'
|
import VideoPlayer from './VideoPlayer.tsx'
|
||||||
import ScheduleBlock from './ScheduleBlock.tsx'
|
import ScheduleBlock from './ScheduleBlock.tsx'
|
||||||
|
|
@ -72,7 +72,6 @@ export default function ContentBlocks({
|
||||||
blocks,
|
blocks,
|
||||||
accent = BRAND,
|
accent = BRAND,
|
||||||
className = '',
|
className = '',
|
||||||
presentAt,
|
|
||||||
anchorPrefix = '',
|
anchorPrefix = '',
|
||||||
}: {
|
}: {
|
||||||
blocks?: ContentBlock[] | null
|
blocks?: ContentBlock[] | null
|
||||||
|
|
@ -80,9 +79,6 @@ export default function ContentBlocks({
|
||||||
className?: string
|
className?: string
|
||||||
/** Put before each heading's id: a blog post's tab (contents.ts, splitTabs). */
|
/** Put before each heading's id: a blog post's tab (contents.ts, splitTabs). */
|
||||||
anchorPrefix?: string
|
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
|
if (!blocks?.length) return null
|
||||||
// Headings get ids so a post's contents (PostContents) and a shared
|
// Headings get ids so a post's contents (PostContents) and a shared
|
||||||
|
|
@ -98,10 +94,6 @@ export default function ContentBlocks({
|
||||||
return level
|
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.
|
// 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] : [])))
|
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}
|
accent={accent}
|
||||||
anchor={idAt.get(index)}
|
anchor={idAt.get(index)}
|
||||||
level={levels[index]}
|
level={levels[index]}
|
||||||
presentHref={presentHrefs[index]}
|
|
||||||
/>
|
/>
|
||||||
</WordMotion>
|
</WordMotion>
|
||||||
))}
|
))}
|
||||||
|
|
@ -161,12 +152,19 @@ function LinkCard({ item }: { item: ContentBlockItem }) {
|
||||||
/* One event card (088): the event's picture, its type and date,
|
/* 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
|
its title (or the item's text) and card text (or the item's
|
||||||
detail); the whole card links to the event. */
|
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 }) {
|
function EventCard({ item, accent }: { item: ContentBlockItem; accent: string }) {
|
||||||
const event = item.event!
|
const event = item.event!
|
||||||
const img = useSmallImage(mediaUrl(event.image))
|
const img = useSmallImage(mediaUrl(event.image))
|
||||||
const color = event.color || accent
|
const color = event.color || accent
|
||||||
const when = event.date_label || (event.starts_on ? occurrenceLabel(event.starts_on) : null)
|
const line = eventLine(event)
|
||||||
const kind = event.event_type && event.event_type !== 'other' ? event.event_type : null
|
|
||||||
return (
|
return (
|
||||||
<Anchor
|
<Anchor
|
||||||
href={eventHref(event.id)}
|
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" />
|
<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">
|
<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) }}>
|
<span className="text-xs font-semibold capitalize" style={{ color: accentText(color) }}>
|
||||||
{[kind, when].filter(Boolean).join(' · ')}
|
{line}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
<span className="font-display text-base font-bold leading-snug text-ink group-hover:text-link">
|
<span className="font-display text-base font-bold leading-snug text-ink group-hover:text-link">
|
||||||
|
|
@ -223,13 +221,11 @@ function Block({
|
||||||
accent,
|
accent,
|
||||||
anchor,
|
anchor,
|
||||||
level,
|
level,
|
||||||
presentHref,
|
|
||||||
}: {
|
}: {
|
||||||
block: ContentBlock
|
block: ContentBlock
|
||||||
accent: string
|
accent: string
|
||||||
anchor?: string
|
anchor?: string
|
||||||
level: 3 | 4 | 5
|
level: 3 | 4 | 5
|
||||||
presentHref?: string
|
|
||||||
}) {
|
}) {
|
||||||
const text = block.text ?? ''
|
const text = block.text ?? ''
|
||||||
const reading = useReadingMode()
|
const reading = useReadingMode()
|
||||||
|
|
@ -439,7 +435,6 @@ function Block({
|
||||||
tags={block.tags}
|
tags={block.tags}
|
||||||
intro={block.text}
|
intro={block.text}
|
||||||
accent={accent}
|
accent={accent}
|
||||||
presentHref={presentHref}
|
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,9 @@
|
||||||
the mark's own, so Layout's jump to the anchor scrolls it into
|
the mark's own, so Layout's jump to the anchor scrolls it into
|
||||||
view and focuses it.
|
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.
|
Reading mode (readingMode.ts) gets the list alone, no picture.
|
||||||
|
|
||||||
PageMaps holds the venues that have a map block among the blocks
|
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.
|
when there's a map on the page to go to.
|
||||||
═══════════════════════════════════════════════════════════════ */
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
||||||
import { createContext, useState } from 'react'
|
import { createContext, useState, type CSSProperties } from 'react'
|
||||||
import { Link, useLocation } from 'react-router-dom'
|
import { Link, useLocation, type To } from 'react-router-dom'
|
||||||
|
|
||||||
import { mediaUrl } from '../lib/media.ts'
|
import { mediaUrl } from '../lib/media.ts'
|
||||||
import type { Venue, VenueLocation } from '../lib/useContent.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}`
|
export const mapAnchor = (venueId: string, key: string) => `map-${venueId}-${key}`
|
||||||
|
|
||||||
const isBox = (location: VenueLocation) => location.w != null && location.h != null
|
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 }) {
|
export default function MapBlock({ venue, accent }: { venue: Venue; accent: string }) {
|
||||||
const { hash, search } = useLocation()
|
const { hash, search } = useLocation()
|
||||||
const [hovered, setHovered] = useState<string | null>(null)
|
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 fromHash = venue.locations.find((location) => hash === `#${mapAnchor(venue.id, location.key)}`)?.key ?? null
|
||||||
const active = hovered ?? fromHash
|
const active = hovered ?? fromHash
|
||||||
const image = useReadingMode() ? null : mediaUrl(venue.map_image)
|
const picture = !useReadingMode() && Boolean(venue.map_image)
|
||||||
const fill = accent.startsWith('#') ? accent : '#000000'
|
|
||||||
|
|
||||||
const to = (key: string) => ({ search, hash: mapAnchor(venue.id, key) })
|
const to = (key: string) => ({ search, hash: mapAnchor(venue.id, key) })
|
||||||
const light = (key: string) => ({
|
const light = (key: string) => ({
|
||||||
|
|
@ -50,68 +176,12 @@ export default function MapBlock({ venue, accent }: { venue: Venue; accent: stri
|
||||||
onFocus: () => setHovered(key),
|
onFocus: () => setHovered(key),
|
||||||
onBlur: () => setHovered(null),
|
onBlur: () => setHovered(null),
|
||||||
})
|
})
|
||||||
const number = (location: VenueLocation) => venue.locations.indexOf(location) + 1
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<figure className="grid gap-6 md:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]">
|
<figure className="grid gap-6 md:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]">
|
||||||
{image && (
|
{picture && <MapPicture venue={venue} accent={accent} active={active} link={to} light={light} className="self-start" />}
|
||||||
<div className="relative self-start">
|
|
||||||
<img src={image} alt={venue.map_alt || `Map of ${venue.name}`} className="block w-full" />
|
|
||||||
{marked.map((location) => {
|
|
||||||
const on = active === location.key
|
|
||||||
const dim = active != null && !on
|
|
||||||
return (
|
|
||||||
<Link
|
|
||||||
key={location.key}
|
|
||||||
id={mapAnchor(venue.id, location.key)}
|
|
||||||
to={to(location.key)}
|
|
||||||
aria-label={location.name}
|
|
||||||
{...light(location.key)}
|
|
||||||
className="absolute transition-opacity"
|
|
||||||
style={
|
|
||||||
isBox(location)
|
|
||||||
? {
|
|
||||||
left: `${location.x}%`,
|
|
||||||
top: `${location.y}%`,
|
|
||||||
width: `${location.w}%`,
|
|
||||||
height: `${location.h}%`,
|
|
||||||
border: `2px solid ${accent}`,
|
|
||||||
background: withAlpha(accent, on ? 35 : 12),
|
|
||||||
opacity: dim ? 0.35 : 1,
|
|
||||||
}
|
|
||||||
: {
|
|
||||||
left: `${location.x}%`,
|
|
||||||
top: `${location.y}%`,
|
|
||||||
transform: 'translate(-50%, -50%)',
|
|
||||||
opacity: dim ? 0.35 : 1,
|
|
||||||
zIndex: on ? 1 : undefined,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<span
|
|
||||||
aria-hidden="true"
|
|
||||||
className={`flex items-center justify-center rounded-full text-xs font-bold shadow ${
|
|
||||||
isBox(location) ? 'absolute top-1 left-1 h-6 w-6' : on ? 'h-9 w-9' : 'h-7 w-7'
|
|
||||||
}`}
|
|
||||||
style={{ background: accent, color: readableOn(fill), outline: on ? '3px solid white' : undefined }}
|
|
||||||
>
|
|
||||||
{number(location)}
|
|
||||||
</span>
|
|
||||||
{on && (
|
|
||||||
<span
|
|
||||||
aria-hidden="true"
|
|
||||||
className="absolute top-full left-1/2 mt-1 -translate-x-1/2 whitespace-nowrap bg-raised px-2 py-0.5 text-xs font-semibold text-ink shadow"
|
|
||||||
>
|
|
||||||
{location.name}
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
</Link>
|
|
||||||
)
|
|
||||||
})}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<figcaption className={image ? '' : 'md:col-span-2'}>
|
<figcaption className={picture ? '' : 'md:col-span-2'}>
|
||||||
<p className="font-display font-bold text-ink">{venue.name}</p>
|
<p className="font-display font-bold text-ink">{venue.name}</p>
|
||||||
{venue.address && <p className="text-sm text-muted">{venue.address}</p>}
|
{venue.address && <p className="text-sm text-muted">{venue.address}</p>}
|
||||||
<ol className="mt-3 space-y-1">
|
<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 on = active === location.key
|
||||||
const row = (
|
const row = (
|
||||||
<>
|
<>
|
||||||
<span
|
<LocationNumber n={locationNumber(venue, location)} accent={accent} />
|
||||||
aria-hidden="true"
|
|
||||||
className="flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-xs font-bold"
|
|
||||||
style={{ background: accent, color: readableOn(fill) }}
|
|
||||||
>
|
|
||||||
{number(location)}
|
|
||||||
</span>
|
|
||||||
<span className="min-w-0">
|
<span className="min-w-0">
|
||||||
<span className="block font-semibold" style={on ? { color: accentText(accent) } : undefined}>
|
<span className="block font-semibold" style={on ? { color: accentText(accent) } : undefined}>
|
||||||
{location.name}
|
{location.name}
|
||||||
|
|
@ -138,7 +202,7 @@ export default function MapBlock({ venue, accent }: { venue: Venue; accent: stri
|
||||||
const rowStyle = on ? { background: withAlpha(accent, 12) } : undefined
|
const rowStyle = on ? { background: withAlpha(accent, 12) } : undefined
|
||||||
return (
|
return (
|
||||||
<li key={location.key}>
|
<li key={location.key}>
|
||||||
{location.x != null && location.y != null ? (
|
{isMarked(location) ? (
|
||||||
<Link to={to(location.key)} {...light(location.key)} className={rowClass} style={rowStyle}>
|
<Link to={to(location.key)} {...light(location.key)} className={rowClass} style={rowStyle}>
|
||||||
{row}
|
{row}
|
||||||
</Link>
|
</Link>
|
||||||
|
|
|
||||||
|
|
@ -38,8 +38,8 @@
|
||||||
that is an event (a workshop) has already taken what it left
|
that is an event (a workshop) has already taken what it left
|
||||||
blank from it (shape.js).
|
blank from it (shape.js).
|
||||||
|
|
||||||
On an event page a Present button opens the schedule as a
|
The event page's Present button shows it, with the rest of the
|
||||||
slideshow for a screen (SchedulePresent.tsx).
|
page, as a slideshow for a screen (EventPresent.tsx).
|
||||||
|
|
||||||
Tabs follow the ARIA tab pattern: arrow keys move between them.
|
Tabs follow the ARIA tab pattern: arrow keys move between them.
|
||||||
|
|
||||||
|
|
@ -48,7 +48,7 @@
|
||||||
it, no map frame (ReadingSchedule).
|
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 { Fragment, createContext, useContext, useId, useState, type KeyboardEvent, type ReactNode } from 'react'
|
||||||
import { Link, useLocation } from 'react-router-dom'
|
import { Link, useLocation } from 'react-router-dom'
|
||||||
|
|
||||||
|
|
@ -475,14 +475,11 @@ export default function ScheduleBlock({
|
||||||
tags = [],
|
tags = [],
|
||||||
intro,
|
intro,
|
||||||
accent,
|
accent,
|
||||||
presentHref,
|
|
||||||
}: {
|
}: {
|
||||||
items: ContentBlockItem[]
|
items: ContentBlockItem[]
|
||||||
tags?: ScheduleTag[]
|
tags?: ScheduleTag[]
|
||||||
intro?: string | null
|
intro?: string | null
|
||||||
accent: string
|
accent: string
|
||||||
/** Where the Present button goes; no button without it. */
|
|
||||||
presentHref?: string
|
|
||||||
}) {
|
}) {
|
||||||
const days = groupByDay(items)
|
const days = groupByDay(items)
|
||||||
const [active, setActive] = useState(() => todayIndex(days))
|
const [active, setActive] = useState(() => todayIndex(days))
|
||||||
|
|
@ -526,21 +523,6 @@ export default function ScheduleBlock({
|
||||||
</div>
|
</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 && (
|
{tabs.length > 1 && (
|
||||||
<div role="tablist" aria-label="Days and tags" className="flex flex-wrap gap-2">
|
<div role="tablist" aria-label="Days and tags" className="flex flex-wrap gap-2">
|
||||||
{tabs.map((tab, index) => {
|
{tabs.map((tab, index) => {
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,8 @@ import { mediaUrl } from '../lib/media.ts'
|
||||||
import { eventTypeLabel } from '../lib/eventTypes.ts'
|
import { eventTypeLabel } from '../lib/eventTypes.ts'
|
||||||
import { occurrenceLabel, seriesLabel, seriesTimes, upcomingOccurrences } from '../lib/eventSeries.ts'
|
import { occurrenceLabel, seriesLabel, seriesTimes, upcomingOccurrences } from '../lib/eventSeries.ts'
|
||||||
import { capitalize } from '../lib/text.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)'
|
const BODY = 'var(--color-muted)'
|
||||||
|
|
||||||
|
|
@ -109,7 +110,22 @@ export default function EventDetail() {
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div className="max-w-3xl">
|
<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>
|
</div>
|
||||||
|
|
||||||
{event.links.length > 0 && (
|
{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. */
|
reduced motion rule in index.css stops all of it. */
|
||||||
|
|
||||||
.present-in {
|
.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
|
An event page's content blocks as an endless slideshow for a
|
||||||
(digital signage), opened from the block's Present button. Outside
|
screen (digital signage), opened from the page's Present button.
|
||||||
the site's Layout: no header, footer or backdrop.
|
Outside the site's Layout: no header, footer or backdrop.
|
||||||
|
|
||||||
First a setup screen: which days and entries, and how many seconds
|
The page is cut into sections at its Heading blocks (the blocks
|
||||||
each kind of slide stays up (0 leaves that kind out). Play writes
|
before the first are a section under the event's title). Each
|
||||||
the choices into the address, so a signage device can bookmark it
|
section, in order, gives:
|
||||||
and start the same way every time (`play=1` skips the setup).
|
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
|
overview the day's picked entries on one slide
|
||||||
spotlight one entry: its person beside title, time and place
|
spotlight one entry: its person beside title, time and place
|
||||||
block a block entry (086) and its sub-items on one slide,
|
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)
|
tag after the days: each of the schedule's tags (087)
|
||||||
and everything it's on, under each day's name
|
and everything it's on, under each day's name
|
||||||
A heading (086) is only a line on the overview; a break gets no
|
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
|
spotlight. "Only entries tagged" (`only=<key>`) cuts every
|
||||||
seconds, scrolls to the end at "Scroll" seconds a screenful
|
schedule slide to what one tag is on, eg. for a screen outside the
|
||||||
(`screen=`), then waits the other half. "Only entries tagged" (`only=<key>`) cuts every slide
|
youth room.
|
||||||
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
|
Keys while playing: arrows step, Space pauses, Escape leaves full
|
||||||
screen (the browser's), S goes back to the setup.
|
screen (the browser's), S goes back to the setup.
|
||||||
|
|
@ -47,54 +64,99 @@ import {
|
||||||
withTag,
|
withTag,
|
||||||
type Day,
|
type Day,
|
||||||
} from '../components/ScheduleBlock.tsx'
|
} 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 { 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 { mediaUrl } from '../lib/media.ts'
|
||||||
import { BRAND, accentText, readableOn, withAlpha } from '../lib/color.ts'
|
import { BRAND, accentText, readableOn, withAlpha } from '../lib/color.ts'
|
||||||
import { documentTitle } from '../lib/site.ts'
|
import { documentTitle } from '../lib/site.ts'
|
||||||
import './SchedulePresent.css'
|
import './EventPresent.css'
|
||||||
|
|
||||||
/* Each kind of slide, its address key and seconds when unset. */
|
/* Each kind of slide, its address key and seconds when unset. */
|
||||||
const KINDS = [
|
const KINDS = [
|
||||||
{ key: 'overview', label: 'Day overview', help: 'The whole day on one slide', seconds: 20 },
|
{ key: 'section', label: 'Sections', help: "A section's text under its heading", seconds: 20 },
|
||||||
{ key: 'spotlight', label: 'Entry spotlight', help: 'One entry at a time, with its person', seconds: 12 },
|
{ key: 'overview', label: 'Day overview', help: 'A schedule day on one slide', seconds: 20 },
|
||||||
{ key: 'block', label: 'Blocks', help: 'A block and the things in it, before each gets a spotlight', seconds: 15 },
|
{ key: 'spotlight', label: 'Entry spotlight', help: 'One schedule entry at a time, with its person', seconds: 12 },
|
||||||
{ key: 'graphic', label: 'Graphics', help: "An entry's graphic, full screen", seconds: 10 },
|
{ key: 'block', label: 'Blocks', help: 'A schedule block and the things in it, before each gets a spotlight', seconds: 15 },
|
||||||
{ key: 'map', label: 'Map images', help: "An entry's own map, full screen", seconds: 10 },
|
{ key: 'graphic', label: 'Graphics', help: "A schedule entry's graphic, full screen", seconds: 10 },
|
||||||
{ key: 'tag', label: 'Tag slides', help: "Each tag and everything it's on, after the days", seconds: 15 },
|
{ 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
|
] as const
|
||||||
type Kind = (typeof KINDS)[number]['key']
|
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. */
|
/* Seconds a long slide takes to scroll one screenful, when unset. */
|
||||||
const PER_SCREEN = 8
|
const PER_SCREEN = 8
|
||||||
/* An overview with more entries than this goes to two columns. */
|
/* An overview with more entries than this goes to two columns. */
|
||||||
const ONE_COLUMN = 8
|
const ONE_COLUMN = 8
|
||||||
/* How long the controls stay up after the pointer last moved (ms). */
|
/* How long the controls stay up after the pointer last moved (ms). */
|
||||||
const CONTROLS_FOR = 2500
|
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
|
/* `label` is the top bar's right side: the day, else the section.
|
||||||
`days` it gathers from. */
|
The rest is what each kind draws. */
|
||||||
type Slide = {
|
type Slide = {
|
||||||
kind: Kind
|
kind: Kind
|
||||||
seconds: number
|
seconds: number
|
||||||
day: Day
|
label: string
|
||||||
|
day?: Day
|
||||||
entry?: ContentBlockItem
|
entry?: ContentBlockItem
|
||||||
parent?: ContentBlockItem
|
parent?: ContentBlockItem
|
||||||
tag?: ScheduleTag
|
tag?: ScheduleTag
|
||||||
days?: Day[]
|
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
|
/* A part of the page: a heading and the blocks under it. */
|
||||||
for a sub-item another dot and its index. */
|
type Section = { title: string; blocks: ContentBlock[] }
|
||||||
const entryKey = (...at: number[]) => at.join('.')
|
/* 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. */
|
/* Lines on an overview: entries and sub-items. */
|
||||||
const lineCount = (entries: ContentBlockItem[]) =>
|
const lineCount = (entries: ContentBlockItem[]) =>
|
||||||
entries.reduce((n, entry) => n + 1 + (entry.kind === 'block' ? (entry.items?.length ?? 0) : 0), 0)
|
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)
|
const list = (value: string | null) => (value ? value.split(',').filter(Boolean) : null)
|
||||||
|
|
||||||
function readSettings(params: URLSearchParams, days: Day[]) {
|
function readSettings(params: URLSearchParams) {
|
||||||
const pickedDays = list(params.get('days'))?.map(Number) ?? days.map((_, i) => i)
|
|
||||||
const hidden = new Set(list(params.get('hide')) ?? [])
|
|
||||||
const seconds = Object.fromEntries(
|
const seconds = Object.fromEntries(
|
||||||
KINDS.map((kind) => {
|
KINDS.map((kind) => {
|
||||||
const value = Number(params.get(kind.key) ?? kind.seconds)
|
const value = Number(params.get(kind.key) ?? kind.seconds)
|
||||||
|
|
@ -103,51 +165,48 @@ function readSettings(params: URLSearchParams, days: Day[]) {
|
||||||
) as Record<Kind, number>
|
) as Record<Kind, number>
|
||||||
const screen = Number(params.get('screen') ?? PER_SCREEN)
|
const screen = Number(params.get('screen') ?? PER_SCREEN)
|
||||||
return {
|
return {
|
||||||
pickedDays: new Set(pickedDays),
|
skipped: new Set((list(params.get('skip')) ?? []).map(Number)),
|
||||||
hidden,
|
hidden: new Set(list(params.get('hide')) ?? []),
|
||||||
seconds,
|
seconds,
|
||||||
screen: Number.isFinite(screen) && screen > 0 ? screen : PER_SCREEN,
|
screen: Number.isFinite(screen) && screen > 0 ? screen : PER_SCREEN,
|
||||||
only: params.get('only') || null,
|
only: params.get('only') || null,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
type Settings = ReturnType<typeof readSettings>
|
type Settings = ReturnType<typeof readSettings>
|
||||||
|
type Picks = Pick<Settings, 'skipped' | 'hidden' | 'seconds' | 'only'>
|
||||||
|
|
||||||
function buildSlides(
|
function scheduleSlides(slides: Slide[], { n, days, tags }: Schedule, { hidden, seconds, only }: Picks) {
|
||||||
days: Day[],
|
|
||||||
tags: ScheduleTag[],
|
|
||||||
{ pickedDays, hidden, seconds, only }: Pick<Settings, 'pickedDays' | 'hidden' | 'seconds' | 'only'>,
|
|
||||||
): Slide[] {
|
|
||||||
const slides: Slide[] = []
|
|
||||||
const kept: Day[] = []
|
const kept: Day[] = []
|
||||||
days.forEach((all, d) => {
|
days.forEach((all, d) => {
|
||||||
if (!pickedDays.has(d)) return
|
if (hidden.has(key(n, d))) return
|
||||||
let entries = all.entries.flatMap((entry, e) => {
|
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]
|
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 (only) entries = withTag(entries, only)
|
||||||
if (entries.length === 0) return
|
if (entries.length === 0) return
|
||||||
kept.push({ name: all.name, entries })
|
kept.push({ name: all.name, entries })
|
||||||
const day = { ...all, 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) => {
|
const media = (entry: ContentBlockItem, parent?: ContentBlockItem) => {
|
||||||
if (seconds.graphic && entry.media) slides.push({ kind: 'graphic', seconds: seconds.graphic, 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, day, entry, parent })
|
if (seconds.map && entry.map_image) slides.push({ kind: 'map', seconds: seconds.map, ...at, entry, parent })
|
||||||
}
|
}
|
||||||
for (const entry of entries) {
|
for (const entry of entries) {
|
||||||
if (entry.kind === 'heading') continue
|
if (entry.kind === 'heading') continue
|
||||||
if (entry.kind === 'block') {
|
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)
|
media(entry)
|
||||||
for (const item of entry.items ?? []) {
|
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)
|
media(item, entry)
|
||||||
}
|
}
|
||||||
continue
|
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)
|
media(entry)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -156,24 +215,59 @@ function buildSlides(
|
||||||
for (const tag of tags) {
|
for (const tag of tags) {
|
||||||
if (only && tag.key !== only) continue
|
if (only && tag.key !== only) continue
|
||||||
const tagDays = daysWithTag(kept, tag.key)
|
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
|
return slides
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function SchedulePresent() {
|
export default function EventPresent() {
|
||||||
const { id } = useParams()
|
const { id } = useParams()
|
||||||
const [params, setParams] = useSearchParams()
|
const [params, setParams] = useSearchParams()
|
||||||
const { data: event, loading, error, notFound, reload } = useEvent(id)
|
const { data: event, loading, error, notFound, reload } = useEvent(id)
|
||||||
|
|
||||||
const blockIndex = Number(params.get('block') ?? 0)
|
const sections = useMemo(() => (event ? sectionsOf(event.blocks ?? [], event.title) : []), [event])
|
||||||
const schedule = event?.blocks?.filter((block) => block.type === 'schedule')[blockIndex]
|
const schedules = useMemo(() => {
|
||||||
const days = useMemo(() => groupByDay(schedule?.items ?? []), [schedule])
|
const out = new Map<ContentBlock, Schedule>()
|
||||||
const tags = schedule?.tags ?? []
|
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(() => {
|
useEffect(() => {
|
||||||
if (event) document.title = documentTitle(`${event.title}: schedule`)
|
if (event) document.title = documentTitle(`${event.title}: present`)
|
||||||
}, [event])
|
}, [event])
|
||||||
|
|
||||||
if (!event) {
|
if (!event) {
|
||||||
|
|
@ -193,10 +287,10 @@ export default function SchedulePresent() {
|
||||||
const accent = event.color || BRAND
|
const accent = event.color || BRAND
|
||||||
const back = `/events/${encodeURIComponent(event.id)}`
|
const back = `/events/${encodeURIComponent(event.id)}`
|
||||||
|
|
||||||
if (!schedule || days.length === 0) {
|
if (sections.length === 0) {
|
||||||
return (
|
return (
|
||||||
<main className="min-h-screen bg-surface p-8">
|
<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">
|
<a href={back} className="mt-4 inline-block text-link underline">
|
||||||
Back to {event.title}
|
Back to {event.title}
|
||||||
</a>
|
</a>
|
||||||
|
|
@ -204,22 +298,20 @@ export default function SchedulePresent() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const settings = readSettings(params, days)
|
const settings = readSettings(params)
|
||||||
if (params.get('play') === '1') {
|
if (params.get('play') === '1') {
|
||||||
return (
|
return (
|
||||||
<ScheduleTags.Provider value={tags}>
|
<Player
|
||||||
<Player
|
title={event.title}
|
||||||
title={event.title}
|
accent={accent}
|
||||||
accent={accent}
|
slides={buildSlides(sections, schedules, settings)}
|
||||||
slides={buildSlides(days, tags, settings)}
|
screen={settings.screen}
|
||||||
screen={settings.screen}
|
onSetup={() => {
|
||||||
onSetup={() => {
|
const next = new URLSearchParams(params)
|
||||||
const next = new URLSearchParams(params)
|
next.delete('play')
|
||||||
next.delete('play')
|
setParams(next)
|
||||||
setParams(next)
|
}}
|
||||||
}}
|
/>
|
||||||
/>
|
|
||||||
</ScheduleTags.Provider>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
|
|
@ -227,14 +319,14 @@ export default function SchedulePresent() {
|
||||||
title={event.title}
|
title={event.title}
|
||||||
back={back}
|
back={back}
|
||||||
accent={accent}
|
accent={accent}
|
||||||
days={days}
|
sections={sections}
|
||||||
tags={tags}
|
schedules={schedules}
|
||||||
settings={settings}
|
settings={settings}
|
||||||
onPlay={(next) => {
|
onPlay={(next) => {
|
||||||
// Full screen needs the click itself, so it's asked for here.
|
// Full screen needs the click itself, so it's asked for here.
|
||||||
document.documentElement.requestFullscreen?.().catch(() => {})
|
document.documentElement.requestFullscreen?.().catch(() => {})
|
||||||
const out = new URLSearchParams({ block: String(blockIndex) })
|
const out = new URLSearchParams()
|
||||||
if (next.pickedDays.size < days.length) out.set('days', [...next.pickedDays].sort((a, b) => a - b).join(','))
|
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(','))
|
if (next.hidden.size) out.set('hide', [...next.hidden].join(','))
|
||||||
for (const kind of KINDS) out.set(kind.key, String(next.seconds[kind.key]))
|
for (const kind of KINDS) out.set(kind.key, String(next.seconds[kind.key]))
|
||||||
out.set('screen', String(next.screen))
|
out.set('screen', String(next.screen))
|
||||||
|
|
@ -253,25 +345,26 @@ function Setup({
|
||||||
title,
|
title,
|
||||||
back,
|
back,
|
||||||
accent,
|
accent,
|
||||||
days,
|
sections,
|
||||||
tags,
|
schedules,
|
||||||
settings,
|
settings,
|
||||||
onPlay,
|
onPlay,
|
||||||
}: {
|
}: {
|
||||||
title: string
|
title: string
|
||||||
back: string
|
back: string
|
||||||
accent: string
|
accent: string
|
||||||
days: Day[]
|
sections: Section[]
|
||||||
tags: ScheduleTag[]
|
schedules: Map<ContentBlock, Schedule>
|
||||||
settings: Settings
|
settings: Settings
|
||||||
onPlay: (settings: Settings) => void
|
onPlay: (settings: Settings) => void
|
||||||
}) {
|
}) {
|
||||||
const [pickedDays, setPickedDays] = useState(settings.pickedDays)
|
const [skipped, setSkipped] = useState(settings.skipped)
|
||||||
const [hidden, setHidden] = useState(settings.hidden)
|
const [hidden, setHidden] = useState(settings.hidden)
|
||||||
const [seconds, setSeconds] = useState(settings.seconds)
|
const [seconds, setSeconds] = useState(settings.seconds)
|
||||||
const [only, setOnly] = useState(settings.only)
|
const [only, setOnly] = useState(settings.only)
|
||||||
const [screen, setScreen] = useState(settings.screen)
|
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 toggle = <T,>(set: Set<T>, value: T) => {
|
||||||
const next = new Set(set)
|
const next = new Set(set)
|
||||||
|
|
@ -285,7 +378,7 @@ function Setup({
|
||||||
<div className="h-2" style={{ background: accent }} />
|
<div className="h-2" style={{ background: accent }} />
|
||||||
<div className="mx-auto max-w-4xl space-y-10 px-6 py-12">
|
<div className="mx-auto max-w-4xl space-y-10 px-6 py-12">
|
||||||
<header>
|
<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) }}>
|
<h1 className="text-4xl font-bold" style={{ color: accentText(accent) }}>
|
||||||
{title}
|
{title}
|
||||||
</h1>
|
</h1>
|
||||||
|
|
@ -349,7 +442,9 @@ function Setup({
|
||||||
<label className="flex flex-wrap items-center gap-4 bg-raised p-4 shadow-sm">
|
<label className="flex flex-wrap items-center gap-4 bg-raised p-4 shadow-sm">
|
||||||
<span className="flex-1">
|
<span className="flex-1">
|
||||||
<span className="block font-semibold text-ink">Only entries tagged</span>
|
<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>
|
</span>
|
||||||
<select
|
<select
|
||||||
value={only ?? ''}
|
value={only ?? ''}
|
||||||
|
|
@ -368,43 +463,69 @@ function Setup({
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<section>
|
<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">
|
<div className="space-y-6">
|
||||||
{days.map((day, d) => (
|
{sections.map((section, s) => {
|
||||||
<fieldset key={d} className="bg-raised p-4 shadow-sm">
|
const on = !skipped.has(s)
|
||||||
<legend className="sr-only">{day.name || 'Schedule'}</legend>
|
const kinds = [...new Set(section.blocks.map((block) => (OWN_SLIDES.get(block.type) ?? 'Text')))]
|
||||||
<label className="flex items-center gap-3 font-bold text-ink">
|
return (
|
||||||
<input type="checkbox" checked={pickedDays.has(d)} onChange={() => setPickedDays(toggle(pickedDays, d))} />
|
<fieldset key={s} className="bg-raised p-4 shadow-sm">
|
||||||
{day.name || 'Schedule'}
|
<legend className="sr-only">{section.title}</legend>
|
||||||
</label>
|
<label className="flex items-baseline gap-3">
|
||||||
<ul className="mt-3 space-y-2 pl-7">
|
<input type="checkbox" checked={on} onChange={() => setSkipped(toggle(skipped, s))} />
|
||||||
{day.entries.map((entry, e) => (
|
<span className="font-bold text-ink">{section.title}</span>
|
||||||
<li key={e}>
|
<span className="text-xs text-muted">{kinds.join(', ')}</span>
|
||||||
<PickEntry
|
</label>
|
||||||
entry={entry}
|
{section.blocks.map((block, b) => {
|
||||||
enabled={pickedDays.has(d)}
|
const schedule = schedules.get(block)
|
||||||
checked={!hidden.has(entryKey(d, e))}
|
if (!schedule) return null
|
||||||
onToggle={() => setHidden(toggle(hidden, entryKey(d, e)))}
|
const { n, days } = schedule
|
||||||
/>
|
return (
|
||||||
{entry.kind === 'block' && entry.items?.length ? (
|
<div key={b} className="mt-3 space-y-4 pl-7">
|
||||||
<ul className="mt-2 space-y-2 pl-7">
|
{days.map((day, d) => (
|
||||||
{entry.items.map((item, i) => (
|
<div key={d}>
|
||||||
<li key={i}>
|
<PickEntry
|
||||||
<PickEntry
|
label={day.name || 'Schedule'}
|
||||||
entry={item}
|
strong
|
||||||
enabled={pickedDays.has(d) && !hidden.has(entryKey(d, e))}
|
enabled={on}
|
||||||
checked={!hidden.has(entryKey(d, e, i))}
|
checked={!hidden.has(key(n, d))}
|
||||||
onToggle={() => setHidden(toggle(hidden, entryKey(d, e, i)))}
|
onToggle={() => setHidden(toggle(hidden, key(n, d)))}
|
||||||
/>
|
/>
|
||||||
</li>
|
<ul className="mt-2 space-y-2 pl-7">
|
||||||
))}
|
{day.entries.map((entry, e) => (
|
||||||
</ul>
|
<li key={e}>
|
||||||
) : null}
|
<PickEntry
|
||||||
</li>
|
entry={entry}
|
||||||
))}
|
enabled={on && !hidden.has(key(n, d))}
|
||||||
</ul>
|
checked={!hidden.has(key(n, d, e))}
|
||||||
</fieldset>
|
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>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|
@ -412,7 +533,7 @@ function Setup({
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
disabled={count === 0}
|
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"
|
className="btn inline-flex items-center gap-2 px-6 py-3 disabled:opacity-50"
|
||||||
style={{ background: accent, color: readableOn(accent) }}
|
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
|
const KIND_NOTE = { block: 'Block', break: 'Break', heading: 'Heading' } as const
|
||||||
|
|
||||||
function PickEntry({
|
function PickEntry({
|
||||||
entry,
|
entry,
|
||||||
|
label,
|
||||||
|
strong = false,
|
||||||
enabled,
|
enabled,
|
||||||
checked,
|
checked,
|
||||||
onToggle,
|
onToggle,
|
||||||
}: {
|
}: {
|
||||||
entry: ContentBlockItem
|
entry?: ContentBlockItem
|
||||||
|
label?: string
|
||||||
|
strong?: boolean
|
||||||
enabled: boolean
|
enabled: boolean
|
||||||
checked: boolean
|
checked: boolean
|
||||||
onToggle: () => void
|
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 (
|
return (
|
||||||
<label className={`flex items-baseline gap-3 ${enabled ? '' : 'opacity-50'}`}>
|
<label className={`flex items-baseline gap-3 ${enabled ? '' : 'opacity-50'}`}>
|
||||||
<input type="checkbox" disabled={!enabled} checked={checked} onChange={onToggle} />
|
<input type="checkbox" disabled={!enabled} checked={checked} onChange={onToggle} />
|
||||||
<span className="w-32 shrink-0 text-sm text-muted">{entry.time}</span>
|
{entry && <span className="w-32 shrink-0 text-sm text-muted">{entry.time}</span>}
|
||||||
<span className={entry.kind === 'heading' ? 'font-semibold' : ''}>
|
<span className={strong || entry?.kind === 'heading' ? 'font-semibold text-ink' : ''}>
|
||||||
{entry.featured && (
|
{entry?.featured && (
|
||||||
<span className="mr-1 text-link">
|
<span className="mr-1 text-link">
|
||||||
<FeaturedStar />
|
<FeaturedStar />
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
{entry.text}
|
{entry ? entry.text : label}
|
||||||
</span>
|
</span>
|
||||||
{note && <span className="text-xs text-muted">{note}</span>}
|
{note && <span className="text-xs text-muted">{note}</span>}
|
||||||
</label>
|
</label>
|
||||||
|
|
@ -557,7 +683,7 @@ function Player({
|
||||||
<div className="h-3 shrink-0" style={{ background: accent }} />
|
<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">
|
<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 className="font-semibold">{title}</span>
|
||||||
<span>{slide.day.name}</span>
|
<span>{slide.label === title ? '' : slide.label}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Keyed by index, so every slide's entrance animation plays. */}
|
{/* Keyed by index, so every slide's entrance animation plays. */}
|
||||||
|
|
@ -565,7 +691,9 @@ function Player({
|
||||||
<SlideTime.Provider
|
<SlideTime.Provider
|
||||||
value={{ wait: slide.seconds / 2, screen, paused, scrolls: (s) => setScroll({ index, seconds: s }) }}
|
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>
|
</SlideTime.Provider>
|
||||||
</div>
|
</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.
|
/* 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. */
|
`start` is the first row's place in the slide's entrance. */
|
||||||
function OverviewEntries({ entries, accent, start = 1 }: { entries: ContentBlockItem[]; accent: string; start?: number }) {
|
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 tags = useContext(ScheduleTags)
|
||||||
const color = accentText(accent)
|
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') {
|
if (slide.kind === 'overview') {
|
||||||
const entries = slide.day.entries
|
const entries = slide.day!.entries
|
||||||
const two = lineCount(entries) > ONE_COLUMN
|
const two = lineCount(entries) > ONE_COLUMN
|
||||||
return (
|
return (
|
||||||
<div className="flex h-full flex-col">
|
<div className="flex h-full flex-col">
|
||||||
<Rise>
|
<SlideTitle color={color}>{slide.day!.name || 'Schedule'}</SlideTitle>
|
||||||
<h1 className="mb-[3vh] text-[clamp(2rem,5vw,6rem)] font-bold leading-none" style={{ color }}>
|
|
||||||
{slide.day.name || 'Schedule'}
|
|
||||||
</h1>
|
|
||||||
</Rise>
|
|
||||||
<Scroll>
|
<Scroll>
|
||||||
<ul className={`grid content-start gap-x-[4vw] ${two ? 'grid-cols-2' : 'grid-cols-1'}`}>
|
<ul className={`grid content-start gap-x-[4vw] ${two ? 'grid-cols-2' : 'grid-cols-1'}`}>
|
||||||
<OverviewEntries entries={entries} accent={accent} />
|
<OverviewEntries entries={entries} accent={accent} />
|
||||||
|
|
@ -782,11 +1106,7 @@ function SlideView({ slide, accent }: { slide: Slide; accent: string }) {
|
||||||
let order = 1
|
let order = 1
|
||||||
return (
|
return (
|
||||||
<div className="flex h-full flex-col">
|
<div className="flex h-full flex-col">
|
||||||
<Rise>
|
<SlideTitle color={accentText(tagColor)}>{tag.name}</SlideTitle>
|
||||||
<h1 className="mb-[3vh] text-[clamp(2rem,5vw,6rem)] font-bold leading-none" style={{ color: accentText(tagColor) }}>
|
|
||||||
{tag.name}
|
|
||||||
</h1>
|
|
||||||
</Rise>
|
|
||||||
<Scroll>
|
<Scroll>
|
||||||
<ul className={`grid content-start gap-x-[4vw] ${two ? 'grid-cols-2' : 'grid-cols-1'}`}>
|
<ul className={`grid content-start gap-x-[4vw] ${two ? 'grid-cols-2' : 'grid-cols-1'}`}>
|
||||||
{tagDays.map((day, d) => {
|
{tagDays.map((day, d) => {
|
||||||
|
|
@ -811,15 +1131,13 @@ function SlideView({ slide, accent }: { slide: Slide; accent: string }) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const entry = slide.entry!
|
|
||||||
|
|
||||||
if (slide.kind === 'block') {
|
if (slide.kind === 'block') {
|
||||||
const items = entry.items ?? []
|
const items = entry.items ?? []
|
||||||
return (
|
return (
|
||||||
<div className="flex h-full flex-col">
|
<div className="flex h-full flex-col">
|
||||||
<Rise>
|
<Rise>
|
||||||
<p className="text-[clamp(1.2rem,2.4vw,3rem)] font-semibold" style={{ color }}>
|
<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>
|
</p>
|
||||||
</Rise>
|
</Rise>
|
||||||
<Rise order={1}>
|
<Rise order={1}>
|
||||||
|
|
@ -915,7 +1233,7 @@ function SlideView({ slide, accent }: { slide: Slide; accent: string }) {
|
||||||
<Scroll center className="min-w-0 self-stretch">
|
<Scroll center className="min-w-0 self-stretch">
|
||||||
<Rise from="right">
|
<Rise from="right">
|
||||||
<p className="text-[clamp(1.2rem,2.4vw,3rem)] font-semibold" style={{ color }}>
|
<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>
|
</p>
|
||||||
</Rise>
|
</Rise>
|
||||||
<Rise order={1} from="right">
|
<Rise order={1} from="right">
|
||||||
Loading…
Add table
Add a link
Reference in a new issue