Event page: a contents list, a links heading, full-width blocks; schedule tags in their own row

Migration 089 adds show_contents and links_heading to events (Page
group in the editor). The content blocks fill the column, beside the
contents list when it shows. A schedule's tag tabs sit in a row of
their own under the days, with a note on what they do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-11-11 02:44:57 -06:00
parent 375c364861
commit b8a744cf41
7 changed files with 149 additions and 61 deletions

View file

@ -67,6 +67,8 @@ export const events = {
bool("is_published"), bool("is_published"),
bool("is_listed"), bool("is_listed"),
bool("in_timeline"), bool("in_timeline"),
bool("show_contents"),
text("links_heading"),
// 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,14 @@
-- ═══════════════════════════════════════════════════════════════
-- 089 EVENT PAGE OPTIONS
--
-- show_contents the page's headings listed beside its content
-- blocks, as a blog post's are (PostContents.tsx)
-- links_heading a heading above the event's link buttons; null
-- shows none
--
-- v_events is SELECT e.*, so it carries both with no rebuild.
-- ═══════════════════════════════════════════════════════════════
ALTER TABLE events ADD COLUMN show_contents INTEGER NOT NULL DEFAULT 0
CHECK (show_contents IN (0, 1));
ALTER TABLE events ADD COLUMN links_heading TEXT;

View file

@ -591,7 +591,14 @@ content.get("/events/:id", (c) => {
citation: r.citation, citation: r.citation,
})); }));
const event = { ...shapeEvent(row, links, cards, hosts), blocks: body, people, awards }; const event = {
...shapeEvent(row, links, cards, hosts),
show_contents: row.show_contents === 1,
links_heading: row.links_heading,
blocks: body,
people,
awards,
};
attachTags(db, "event", [event]); attachTags(db, "event", [event]);
return json(c, { event }); return json(c, { event });

View file

@ -28,8 +28,8 @@
Tags (087) are the block's own: an entry or sub-item shows its Tags (087) are the block's own: an entry or sub-item shows its
tags as chips, and each tag (unless it's set No tab) is a tab tags as chips, and each tag (unless it's set No tab) is a tab
after the days, gathering what it's on from every day under the in a row of its own under the days, with a note saying what it
day's name. A tagged entry comes whole; an untagged block comes does, gathering what it's on from every day under the day's name. A tagged entry comes whole; an untagged block comes
with only its tagged sub-items. A tag on nothing draws no tab. with only its tagged sub-items. A tag on nothing draws no tab.
An entry's place on the block's venue (088) links to the map An entry's place on the block's venue (088) links to the map
@ -48,7 +48,7 @@
it, no map frame (ReadingSchedule). it, no map frame (ReadingSchedule).
═══════════════════════════════════════════════════════════════ */ ═══════════════════════════════════════════════════════════════ */
import { CaretDown, MapPin, Star } from '@phosphor-icons/react' import { CaretDown, MapPin, Star, Tag as TagIcon } from '@phosphor-icons/react'
import { Fragment, createContext, useContext, useId, useState, type KeyboardEvent, type ReactNode } from 'react' import { Fragment, createContext, useContext, useId, useState, type KeyboardEvent, type ReactNode } from 'react'
import { Link, useLocation } from 'react-router-dom' import { Link, useLocation } from 'react-router-dom'
@ -496,9 +496,41 @@ export default function ScheduleBlock({
.map((tag) => ({ label: tag.name, days: daysWithTag(days, tag.key), color: tag.color, tag: true })) .map((tag) => ({ label: tag.name, days: daysWithTag(days, tag.key), color: tag.color, tag: true }))
.filter((tab) => tab.days.length), .filter((tab) => tab.days.length),
] ]
const dayCount = days.length
const at = Math.min(active, tabs.length - 1) const at = Math.min(active, tabs.length - 1)
const current = tabs[at] const current = tabs[at]
// A day's tab, or a tag's: smaller, its tag icon in front.
const tabButton = (tab: Tab, index: number) => {
const selected = index === at
const color = tab.color || accent
return (
<button
key={index}
id={`${baseId}-tab-${index}`}
type="button"
role="tab"
aria-selected={selected}
aria-controls={`${baseId}-panel`}
tabIndex={selected ? 0 : -1}
onClick={() => setActive(index)}
onKeyDown={onKey}
className={
'btn inline-flex items-center gap-1.5 border transition-colors ' +
(tab.tag ? 'px-3 py-1 text-xs' : 'px-5 py-2 text-sm')
}
style={
selected
? { background: color, borderColor: color, color: readableOn(color) }
: { borderColor: withAlpha(color, 33), color: accentText(color) }
}
>
{tab.tag && <TagIcon aria-hidden="true" weight="bold" className="h-3.5 w-3.5" />}
{tab.label}
</button>
)
}
// Arrows move one tab and wrap; Home and End jump to the ends. // Arrows move one tab and wrap; Home and End jump to the ends.
const onKey = (e: KeyboardEvent<HTMLButtonElement>) => { const onKey = (e: KeyboardEvent<HTMLButtonElement>) => {
const last = tabs.length - 1 const last = tabs.length - 1
@ -524,32 +556,28 @@ export default function ScheduleBlock({
)} )}
{tabs.length > 1 && ( {tabs.length > 1 && (
<div role="tablist" aria-label="Days and tags" className="flex flex-wrap gap-2"> <div className="space-y-3">
{tabs.map((tab, index) => { {/* Days, then the tags in a row of their own: one tablist,
const selected = index === at so the arrow keys still walk every tab. */}
const color = tab.color || accent <div role="tablist" aria-label="Days and tags" className="space-y-3">
return ( <div role="presentation" className="flex flex-wrap gap-2">
<button {tabs.slice(0, dayCount).map((tab, index) => tabButton(tab, index))}
key={index} </div>
id={`${baseId}-tab-${index}`} {tabs.length > dayCount && (
type="button" <div role="presentation" className="flex flex-wrap items-center gap-2 border-t border-brand/15 pt-3">
role="tab" <span aria-hidden="true" className="mr-1 inline-flex items-center gap-1.5 text-sm font-semibold text-ink">
aria-selected={selected} <TagIcon weight="bold" className="h-4 w-4" />
aria-controls={`${baseId}-panel`} By tag
tabIndex={selected ? 0 : -1} </span>
onClick={() => setActive(index)} {tabs.slice(dayCount).map((tab, i) => tabButton(tab, dayCount + i))}
onKeyDown={onKey} </div>
className="btn border px-5 py-2 text-sm transition-colors" )}
style={ </div>
selected {tabs.length > dayCount && (
? { background: color, borderColor: color, color: readableOn(color) } <p className="text-sm text-muted">
: { borderColor: `${withAlpha(color, 33)}`, color: accentText(color) } Pick a tag to see everything it's on, from every day.
} </p>
> )}
{tab.label}
</button>
)
})}
</div> </div>
)} )}

View file

@ -173,6 +173,22 @@ export const events = {
}, },
], ],
}, },
{
legend: "Page",
fields: [
{
path: "show_contents",
label: "Show contents",
widget: "checkbox",
help: "Lists the content blocks' headings beside them, the one being read lit (a fold-out on phones), as on a blog post. Worth it with two or more headings.",
},
{
path: "links_heading",
label: "Links heading",
help: "Above the link buttons, eg. Sign up. Default: no heading.",
},
],
},
timelineGroup("event"), timelineGroup("event"),
timelineDetailGroup("event"), timelineDetailGroup("event"),
{ legend: "Publishing", fields: [PUBLISHED_FIELD, LISTED_FIELD] }, { legend: "Publishing", fields: [PUBLISHED_FIELD, LISTED_FIELD] },

View file

@ -224,6 +224,10 @@ export type EventRecord = {
links: Link[] links: Link[]
/** The instagram link's label, the handle. See splitLinks in shape.js. */ /** The instagram link's label, the handle. See splitLinks in shape.js. */
instagram?: string | null instagram?: string | null
/** Its headings listed beside the blocks (089). */
show_contents?: boolean
/** Above the link buttons; null shows none (089). */
links_heading?: string | null
blocks: ContentBlock[] blocks: ContentBlock[]
people: EventPerson[] people: EventPerson[]
awards: EventAward[] awards: EventAward[]

View file

@ -22,6 +22,8 @@ import PageShell, { type ShellSection } from '../components/PageShell.tsx'
import PageState from '../components/PageState.tsx' import PageState from '../components/PageState.tsx'
import PlatformIcon from '../components/PlatformIcon.tsx' import PlatformIcon from '../components/PlatformIcon.tsx'
import ContentBlocks from '../components/ContentBlocks.tsx' import ContentBlocks from '../components/ContentBlocks.tsx'
import PostContents from '../components/PostContents.tsx'
import { headingAnchors } from '../lib/contents.ts'
import Tags from '../components/Tags.tsx' import Tags from '../components/Tags.tsx'
import PeopleTiles, { type PeopleGroupInput } from '../components/PeopleTiles.tsx' import PeopleTiles, { type PeopleGroupInput } from '../components/PeopleTiles.tsx'
import { import {
@ -89,6 +91,9 @@ export default function EventDetail() {
const accent = event.color || BRAND const accent = event.color || BRAND
const groups = peopleGroups(event.people, accent) const groups = peopleGroups(event.people, accent)
// Two headings or more make a list worth showing, as on a post.
const contents = event.show_contents ? headingAnchors(event.blocks).entries : []
const withContents = contents.length >= 2
const sections: ShellSection[] = [ const sections: ShellSection[] = [
{ {
@ -109,40 +114,52 @@ export default function EventDetail() {
/> />
)} )}
<div className="max-w-3xl"> {/* The blocks take the column's whole width, beside the
{/* The page as a slideshow for a screen (EventPresent.tsx). */} contents list when it shows. */}
{event.blocks.length > 0 && ( <div className={withContents ? 'grid gap-8 lg:grid-cols-[14rem_minmax(0,1fr)] lg:gap-12 print:block' : undefined}>
<div className="mb-6 flex justify-end"> {withContents && <PostContents entries={contents} />}
<Link <div className="min-w-0">
to={`/events/${encodeURIComponent(event.id)}/present`} {/* The page as a slideshow for a screen (EventPresent.tsx). */}
target="_blank" {event.blocks.length > 0 && (
className="btn inline-flex items-center gap-2 border px-4 py-2 text-sm transition-colors hover:bg-tint" <div className="mb-6 flex justify-end">
style={{ borderColor: withAlpha(accent, 33), color: accentText(accent) }} <Link
> to={`/events/${encodeURIComponent(event.id)}/present`}
<Presentation aria-hidden="true" weight="bold" className="h-4 w-4" /> target="_blank"
Present className="btn inline-flex items-center gap-2 border px-4 py-2 text-sm transition-colors hover:bg-tint"
<span className="sr-only">(opens in a new tab)</span> style={{ borderColor: withAlpha(accent, 33), color: accentText(accent) }}
</Link> >
</div> <Presentation aria-hidden="true" weight="bold" className="h-4 w-4" />
)} Present
<ContentBlocks blocks={event.blocks} accent={accent} /> <span className="sr-only">(opens in a new tab)</span>
</Link>
</div>
)}
<ContentBlocks blocks={event.blocks} accent={accent} />
</div>
</div> </div>
{event.links.length > 0 && ( {event.links.length > 0 && (
<div className="flex flex-wrap gap-3"> <div className="space-y-4">
{event.links.map((link) => ( {event.links_heading && (
<a <h3 className="text-2xl font-bold" style={{ color: accentText(accent) }}>
key={link.url} {event.links_heading}
href={link.url} </h3>
target="_blank" )}
rel="noreferrer" <div className="flex flex-wrap gap-3">
className="inline-flex items-center gap-2 btn px-5 py-2 text-sm text-white transition-transform hover:scale-105" {event.links.map((link) => (
style={{ background: accent }} <a
> key={link.url}
<PlatformIcon platform={link.platform} /> href={link.url}
{link.label} target="_blank"
</a> rel="noreferrer"
))} className="inline-flex items-center gap-2 btn px-5 py-2 text-sm text-white transition-transform hover:scale-105"
style={{ background: accent }}
>
<PlatformIcon platform={link.platform} />
{link.label}
</a>
))}
</div>
</div> </div>
)} )}
</div> </div>