Present: slide order, presentation settings, blocks drawn for a screen
- Setup's Order list: drag or move any slide; saved in the address - A heading-only section titles the slides after it, no slide of its own - Event Presentation settings (095): background image and color, dim, frame, accent, text color, logo - Blocks: Presentation text and Leave out of the presentation; map blocks get a slide per section, map only, no details, location slides - Presented, links are plain text, people a row of round photos and names, organizations their logos Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
a79559d290
commit
7e21a0dd40
16 changed files with 652 additions and 68 deletions
|
|
@ -71,7 +71,8 @@ import { SITE_NAME } from '../lib/site.ts'
|
|||
import { useSmallImage } from '../lib/useSmallImage.ts'
|
||||
import { useReadingMode } from '../lib/readingMode.ts'
|
||||
import { WordMotion, Words } from './RotatingWords.tsx'
|
||||
import OrgListCards from '../pages/sections/OrgList-Card.tsx'
|
||||
import OrgListCards, { OrgLogoRow } from '../pages/sections/OrgList-Card.tsx'
|
||||
import { usePresenting } from '../lib/presenting.ts'
|
||||
|
||||
const BODY = 'var(--color-muted)'
|
||||
|
||||
|
|
@ -87,6 +88,14 @@ export default function ContentBlocks({
|
|||
/** Put before each heading's id: a blog post's tab (contents.ts, splitTabs). */
|
||||
anchorPrefix?: string
|
||||
}) {
|
||||
const presenting = usePresenting()
|
||||
// Presented, a block set to is left out and the rest take their
|
||||
// Presentation text (095).
|
||||
if (presenting && blocks) {
|
||||
blocks = blocks
|
||||
.filter((block) => !block.present?.hide)
|
||||
.map((block) => (block.present?.text ? { ...block, text: block.present.text } : block))
|
||||
}
|
||||
if (!blocks?.length) return null
|
||||
// Headings get ids so a post's contents (PostContents) and a shared
|
||||
// link (#getting-there) can point at them.
|
||||
|
|
@ -378,6 +387,9 @@ function Block({
|
|||
}) {
|
||||
const text = block.text ?? ''
|
||||
const reading = useReadingMode()
|
||||
// On a screen: links are their text, people and organizations
|
||||
// just pictures and names (095).
|
||||
const presenting = usePresenting()
|
||||
|
||||
switch (block.type) {
|
||||
// A blog post's tab marker (BlogPost.tsx splits the post at
|
||||
|
|
@ -410,7 +422,7 @@ function Block({
|
|||
</span>
|
||||
<span style={{ color: plain ? BODY : 'var(--color-body)' }}>
|
||||
<span className={plain ? undefined : 'font-bold'}>
|
||||
{item.url ? (
|
||||
{item.url && !presenting ? (
|
||||
<Anchor href={item.url} className="underline" style={{ color: accentText(accent) }}>
|
||||
{item.text}
|
||||
</Anchor>
|
||||
|
|
@ -607,6 +619,7 @@ function Block({
|
|||
// Picked ones in their order, else every listed one of its kind.
|
||||
const ids = (block.items ?? []).map((item) => item.org_id).filter((id): id is string => Boolean(id))
|
||||
if (ids.length === 0 && !block.org_kind) return null
|
||||
if (presenting) return <OrgLogoRow kind={block.org_kind} ids={ids} accent={accent} />
|
||||
return (
|
||||
<OrgListCards
|
||||
kind={block.org_kind}
|
||||
|
|
@ -626,8 +639,8 @@ function Block({
|
|||
if (!block.team_id && picked.length === 0) return null
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
{block.team_id && <PeopleTiles size="lg" teams={block.team_id} accent={accent} headingLevel={level} />}
|
||||
{picked.length > 0 && <PeopleTiles size="lg" people={picked} accent={accent} headingLevel={level} />}
|
||||
{block.team_id && <PeopleTiles size="lg" teams={block.team_id} accent={accent} headingLevel={level} row={presenting} />}
|
||||
{picked.length > 0 && <PeopleTiles size="lg" people={picked} accent={accent} headingLevel={level} row={presenting} />}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
@ -638,7 +651,7 @@ function Block({
|
|||
case 'paragraph':
|
||||
default:
|
||||
if (!text) return null
|
||||
return block.href ? (
|
||||
return block.href && !presenting ? (
|
||||
<p className="leading-relaxed" style={{ color: BODY }}>
|
||||
<Anchor href={block.href} className="underline" style={{ color: accentText(accent) }}>
|
||||
{text}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import { Fragment, type CSSProperties, type ReactNode } from 'react'
|
|||
import { Link } from 'react-router-dom'
|
||||
import { accentText } from '../lib/color.ts'
|
||||
import { RotatingWords } from './RotatingWords.tsx'
|
||||
import { usePresenting } from '../lib/presenting.ts'
|
||||
|
||||
const TOKEN = /\*\*(.+?)\*\*|\*(.+?)\*|\[([^\]]+)\]\(([^)\s]+)\)|\{([^{}|\n]+(?:\|[^{}|\n]+)+)\}/g
|
||||
const SAFE_URL = /^(\/(?!\/)|#|https?:\/\/|mailto:|tel:)/i
|
||||
|
|
@ -77,7 +78,8 @@ export function Anchor({
|
|||
)
|
||||
}
|
||||
|
||||
function line(text: string, accent: string, key: string): ReactNode[] {
|
||||
/* `plain`: a link's text alone, presented (095). */
|
||||
function line(text: string, accent: string, key: string, plain = false): ReactNode[] {
|
||||
const out: ReactNode[] = []
|
||||
let last = 0
|
||||
let n = 0
|
||||
|
|
@ -89,6 +91,7 @@ function line(text: string, accent: string, key: string): ReactNode[] {
|
|||
if (words != null) out.push(<RotatingWords key={k} words={words.split('|').map((word) => word.trim())} />)
|
||||
else if (bold != null) out.push(<strong key={k} className="font-semibold">{bold}</strong>)
|
||||
else if (italic != null) out.push(<em key={k}>{italic}</em>)
|
||||
else if (label != null && plain) out.push(label)
|
||||
else if (label != null && SAFE_URL.test(url)) {
|
||||
out.push(
|
||||
<Anchor key={k} href={url} className="underline underline-offset-2" style={{ color: accentText(accent) }}>
|
||||
|
|
@ -104,13 +107,14 @@ function line(text: string, accent: string, key: string): ReactNode[] {
|
|||
|
||||
/** Text inside another element: formatting and line breaks. */
|
||||
export function Inline({ text, accent }: { text?: string | null; accent: string }) {
|
||||
const plain = usePresenting()
|
||||
const lines = (text ?? '').split('\n')
|
||||
return (
|
||||
<>
|
||||
{lines.map((part, i) => (
|
||||
<Fragment key={i}>
|
||||
{i > 0 && <br />}
|
||||
{line(part, accent, `l${i}`)}
|
||||
{line(part, accent, `l${i}`, plain)}
|
||||
</Fragment>
|
||||
))}
|
||||
</>
|
||||
|
|
|
|||
|
|
@ -165,6 +165,8 @@ export interface PeopleTilesProps
|
|||
/** The group labels' heading level, by what they sit under (3 under
|
||||
* a section's h2). In reading mode the names are one level under. */
|
||||
headingLevel?: 3 | 4 | 5;
|
||||
/** Just round photos and names in a row, as presented (095). */
|
||||
row?: boolean;
|
||||
/** How long a fetched team or person is reused, in ms. */
|
||||
ttl?: number;
|
||||
emptyMessage?: string;
|
||||
|
|
@ -195,8 +197,10 @@ export default function PeopleTiles({
|
|||
ttl = 5 * 60_000,
|
||||
loadingMessage = "Loading…",
|
||||
errorMessage = "Couldn't load this list right now.",
|
||||
row = false,
|
||||
...view
|
||||
}: PeopleTilesProps) {
|
||||
const View = row ? PeopleRow : PeopleTilesView;
|
||||
const specs = useMemo(() => normalizeTeams(teams), [teams]);
|
||||
const teamKey = specs.map((spec) => spec.id).join(",");
|
||||
|
||||
|
|
@ -278,14 +282,14 @@ export default function PeopleTiles({
|
|||
if (specs.length) {
|
||||
if (failed) return <p className="pl__empty">{errorMessage}</p>;
|
||||
if (!teamGroups) return <p className="pl__empty">{loadingMessage}</p>;
|
||||
return <PeopleTilesView {...view} groups={teamGroups} />;
|
||||
return <View {...view} groups={teamGroups} />;
|
||||
}
|
||||
|
||||
if (slugKey) {
|
||||
if (failed) return <p className="pl__empty">{errorMessage}</p>;
|
||||
if (!directory) return <p className="pl__empty">{loadingMessage}</p>;
|
||||
return (
|
||||
<PeopleTilesView
|
||||
<View
|
||||
{...view}
|
||||
groups={groups?.map((group) => ({
|
||||
...group,
|
||||
|
|
@ -297,7 +301,7 @@ export default function PeopleTiles({
|
|||
}
|
||||
|
||||
return (
|
||||
<PeopleTilesView
|
||||
<View
|
||||
{...view}
|
||||
groups={groups as PeopleGroup[] | undefined}
|
||||
people={people as Person[] | undefined}
|
||||
|
|
@ -768,6 +772,24 @@ function Tile({
|
|||
);
|
||||
}
|
||||
|
||||
/* Everyone in the groups, then the people, as round photos over
|
||||
their names, left to right: a people block presented (095). */
|
||||
function PeopleRow({ groups, people }: { groups?: PeopleGroup[]; people?: Person[] }) {
|
||||
const everyone = [...(groups ?? []).flatMap((group) => group.people), ...(people ?? [])];
|
||||
return (
|
||||
<ul className="flex flex-wrap gap-6">
|
||||
{everyone.map((person, i) => (
|
||||
<li key={person.id ?? i} className="flex w-28 flex-col items-center text-center">
|
||||
<span className="block h-24 w-24 overflow-hidden rounded-full">
|
||||
<Photo src={mediaUrl(person.photo)} name={person.name} />
|
||||
</span>
|
||||
<span className="mt-2 text-sm font-semibold leading-tight text-ink">{person.name}</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
);
|
||||
}
|
||||
|
||||
function Photo({ src, name }: { src?: string | null; name: string }) {
|
||||
const img = useSmallImage(src);
|
||||
|
||||
|
|
|
|||
|
|
@ -854,7 +854,9 @@ export function Repeater({
|
|||
row={row}
|
||||
parentRow={parentRow}
|
||||
value={row[field.path]}
|
||||
options={options}
|
||||
// Its own lent options too: a map block's
|
||||
// Locations with a slide (095).
|
||||
options={spec.lends ? { ...options, ...spec.lends(row, options) } : options}
|
||||
error={errors?.[`${errorPrefix}${index}.${field.path}`]}
|
||||
onChange={(value) => update(index, { ...row, [field.path]: value })}
|
||||
onPatch={(patch) => update(index, { ...row, ...patch })}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
import { mediaUrl } from "../media.ts";
|
||||
import { PLACE_FIELDS, PUBLISHED_FIELD, LISTED_FIELD, timelineGroup, timelineDetailGroup, linksChild, hostsChild, blocksChild, tagsChild } from "./shared.ts";
|
||||
import { PLACE_FIELDS, PUBLISHED_FIELD, LISTED_FIELD, timelineGroup, timelineDetailGroup, linksChild, hostsChild, blocksChild, tagsChild, PRESENT_BLOCK_FIELDS } from "./shared.ts";
|
||||
|
||||
/* An event's blocks also say how they're presented (095). */
|
||||
const eventBlocksChild = { ...blocksChild, fields: [...blocksChild.fields, ...PRESENT_BLOCK_FIELDS] };
|
||||
|
||||
/* ── Events ──────────────────────────────────────────────────── */
|
||||
|
||||
|
|
@ -189,6 +192,58 @@ export const events = {
|
|||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
legend: "Presentation",
|
||||
fields: [
|
||||
{
|
||||
path: "present_background",
|
||||
label: "Background image",
|
||||
widget: "image",
|
||||
crop: "free",
|
||||
resolve: mediaUrl,
|
||||
full: true,
|
||||
help: "Behind every slide when the page is presented, under the background color. Default: none.",
|
||||
},
|
||||
{
|
||||
path: "present_background_color",
|
||||
label: "Background color",
|
||||
widget: "color",
|
||||
help: "The slides' background, laid over the image at Dim. Default: the site's background.",
|
||||
},
|
||||
{
|
||||
path: "present_dim",
|
||||
label: "Dim",
|
||||
widget: "number",
|
||||
help: "How much of the background color covers the image, 0 to 90 percent, so the text stays readable. Default: 60.",
|
||||
},
|
||||
{
|
||||
path: "present_frame",
|
||||
label: "Frame",
|
||||
widget: "select",
|
||||
options: [
|
||||
["border", "A border around the slide"],
|
||||
["none", "None: the slide alone"],
|
||||
],
|
||||
blankLabel: "Default: a bar on top, the title line and the timer",
|
||||
},
|
||||
{ path: "present_accent", label: "Accent", widget: "color", help: "Default: the event's color" },
|
||||
{
|
||||
path: "present_text_color",
|
||||
label: "Text color",
|
||||
widget: "color",
|
||||
help: "Default: readable on the background color, else the site's text colors",
|
||||
},
|
||||
{
|
||||
path: "present_logo",
|
||||
label: "Logo",
|
||||
widget: "image",
|
||||
folder: "logos",
|
||||
resolve: mediaUrl,
|
||||
full: true,
|
||||
help: "In the bottom-right corner of every slide. Default: none.",
|
||||
},
|
||||
],
|
||||
},
|
||||
timelineGroup("event"),
|
||||
timelineDetailGroup("event"),
|
||||
{ legend: "Publishing", fields: [PUBLISHED_FIELD, LISTED_FIELD] },
|
||||
|
|
@ -231,6 +286,6 @@ export const events = {
|
|||
],
|
||||
},
|
||||
linksChild,
|
||||
blocksChild,
|
||||
eventBlocksChild,
|
||||
],
|
||||
};
|
||||
|
|
|
|||
|
|
@ -494,6 +494,65 @@ const SUB_ITEM_FIELDS = [
|
|||
TAGS_FIELD,
|
||||
];
|
||||
|
||||
/* An event's blocks' presentation fields (095), EventPresent.tsx. */
|
||||
export const PRESENT_BLOCK_FIELDS = [
|
||||
{
|
||||
path: "present_hide",
|
||||
label: "Leave out of the presentation",
|
||||
widget: "checkbox",
|
||||
help: "The page still shows it.",
|
||||
},
|
||||
{
|
||||
path: "present_text",
|
||||
label: "Presentation text",
|
||||
widget: "textarea",
|
||||
full: true,
|
||||
when: { path: "type", value: TEXT_TYPES },
|
||||
help: "Shown in place of the text when the page is presented, eg. a shorter heading. Default: the text.",
|
||||
},
|
||||
{
|
||||
path: "present_map_split",
|
||||
label: "A slide per section",
|
||||
widget: "checkbox",
|
||||
help: "Presented: each of the sections below gets its own map slide with only its locations. Default: one map slide with every location.",
|
||||
when: { path: "type", value: "map" },
|
||||
},
|
||||
{
|
||||
path: "present_map_no_list",
|
||||
label: "Map only",
|
||||
widget: "checkbox",
|
||||
help: "Presented: no locations list beside the map, so the map fills the slide.",
|
||||
when: { path: "type", value: "map" },
|
||||
},
|
||||
{
|
||||
path: "present_map_no_details",
|
||||
label: "No location details",
|
||||
widget: "checkbox",
|
||||
help: "Presented: each location's name only, without its detail line.",
|
||||
when: { path: "type", value: "map" },
|
||||
},
|
||||
{
|
||||
path: "present_places",
|
||||
label: "Location slides",
|
||||
widget: "select",
|
||||
options: [
|
||||
["picked", "Only the locations picked below"],
|
||||
["none", "None"],
|
||||
],
|
||||
blankLabel: "Default: each marked location, lit up on the map",
|
||||
when: { path: "type", value: "map" },
|
||||
},
|
||||
{
|
||||
path: "present_place_keys",
|
||||
label: "Locations with a slide",
|
||||
widget: "checklist",
|
||||
optionsFrom: "mapLocations",
|
||||
full: true,
|
||||
when: { path: "present_places", value: "picked" },
|
||||
emptyNote: "No locations yet: pick the block's Venue, and give it locations under Data → Venues.",
|
||||
},
|
||||
];
|
||||
|
||||
export const blocksChild = {
|
||||
key: "content_blocks",
|
||||
label: "Content blocks",
|
||||
|
|
|
|||
10
src/lib/presenting.ts
Normal file
10
src/lib/presenting.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
/* Whether the blocks are drawn for a presentation screen
|
||||
(EventPresent.tsx, 095): ContentBlocks leaves out the blocks set to,
|
||||
takes their Presentation text, and draws links as plain text,
|
||||
people as a row of round photos and organizations as logos. */
|
||||
|
||||
import { createContext, useContext } from 'react'
|
||||
|
||||
export const Presenting = createContext(false)
|
||||
|
||||
export const usePresenting = () => useContext(Presenting)
|
||||
|
|
@ -70,6 +70,35 @@ export type ContentBlock = {
|
|||
/** A map block's own sections of its venue's locations, by key
|
||||
* (094). With any, `venue` holds only the locations they name. */
|
||||
map_sections?: MapSection[]
|
||||
/** How it's presented (095); null with nothing set. */
|
||||
present?: BlockPresent | null
|
||||
}
|
||||
|
||||
/** A block's presentation settings (095), EventPresent.tsx. */
|
||||
export type BlockPresent = {
|
||||
hide: boolean
|
||||
/** In place of its text, eg. a shorter heading. */
|
||||
text: string | null
|
||||
/** A map: a slide per map section. */
|
||||
map_split: boolean
|
||||
map_no_list: boolean
|
||||
map_no_details: boolean
|
||||
/** A map: which locations get a slide; null every marked one. */
|
||||
places: 'picked' | 'none' | null
|
||||
place_keys: string[]
|
||||
}
|
||||
|
||||
/** An event's presentation look (095). */
|
||||
export type EventPresentLook = {
|
||||
background: string | null
|
||||
background_color: string | null
|
||||
/** Percent of the color over the image; null 60. */
|
||||
dim: number | null
|
||||
/** null the accent bar, title line and timer. */
|
||||
frame: 'border' | 'none' | null
|
||||
accent: string | null
|
||||
text_color: string | null
|
||||
logo: string | null
|
||||
}
|
||||
|
||||
export type MapSection = { name: string; keys: string[] }
|
||||
|
|
@ -246,6 +275,8 @@ export type EventRecord = {
|
|||
show_contents?: boolean
|
||||
/** Above the link buttons; null shows none (089). */
|
||||
links_heading?: string | null
|
||||
/** Its page presented (095). */
|
||||
present?: EventPresentLook
|
||||
blocks: ContentBlock[]
|
||||
people: EventPerson[]
|
||||
awards: EventAward[]
|
||||
|
|
|
|||
|
|
@ -43,11 +43,24 @@
|
|||
half its seconds, scrolls to the end at "Scroll" seconds a
|
||||
screenful (`screen=`), then waits the other half.
|
||||
|
||||
A section with only a heading (and subheadings or dividers) before
|
||||
its map, schedule or events gets no text slide: its heading titles
|
||||
the slides that follow. The setup's Order list moves any slide
|
||||
(`order`, slide ids, see buildSlides); a slide it doesn't name
|
||||
stays after the one it follows by default.
|
||||
|
||||
The event's Presentation settings (095) give the slides their
|
||||
background, frame, colors and logo (lookTokens, Player); a block's
|
||||
give its Presentation text, leave it out, and say how a map is
|
||||
shown. The blocks themselves are drawn for a screen (Presenting):
|
||||
links as their text, people as round photos and names,
|
||||
organizations as their logos.
|
||||
|
||||
Keys while playing: arrows step, Space pauses, Escape leaves full
|
||||
screen (the browser's), S goes back to the setup.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
import { ArrowsOut, CaretLeft, CaretRight, Gear, Pause, Play } from '@phosphor-icons/react'
|
||||
import { ArrowDown, ArrowUp, ArrowsOut, CaretLeft, CaretRight, DotsSixVertical, Gear, Pause, Play } from '@phosphor-icons/react'
|
||||
import { createContext, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type ReactNode } from 'react'
|
||||
import { useParams, useSearchParams } from 'react-router-dom'
|
||||
|
||||
|
|
@ -67,10 +80,13 @@ import {
|
|||
import ContentBlocks, { eventLine } from '../components/ContentBlocks.tsx'
|
||||
import { LocationNumber, MapPicture, isMarked, locationNumber } from '../components/MapBlock.tsx'
|
||||
import { Paragraphs } from '../components/InlineText.tsx'
|
||||
import Logo from '../components/Logo.tsx'
|
||||
import { Presenting } from '../lib/presenting.ts'
|
||||
import {
|
||||
useEvent,
|
||||
type ContentBlock,
|
||||
type ContentBlockItem,
|
||||
type EventPresentLook,
|
||||
type ScheduleTag,
|
||||
type Venue,
|
||||
type VenueLocation,
|
||||
|
|
@ -105,6 +121,11 @@ const OWN_SLIDES = new Map([
|
|||
])
|
||||
/* Blocks that start a section. */
|
||||
const STARTS_SECTION = new Set(['heading', 'tab'])
|
||||
/* Text that alone makes no section slide: the heading titles what
|
||||
follows instead. */
|
||||
const FILLER = new Set(['subheading', 'divider'])
|
||||
/* Percent of the background color over the background image, unset. */
|
||||
const DIM = 60
|
||||
|
||||
/* Seconds a long slide takes to scroll one screenful, when unset. */
|
||||
const PER_SCREEN = 8
|
||||
|
|
@ -119,7 +140,11 @@ const TEXT_WIDTH = 1000
|
|||
/* `label` is the top bar's right side: the day, else the section.
|
||||
The rest is what each kind draws. */
|
||||
type Slide = {
|
||||
/* Where it comes from, for the Order list (buildSlides). */
|
||||
id: string
|
||||
kind: Kind
|
||||
/* A map's or event list's title, when not the label. */
|
||||
title?: string
|
||||
seconds: number
|
||||
label: string
|
||||
day?: Day
|
||||
|
|
@ -132,18 +157,28 @@ type Slide = {
|
|||
venue?: Venue
|
||||
location?: VenueLocation
|
||||
items?: ContentBlockItem[]
|
||||
/* A map: the locations shown, by key (all when unset), and its
|
||||
block's Map only and No location details (095). */
|
||||
only?: string[]
|
||||
noList?: boolean
|
||||
noDetails?: boolean
|
||||
}
|
||||
|
||||
/* A part of the page: a heading and the blocks under it. */
|
||||
type Section = { title: string; blocks: ContentBlock[] }
|
||||
/* A part of the page: a heading (`headed`, else the event's title)
|
||||
and the blocks under it. */
|
||||
type Section = { title: string; headed: boolean; blocks: ContentBlock[] }
|
||||
/* A schedule block, numbered among the page's, with its days. */
|
||||
type Schedule = { n: number; days: Day[]; tags: ScheduleTag[] }
|
||||
|
||||
/* Blocks left out of the presentation (095) are dropped; a left out
|
||||
heading still starts its section, under the event's title. */
|
||||
function sectionsOf(blocks: ContentBlock[], title: string): Section[] {
|
||||
const sections: Section[] = [{ title, blocks: [] }]
|
||||
const sections: Section[] = [{ title, headed: false, 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)
|
||||
if (STARTS_SECTION.has(block.type)) {
|
||||
const heading = block.present?.hide ? '' : block.present?.text || block.text
|
||||
sections.push({ title: heading || title, headed: Boolean(heading), blocks: [] })
|
||||
} else if (!block.present?.hide) sections[sections.length - 1].blocks.push(block)
|
||||
}
|
||||
return sections.filter((section) => section.blocks.length)
|
||||
}
|
||||
|
|
@ -170,43 +205,58 @@ function readSettings(params: URLSearchParams) {
|
|||
seconds,
|
||||
screen: Number.isFinite(screen) && screen > 0 ? screen : PER_SCREEN,
|
||||
only: params.get('only') || null,
|
||||
order: list(params.get('order')),
|
||||
}
|
||||
}
|
||||
type Settings = ReturnType<typeof readSettings>
|
||||
type Picks = Pick<Settings, 'skipped' | 'hidden' | 'seconds' | 'only'>
|
||||
|
||||
/* An entry or sub-item with its key (key()), carried through the
|
||||
picks and the tag filter, which copy blocks. */
|
||||
type Keyed = ContentBlockItem & { slideKey: string }
|
||||
const keyOf = (entry: ContentBlockItem) => (entry as Keyed).slideKey
|
||||
|
||||
function scheduleSlides(slides: Slide[], { n, days, tags }: Schedule, { hidden, seconds, only }: Picks) {
|
||||
const kept: Day[] = []
|
||||
days.forEach((all, d) => {
|
||||
if (hidden.has(key(n, d))) return
|
||||
let entries = all.entries.flatMap((entry, e) => {
|
||||
let entries: ContentBlockItem[] = all.entries.flatMap((entry, e) => {
|
||||
if (hidden.has(key(n, d, e))) return []
|
||||
if (entry.kind !== 'block') return [entry]
|
||||
return [{ ...entry, items: (entry.items ?? []).filter((_, i) => !hidden.has(key(n, d, e, i))) }]
|
||||
const slideKey = key(n, d, e)
|
||||
if (entry.kind !== 'block') return [{ ...entry, slideKey }]
|
||||
const items = (entry.items ?? []).flatMap((item, i) =>
|
||||
hidden.has(key(n, d, e, i)) ? [] : [{ ...item, slideKey: key(n, d, e, i) }],
|
||||
)
|
||||
return [{ ...entry, slideKey, items }]
|
||||
})
|
||||
if (only) entries = withTag(entries, only)
|
||||
if (entries.length === 0) return
|
||||
kept.push({ name: all.name, entries })
|
||||
const day = { ...all, entries }
|
||||
const at = { day, label: day.name, tags }
|
||||
if (seconds.overview) slides.push({ kind: 'overview', seconds: seconds.overview, ...at })
|
||||
if (seconds.overview) slides.push({ id: `o${key(n, d)}`, kind: 'overview', seconds: seconds.overview, ...at })
|
||||
|
||||
const media = (entry: ContentBlockItem, parent?: ContentBlockItem) => {
|
||||
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 })
|
||||
const k = keyOf(entry)
|
||||
if (seconds.graphic && entry.media) slides.push({ id: `g${k}`, kind: 'graphic', seconds: seconds.graphic, ...at, entry, parent })
|
||||
if (seconds.map && entry.map_image) slides.push({ id: `m${k}`, 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, ...at, entry })
|
||||
if (seconds.block) slides.push({ id: `k${keyOf(entry)}`, 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, ...at, entry: item, parent: entry })
|
||||
if (seconds.spotlight) {
|
||||
slides.push({ id: `s${keyOf(item)}`, 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, ...at, entry })
|
||||
if (seconds.spotlight && entry.kind !== 'break') {
|
||||
slides.push({ id: `s${keyOf(entry)}`, kind: 'spotlight', seconds: seconds.spotlight, ...at, entry })
|
||||
}
|
||||
media(entry)
|
||||
}
|
||||
})
|
||||
|
|
@ -215,11 +265,41 @@ function scheduleSlides(slides: Slide[], { n, days, tags }: Schedule, { hidden,
|
|||
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, label: tag.name, tag, days: tagDays, tags })
|
||||
if (tagDays.length) slides.push({ id: `x${n}.${tag.key}`, kind: 'tag', seconds: seconds.tag, label: tag.name, tag, days: tagDays, tags })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* A map block's slides: the map (once per section with A slide per
|
||||
section), then each location picked for a slide of its own (095).
|
||||
`title` is the heading folded in, if any. */
|
||||
function mapSlides(slides: Slide[], block: ContentBlock, at: string, label: string, title: string | null, seconds: Picks['seconds']) {
|
||||
const venue = block.venue!
|
||||
const present = block.present
|
||||
const shown = { noList: present?.map_no_list, noDetails: present?.map_no_details }
|
||||
if (seconds.venue) {
|
||||
const parts = present?.map_split ? (block.map_sections ?? []) : []
|
||||
if (parts.length) {
|
||||
parts.forEach((part, i) => {
|
||||
slides.push({ id: `v${at}.${i}`, kind: 'venue', seconds: seconds.venue, label, venue, title: part.name, only: part.keys, ...shown })
|
||||
})
|
||||
} else {
|
||||
slides.push({ id: `v${at}`, kind: 'venue', seconds: seconds.venue, label, venue, title: title ?? venue.name, ...shown })
|
||||
}
|
||||
}
|
||||
if (!seconds.place || !venue.map_image || present?.places === 'none') return
|
||||
const picked = present?.places === 'picked' ? new Set(present.place_keys) : null
|
||||
for (const location of venue.locations.filter(isMarked)) {
|
||||
if (picked && !picked.has(location.key)) continue
|
||||
slides.push({ id: `p${at}.${location.key}`, kind: 'place', seconds: seconds.place, label, venue, location, ...shown })
|
||||
}
|
||||
}
|
||||
|
||||
/* Each slide's id says where it comes from, so a saved order still
|
||||
finds it: t<section> a section's text; v and p a map and its
|
||||
locations, c and e an events list and its events, by
|
||||
<section>.<block>; o, k, s, g and m a schedule's overview, block,
|
||||
spotlight, graphic and map image, and x its tag slides, by key(). */
|
||||
function buildSlides(sections: Section[], schedules: Map<ContentBlock, Schedule>, picks: Picks): Slide[] {
|
||||
const { skipped, seconds } = picks
|
||||
const slides: Slide[] = []
|
||||
|
|
@ -227,29 +307,66 @@ function buildSlides(sections: Section[], schedules: Map<ContentBlock, Schedule>
|
|||
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) {
|
||||
// Nothing but a heading: it titles the slides that follow.
|
||||
const own = text.some((block) => !FILLER.has(block.type))
|
||||
if (seconds.section && own) slides.push({ id: `t${s}`, kind: 'section', seconds: seconds.section, label, blocks: text })
|
||||
const title = section.headed && !own ? label : null
|
||||
section.blocks.forEach((block, b) => {
|
||||
const at = `${s}.${b}`
|
||||
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 === 'map' && block.venue) mapSlides(slides, block, at, label, title, seconds)
|
||||
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 })
|
||||
if (seconds.cards && items.length) slides.push({ id: `c${at}`, kind: 'cards', seconds: seconds.cards, label, items })
|
||||
if (seconds.event) {
|
||||
items.forEach((entry, i) => slides.push({ id: `e${at}.${i}`, kind: 'event', seconds: seconds.event, label, entry }))
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
return slides
|
||||
}
|
||||
|
||||
/* The slides in the Order list's order: one it doesn't name stays
|
||||
right after the slide it follows by default. */
|
||||
function ordered(slides: Slide[], order: string[] | null): Slide[] {
|
||||
if (!order?.length) return slides
|
||||
const rank = new Map(order.map((id, i) => [id, i]))
|
||||
let last = -1
|
||||
return slides
|
||||
.map((slide, i) => {
|
||||
const at = rank.get(slide.id)
|
||||
if (at != null) last = at
|
||||
return { slide, i, at: at ?? last + 0.5 }
|
||||
})
|
||||
.sort((a, b) => a.at - b.at || a.i - b.i)
|
||||
.map(({ slide }) => slide)
|
||||
}
|
||||
|
||||
/* A slide's line in the Order list. */
|
||||
function slideName(slide: Slide): string {
|
||||
const entry = slide.entry
|
||||
switch (slide.kind) {
|
||||
case 'section':
|
||||
case 'cards':
|
||||
return slide.label
|
||||
case 'overview':
|
||||
return slide.day?.name || 'Schedule'
|
||||
case 'tag':
|
||||
return slide.tag!.name
|
||||
case 'venue':
|
||||
return slide.title ?? slide.venue!.name
|
||||
case 'place':
|
||||
return slide.location!.name
|
||||
case 'event':
|
||||
return entry!.text || entry!.event!.title
|
||||
default:
|
||||
return [slide.day?.name, entry!.time, entry!.text].filter(Boolean).join(' · ')
|
||||
}
|
||||
}
|
||||
const KIND_LABEL = new Map<string, string>(KINDS.map((kind) => [kind.key, kind.label]))
|
||||
|
||||
export default function EventPresent() {
|
||||
const { id } = useParams()
|
||||
const [params, setParams] = useSearchParams()
|
||||
|
|
@ -284,7 +401,8 @@ export default function EventPresent() {
|
|||
)
|
||||
}
|
||||
|
||||
const accent = event.color || BRAND
|
||||
const look = event.present
|
||||
const accent = look?.accent || event.color || BRAND
|
||||
const back = `/events/${encodeURIComponent(event.id)}`
|
||||
|
||||
if (sections.length === 0) {
|
||||
|
|
@ -304,7 +422,8 @@ export default function EventPresent() {
|
|||
<Player
|
||||
title={event.title}
|
||||
accent={accent}
|
||||
slides={buildSlides(sections, schedules, settings)}
|
||||
look={look}
|
||||
slides={ordered(buildSlides(sections, schedules, settings), settings.order)}
|
||||
screen={settings.screen}
|
||||
onSetup={() => {
|
||||
const next = new URLSearchParams(params)
|
||||
|
|
@ -332,6 +451,7 @@ export default function EventPresent() {
|
|||
out.set('screen', String(next.screen))
|
||||
// Not 'tag': that's the tag slides' seconds.
|
||||
if (next.only) out.set('only', next.only)
|
||||
if (next.order?.length) out.set('order', next.order.join(','))
|
||||
out.set('play', '1')
|
||||
setParams(out)
|
||||
}}
|
||||
|
|
@ -363,7 +483,18 @@ function Setup({
|
|||
const [seconds, setSeconds] = useState(settings.seconds)
|
||||
const [only, setOnly] = useState(settings.only)
|
||||
const [screen, setScreen] = useState(settings.screen)
|
||||
const count = buildSlides(sections, schedules, { skipped, hidden, seconds, only }).length
|
||||
const [order, setOrder] = useState(settings.order)
|
||||
const [dragging, setDragging] = useState<number | null>(null)
|
||||
const slides = ordered(buildSlides(sections, schedules, { skipped, hidden, seconds, only }), order)
|
||||
const count = slides.length
|
||||
// Moves a slide in the list, which then names every slide shown.
|
||||
const move = (from: number, to: number) => {
|
||||
if (to < 0 || to >= slides.length || from === to) return
|
||||
const ids = slides.map((slide) => slide.id)
|
||||
const [id] = ids.splice(from, 1)
|
||||
ids.splice(to, 0, id)
|
||||
setOrder(ids)
|
||||
}
|
||||
const tags = [...schedules.values()].flatMap((schedule) => schedule.tags)
|
||||
|
||||
const toggle = <T,>(set: Set<T>, value: T) => {
|
||||
|
|
@ -529,11 +660,67 @@ function Setup({
|
|||
</div>
|
||||
</section>
|
||||
|
||||
{slides.length > 1 && (
|
||||
<section>
|
||||
<div className="mb-4 flex flex-wrap items-baseline gap-4">
|
||||
<h2 className="text-2xl font-bold text-ink">Order</h2>
|
||||
{order && (
|
||||
<button type="button" onClick={() => setOrder(null)} className="text-sm text-link underline">
|
||||
Back to the page's order
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
<p className="mb-4 text-sm text-muted">
|
||||
Drag a slide, or move it with its arrows. A slide picked again later goes back after the one it follows on
|
||||
the page.
|
||||
</p>
|
||||
<ol className="max-h-[36rem] space-y-1 overflow-y-auto">
|
||||
{slides.map((slide, i) => (
|
||||
<li
|
||||
key={slide.id}
|
||||
draggable
|
||||
onDragStart={() => setDragging(i)}
|
||||
onDragOver={(e) => e.preventDefault()}
|
||||
onDrop={() => {
|
||||
if (dragging != null) move(dragging, i)
|
||||
setDragging(null)
|
||||
}}
|
||||
onDragEnd={() => setDragging(null)}
|
||||
className={`flex cursor-grab items-center gap-3 bg-raised px-3 py-2 shadow-sm ${dragging === i ? 'opacity-50' : ''}`}
|
||||
>
|
||||
<DotsSixVertical aria-hidden="true" weight="bold" className="h-4 w-4 shrink-0 text-muted" />
|
||||
<span className="w-8 shrink-0 text-right text-sm text-muted">{i + 1}</span>
|
||||
<span className="min-w-0 flex-1 truncate text-ink">{slideName(slide)}</span>
|
||||
<span className="shrink-0 text-xs text-muted">{KIND_LABEL.get(slide.kind)}</span>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => move(i, i - 1)}
|
||||
disabled={i === 0}
|
||||
aria-label={`Move ${slideName(slide)} up`}
|
||||
className="p-1 text-muted hover:text-ink disabled:opacity-30"
|
||||
>
|
||||
<ArrowUp aria-hidden="true" weight="bold" className="h-4 w-4" />
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => move(i, i + 1)}
|
||||
disabled={i === slides.length - 1}
|
||||
aria-label={`Move ${slideName(slide)} down`}
|
||||
className="p-1 text-muted hover:text-ink disabled:opacity-30"
|
||||
>
|
||||
<ArrowDown aria-hidden="true" weight="bold" className="h-4 w-4" />
|
||||
</button>
|
||||
</li>
|
||||
))}
|
||||
</ol>
|
||||
</section>
|
||||
)}
|
||||
|
||||
<div className="flex flex-wrap items-center gap-4">
|
||||
<button
|
||||
type="button"
|
||||
disabled={count === 0}
|
||||
onClick={() => onPlay({ skipped, hidden, seconds, screen, only })}
|
||||
onClick={() => onPlay({ skipped, hidden, seconds, screen, only, order })}
|
||||
className="btn inline-flex items-center gap-2 px-6 py-3 disabled:opacity-50"
|
||||
style={{ background: accent, color: readableOn(accent) }}
|
||||
>
|
||||
|
|
@ -591,15 +778,39 @@ function PickEntry({
|
|||
|
||||
/* ── Player ─────────────────────────────────────────────────── */
|
||||
|
||||
/* The event's Presentation colors (095) as the site's color tokens,
|
||||
so every slide's text-ink, bg-raised and so on take them. */
|
||||
function lookTokens(look?: EventPresentLook): CSSProperties | undefined {
|
||||
const bg = look?.background_color
|
||||
const ink = look?.text_color || (bg ? readableOn(bg) : null)
|
||||
if (!bg && !ink) return undefined
|
||||
const ground = bg ?? 'var(--color-surface)'
|
||||
return {
|
||||
...(bg ? { '--color-surface': bg } : {}),
|
||||
...(ink
|
||||
? {
|
||||
'--color-ink': ink,
|
||||
'--color-body': ink,
|
||||
'--color-muted': `color-mix(in srgb, ${ink} 75%, ${ground})`,
|
||||
'--color-raised': `color-mix(in srgb, ${ink} 8%, ${ground})`,
|
||||
'--color-tint': `color-mix(in srgb, ${ink} 14%, ${ground})`,
|
||||
'--color-tint-soft': `color-mix(in srgb, ${ink} 6%, ${ground})`,
|
||||
}
|
||||
: {}),
|
||||
} as CSSProperties
|
||||
}
|
||||
|
||||
function Player({
|
||||
title,
|
||||
accent,
|
||||
look,
|
||||
slides,
|
||||
screen,
|
||||
onSetup,
|
||||
}: {
|
||||
title: string
|
||||
accent: string
|
||||
look?: EventPresentLook
|
||||
slides: Slide[]
|
||||
screen: number
|
||||
onSetup: () => void
|
||||
|
|
@ -675,16 +886,35 @@ function Player({
|
|||
}
|
||||
|
||||
const control = 'btn flex h-12 w-12 items-center justify-center bg-raised text-ink shadow-md'
|
||||
const frame = look?.frame ?? null
|
||||
const background = mediaUrl(look?.background)
|
||||
const label = slide.label === title || slide.label === slide.title ? '' : slide.label
|
||||
return (
|
||||
<main
|
||||
onMouseMove={wake}
|
||||
className={`present relative flex h-screen flex-col overflow-hidden bg-surface text-body ${controls ? '' : 'cursor-none'}`}
|
||||
style={lookTokens(look)}
|
||||
className={`present relative isolate flex h-screen flex-col overflow-hidden bg-surface text-body ${controls ? '' : 'cursor-none'}`}
|
||||
>
|
||||
<div className="h-3 shrink-0" style={{ background: accent }} />
|
||||
<div className="flex shrink-0 items-baseline justify-between gap-6 px-[4vw] pt-[2vh] text-[clamp(1rem,1.6vw,2rem)] text-muted">
|
||||
<span className="font-semibold">{title}</span>
|
||||
<span>{slide.label === title ? '' : slide.label}</span>
|
||||
</div>
|
||||
{/* The background image, the background color over it at Dim. */}
|
||||
{background && (
|
||||
<div aria-hidden="true" className="absolute inset-0 -z-10 bg-cover bg-center" style={{ backgroundImage: `url("${background}")` }}>
|
||||
<div className="absolute inset-0 bg-surface" style={{ opacity: (look?.dim ?? DIM) / 100 }} />
|
||||
</div>
|
||||
)}
|
||||
{frame === 'border' && (
|
||||
<div aria-hidden="true" className="pointer-events-none absolute inset-0 z-10" style={{ border: `1vw solid ${accent}` }} />
|
||||
)}
|
||||
{frame == null && <div className="h-3 shrink-0" style={{ background: accent }} />}
|
||||
{frame !== 'none' && (
|
||||
<div
|
||||
className={`flex shrink-0 items-baseline justify-between gap-6 px-[4vw] text-[clamp(1rem,1.6vw,2rem)] text-muted ${
|
||||
frame === 'border' ? 'pt-[4vh]' : 'pt-[2vh]'
|
||||
}`}
|
||||
>
|
||||
<span className="font-semibold">{title}</span>
|
||||
<span>{label}</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Keyed by index, so every slide's entrance animation plays. */}
|
||||
<div key={index} className="min-h-0 flex-1 px-[4vw] py-[3vh]">
|
||||
|
|
@ -692,19 +922,35 @@ function Player({
|
|||
value={{ wait: slide.seconds / 2, screen, paused, scrolls: (s) => setScroll({ index, seconds: s }) }}
|
||||
>
|
||||
<ScheduleTags.Provider value={slide.tags ?? []}>
|
||||
<SlideView slide={slide} accent={accent} />
|
||||
<Presenting.Provider value={true}>
|
||||
<SlideView slide={slide} accent={accent} />
|
||||
</Presenting.Provider>
|
||||
</ScheduleTags.Provider>
|
||||
</SlideTime.Provider>
|
||||
</div>
|
||||
|
||||
{/* How long this slide has left. */}
|
||||
<div className="h-1.5 shrink-0" style={{ background: `color-mix(in srgb, ${accent} 20%, transparent)` }}>
|
||||
{frame !== 'none' && (
|
||||
<div
|
||||
key={`${index}-${paused}`}
|
||||
className={paused ? 'h-full w-0' : 'present-timer h-full'}
|
||||
style={{ background: accent, animationDuration: `${seconds}s` }}
|
||||
className={`h-1.5 shrink-0 ${frame === 'border' ? 'mx-[1vw] mb-[1vw]' : ''}`}
|
||||
style={{ background: `color-mix(in srgb, ${accent} 20%, transparent)` }}
|
||||
>
|
||||
<div
|
||||
key={`${index}-${paused}`}
|
||||
className={paused ? 'h-full w-0' : 'present-timer h-full'}
|
||||
style={{ background: accent, animationDuration: `${seconds}s` }}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{look?.logo && (
|
||||
<Logo
|
||||
src={mediaUrl(look.logo)}
|
||||
className={`pointer-events-none absolute right-[3vw] h-[8vh] w-auto max-w-[16vw] object-contain ${
|
||||
frame === 'border' ? 'bottom-[4vh]' : 'bottom-[3vh]'
|
||||
}`}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div
|
||||
className={`absolute bottom-6 left-1/2 flex -translate-x-1/2 items-center gap-3 transition-opacity duration-300 ${
|
||||
|
|
@ -829,11 +1075,18 @@ function useRatio(src: string | null) {
|
|||
|
||||
/* 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 }) {
|
||||
function SlideMap({ venue, accent, active, vh, only }: {
|
||||
venue: Venue
|
||||
accent: string
|
||||
active: string | null
|
||||
vh: number
|
||||
/** Marks only these locations' keys; all when unset. */
|
||||
only?: string[]
|
||||
}) {
|
||||
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 />
|
||||
<MapPicture venue={venue} accent={accent} active={active} only={only && new Set(only)} big />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
@ -937,24 +1190,38 @@ function SlideView({ slide, accent }: { slide: Slide; accent: string }) {
|
|||
|
||||
if (slide.kind === 'venue') {
|
||||
const venue = slide.venue!
|
||||
const only = slide.only
|
||||
const locations = only ? venue.locations.filter((location) => only.includes(location.key)) : venue.locations
|
||||
const heading = slide.title ?? venue.name
|
||||
// Map only: the map under its title, as big as the slide holds.
|
||||
if (slide.noList && venue.map_image) {
|
||||
return (
|
||||
<div className="flex h-full flex-col items-center">
|
||||
<SlideTitle color={color}>{heading}</SlideTitle>
|
||||
<Rise order={1} className="flex min-h-0 w-full flex-1 justify-center">
|
||||
<SlideMap venue={venue} accent={accent} active={null} vh={68} only={only} />
|
||||
</Rise>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
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} />
|
||||
<SlideMap venue={venue} accent={accent} active={null} vh={78} only={only} />
|
||||
</Rise>
|
||||
)}
|
||||
<div className="flex min-w-0 flex-1 flex-col">
|
||||
<SlideTitle color={color}>{venue.name}</SlideTitle>
|
||||
<SlideTitle color={color}>{heading}</SlideTitle>
|
||||
<Scroll>
|
||||
<ol className="space-y-[1.5vh]">
|
||||
{venue.locations.map((location, i) => (
|
||||
{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 && (
|
||||
{location.detail && !slide.noDetails && (
|
||||
<span className="block text-[clamp(0.9rem,1.4vw,1.8rem)] text-muted">{location.detail}</span>
|
||||
)}
|
||||
</span>
|
||||
|
|
@ -983,7 +1250,7 @@ function SlideView({ slide, accent }: { slide: Slide; accent: string }) {
|
|||
<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 && (
|
||||
{location.detail && !slide.noDetails && (
|
||||
<Rise order={2} from="right">
|
||||
<p className="mt-[1.5vh] text-[clamp(1.1rem,2.2vw,2.8rem)] text-muted">{location.detail}</p>
|
||||
</Rise>
|
||||
|
|
@ -1002,7 +1269,7 @@ function SlideView({ slide, accent }: { slide: Slide; accent: string }) {
|
|||
const items = slide.items ?? []
|
||||
return (
|
||||
<div className="flex h-full flex-col">
|
||||
<SlideTitle color={color}>{slide.label}</SlideTitle>
|
||||
<SlideTitle color={color}>{slide.title ?? slide.label}</SlideTitle>
|
||||
<Scroll>
|
||||
<ul className={`grid gap-[2vw] ${items.length > 4 ? 'grid-cols-3' : 'grid-cols-2'}`}>
|
||||
{items.map((item, i) => {
|
||||
|
|
|
|||
|
|
@ -159,6 +159,25 @@ function Block({ title, orgs, accent, pageLabel, siteLabel, nested = false }) {
|
|||
}
|
||||
|
||||
|
||||
/* Just the logos, in a row: an organizations block presented (095).
|
||||
Picked ones in their order, else every one of the kind by name. */
|
||||
export function OrgLogoRow({ kind, ids, accent = FALLBACK_COLOR }: { kind?: string | null; ids?: string[]; accent?: string }) {
|
||||
const { organizations } = useOrganizations(kind, ids);
|
||||
const sorted = ids?.length
|
||||
? ids.flatMap((id) => organizations.filter((org) => org.id === id))
|
||||
: [...organizations].sort(byName);
|
||||
return (
|
||||
<ul className="flex flex-wrap items-center gap-8">
|
||||
{sorted.map((org) => (
|
||||
<li key={org.id} title={org.name}>
|
||||
<span className="sr-only">{org.name}</span>
|
||||
<OrgLogo org={org} color={org.color || accent} size="h-24 w-44" fallbackSize="h-24 w-24 text-3xl" />
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
);
|
||||
}
|
||||
|
||||
export default function OrgListCards({
|
||||
kind,
|
||||
ids,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue