diff --git a/server/src/admin-schema/events.js b/server/src/admin-schema/events.js index 253a1b8..3b5e791 100644 --- a/server/src/admin-schema/events.js +++ b/server/src/admin-schema/events.js @@ -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 diff --git a/server/src/migrations/089_event_page_options.sql b/server/src/migrations/089_event_page_options.sql new file mode 100644 index 0000000..073c77e --- /dev/null +++ b/server/src/migrations/089_event_page_options.sql @@ -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; diff --git a/server/src/routes/content.js b/server/src/routes/content.js index 3191e17..629192d 100644 --- a/server/src/routes/content.js +++ b/server/src/routes/content.js @@ -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 }); diff --git a/src/components/ScheduleBlock.tsx b/src/components/ScheduleBlock.tsx index bc7ee4d..b5c838a 100644 --- a/src/components/ScheduleBlock.tsx +++ b/src/components/ScheduleBlock.tsx @@ -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 ( + + ) + } + // Arrows move one tab and wrap; Home and End jump to the ends. const onKey = (e: KeyboardEvent) => { const last = tabs.length - 1 @@ -524,32 +556,28 @@ export default function ScheduleBlock({ )} {tabs.length > 1 && ( -
- {tabs.map((tab, index) => { - const selected = index === at - const color = tab.color || accent - return ( - - ) - })} +
+ {/* Days, then the tags in a row of their own: one tablist, + so the arrow keys still walk every tab. */} +
+
+ {tabs.slice(0, dayCount).map((tab, index) => tabButton(tab, index))} +
+ {tabs.length > dayCount && ( +
+ + {tabs.slice(dayCount).map((tab, i) => tabButton(tab, dayCount + i))} +
+ )} +
+ {tabs.length > dayCount && ( +

+ Pick a tag to see everything it's on, from every day. +

+ )}
)} diff --git a/src/lib/adminSchema/events.ts b/src/lib/adminSchema/events.ts index ad14084..a4babc0 100644 --- a/src/lib/adminSchema/events.ts +++ b/src/lib/adminSchema/events.ts @@ -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] }, diff --git a/src/lib/useContent.ts b/src/lib/useContent.ts index a9f8819..38ffde3 100644 --- a/src/lib/useContent.ts +++ b/src/lib/useContent.ts @@ -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[] diff --git a/src/pages/EventDetail.tsx b/src/pages/EventDetail.tsx index 31c03a2..b51f0b5 100644 --- a/src/pages/EventDetail.tsx +++ b/src/pages/EventDetail.tsx @@ -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,40 +114,52 @@ export default function EventDetail() { /> )} -
- {/* The page as a slideshow for a screen (EventPresent.tsx). */} - {event.blocks.length > 0 && ( -
- -
- )} - + {/* The blocks take the column's whole width, beside the + contents list when it shows. */} +
+ {withContents && } +
+ {/* The page as a slideshow for a screen (EventPresent.tsx). */} + {event.blocks.length > 0 && ( +
+ +
+ )} + +
{event.links.length > 0 && ( -
- {event.links.map((link) => ( - - - {link.label} - - ))} +
+ {event.links_heading && ( +

+ {event.links_heading} +

+ )} +
+ {event.links.map((link) => ( + + + {link.label} + + ))} +
)}