diff --git a/src/components/ContentBlocks.tsx b/src/components/ContentBlocks.tsx index 8ffd806..36286bb 100644 --- a/src/components/ContentBlocks.tsx +++ b/src/components/ContentBlocks.tsx @@ -642,8 +642,8 @@ function Block({ if (!block.team_id && picked.length === 0) return null return (
- {block.team_id && } - {picked.length > 0 && } + {block.team_id && } + {picked.length > 0 && }
) } diff --git a/src/components/PeopleTiles.tsx b/src/components/PeopleTiles.tsx index 262b37e..c01ccd5 100644 --- a/src/components/PeopleTiles.tsx +++ b/src/components/PeopleTiles.tsx @@ -167,6 +167,8 @@ export interface PeopleTilesProps headingLevel?: 3 | 4 | 5; /** Just round photos and names in a row, as presented (095). */ row?: boolean; + /** In the row, each one's role or title under their name. */ + titles?: boolean; /** How long a fetched team or person is reused, in ms. */ ttl?: number; emptyMessage?: string; @@ -198,9 +200,13 @@ export default function PeopleTiles({ loadingMessage = "Loading…", errorMessage = "Couldn't load this list right now.", row = false, + titles = false, ...view }: PeopleTilesProps) { - const View = row ? PeopleRow : PeopleTilesView; + const View = useMemo( + () => (row ? (props) => : PeopleTilesView), + [row, titles], + ); const specs = useMemo(() => normalizeTeams(teams), [teams]); const teamKey = specs.map((spec) => spec.id).join(","); @@ -774,7 +780,7 @@ 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[] }) { +function PeopleRow({ groups, people, titles = false }: { groups?: PeopleGroup[]; people?: Person[]; titles?: boolean }) { const everyone = [...(groups ?? []).flatMap((group) => group.people), ...(people ?? [])]; return ( diff --git a/src/lib/useContent.ts b/src/lib/useContent.ts index f6f5f0f..b95c9d5 100644 --- a/src/lib/useContent.ts +++ b/src/lib/useContent.ts @@ -76,6 +76,9 @@ export type ContentBlock = { /** A block's presentation settings (095), EventPresent.tsx. */ export type BlockPresent = { + /** A people block: each one's role or title under their name, as + * the Present setup picks (not stored). */ + titles?: boolean /** Only on the page: left out of the presentation (099). */ hide: boolean /** Only in the presentation: left off the page (099). */ diff --git a/src/pages/EventPresent.tsx b/src/pages/EventPresent.tsx index 1901052..71dc296 100644 --- a/src/pages/EventPresent.tsx +++ b/src/pages/EventPresent.tsx @@ -28,7 +28,8 @@ A list picked for neither is part of its section's text. The setup picks them per list (`lists`, o
. and i
.) and ticks its items on and off (`hide`, - l
..). + l
..). A people block shows each one's role + or title when the setup ticks it (`titles`,
.). A schedule's slides, for each day picked, in order: overview the day's picked entries on one slide @@ -99,6 +100,7 @@ import { Presenting } from '../lib/presenting.ts' import { useEvent, type ContentBlock, + type BlockPresent, type ContentBlockItem, type EventPresentLook, type ScheduleTag, @@ -262,11 +264,12 @@ function readSettings(params: URLSearchParams) { only: params.get('only') || null, order: list(params.get('order')), lists: new Set(list(params.get('lists')) ?? []), + titles: new Set(list(params.get('titles')) ?? []), theme: THEMES.find((theme) => theme === params.get('theme')) ?? null, } } type Settings = ReturnType -type Picks = Pick +type Picks = Pick /* An entry or sub-item with its key (key()), carried through the picks and the tag filter, which copy blocks. */ @@ -359,12 +362,17 @@ function mapSlides(slides: Slide[], block: ContentBlock, at: string, label: stri 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, picks: Picks): Slide[] { - const { skipped, seconds, hidden, lists } = picks + const { skipped, seconds, hidden, lists, titles } = picks const slides: Slide[] = [] sections.forEach((section, s) => { if (skipped.has(s)) return const label = section.title - const text = section.blocks.filter((block, b) => !ownSlides(block, lists, s, b)) + const text = section.blocks.flatMap((block, b) => { + if (ownSlides(block, lists, s, b)) return [] + // A people block picked to show roles and titles. + if (block.type === 'people' && titles.has(`${s}.${b}`)) return [{ ...block, present: { ...block.present, titles: true } as BlockPresent }] + return [block] + }) // 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 }) @@ -541,6 +549,7 @@ export default function EventPresent() { if (next.order?.length) out.set('order', next.order.join(',')) if (next.theme) out.set('theme', next.theme) if (next.lists.size) out.set('lists', [...next.lists].join(',')) + if (next.titles.size) out.set('titles', [...next.titles].join(',')) out.set('play', '1') setParams(out) }} @@ -575,8 +584,9 @@ function Setup({ const [order, setOrder] = useState(settings.order) const [theme, setTheme] = useState(settings.theme) const [lists, setLists] = useState(settings.lists) + const [titles, setTitles] = useState(settings.titles) const [dragging, setDragging] = useState(null) - const slides = ordered(buildSlides(sections, schedules, { skipped, hidden, seconds, only, lists }), order) + const slides = ordered(buildSlides(sections, schedules, { skipped, hidden, seconds, only, lists, titles }), order) const count = slides.length // Moves a slide in the list, which then names every slide shown. const move = (from: number, to: number) => { @@ -758,6 +768,19 @@ function Setup({ ) } + // A people block: their roles and titles, or not. + if (block.type === 'people') { + return ( +
+ setTitles(toggle(titles, `${s}.${b}`))} + /> +
+ ) + } // An events block: what's shown, then which events. if (block.type === 'events') { const events = (block.items ?? []).flatMap((item, i) => (item.event ? [{ item, i }] : [])) @@ -905,7 +928,7 @@ function Setup({