Venues, map blocks and event blocks; schedule entries link to them
Data → Venues: a map picture with its locations marked as pins or boxes (088). A Map block draws a venue with its locations listed; a schedule names a venue and its entries pick a location, linking to the map on the page with it lit up. Entries and sub-items can name an event (a workshop) and take what they leave blank from it, and an Events block shows event cards. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
3d087da005
commit
818d648e91
18 changed files with 964 additions and 35 deletions
|
|
@ -30,6 +30,12 @@
|
|||
people team_id's members as people tiles, then
|
||||
items as more tiles: person, text their
|
||||
title (an unpublished person is left out)
|
||||
map venue: its map, locations marked and
|
||||
listed (MapBlock); a schedule's places
|
||||
link to it
|
||||
events items as event cards: event (from
|
||||
event_id), text the title shown, detail
|
||||
in place of the event's card text
|
||||
divider nothing
|
||||
|
||||
"Formatted" is InlineText.tsx: **bold**, *italic*, [text](url),
|
||||
|
|
@ -50,6 +56,9 @@ import type { ContentBlock, ContentBlockItem } from '../lib/useContent.ts'
|
|||
import { Anchor, Inline, Paragraphs, isExternalUrl } from './InlineText.tsx'
|
||||
import VideoPlayer from './VideoPlayer.tsx'
|
||||
import ScheduleBlock from './ScheduleBlock.tsx'
|
||||
import MapBlock, { PageMaps } from './MapBlock.tsx'
|
||||
import { eventHref } from '../lib/hrefs.ts'
|
||||
import { occurrenceLabel } from '../lib/eventSeries.ts'
|
||||
import { accentText, BRAND } from '../lib/color.ts'
|
||||
import { headingAnchors } from '../lib/contents.ts'
|
||||
import { SITE_NAME } from '../lib/site.ts'
|
||||
|
|
@ -94,7 +103,11 @@ export default function ContentBlocks({
|
|||
presentAt && block.type === 'schedule' ? `${presentAt}?block=${schedules++}` : undefined,
|
||||
)
|
||||
|
||||
// The venues mapped here, for a schedule's places to link to.
|
||||
const maps = new Set(blocks.flatMap((block) => (block.type === 'map' && block.venue ? [block.venue.id] : [])))
|
||||
|
||||
return (
|
||||
<PageMaps.Provider value={maps}>
|
||||
<div className={`space-y-6 ${className}`}>
|
||||
{blocks.map((block, index) => (
|
||||
<WordMotion key={block.id ?? index} settings={block.words}>
|
||||
|
|
@ -108,6 +121,7 @@ export default function ContentBlocks({
|
|||
</WordMotion>
|
||||
))}
|
||||
</div>
|
||||
</PageMaps.Provider>
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -144,6 +158,40 @@ function LinkCard({ item }: { item: ContentBlockItem }) {
|
|||
)
|
||||
}
|
||||
|
||||
/* One event card (088): the event's picture, its type and date,
|
||||
its title (or the item's text) and card text (or the item's
|
||||
detail); the whole card links to the event. */
|
||||
function EventCard({ item, accent }: { item: ContentBlockItem; accent: string }) {
|
||||
const event = item.event!
|
||||
const img = useSmallImage(mediaUrl(event.image))
|
||||
const color = event.color || accent
|
||||
const when = event.date_label || (event.starts_on ? occurrenceLabel(event.starts_on) : null)
|
||||
const kind = event.event_type && event.event_type !== 'other' ? event.event_type : null
|
||||
return (
|
||||
<Anchor
|
||||
href={eventHref(event.id)}
|
||||
className="group flex h-full flex-col overflow-hidden border border-brand/15 bg-raised shadow-sm transition-shadow hover:shadow-lg"
|
||||
>
|
||||
{!img.failed && (
|
||||
<img src={img.src} alt="" loading="lazy" onError={img.onError} className="aspect-video w-full object-cover" />
|
||||
)}
|
||||
<span className="flex flex-1 flex-col gap-1 p-4">
|
||||
{(kind || when) && (
|
||||
<span className="text-xs font-semibold capitalize" style={{ color: accentText(color) }}>
|
||||
{[kind, when].filter(Boolean).join(' · ')}
|
||||
</span>
|
||||
)}
|
||||
<span className="font-display text-base font-bold leading-snug text-ink group-hover:text-link">
|
||||
{item.text || event.title}
|
||||
</span>
|
||||
{(item.detail || event.blurb) && (
|
||||
<span className="line-clamp-3 text-sm leading-snug text-body">{item.detail || event.blurb}</span>
|
||||
)}
|
||||
</span>
|
||||
</Anchor>
|
||||
)
|
||||
}
|
||||
|
||||
/* A table block's text as rows of cells: one row per line, cells
|
||||
split by "|" (a literal bar is "\|"), blank lines skipped. A
|
||||
leading and trailing bar, as in Markdown, is allowed. */
|
||||
|
|
@ -395,6 +443,24 @@ function Block({
|
|||
/>
|
||||
)
|
||||
|
||||
case 'map':
|
||||
if (!block.venue) return null
|
||||
return <MapBlock venue={block.venue} accent={accent} />
|
||||
|
||||
case 'events': {
|
||||
const events = (block.items ?? []).filter((item) => item.event)
|
||||
if (events.length === 0) return null
|
||||
return (
|
||||
<ul className="grid gap-4 sm:grid-cols-2 lg:grid-cols-3">
|
||||
{events.map((item, i) => (
|
||||
<li key={i}>
|
||||
<EventCard item={item} accent={accent} />
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)
|
||||
}
|
||||
|
||||
case 'people': {
|
||||
const picked = (block.items ?? [])
|
||||
.filter((item) => item.person)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue