v1.14.2-present: event schedules, venues and map blocks, Present mode and its phone remote #33

Merged
ngu-git-admin merged 40 commits from event-schedule into main 2026-11-21 23:02:06 +00:00
16 changed files with 652 additions and 68 deletions
Showing only changes of commit 7e21a0dd40 - Show all commits

View file

@ -184,6 +184,8 @@ also in `server/src/admin-schema/` and a CHECK):
| Content blocks → Type | heading, subheading, paragraph, list, links, quote, image, divider, video, button, callout, schedule, table, cards, people, map, events, organizations | **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, organizations | **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 `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`). | | 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`). |
| Content blocks → List → Style | (blank: bold text, normal detail), plain (plain text, gray detail) | **yes**, migration 092 | The Style field in `src/lib/adminSchema/shared.ts`; drawn by the `list` case in `ContentBlocks.tsx`. | | Content blocks → List → Style | (blank: bold text, normal detail), plain (plain text, gray detail) | **yes**, migration 092 | The Style field in `src/lib/adminSchema/shared.ts`; drawn by the `list` case in `ContentBlocks.tsx`. |
| Content blocks (an event's) → Map → Location slides | (blank: each marked location), picked (the Locations with a slide), none | **yes**, migration 095 | `PRESENT_BLOCK_FIELDS` in `src/lib/adminSchema/shared.ts`; read by `mapSlides` in `src/pages/EventPresent.tsx` |
| Events → Presentation → Frame | (blank: the accent bar, title line and timer), border, none | **yes**, migration 095 | The `present_frame` field in `src/lib/adminSchema/events.ts`; drawn by `Player` in `src/pages/EventPresent.tsx` |
| Content blocks → Organizations → List | (blank: only the picked ones), partner, region, group, ministry | **yes**, migration 093 | The `org_kind` field in `src/lib/adminSchema/shared.ts`; the `organizations` case in `ContentBlocks.tsx` passes it as the kind to `OrgListCards` (`nested`); items picked by `org_id` replace it | | Content blocks → Organizations → List | (blank: only the picked ones), partner, region, group, ministry | **yes**, migration 093 | The `org_kind` field in `src/lib/adminSchema/shared.ts`; the `organizations` case in `ContentBlocks.tsx` passes it as the kind to `OrgListCards` (`nested`); items picked by `org_id` replace it |
| 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` |

View file

@ -181,6 +181,14 @@ export const blocksChild = (ownerKind) => ({
enumeration("list_style", ["plain"]), enumeration("list_style", ["plain"]),
// Organizations blocks (093): the kind listed when none are picked. // Organizations blocks (093): the kind listed when none are picked.
enumeration("org_kind", ["region", "group", "partner", "ministry"]), enumeration("org_kind", ["region", "group", "partner", "ministry"]),
// How it's presented (095): EventPresent.tsx.
bool("present_hide"),
text("present_text"),
bool("present_map_split"),
bool("present_map_no_list"),
bool("present_map_no_details"),
enumeration("present_places", ["picked", "none"]),
text("present_place_keys"),
], ],
children: [ children: [
{ {

View file

@ -69,6 +69,14 @@ export const events = {
bool("in_timeline"), bool("in_timeline"),
bool("show_contents"), bool("show_contents"),
text("links_heading"), text("links_heading"),
// Its page presented (095).
text("present_background"),
text("present_background_color"),
int("present_dim"),
enumeration("present_frame", ["border", "none"]),
text("present_accent"),
text("present_text_color"),
text("present_logo"),
// A repeating schedule. Columns rather than a side table: the // A repeating schedule. Columns rather than a side table: the
// schedule is always exactly one per event, and the public view // schedule is always exactly one per event, and the public view

View file

@ -0,0 +1,56 @@
-- ═══════════════════════════════════════════════════════════════
-- 095 PRESENTATION SETTINGS
--
-- How an event's page looks presented (EventPresent.tsx), set on
-- the event; nothing here changes the page itself.
--
-- On events (v_events is SELECT e.*, so no rebuild):
-- present_background an image behind every slide
-- present_background_color the slides' background color; with an
-- image, laid over it at present_dim
-- present_dim percent of the color over the image,
-- 0 to 90; null 60
-- present_frame null the accent bar, title line and
-- timer; 'border' an accent border around
-- the slide; 'none' the slide alone
-- present_accent in place of the event's color
-- present_text_color the slides' text; null the background
-- color's readable one, else the site's
-- present_logo in the slide's bottom-right corner
--
-- On content blocks (any owner's; only an event's are presented):
-- present_hide left out of the presentation
-- present_text shown presented in place of its text,
-- eg. a shorter heading
-- present_map_split a map: a slide per map section (094)
-- present_map_no_list a map: no locations list beside it
-- present_map_no_details a map: no location detail lines
-- present_places a map: which locations get a slide of
-- their own; null every marked one,
-- 'picked' present_place_keys, 'none'
-- present_place_keys the venue's location_keys (088),
-- comma-separated
-- ═══════════════════════════════════════════════════════════════
ALTER TABLE events ADD COLUMN present_background TEXT;
ALTER TABLE events ADD COLUMN present_background_color TEXT;
ALTER TABLE events ADD COLUMN present_dim INTEGER
CHECK (present_dim BETWEEN 0 AND 90);
ALTER TABLE events ADD COLUMN present_frame TEXT
CHECK (present_frame IN ('border', 'none'));
ALTER TABLE events ADD COLUMN present_accent TEXT;
ALTER TABLE events ADD COLUMN present_text_color TEXT;
ALTER TABLE events ADD COLUMN present_logo TEXT;
ALTER TABLE content_blocks ADD COLUMN present_hide INTEGER NOT NULL DEFAULT 0
CHECK (present_hide IN (0, 1));
ALTER TABLE content_blocks ADD COLUMN present_text TEXT;
ALTER TABLE content_blocks ADD COLUMN present_map_split INTEGER NOT NULL DEFAULT 0
CHECK (present_map_split IN (0, 1));
ALTER TABLE content_blocks ADD COLUMN present_map_no_list INTEGER NOT NULL DEFAULT 0
CHECK (present_map_no_list IN (0, 1));
ALTER TABLE content_blocks ADD COLUMN present_map_no_details INTEGER NOT NULL DEFAULT 0
CHECK (present_map_no_details IN (0, 1));
ALTER TABLE content_blocks ADD COLUMN present_places TEXT
CHECK (present_places IN ('picked', 'none'));
ALTER TABLE content_blocks ADD COLUMN present_place_keys TEXT;

View file

@ -595,6 +595,16 @@ content.get("/events/:id", (c) => {
...shapeEvent(row, links, cards, hosts), ...shapeEvent(row, links, cards, hosts),
show_contents: row.show_contents === 1, show_contents: row.show_contents === 1,
links_heading: row.links_heading, links_heading: row.links_heading,
// Its page presented (095).
present: {
background: row.present_background,
background_color: row.present_background_color,
dim: row.present_dim,
frame: row.present_frame,
accent: row.present_accent,
text_color: row.present_text_color,
logo: row.present_logo,
},
blocks: body, blocks: body,
people, people,
awards, awards,

View file

@ -64,6 +64,20 @@ export function loadLinks(db, ownerKind, ids) {
rather than no key, so the renderer never has to check. rather than no key, so the renderer never has to check.
───────────────────────────────────────────────────────────── */ ───────────────────────────────────────────────────────────── */
/* A block's presentation settings (095), or null with none set. */
function presentOf(row) {
const present = {
hide: row.present_hide === 1,
text: row.present_text,
map_split: row.present_map_split === 1,
map_no_list: row.present_map_no_list === 1,
map_no_details: row.present_map_no_details === 1,
places: row.present_places,
place_keys: row.present_place_keys ? row.present_place_keys.split(",").filter(Boolean) : [],
};
return Object.values(present).some((value) => (Array.isArray(value) ? value.length : value)) ? present : null;
}
export function loadBlocks(db, ownerKind, ids, slot = "body", depth = 0) { export function loadBlocks(db, ownerKind, ids, slot = "body", depth = 0) {
const out = new Map(); const out = new Map();
if (ids.length === 0) return out; if (ids.length === 0) return out;
@ -71,7 +85,9 @@ export function loadBlocks(db, ownerKind, ids, slot = "body", depth = 0) {
const blockRows = db const blockRows = db
.prepare( .prepare(
`SELECT id, owner_id, type, text, media, href, alt, cite, captions, team_id, venue_id, `SELECT id, owner_id, type, text, media, href, alt, cite, captions, team_id, venue_id,
word_motion, word_direction, word_seconds, list_style, org_kind word_motion, word_direction, word_seconds, list_style, org_kind,
present_hide, present_text, present_map_split, present_map_no_list,
present_map_no_details, present_places, present_place_keys
FROM content_blocks FROM content_blocks
WHERE owner_kind = ? AND slot IN (?, 'both') AND owner_id IN (${placeholders(ids.length)}) WHERE owner_kind = ? AND slot IN (?, 'both') AND owner_id IN (${placeholders(ids.length)})
ORDER BY owner_id, sort_order`, ORDER BY owner_id, sort_order`,
@ -99,6 +115,8 @@ export function loadBlocks(db, ownerKind, ids, slot = "body", depth = 0) {
words: row.word_motion || row.word_direction || row.word_seconds words: row.word_motion || row.word_direction || row.word_seconds
? { motion: row.word_motion, direction: row.word_direction, seconds: row.word_seconds } ? { motion: row.word_motion, direction: row.word_direction, seconds: row.word_seconds }
: null, : null,
// How it's presented (095), when anything is set.
present: presentOf(row),
items: [], items: [],
}; };
byId.set(row.id, block); byId.set(row.id, block);

View file

@ -71,7 +71,8 @@ import { SITE_NAME } from '../lib/site.ts'
import { useSmallImage } from '../lib/useSmallImage.ts' import { useSmallImage } from '../lib/useSmallImage.ts'
import { useReadingMode } from '../lib/readingMode.ts' import { useReadingMode } from '../lib/readingMode.ts'
import { WordMotion, Words } from './RotatingWords.tsx' 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)' 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). */ /** Put before each heading's id: a blog post's tab (contents.ts, splitTabs). */
anchorPrefix?: string 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 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
// link (#getting-there) can point at them. // link (#getting-there) can point at them.
@ -378,6 +387,9 @@ function Block({
}) { }) {
const text = block.text ?? '' const text = block.text ?? ''
const reading = useReadingMode() const reading = useReadingMode()
// On a screen: links are their text, people and organizations
// just pictures and names (095).
const presenting = usePresenting()
switch (block.type) { switch (block.type) {
// A blog post's tab marker (BlogPost.tsx splits the post at // A blog post's tab marker (BlogPost.tsx splits the post at
@ -410,7 +422,7 @@ function Block({
</span> </span>
<span style={{ color: plain ? BODY : 'var(--color-body)' }}> <span style={{ color: plain ? BODY : 'var(--color-body)' }}>
<span className={plain ? undefined : 'font-bold'}> <span className={plain ? undefined : 'font-bold'}>
{item.url ? ( {item.url && !presenting ? (
<Anchor href={item.url} className="underline" style={{ color: accentText(accent) }}> <Anchor href={item.url} className="underline" style={{ color: accentText(accent) }}>
{item.text} {item.text}
</Anchor> </Anchor>
@ -607,6 +619,7 @@ function Block({
// Picked ones in their order, else every listed one of its kind. // 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)) 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 (ids.length === 0 && !block.org_kind) return null
if (presenting) return <OrgLogoRow kind={block.org_kind} ids={ids} accent={accent} />
return ( return (
<OrgListCards <OrgListCards
kind={block.org_kind} kind={block.org_kind}
@ -626,8 +639,8 @@ function Block({
if (!block.team_id && picked.length === 0) return null if (!block.team_id && picked.length === 0) return null
return ( return (
<div className="space-y-6"> <div className="space-y-6">
{block.team_id && <PeopleTiles size="lg" teams={block.team_id} 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} />} {picked.length > 0 && <PeopleTiles size="lg" people={picked} accent={accent} headingLevel={level} row={presenting} />}
</div> </div>
) )
} }
@ -638,7 +651,7 @@ function Block({
case 'paragraph': case 'paragraph':
default: default:
if (!text) return null if (!text) return null
return block.href ? ( return block.href && !presenting ? (
<p className="leading-relaxed" style={{ color: BODY }}> <p className="leading-relaxed" style={{ color: BODY }}>
<Anchor href={block.href} className="underline" style={{ color: accentText(accent) }}> <Anchor href={block.href} className="underline" style={{ color: accentText(accent) }}>
{text} {text}

View file

@ -22,6 +22,7 @@ import { Fragment, type CSSProperties, type ReactNode } from 'react'
import { Link } from 'react-router-dom' import { Link } from 'react-router-dom'
import { accentText } from '../lib/color.ts' import { accentText } from '../lib/color.ts'
import { RotatingWords } from './RotatingWords.tsx' import { RotatingWords } from './RotatingWords.tsx'
import { usePresenting } from '../lib/presenting.ts'
const TOKEN = /\*\*(.+?)\*\*|\*(.+?)\*|\[([^\]]+)\]\(([^)\s]+)\)|\{([^{}|\n]+(?:\|[^{}|\n]+)+)\}/g const TOKEN = /\*\*(.+?)\*\*|\*(.+?)\*|\[([^\]]+)\]\(([^)\s]+)\)|\{([^{}|\n]+(?:\|[^{}|\n]+)+)\}/g
const SAFE_URL = /^(\/(?!\/)|#|https?:\/\/|mailto:|tel:)/i 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[] = [] const out: ReactNode[] = []
let last = 0 let last = 0
let n = 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())} />) 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 (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 (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)) { else if (label != null && SAFE_URL.test(url)) {
out.push( out.push(
<Anchor key={k} href={url} className="underline underline-offset-2" style={{ color: accentText(accent) }}> <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. */ /** Text inside another element: formatting and line breaks. */
export function Inline({ text, accent }: { text?: string | null; accent: string }) { export function Inline({ text, accent }: { text?: string | null; accent: string }) {
const plain = usePresenting()
const lines = (text ?? '').split('\n') const lines = (text ?? '').split('\n')
return ( return (
<> <>
{lines.map((part, i) => ( {lines.map((part, i) => (
<Fragment key={i}> <Fragment key={i}>
{i > 0 && <br />} {i > 0 && <br />}
{line(part, accent, `l${i}`)} {line(part, accent, `l${i}`, plain)}
</Fragment> </Fragment>
))} ))}
</> </>

View file

@ -165,6 +165,8 @@ export interface PeopleTilesProps
/** The group labels' heading level, by what they sit under (3 under /** 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. */ * a section's h2). In reading mode the names are one level under. */
headingLevel?: 3 | 4 | 5; 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. */ /** How long a fetched team or person is reused, in ms. */
ttl?: number; ttl?: number;
emptyMessage?: string; emptyMessage?: string;
@ -195,8 +197,10 @@ export default function PeopleTiles({
ttl = 5 * 60_000, ttl = 5 * 60_000,
loadingMessage = "Loading…", loadingMessage = "Loading…",
errorMessage = "Couldn't load this list right now.", errorMessage = "Couldn't load this list right now.",
row = false,
...view ...view
}: PeopleTilesProps) { }: PeopleTilesProps) {
const View = row ? PeopleRow : PeopleTilesView;
const specs = useMemo(() => normalizeTeams(teams), [teams]); const specs = useMemo(() => normalizeTeams(teams), [teams]);
const teamKey = specs.map((spec) => spec.id).join(","); const teamKey = specs.map((spec) => spec.id).join(",");
@ -278,14 +282,14 @@ export default function PeopleTiles({
if (specs.length) { if (specs.length) {
if (failed) return <p className="pl__empty">{errorMessage}</p>; if (failed) return <p className="pl__empty">{errorMessage}</p>;
if (!teamGroups) return <p className="pl__empty">{loadingMessage}</p>; if (!teamGroups) return <p className="pl__empty">{loadingMessage}</p>;
return <PeopleTilesView {...view} groups={teamGroups} />; return <View {...view} groups={teamGroups} />;
} }
if (slugKey) { if (slugKey) {
if (failed) return <p className="pl__empty">{errorMessage}</p>; if (failed) return <p className="pl__empty">{errorMessage}</p>;
if (!directory) return <p className="pl__empty">{loadingMessage}</p>; if (!directory) return <p className="pl__empty">{loadingMessage}</p>;
return ( return (
<PeopleTilesView <View
{...view} {...view}
groups={groups?.map((group) => ({ groups={groups?.map((group) => ({
...group, ...group,
@ -297,7 +301,7 @@ export default function PeopleTiles({
} }
return ( return (
<PeopleTilesView <View
{...view} {...view}
groups={groups as PeopleGroup[] | undefined} groups={groups as PeopleGroup[] | undefined}
people={people as Person[] | 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 }) { function Photo({ src, name }: { src?: string | null; name: string }) {
const img = useSmallImage(src); const img = useSmallImage(src);

View file

@ -854,7 +854,9 @@ export function Repeater({
row={row} row={row}
parentRow={parentRow} parentRow={parentRow}
value={row[field.path]} 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}`]} error={errors?.[`${errorPrefix}${index}.${field.path}`]}
onChange={(value) => update(index, { ...row, [field.path]: value })} onChange={(value) => update(index, { ...row, [field.path]: value })}
onPatch={(patch) => update(index, { ...row, ...patch })} onPatch={(patch) => update(index, { ...row, ...patch })}

View file

@ -1,5 +1,8 @@
import { mediaUrl } from "../media.ts"; 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 ──────────────────────────────────────────────────── */ /* ── 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"), timelineGroup("event"),
timelineDetailGroup("event"), timelineDetailGroup("event"),
{ legend: "Publishing", fields: [PUBLISHED_FIELD, LISTED_FIELD] }, { legend: "Publishing", fields: [PUBLISHED_FIELD, LISTED_FIELD] },
@ -231,6 +286,6 @@ export const events = {
], ],
}, },
linksChild, linksChild,
blocksChild, eventBlocksChild,
], ],
}; };

View file

@ -494,6 +494,65 @@ const SUB_ITEM_FIELDS = [
TAGS_FIELD, 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 = { export const blocksChild = {
key: "content_blocks", key: "content_blocks",
label: "Content blocks", label: "Content blocks",

10
src/lib/presenting.ts Normal file
View 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)

View file

@ -70,6 +70,35 @@ export type ContentBlock = {
/** A map block's own sections of its venue's locations, by key /** A map block's own sections of its venue's locations, by key
* (094). With any, `venue` holds only the locations they name. */ * (094). With any, `venue` holds only the locations they name. */
map_sections?: MapSection[] 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[] } export type MapSection = { name: string; keys: string[] }
@ -246,6 +275,8 @@ export type EventRecord = {
show_contents?: boolean show_contents?: boolean
/** Above the link buttons; null shows none (089). */ /** Above the link buttons; null shows none (089). */
links_heading?: string | null links_heading?: string | null
/** Its page presented (095). */
present?: EventPresentLook
blocks: ContentBlock[] blocks: ContentBlock[]
people: EventPerson[] people: EventPerson[]
awards: EventAward[] awards: EventAward[]

View file

@ -43,11 +43,24 @@
half its seconds, scrolls to the end at "Scroll" seconds a half its seconds, scrolls to the end at "Scroll" seconds a
screenful (`screen=`), then waits the other half. 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 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.
═══════════════════════════════════════════════════════════════ */ ═══════════════════════════════════════════════════════════════ */
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 { createContext, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type ReactNode } from 'react'
import { useParams, useSearchParams } from 'react-router-dom' import { useParams, useSearchParams } from 'react-router-dom'
@ -67,10 +80,13 @@ import {
import ContentBlocks, { eventLine } from '../components/ContentBlocks.tsx' import ContentBlocks, { eventLine } from '../components/ContentBlocks.tsx'
import { LocationNumber, MapPicture, isMarked, locationNumber } from '../components/MapBlock.tsx' import { LocationNumber, MapPicture, isMarked, locationNumber } from '../components/MapBlock.tsx'
import { Paragraphs } from '../components/InlineText.tsx' import { Paragraphs } from '../components/InlineText.tsx'
import Logo from '../components/Logo.tsx'
import { Presenting } from '../lib/presenting.ts'
import { import {
useEvent, useEvent,
type ContentBlock, type ContentBlock,
type ContentBlockItem, type ContentBlockItem,
type EventPresentLook,
type ScheduleTag, type ScheduleTag,
type Venue, type Venue,
type VenueLocation, type VenueLocation,
@ -105,6 +121,11 @@ const OWN_SLIDES = new Map([
]) ])
/* Blocks that start a section. */ /* Blocks that start a section. */
const STARTS_SECTION = new Set(['heading', 'tab']) 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. */ /* Seconds a long slide takes to scroll one screenful, when unset. */
const PER_SCREEN = 8 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. /* `label` is the top bar's right side: the day, else the section.
The rest is what each kind draws. */ The rest is what each kind draws. */
type Slide = { type Slide = {
/* Where it comes from, for the Order list (buildSlides). */
id: string
kind: Kind kind: Kind
/* A map's or event list's title, when not the label. */
title?: string
seconds: number seconds: number
label: string label: string
day?: Day day?: Day
@ -132,18 +157,28 @@ type Slide = {
venue?: Venue venue?: Venue
location?: VenueLocation location?: VenueLocation
items?: ContentBlockItem[] 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. */ /* A part of the page: a heading (`headed`, else the event's title)
type Section = { title: string; blocks: ContentBlock[] } and the blocks under it. */
type Section = { title: string; headed: boolean; blocks: ContentBlock[] }
/* A schedule block, numbered among the page's, with its days. */ /* A schedule block, numbered among the page's, with its days. */
type Schedule = { n: number; days: Day[]; tags: ScheduleTag[] } 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[] { function sectionsOf(blocks: ContentBlock[], title: string): Section[] {
const sections: Section[] = [{ title, blocks: [] }] const sections: Section[] = [{ title, headed: false, blocks: [] }]
for (const block of blocks) { for (const block of blocks) {
if (STARTS_SECTION.has(block.type)) sections.push({ title: block.text || title, blocks: [] }) if (STARTS_SECTION.has(block.type)) {
else sections[sections.length - 1].blocks.push(block) 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) return sections.filter((section) => section.blocks.length)
} }
@ -170,43 +205,58 @@ function readSettings(params: URLSearchParams) {
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,
order: list(params.get('order')),
} }
} }
type Settings = ReturnType<typeof readSettings> type Settings = ReturnType<typeof readSettings>
type Picks = Pick<Settings, 'skipped' | 'hidden' | 'seconds' | 'only'> 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) { function scheduleSlides(slides: Slide[], { n, days, tags }: Schedule, { hidden, seconds, only }: Picks) {
const kept: Day[] = [] const kept: Day[] = []
days.forEach((all, d) => { days.forEach((all, d) => {
if (hidden.has(key(n, d))) return 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 (hidden.has(key(n, d, e))) return []
if (entry.kind !== 'block') return [entry] const slideKey = key(n, d, e)
return [{ ...entry, items: (entry.items ?? []).filter((_, i) => !hidden.has(key(n, d, e, i))) }] 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 (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 }
const at = { day, label: day.name, tags } 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) => { const media = (entry: ContentBlockItem, parent?: ContentBlockItem) => {
if (seconds.graphic && entry.media) slides.push({ kind: 'graphic', seconds: seconds.graphic, ...at, entry, parent }) const k = keyOf(entry)
if (seconds.map && entry.map_image) slides.push({ kind: 'map', seconds: seconds.map, ...at, entry, parent }) 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) { 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, ...at, entry }) if (seconds.block) slides.push({ id: `k${keyOf(entry)}`, 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, ...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) media(item, entry)
} }
continue 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) media(entry)
} }
}) })
@ -215,11 +265,41 @@ function scheduleSlides(slides: Slide[], { n, days, tags }: Schedule, { hidden,
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, 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[] { function buildSlides(sections: Section[], schedules: Map<ContentBlock, Schedule>, picks: Picks): Slide[] {
const { skipped, seconds } = picks const { skipped, seconds } = picks
const slides: Slide[] = [] const slides: Slide[] = []
@ -227,29 +307,66 @@ function buildSlides(sections: Section[], schedules: Map<ContentBlock, Schedule>
if (skipped.has(s)) return if (skipped.has(s)) return
const label = section.title const label = section.title
const text = section.blocks.filter((block) => !OWN_SLIDES.has(block.type)) 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 }) // Nothing but a heading: it titles the slides that follow.
for (const block of section.blocks) { 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) const schedule = schedules.get(block)
if (schedule) scheduleSlides(slides, schedule, picks) if (schedule) scheduleSlides(slides, schedule, picks)
if (block.type === 'map' && block.venue) { if (block.type === 'map' && block.venue) mapSlides(slides, block, at, label, title, seconds)
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') { if (block.type === 'events') {
const items = (block.items ?? []).filter((item) => item.event) const items = (block.items ?? []).filter((item) => item.event)
if (seconds.cards && items.length) slides.push({ kind: 'cards', seconds: seconds.cards, label, items }) if (seconds.cards && items.length) slides.push({ id: `c${at}`, 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.event) {
items.forEach((entry, i) => slides.push({ id: `e${at}.${i}`, kind: 'event', seconds: seconds.event, label, entry }))
}
} }
} })
}) })
return slides 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() { export default function EventPresent() {
const { id } = useParams() const { id } = useParams()
const [params, setParams] = useSearchParams() 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)}` const back = `/events/${encodeURIComponent(event.id)}`
if (sections.length === 0) { if (sections.length === 0) {
@ -304,7 +422,8 @@ export default function EventPresent() {
<Player <Player
title={event.title} title={event.title}
accent={accent} accent={accent}
slides={buildSlides(sections, schedules, settings)} look={look}
slides={ordered(buildSlides(sections, schedules, settings), settings.order)}
screen={settings.screen} screen={settings.screen}
onSetup={() => { onSetup={() => {
const next = new URLSearchParams(params) const next = new URLSearchParams(params)
@ -332,6 +451,7 @@ export default function EventPresent() {
out.set('screen', String(next.screen)) out.set('screen', String(next.screen))
// Not 'tag': that's the tag slides' seconds. // Not 'tag': that's the tag slides' seconds.
if (next.only) out.set('only', next.only) if (next.only) out.set('only', next.only)
if (next.order?.length) out.set('order', next.order.join(','))
out.set('play', '1') out.set('play', '1')
setParams(out) setParams(out)
}} }}
@ -363,7 +483,18 @@ function Setup({
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(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 tags = [...schedules.values()].flatMap((schedule) => schedule.tags)
const toggle = <T,>(set: Set<T>, value: T) => { const toggle = <T,>(set: Set<T>, value: T) => {
@ -529,11 +660,67 @@ function Setup({
</div> </div>
</section> </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"> <div className="flex flex-wrap items-center gap-4">
<button <button
type="button" type="button"
disabled={count === 0} 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" 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) }}
> >
@ -591,15 +778,39 @@ function PickEntry({
/* ── Player ─────────────────────────────────────────────────── */ /* ── 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({ function Player({
title, title,
accent, accent,
look,
slides, slides,
screen, screen,
onSetup, onSetup,
}: { }: {
title: string title: string
accent: string accent: string
look?: EventPresentLook
slides: Slide[] slides: Slide[]
screen: number screen: number
onSetup: () => void 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 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 ( return (
<main <main
onMouseMove={wake} 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 }} /> {/* The background image, the background color over it at Dim. */}
<div className="flex shrink-0 items-baseline justify-between gap-6 px-[4vw] pt-[2vh] text-[clamp(1rem,1.6vw,2rem)] text-muted"> {background && (
<span className="font-semibold">{title}</span> <div aria-hidden="true" className="absolute inset-0 -z-10 bg-cover bg-center" style={{ backgroundImage: `url("${background}")` }}>
<span>{slide.label === title ? '' : slide.label}</span> <div className="absolute inset-0 bg-surface" style={{ opacity: (look?.dim ?? DIM) / 100 }} />
</div> </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. */} {/* Keyed by index, so every slide's entrance animation plays. */}
<div key={index} className="min-h-0 flex-1 px-[4vw] py-[3vh]"> <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 }) }} value={{ wait: slide.seconds / 2, screen, paused, scrolls: (s) => setScroll({ index, seconds: s }) }}
> >
<ScheduleTags.Provider value={slide.tags ?? []}> <ScheduleTags.Provider value={slide.tags ?? []}>
<SlideView slide={slide} accent={accent} /> <Presenting.Provider value={true}>
<SlideView slide={slide} accent={accent} />
</Presenting.Provider>
</ScheduleTags.Provider> </ScheduleTags.Provider>
</SlideTime.Provider> </SlideTime.Provider>
</div> </div>
{/* How long this slide has left. */} {/* 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 <div
key={`${index}-${paused}`} className={`h-1.5 shrink-0 ${frame === 'border' ? 'mx-[1vw] mb-[1vw]' : ''}`}
className={paused ? 'h-full w-0' : 'present-timer h-full'} style={{ background: `color-mix(in srgb, ${accent} 20%, transparent)` }}
style={{ background: accent, animationDuration: `${seconds}s` }} >
<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 <div
className={`absolute bottom-6 left-1/2 flex -translate-x-1/2 items-center gap-3 transition-opacity duration-300 ${ 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 /* A venue's map at the most the slide holds: as wide as it can be
without being taller than `vh` of the screen. */ 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)) const ratio = useRatio(mediaUrl(venue.map_image))
return ( return (
<div style={{ width: ratio ? `min(100%, ${ratio * vh}vh)` : '100%' }}> <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> </div>
) )
} }
@ -937,24 +1190,38 @@ function SlideView({ slide, accent }: { slide: Slide; accent: string }) {
if (slide.kind === 'venue') { if (slide.kind === 'venue') {
const venue = slide.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 ( return (
<div className="flex h-full gap-[4vw]"> <div className="flex h-full gap-[4vw]">
{venue.map_image && ( {venue.map_image && (
<Rise className="min-w-0 flex-[2]"> <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> </Rise>
)} )}
<div className="flex min-w-0 flex-1 flex-col"> <div className="flex min-w-0 flex-1 flex-col">
<SlideTitle color={color}>{venue.name}</SlideTitle> <SlideTitle color={color}>{heading}</SlideTitle>
<Scroll> <Scroll>
<ol className="space-y-[1.5vh]"> <ol className="space-y-[1.5vh]">
{venue.locations.map((location, i) => ( {locations.map((location, i) => (
<li key={location.key}> <li key={location.key}>
<Rise order={i + 1} from="right" className="flex items-start gap-[1vw]"> <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]" /> <LocationNumber n={locationNumber(venue, location)} accent={accent} className="h-[2.6vw] w-[2.6vw] text-[1.3vw]" />
<span> <span>
<span className="block text-[clamp(1.1rem,2vw,2.6rem)] font-bold leading-tight text-ink">{location.name}</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 className="block text-[clamp(0.9rem,1.4vw,1.8rem)] text-muted">{location.detail}</span>
)} )}
</span> </span>
@ -983,7 +1250,7 @@ function SlideView({ slide, accent }: { slide: Slide; accent: string }) {
<Rise order={1} from="right"> <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> <h1 className="mt-[2vh] text-[clamp(2.4rem,5vw,6.5rem)] font-bold leading-[1.05] text-ink">{location.name}</h1>
</Rise> </Rise>
{location.detail && ( {location.detail && !slide.noDetails && (
<Rise order={2} from="right"> <Rise order={2} from="right">
<p className="mt-[1.5vh] text-[clamp(1.1rem,2.2vw,2.8rem)] text-muted">{location.detail}</p> <p className="mt-[1.5vh] text-[clamp(1.1rem,2.2vw,2.8rem)] text-muted">{location.detail}</p>
</Rise> </Rise>
@ -1002,7 +1269,7 @@ function SlideView({ slide, accent }: { slide: Slide; accent: string }) {
const items = slide.items ?? [] const items = slide.items ?? []
return ( return (
<div className="flex h-full flex-col"> <div className="flex h-full flex-col">
<SlideTitle color={color}>{slide.label}</SlideTitle> <SlideTitle color={color}>{slide.title ?? slide.label}</SlideTitle>
<Scroll> <Scroll>
<ul className={`grid gap-[2vw] ${items.length > 4 ? 'grid-cols-3' : 'grid-cols-2'}`}> <ul className={`grid gap-[2vw] ${items.length > 4 ? 'grid-cols-3' : 'grid-cols-2'}`}>
{items.map((item, i) => { {items.map((item, i) => {

View file

@ -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({ export default function OrgListCards({
kind, kind,
ids, ids,