Schedule: entry types, picked times, striped rows, blocks in the presentation
Entries get a type (normal, block, break, heading) and a Featured tick. Times are picked (start, optional end) and shown as 7:00pm or 9:00 to 10:30am; the typed time stays as the override, so existing entries look the same. A block holds sub-items (content_block_subitems, migration 086), each with every entry field. Rows alternate a faint tint. The presentation gets a Blocks slide (its own seconds) before each sub-item's spotlight, and sub-items get their own checkboxes on the setup page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
274ffc26e0
commit
7885d10249
9 changed files with 603 additions and 120 deletions
|
|
@ -18,6 +18,14 @@
|
|||
the place typed in, with a link out to the full map; an entry's
|
||||
own map image (069) shows instead, the link out kept.
|
||||
|
||||
An entry's kind (086): a normal entry; a block, its sub-items
|
||||
listed under it, each a row of its own with its own fold-out; a
|
||||
break (a meal, free time), a quieter row with no fold-out; or a
|
||||
heading across the day. A featured entry stands out in the
|
||||
accent, with a star. Rows alternate a faint tint, for reading
|
||||
across. The time shown is `time`, which the API has already made
|
||||
from the picked times or the typed override.
|
||||
|
||||
On an event page a Present button opens the schedule as a
|
||||
slideshow for a screen (SchedulePresent.tsx).
|
||||
|
||||
|
|
@ -28,7 +36,7 @@
|
|||
it, no map frame (ReadingSchedule).
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
import { CaretDown, Presentation } from '@phosphor-icons/react'
|
||||
import { CaretDown, Presentation, Star } from '@phosphor-icons/react'
|
||||
import { Fragment, useId, useState, type KeyboardEvent, type ReactNode } from 'react'
|
||||
import { Link } from 'react-router-dom'
|
||||
|
||||
|
|
@ -93,7 +101,24 @@ export function Avatar({ person, size }: { person: NonNullable<ContentBlockItem[
|
|||
)
|
||||
}
|
||||
|
||||
function Entry({ entry, accent }: { entry: ContentBlockItem; accent: string }) {
|
||||
/* A featured entry's star, read as a word by a screen reader. */
|
||||
export function FeaturedStar({ className = 'h-4 w-4' }: { className?: string }) {
|
||||
return (
|
||||
<>
|
||||
<Star aria-hidden="true" weight="fill" className={`inline shrink-0 ${className}`} />
|
||||
<span className="sr-only">Featured: </span>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
/* A featured row's look: a faint wash of the accent and a bar down
|
||||
its left edge. */
|
||||
export const featuredStyle = (accent: string) => ({
|
||||
background: withAlpha(accent, 10),
|
||||
boxShadow: `inset 4px 0 0 ${accent}`,
|
||||
})
|
||||
|
||||
function Entry({ entry, accent, sub = false }: { entry: ContentBlockItem; accent: string; sub?: boolean }) {
|
||||
const [open, setOpen] = useState(false)
|
||||
// Google's map loads only when asked for (Privacy page).
|
||||
const [showMap, setShowMap] = useState(false)
|
||||
|
|
@ -101,7 +126,23 @@ function Entry({ entry, accent }: { entry: ContentBlockItem; accent: string }) {
|
|||
const graphic = mediaUrl(entry.media)
|
||||
const place = entry.map?.trim()
|
||||
const mapImage = mediaUrl(entry.map_image)
|
||||
const more = Boolean(entry.description || graphic || place || mapImage || entry.person)
|
||||
const quiet = entry.kind === 'break'
|
||||
const more = !quiet && Boolean(entry.description || graphic || place || mapImage || entry.person)
|
||||
|
||||
if (entry.kind === 'heading') {
|
||||
return (
|
||||
<li className="border-b border-brand/10 px-5 pt-6 pb-2 last:border-b-0">
|
||||
<p className="text-sm font-bold uppercase tracking-wide" style={{ color: accentText(accent) }}>
|
||||
{entry.text}
|
||||
</p>
|
||||
{entry.detail && (
|
||||
<p className="mt-1 text-sm" style={{ color: BODY }}>
|
||||
{entry.detail}
|
||||
</p>
|
||||
)}
|
||||
</li>
|
||||
)
|
||||
}
|
||||
|
||||
const title = entry.url ? (
|
||||
<Anchor href={entry.url} className="underline-offset-2 hover:underline" style={{ color: accentText(accent) }}>
|
||||
|
|
@ -112,16 +153,33 @@ function Entry({ entry, accent }: { entry: ContentBlockItem; accent: string }) {
|
|||
)
|
||||
|
||||
return (
|
||||
<li className="border-b border-brand/10 last:border-b-0">
|
||||
<li
|
||||
className={sub ? 'pl-4' : 'border-b border-brand/10 px-5 last:border-b-0 even:bg-tint-soft/60'}
|
||||
style={entry.featured ? featuredStyle(accent) : undefined}
|
||||
>
|
||||
{/* On a phone the time sits on its own line above the entry,
|
||||
leaving the title the full width. */}
|
||||
<div className="flex flex-wrap gap-x-4 gap-y-1 py-4 sm:flex-nowrap sm:gap-6">
|
||||
<p className="w-full shrink-0 pt-0.5 text-sm font-semibold sm:w-32" style={{ color: accentText(accent) }}>
|
||||
<div
|
||||
className={`flex flex-wrap gap-x-4 gap-y-1 sm:flex-nowrap ${quiet || sub ? 'py-2.5' : 'py-4'} ${
|
||||
sub ? 'sm:gap-4' : 'sm:gap-6'
|
||||
}`}
|
||||
>
|
||||
<p
|
||||
className={`w-full shrink-0 pt-0.5 text-sm font-semibold ${sub ? 'sm:w-28' : 'sm:w-32'}`}
|
||||
style={{ color: quiet ? BODY : accentText(accent) }}
|
||||
>
|
||||
{entry.time}
|
||||
</p>
|
||||
|
||||
<div className="min-w-0 flex-1">
|
||||
<p className="font-semibold text-body">{title}</p>
|
||||
<p className={quiet ? 'text-muted' : 'font-semibold text-body'}>
|
||||
{entry.featured && (
|
||||
<span className="mr-1.5" style={{ color: accentText(accent) }}>
|
||||
<FeaturedStar className="h-4 w-4 -translate-y-px" />
|
||||
</span>
|
||||
)}
|
||||
{title}
|
||||
</p>
|
||||
{(entry.location || entry.person) && (
|
||||
<p className="mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-sm" style={{ color: BODY }}>
|
||||
{entry.location && <span>{entry.location}</span>}
|
||||
|
|
@ -160,7 +218,7 @@ function Entry({ entry, accent }: { entry: ContentBlockItem; accent: string }) {
|
|||
</div>
|
||||
|
||||
{more && open && (
|
||||
<div id={panelId} className="mb-5 space-y-5 bg-tint-soft p-5 sm:ml-38">
|
||||
<div id={panelId} className={`mb-5 space-y-5 bg-tint-soft p-5 ${sub ? 'sm:ml-32' : 'sm:ml-38'}`}>
|
||||
{entry.person && (
|
||||
<div className="flex items-center gap-4">
|
||||
<Avatar person={entry.person} size="h-16 w-16" />
|
||||
|
|
@ -228,6 +286,64 @@ function Entry({ entry, accent }: { entry: ContentBlockItem; accent: string }) {
|
|||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* A block's sub-items, under its title. */}
|
||||
{entry.kind === 'block' && entry.items?.length ? (
|
||||
<ul className="mb-4 sm:ml-38" style={{ borderLeft: `2px solid ${withAlpha(accent, 33)}` }}>
|
||||
{entry.items.map((item, index) => (
|
||||
<Entry key={index} entry={item} accent={accent} sub />
|
||||
))}
|
||||
</ul>
|
||||
) : null}
|
||||
</li>
|
||||
)
|
||||
}
|
||||
|
||||
/* One entry in reading mode, a block's sub-items in a list under it. */
|
||||
function readingEntry(entry: ContentBlockItem, accent: string, key: number): ReactNode {
|
||||
if (entry.kind === 'heading') {
|
||||
return (
|
||||
<li key={key}>
|
||||
<p>
|
||||
<strong>{entry.text}</strong>
|
||||
</p>
|
||||
{entry.detail && <p>{entry.detail}</p>}
|
||||
</li>
|
||||
)
|
||||
}
|
||||
const graphic = mediaUrl(entry.media)
|
||||
const place = entry.map?.trim()
|
||||
const mapImage = mediaUrl(entry.map_image)
|
||||
const parts: ReactNode[] = [
|
||||
entry.time,
|
||||
entry.url ? <Anchor href={entry.url}>{entry.text}</Anchor> : entry.text,
|
||||
entry.location,
|
||||
entry.person && <Link to={personHref(entry.person.id)}>{entry.person.name}</Link>,
|
||||
].filter(Boolean)
|
||||
return (
|
||||
<li key={key}>
|
||||
<p>
|
||||
{entry.featured && 'Featured: '}
|
||||
{parts.map((part, j) => (
|
||||
<Fragment key={j}>
|
||||
{j > 0 && ' · '}
|
||||
{part}
|
||||
</Fragment>
|
||||
))}
|
||||
</p>
|
||||
{entry.detail && <p>{entry.detail}</p>}
|
||||
{entry.person?.tagline && <p>{entry.person.tagline}</p>}
|
||||
{entry.description && <Paragraphs text={entry.description} accent={accent} />}
|
||||
{graphic && <img src={graphic} alt={entry.media_alt ?? ''} />}
|
||||
{mapImage && <img src={mapImage} alt={mapAlt(entry)} />}
|
||||
{place && (
|
||||
<p>
|
||||
<a href={mapLink(place)}>Open {place} in Google Maps</a>
|
||||
</p>
|
||||
)}
|
||||
{entry.kind === 'block' && entry.items?.length ? (
|
||||
<ul>{entry.items.map((item, i) => readingEntry(item, accent, i))}</ul>
|
||||
) : null}
|
||||
</li>
|
||||
)
|
||||
}
|
||||
|
|
@ -241,41 +357,7 @@ function ReadingSchedule({ days, intro, accent }: { days: Day[]; intro?: string
|
|||
{days.map((day, index) => (
|
||||
<div key={day.name || index}>
|
||||
{days.length > 1 && <h4>{day.name || 'Schedule'}</h4>}
|
||||
<ul>
|
||||
{day.entries.map((entry, i) => {
|
||||
const graphic = mediaUrl(entry.media)
|
||||
const place = entry.map?.trim()
|
||||
const mapImage = mediaUrl(entry.map_image)
|
||||
const parts: ReactNode[] = [
|
||||
entry.time,
|
||||
entry.url ? <Anchor href={entry.url}>{entry.text}</Anchor> : entry.text,
|
||||
entry.location,
|
||||
entry.person && <Link to={personHref(entry.person.id)}>{entry.person.name}</Link>,
|
||||
].filter(Boolean)
|
||||
return (
|
||||
<li key={i}>
|
||||
<p>
|
||||
{parts.map((part, j) => (
|
||||
<Fragment key={j}>
|
||||
{j > 0 && ' · '}
|
||||
{part}
|
||||
</Fragment>
|
||||
))}
|
||||
</p>
|
||||
{entry.detail && <p>{entry.detail}</p>}
|
||||
{entry.person?.tagline && <p>{entry.person.tagline}</p>}
|
||||
{entry.description && <Paragraphs text={entry.description} accent={accent} />}
|
||||
{graphic && <img src={graphic} alt={entry.media_alt ?? ''} />}
|
||||
{mapImage && <img src={mapImage} alt={mapAlt(entry)} />}
|
||||
{place && (
|
||||
<p>
|
||||
<a href={mapLink(place)}>Open {place} in Google Maps</a>
|
||||
</p>
|
||||
)}
|
||||
</li>
|
||||
)
|
||||
})}
|
||||
</ul>
|
||||
<ul>{day.entries.map((entry, i) => readingEntry(entry, accent, i))}</ul>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
|
@ -374,7 +456,7 @@ export default function ScheduleBlock({
|
|||
id={`${baseId}-panel`}
|
||||
role={days.length > 1 ? 'tabpanel' : undefined}
|
||||
aria-labelledby={days.length > 1 ? `${baseId}-tab-${days.indexOf(current)}` : undefined}
|
||||
className="border border-brand/15 bg-surface px-5"
|
||||
className="border border-brand/15 bg-surface"
|
||||
>
|
||||
{current.entries.map((entry, index) => (
|
||||
<Entry key={`${current.name}-${index}`} entry={entry} accent={accent} />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue