v1.14.2-present: event schedules, venues and map blocks, Present mode and its phone remote #33
7 changed files with 149 additions and 61 deletions
|
|
@ -67,6 +67,8 @@ export const events = {
|
|||
bool("is_published"),
|
||||
bool("is_listed"),
|
||||
bool("in_timeline"),
|
||||
bool("show_contents"),
|
||||
text("links_heading"),
|
||||
|
||||
// A repeating schedule. Columns rather than a side table: the
|
||||
// schedule is always exactly one per event, and the public view
|
||||
|
|
|
|||
14
server/src/migrations/089_event_page_options.sql
Normal file
14
server/src/migrations/089_event_page_options.sql
Normal 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;
|
||||
|
|
@ -591,7 +591,14 @@ content.get("/events/:id", (c) => {
|
|||
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]);
|
||||
|
||||
return json(c, { event });
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@
|
|||
|
||||
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
|
||||
after the days, gathering what it's on from every day under the
|
||||
day's name. A tagged entry comes whole; an untagged block comes
|
||||
in a row of its own under the days, with a note saying what it
|
||||
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.
|
||||
|
||||
An entry's place on the block's venue (088) links to the map
|
||||
|
|
@ -48,7 +48,7 @@
|
|||
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 { 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 }))
|
||||
.filter((tab) => tab.days.length),
|
||||
]
|
||||
const dayCount = days.length
|
||||
const at = Math.min(active, tabs.length - 1)
|
||||
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.
|
||||
const onKey = (e: KeyboardEvent<HTMLButtonElement>) => {
|
||||
const last = tabs.length - 1
|
||||
|
|
@ -524,32 +556,28 @@ export default function ScheduleBlock({
|
|||
)}
|
||||
|
||||
{tabs.length > 1 && (
|
||||
<div role="tablist" aria-label="Days and tags" className="flex flex-wrap gap-2">
|
||||
{tabs.map((tab, index) => {
|
||||
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 border px-5 py-2 text-sm transition-colors"
|
||||
style={
|
||||
selected
|
||||
? { background: color, borderColor: color, color: readableOn(color) }
|
||||
: { borderColor: `${withAlpha(color, 33)}`, color: accentText(color) }
|
||||
}
|
||||
>
|
||||
{tab.label}
|
||||
</button>
|
||||
)
|
||||
})}
|
||||
<div className="space-y-3">
|
||||
{/* Days, then the tags in a row of their own: one tablist,
|
||||
so the arrow keys still walk every tab. */}
|
||||
<div role="tablist" aria-label="Days and tags" className="space-y-3">
|
||||
<div role="presentation" className="flex flex-wrap gap-2">
|
||||
{tabs.slice(0, dayCount).map((tab, index) => tabButton(tab, index))}
|
||||
</div>
|
||||
{tabs.length > dayCount && (
|
||||
<div role="presentation" className="flex flex-wrap items-center gap-2 border-t border-brand/15 pt-3">
|
||||
<span aria-hidden="true" className="mr-1 inline-flex items-center gap-1.5 text-sm font-semibold text-ink">
|
||||
<TagIcon weight="bold" className="h-4 w-4" />
|
||||
By tag
|
||||
</span>
|
||||
{tabs.slice(dayCount).map((tab, i) => tabButton(tab, dayCount + i))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
{tabs.length > dayCount && (
|
||||
<p className="text-sm text-muted">
|
||||
Pick a tag to see everything it's on, from every day.
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
|
|
|||
|
|
@ -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"),
|
||||
timelineDetailGroup("event"),
|
||||
{ legend: "Publishing", fields: [PUBLISHED_FIELD, LISTED_FIELD] },
|
||||
|
|
|
|||
|
|
@ -224,6 +224,10 @@ export type EventRecord = {
|
|||
links: Link[]
|
||||
/** The instagram link's label, the handle. See splitLinks in shape.js. */
|
||||
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[]
|
||||
people: EventPerson[]
|
||||
awards: EventAward[]
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@ import PageShell, { type ShellSection } from '../components/PageShell.tsx'
|
|||
import PageState from '../components/PageState.tsx'
|
||||
import PlatformIcon from '../components/PlatformIcon.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 PeopleTiles, { type PeopleGroupInput } from '../components/PeopleTiles.tsx'
|
||||
import {
|
||||
|
|
@ -89,6 +91,9 @@ export default function EventDetail() {
|
|||
|
||||
const accent = event.color || BRAND
|
||||
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[] = [
|
||||
{
|
||||
|
|
@ -109,7 +114,11 @@ export default function EventDetail() {
|
|||
/>
|
||||
)}
|
||||
|
||||
<div className="max-w-3xl">
|
||||
{/* The blocks take the column's whole width, beside the
|
||||
contents list when it shows. */}
|
||||
<div className={withContents ? 'grid gap-8 lg:grid-cols-[14rem_minmax(0,1fr)] lg:gap-12 print:block' : undefined}>
|
||||
{withContents && <PostContents entries={contents} />}
|
||||
<div className="min-w-0">
|
||||
{/* The page as a slideshow for a screen (EventPresent.tsx). */}
|
||||
{event.blocks.length > 0 && (
|
||||
<div className="mb-6 flex justify-end">
|
||||
|
|
@ -127,8 +136,15 @@ export default function EventDetail() {
|
|||
)}
|
||||
<ContentBlocks blocks={event.blocks} accent={accent} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{event.links.length > 0 && (
|
||||
<div className="space-y-4">
|
||||
{event.links_heading && (
|
||||
<h3 className="text-2xl font-bold" style={{ color: accentText(accent) }}>
|
||||
{event.links_heading}
|
||||
</h3>
|
||||
)}
|
||||
<div className="flex flex-wrap gap-3">
|
||||
{event.links.map((link) => (
|
||||
<a
|
||||
|
|
@ -144,6 +160,7 @@ export default function EventDetail() {
|
|||
</a>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue