Compare commits
No commits in common. "d890efca2b0c56b4c5a4aa7cf21e356d6f55e59a" and "7885d10249418bc681f9332b91271368dcfe486b" have entirely different histories.
d890efca2b
...
7885d10249
13 changed files with 128 additions and 545 deletions
|
|
@ -182,7 +182,7 @@ also in `server/src/admin-schema/` and a CHECK):
|
||||||
| Links → Platform | instagram, facebook, discord, youtube, tiktok, x, substack, spotify, linkedin | **yes**, `PLATFORMS` | `PlatformIcon.tsx` draws the icon on the button. **No CHECK and no `enumeration`**: the column is plain text, so adding one is an entry in `PLATFORMS` (`src/lib/platforms.ts`) and its icon in `src/components/PlatformIcon.tsx`, no migration. |
|
| Links → Platform | instagram, facebook, discord, youtube, tiktok, x, substack, spotify, linkedin | **yes**, `PLATFORMS` | `PlatformIcon.tsx` draws the icon on the button. **No CHECK and no `enumeration`**: the column is plain text, so adding one is an entry in `PLATFORMS` (`src/lib/platforms.ts`) and its icon in `src/components/PlatformIcon.tsx`, no migration. |
|
||||||
| Content blocks → Shown in (slot) | card, body | **yes** | `paragraphs()` in `server/src/shape.js` (card), `ContentBlocks.tsx` (body) |
|
| Content blocks → Shown in (slot) | card, body | **yes** | `paragraphs()` in `server/src/shape.js` (card), `ContentBlocks.tsx` (body) |
|
||||||
| Content blocks → Type | heading, subheading, paragraph, list, links, quote, image, divider, video, button, callout, schedule, table | **yes**, `BLOCK_TYPES` (with each type's description) | `ContentBlocks.tsx` (one renderer per type). Which fields each type shows is `when` on the fields in `blocksChild` (`src/lib/adminSchema/shared.ts`). |
|
| Content blocks → Type | heading, subheading, paragraph, list, links, quote, image, divider, video, button, callout, schedule, table | **yes**, `BLOCK_TYPES` (with each type's description) | `ContentBlocks.tsx` (one renderer per type). Which fields each type shows is `when` on the fields in `blocksChild` (`src/lib/adminSchema/shared.ts`). |
|
||||||
| Content blocks → Schedule items → Type | (blank: normal entry), block, break, heading | **yes**, migration 086 | `SCHEDULE_KINDS` in `src/lib/adminSchema/shared.ts`; drawn by `ScheduleBlock.tsx` and `SchedulePresent.tsx` (which slides each kind gets). A block's sub-items are `content_block_subitems`. A schedule's own tags (087) are `content_block_tags`, rows of the block typed in the admin (not a fixed list); entries name them by `tag_key`, made in the admin as the tag is added. |
|
| Content blocks → Schedule items → Type | (blank: normal entry), block, break, heading | **yes**, migration 086 | `SCHEDULE_KINDS` in `src/lib/adminSchema/shared.ts`; drawn by `ScheduleBlock.tsx` and `SchedulePresent.tsx` (which slides each kind gets). A block's sub-items are `content_block_subitems`. |
|
||||||
| Timeline → Kind (+ list filter) | milestone, event, organization, award, people | no | `KIND_NAMES` in `src/pages/sections/history/TimelineEntry.tsx` |
|
| Timeline → Kind (+ list filter) | milestone, event, organization, award, people | no | `KIND_NAMES` in `src/pages/sections/history/TimelineEntry.tsx` |
|
||||||
| Timeline → Points at (+ list filter) | event, organization, award, person, team | no | `refHref` in `src/lib/hrefs.ts` |
|
| Timeline → Points at (+ list filter) | event, organization, award, person, team | no | `refHref` in `src/lib/hrefs.ts` |
|
||||||
| Timeline → Precision (and on events/orgs) | year, month, day | no | the history page's grouping |
|
| Timeline → Precision (and on events/orgs) | year, month, day | no | the history page's grouping |
|
||||||
|
|
|
||||||
|
|
@ -494,8 +494,6 @@ function isBlankChildRow(child, raw) {
|
||||||
if (!raw || typeof raw !== "object") return true;
|
if (!raw || typeof raw !== "object") return true;
|
||||||
|
|
||||||
for (const column of child.columns) {
|
for (const column of child.columns) {
|
||||||
// A value the admin seeds every new row with (`seeded`), not input.
|
|
||||||
if (column.seeded) continue;
|
|
||||||
const value = raw[column.name];
|
const value = raw[column.name];
|
||||||
if (value === undefined || value === null || value === "") continue;
|
if (value === undefined || value === null || value === "") continue;
|
||||||
// An unchecked box is the default state of a new row, not input.
|
// An unchecked box is the default state of a new row, not input.
|
||||||
|
|
|
||||||
|
|
@ -196,8 +196,6 @@ export const blocksChild = (ownerKind) => ({
|
||||||
time("start_time"),
|
time("start_time"),
|
||||||
time("end_time"),
|
time("end_time"),
|
||||||
bool("featured"),
|
bool("featured"),
|
||||||
// The block's tags it has, by key, comma-separated (087).
|
|
||||||
text("tags"),
|
|
||||||
],
|
],
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
|
|
@ -222,26 +220,10 @@ export const blocksChild = (ownerKind) => ({
|
||||||
text("map"),
|
text("map"),
|
||||||
text("map_image"),
|
text("map_image"),
|
||||||
bool("featured"),
|
bool("featured"),
|
||||||
text("tags"),
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
|
||||||
// A schedule's own tags (087).
|
|
||||||
key: "tags",
|
|
||||||
table: "content_block_tags",
|
|
||||||
owner: { column: "block_id" },
|
|
||||||
order: "sort_order",
|
|
||||||
when: { column: "type", value: "schedule" },
|
|
||||||
columns: [
|
|
||||||
// Made by the admin as the row is added, so it isn't input.
|
|
||||||
text("tag_key", { required: true, seeded: true }),
|
|
||||||
text("name", { required: true }),
|
|
||||||
text("color"),
|
|
||||||
bool("no_tab"),
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
||||||
-- ═══════════════════════════════════════════════════════════════
|
|
||||||
-- 087 SCHEDULE TAGS
|
|
||||||
--
|
|
||||||
-- A schedule block's own tags, eg. Youth or Worship: entries and
|
|
||||||
-- sub-items are tagged with them, a tag can be a tab of its own
|
|
||||||
-- gathering every entry it's on (across the days), and the schedule
|
|
||||||
-- presentation can show only one tag's entries and a slide per tag.
|
|
||||||
--
|
|
||||||
-- These are the block's, not Data → Tags (070). The block's rows are
|
|
||||||
-- rewritten on every save, so entries name a tag by `tag_key` (made
|
|
||||||
-- in the admin when the tag is added, kept when it's renamed), not
|
|
||||||
-- by its row id. An entry's `tags` is its keys, comma-separated; a
|
|
||||||
-- key no tag has any more is skipped.
|
|
||||||
-- ═══════════════════════════════════════════════════════════════
|
|
||||||
|
|
||||||
CREATE TABLE content_block_tags (
|
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
||||||
block_id INTEGER NOT NULL REFERENCES content_blocks (id) ON DELETE CASCADE,
|
|
||||||
sort_order INTEGER NOT NULL DEFAULT 0,
|
|
||||||
tag_key TEXT NOT NULL,
|
|
||||||
name TEXT NOT NULL,
|
|
||||||
color TEXT, -- null: the event's accent
|
|
||||||
no_tab INTEGER NOT NULL DEFAULT 0 CHECK (no_tab IN (0, 1)),
|
|
||||||
UNIQUE (block_id, tag_key)
|
|
||||||
) STRICT;
|
|
||||||
|
|
||||||
ALTER TABLE content_block_items ADD COLUMN tags TEXT;
|
|
||||||
ALTER TABLE content_block_subitems ADD COLUMN tags TEXT;
|
|
||||||
|
|
@ -86,29 +86,24 @@ const PAST = "showcase-past-event";
|
||||||
plain entry, one with a location and person, one folding out with
|
plain entry, one with a location and person, one folding out with
|
||||||
a description, graphic and map, one linked, a heading, a featured
|
a description, graphic and map, one linked, a heading, a featured
|
||||||
entry, a block with sub-items, a break, typed and picked times,
|
entry, a block with sub-items, a break, typed and picked times,
|
||||||
tags (one a tab of its own in its color, one with No tab), and one
|
and one with no day (it lands in a tab of its own). */
|
||||||
with no day (it lands in a tab of its own). */
|
|
||||||
const SCHEDULE = [
|
const SCHEDULE = [
|
||||||
"schedule",
|
"schedule",
|
||||||
{ text: "The weekend at a glance. Tap an entry for more." },
|
{ text: "The weekend at a glance. Tap an entry for more." },
|
||||||
[
|
[
|
||||||
{ day: "Friday", start_time: "16:00", text: "Arrivals and check-in", location: "Front desk", tags: "showcase-youth,showcase-all" },
|
{ day: "Friday", start_time: "16:00", text: "Arrivals and check-in", location: "Front desk" },
|
||||||
{ day: "Friday", kind: "heading", text: "Evening", detail: "A heading across the day" },
|
{ day: "Friday", kind: "heading", text: "Evening", detail: "A heading across the day" },
|
||||||
{ day: "Friday", time: "7:00 to 8:30pm", text: "Opening session", location: "Main Hall", person_id: "showcase-person", detail: "Welcome and worship", description: "The **opening session** sets the theme for the weekend.\n\nBring a notebook.", media: "/uploads/showcase.jpg", map: "Camp Hebron, Halifax PA", map_image: "/uploads/showcase.jpg" },
|
{ day: "Friday", time: "7:00 to 8:30pm", text: "Opening session", location: "Main Hall", person_id: "showcase-person", detail: "Welcome and worship", description: "The **opening session** sets the theme for the weekend.\n\nBring a notebook.", media: "/uploads/showcase.jpg", map: "Camp Hebron, Halifax PA", map_image: "/uploads/showcase.jpg" },
|
||||||
{ day: "Saturday", start_time: "08:00", end_time: "09:00", kind: "break", text: "Breakfast", location: "Dining hall" },
|
{ day: "Saturday", start_time: "08:00", end_time: "09:00", kind: "break", text: "Breakfast", location: "Dining hall" },
|
||||||
{ day: "Saturday", start_time: "09:00", end_time: "10:30", kind: "block", text: "Workshops", location: "Classrooms", detail: "Pick one of three", items: [
|
{ day: "Saturday", start_time: "09:00", end_time: "10:30", kind: "block", text: "Workshops", location: "Classrooms", detail: "Pick one of three", items: [
|
||||||
{ start_time: "09:00", end_time: "09:45", text: "Leading worship", location: "Room A", person_id: "showcase-member-2", url: "/blog/content-block-showcase" },
|
{ start_time: "09:00", end_time: "09:45", text: "Leading worship", location: "Room A", person_id: "showcase-member-2", url: "/blog/content-block-showcase" },
|
||||||
{ start_time: "09:00", end_time: "09:45", text: "Speaking with confidence", location: "Room B", featured: 1, tags: "showcase-youth", description: "A featured sub-item that folds out." },
|
{ start_time: "09:00", end_time: "09:45", text: "Speaking with confidence", location: "Room B", featured: 1, description: "A featured sub-item that folds out." },
|
||||||
{ time: "After the first round", text: "Open questions", location: "Room C" },
|
{ time: "After the first round", text: "Open questions", location: "Room C" },
|
||||||
] },
|
] },
|
||||||
{ day: "Saturday", start_time: "19:00", featured: 1, tags: "showcase-youth", text: "Talent night", location: "Main Hall", person_id: "showcase-member-3", description: "Sign up at the front desk by noon." },
|
{ day: "Saturday", start_time: "19:00", featured: 1, text: "Talent night", location: "Main Hall", person_id: "showcase-member-3", description: "Sign up at the front desk by noon." },
|
||||||
{ day: "Sunday", time: "10:00am", text: "Closing service", location: "Chapel", map: "Main Street, Halifax PA" },
|
{ day: "Sunday", time: "10:00am", text: "Closing service", location: "Chapel", map: "Main Street, Halifax PA" },
|
||||||
{ time: "Any time", text: "Quiet room open", location: "Library", detail: "An entry with no day" },
|
{ time: "Any time", text: "Quiet room open", location: "Library", detail: "An entry with no day" },
|
||||||
],
|
],
|
||||||
[
|
|
||||||
{ tag_key: "showcase-youth", name: "Youth", color: "#00748a" },
|
|
||||||
{ tag_key: "showcase-all", name: "Everyone", no_tab: 1 },
|
|
||||||
],
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/* Every block type, for the blog showcase. [type, fields, items?] */
|
/* Every block type, for the blog showcase. [type, fields, items?] */
|
||||||
|
|
@ -213,7 +208,7 @@ function insert(table, row) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function blocks(ownerKind, ownerId, slot, list) {
|
function blocks(ownerKind, ownerId, slot, list) {
|
||||||
list.forEach(([type, f, items = [], tags = []], order) => {
|
list.forEach(([type, f, items = []], order) => {
|
||||||
const { lastInsertRowid } = insert("content_blocks", {
|
const { lastInsertRowid } = insert("content_blocks", {
|
||||||
owner_kind: ownerKind,
|
owner_kind: ownerKind,
|
||||||
owner_id: ownerId,
|
owner_id: ownerId,
|
||||||
|
|
@ -226,7 +221,6 @@ function blocks(ownerKind, ownerId, slot, list) {
|
||||||
const entry = insert("content_block_items", { block_id: lastInsertRowid, sort_order: i, ...item });
|
const entry = insert("content_block_items", { block_id: lastInsertRowid, sort_order: i, ...item });
|
||||||
subitems.forEach((sub, j) => insert("content_block_subitems", { item_id: entry.lastInsertRowid, sort_order: j, ...sub }));
|
subitems.forEach((sub, j) => insert("content_block_subitems", { item_id: entry.lastInsertRowid, sort_order: j, ...sub }));
|
||||||
});
|
});
|
||||||
tags.forEach((tag, i) => insert("content_block_tags", { block_id: lastInsertRowid, sort_order: i, ...tag }));
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@ export function loadBlocks(db, ownerKind, ids, slot = "body") {
|
||||||
const blockIds = [...byId.keys()];
|
const blockIds = [...byId.keys()];
|
||||||
|
|
||||||
const ENTRY_FIELDS = `i.text, i.detail, i.url, i.start_time, i.end_time, i.time, i.location,
|
const ENTRY_FIELDS = `i.text, i.detail, i.url, i.start_time, i.end_time, i.time, i.location,
|
||||||
i.description, i.media, i.media_alt, i.map, i.map_image, i.featured, i.tags,
|
i.description, i.media, i.media_alt, i.map, i.map_image, i.featured,
|
||||||
p.id AS person_id, p.display_name AS person_name,
|
p.id AS person_id, p.display_name AS person_name,
|
||||||
p.photo AS person_photo, p.tagline AS person_tagline`;
|
p.photo AS person_photo, p.tagline AS person_tagline`;
|
||||||
|
|
||||||
|
|
@ -146,32 +146,6 @@ export function loadBlocks(db, ownerKind, ids, slot = "body") {
|
||||||
for (const row of subRows) itemsById.get(row.item_id)?.items.push(scheduleEntry(row));
|
for (const row of subRows) itemsById.get(row.item_id)?.items.push(scheduleEntry(row));
|
||||||
}
|
}
|
||||||
|
|
||||||
// A schedule's own tags (087), and each entry's cut to the ones
|
|
||||||
// the block still has.
|
|
||||||
const tagRows = db
|
|
||||||
.prepare(
|
|
||||||
`SELECT block_id, tag_key, name, color, no_tab
|
|
||||||
FROM content_block_tags
|
|
||||||
WHERE block_id IN (${placeholders(blockIds.length)})
|
|
||||||
ORDER BY block_id, sort_order`,
|
|
||||||
)
|
|
||||||
.all(...blockIds);
|
|
||||||
for (const row of tagRows) {
|
|
||||||
const block = byId.get(row.block_id);
|
|
||||||
if (!block) continue;
|
|
||||||
block.tags ??= [];
|
|
||||||
block.tags.push({ key: row.tag_key, name: row.name, color: row.color, tab: row.no_tab === 0 });
|
|
||||||
}
|
|
||||||
for (const block of byId.values()) {
|
|
||||||
if (block.type !== "schedule") continue;
|
|
||||||
const known = new Set((block.tags ??= []).map((tag) => tag.key));
|
|
||||||
const cut = (entry) => {
|
|
||||||
entry.tags = entry.tags.filter((key) => known.has(key));
|
|
||||||
entry.items?.forEach(cut);
|
|
||||||
};
|
|
||||||
block.items.forEach(cut);
|
|
||||||
}
|
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -193,7 +167,6 @@ function scheduleEntry(row) {
|
||||||
map: row.map,
|
map: row.map,
|
||||||
map_image: row.map_image,
|
map_image: row.map_image,
|
||||||
featured: row.featured === 1,
|
featured: row.featured === 1,
|
||||||
tags: row.tags ? row.tags.split(",").filter(Boolean) : [],
|
|
||||||
person: row.person_id
|
person: row.person_id
|
||||||
? {
|
? {
|
||||||
id: row.person_id,
|
id: row.person_id,
|
||||||
|
|
|
||||||
|
|
@ -385,15 +385,7 @@ function Block({
|
||||||
|
|
||||||
case 'schedule':
|
case 'schedule':
|
||||||
if (!block.items?.length) return null
|
if (!block.items?.length) return null
|
||||||
return (
|
return <ScheduleBlock items={block.items} intro={block.text} accent={accent} presentHref={presentHref} />
|
||||||
<ScheduleBlock
|
|
||||||
items={block.items}
|
|
||||||
tags={block.tags}
|
|
||||||
intro={block.text}
|
|
||||||
accent={accent}
|
|
||||||
presentHref={presentHref}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
|
|
||||||
case 'people': {
|
case 'people': {
|
||||||
const picked = (block.items ?? [])
|
const picked = (block.items ?? [])
|
||||||
|
|
|
||||||
|
|
@ -26,12 +26,6 @@
|
||||||
across. The time shown is `time`, which the API has already made
|
across. The time shown is `time`, which the API has already made
|
||||||
from the picked times or the typed override.
|
from the picked times or the typed override.
|
||||||
|
|
||||||
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
|
|
||||||
with only its tagged sub-items. A tag on nothing draws no tab.
|
|
||||||
|
|
||||||
On an event page a Present button opens the schedule as a
|
On an event page a Present button opens the schedule as a
|
||||||
slideshow for a screen (SchedulePresent.tsx).
|
slideshow for a screen (SchedulePresent.tsx).
|
||||||
|
|
||||||
|
|
@ -43,12 +37,12 @@
|
||||||
═══════════════════════════════════════════════════════════════ */
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
||||||
import { CaretDown, Presentation, Star } from '@phosphor-icons/react'
|
import { CaretDown, Presentation, Star } from '@phosphor-icons/react'
|
||||||
import { Fragment, createContext, useContext, useId, useState, type KeyboardEvent, type ReactNode } from 'react'
|
import { Fragment, useId, useState, type KeyboardEvent, type ReactNode } from 'react'
|
||||||
import { Link } from 'react-router-dom'
|
import { Link } from 'react-router-dom'
|
||||||
|
|
||||||
import { personHref } from '../lib/hrefs.ts'
|
import { personHref } from '../lib/hrefs.ts'
|
||||||
import { mediaUrl, initials } from '../lib/media.ts'
|
import { mediaUrl, initials } from '../lib/media.ts'
|
||||||
import type { ContentBlockItem, ScheduleTag } from '../lib/useContent.ts'
|
import type { ContentBlockItem } from '../lib/useContent.ts'
|
||||||
import { Anchor, Paragraphs } from './InlineText.tsx'
|
import { Anchor, Paragraphs } from './InlineText.tsx'
|
||||||
import { withAlpha, accentText, readableOn } from '../lib/color.ts'
|
import { withAlpha, accentText, readableOn } from '../lib/color.ts'
|
||||||
import { useSmallImage } from '../lib/useSmallImage.ts'
|
import { useSmallImage } from '../lib/useSmallImage.ts'
|
||||||
|
|
@ -74,57 +68,6 @@ export function groupByDay(items: ContentBlockItem[]): Day[] {
|
||||||
return days
|
return days
|
||||||
}
|
}
|
||||||
|
|
||||||
/* What a tag is on (087): a tagged entry whole, and an untagged
|
|
||||||
block with only its tagged sub-items. */
|
|
||||||
export function withTag(entries: ContentBlockItem[], key: string): ContentBlockItem[] {
|
|
||||||
return entries.flatMap((entry) => {
|
|
||||||
if (entry.tags?.includes(key)) return [entry]
|
|
||||||
if (entry.kind !== 'block') return []
|
|
||||||
const items = (entry.items ?? []).filter((item) => item.tags?.includes(key))
|
|
||||||
return items.length ? [{ ...entry, items }] : []
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The days, each cut to what a tag is on, empty ones dropped. */
|
|
||||||
export const daysWithTag = (days: Day[], key: string): Day[] =>
|
|
||||||
days.map((day) => ({ name: day.name, entries: withTag(day.entries, key) })).filter((day) => day.entries.length)
|
|
||||||
|
|
||||||
/* The schedule's tags, for its rows' chips. */
|
|
||||||
export const ScheduleTags = createContext<ScheduleTag[]>([])
|
|
||||||
|
|
||||||
/* An entry's tags as chips, each in its tag's color (else the
|
|
||||||
accent). `className` sizes them. */
|
|
||||||
export function TagChips({
|
|
||||||
keys,
|
|
||||||
tags,
|
|
||||||
accent,
|
|
||||||
className = 'px-2 py-0.5 text-xs',
|
|
||||||
}: {
|
|
||||||
keys?: string[]
|
|
||||||
tags: ScheduleTag[]
|
|
||||||
accent: string
|
|
||||||
className?: string
|
|
||||||
}) {
|
|
||||||
const shown = tags.filter((tag) => keys?.includes(tag.key))
|
|
||||||
if (shown.length === 0) return null
|
|
||||||
return (
|
|
||||||
<span className="inline-flex flex-wrap gap-1.5">
|
|
||||||
{shown.map((tag) => {
|
|
||||||
const color = tag.color || accent
|
|
||||||
return (
|
|
||||||
<span
|
|
||||||
key={tag.key}
|
|
||||||
className={`font-semibold ${className}`}
|
|
||||||
style={{ background: withAlpha(color, 14), color: accentText(color) }}
|
|
||||||
>
|
|
||||||
{tag.name}
|
|
||||||
</span>
|
|
||||||
)
|
|
||||||
})}
|
|
||||||
</span>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The tab to open with: today's weekday if a tab starts with it (or
|
/* The tab to open with: today's weekday if a tab starts with it (or
|
||||||
its three-letter form), else the first. */
|
its three-letter form), else the first. */
|
||||||
function todayIndex(days: Day[]): number {
|
function todayIndex(days: Day[]): number {
|
||||||
|
|
@ -176,7 +119,6 @@ export const featuredStyle = (accent: string) => ({
|
||||||
})
|
})
|
||||||
|
|
||||||
function Entry({ entry, accent, sub = false }: { entry: ContentBlockItem; accent: string; sub?: boolean }) {
|
function Entry({ entry, accent, sub = false }: { entry: ContentBlockItem; accent: string; sub?: boolean }) {
|
||||||
const tags = useContext(ScheduleTags)
|
|
||||||
const [open, setOpen] = useState(false)
|
const [open, setOpen] = useState(false)
|
||||||
// Google's map loads only when asked for (Privacy page).
|
// Google's map loads only when asked for (Privacy page).
|
||||||
const [showMap, setShowMap] = useState(false)
|
const [showMap, setShowMap] = useState(false)
|
||||||
|
|
@ -254,11 +196,6 @@ function Entry({ entry, accent, sub = false }: { entry: ContentBlockItem; accent
|
||||||
{entry.detail}
|
{entry.detail}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
{entry.tags?.length ? (
|
|
||||||
<div className="mt-2">
|
|
||||||
<TagChips keys={entry.tags} tags={tags} accent={accent} />
|
|
||||||
</div>
|
|
||||||
) : null}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{more && (
|
{more && (
|
||||||
|
|
@ -363,7 +300,7 @@ function Entry({ entry, accent, sub = false }: { entry: ContentBlockItem; accent
|
||||||
}
|
}
|
||||||
|
|
||||||
/* One entry in reading mode, a block's sub-items in a list under it. */
|
/* One entry in reading mode, a block's sub-items in a list under it. */
|
||||||
function readingEntry(entry: ContentBlockItem, accent: string, key: number, tags: ScheduleTag[]): ReactNode {
|
function readingEntry(entry: ContentBlockItem, accent: string, key: number): ReactNode {
|
||||||
if (entry.kind === 'heading') {
|
if (entry.kind === 'heading') {
|
||||||
return (
|
return (
|
||||||
<li key={key}>
|
<li key={key}>
|
||||||
|
|
@ -395,9 +332,6 @@ function readingEntry(entry: ContentBlockItem, accent: string, key: number, tags
|
||||||
))}
|
))}
|
||||||
</p>
|
</p>
|
||||||
{entry.detail && <p>{entry.detail}</p>}
|
{entry.detail && <p>{entry.detail}</p>}
|
||||||
{entry.tags?.length ? (
|
|
||||||
<p>Tags: {tags.filter((tag) => entry.tags!.includes(tag.key)).map((tag) => tag.name).join(', ')}</p>
|
|
||||||
) : null}
|
|
||||||
{entry.person?.tagline && <p>{entry.person.tagline}</p>}
|
{entry.person?.tagline && <p>{entry.person.tagline}</p>}
|
||||||
{entry.description && <Paragraphs text={entry.description} accent={accent} />}
|
{entry.description && <Paragraphs text={entry.description} accent={accent} />}
|
||||||
{graphic && <img src={graphic} alt={entry.media_alt ?? ''} />}
|
{graphic && <img src={graphic} alt={entry.media_alt ?? ''} />}
|
||||||
|
|
@ -408,7 +342,7 @@ function readingEntry(entry: ContentBlockItem, accent: string, key: number, tags
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
{entry.kind === 'block' && entry.items?.length ? (
|
{entry.kind === 'block' && entry.items?.length ? (
|
||||||
<ul>{entry.items.map((item, i) => readingEntry(item, accent, i, tags))}</ul>
|
<ul>{entry.items.map((item, i) => readingEntry(item, accent, i))}</ul>
|
||||||
) : null}
|
) : null}
|
||||||
</li>
|
</li>
|
||||||
)
|
)
|
||||||
|
|
@ -416,42 +350,27 @@ function readingEntry(entry: ContentBlockItem, accent: string, key: number, tags
|
||||||
|
|
||||||
/* Reading mode: every day, every entry and its fold-out, as text. A
|
/* Reading mode: every day, every entry and its fold-out, as text. A
|
||||||
day is an h4, under the page's h3 block headings (ContentBlocks). */
|
day is an h4, under the page's h3 block headings (ContentBlocks). */
|
||||||
function ReadingSchedule({
|
function ReadingSchedule({ days, intro, accent }: { days: Day[]; intro?: string | null; accent: string }) {
|
||||||
days,
|
|
||||||
tags,
|
|
||||||
intro,
|
|
||||||
accent,
|
|
||||||
}: {
|
|
||||||
days: Day[]
|
|
||||||
tags: ScheduleTag[]
|
|
||||||
intro?: string | null
|
|
||||||
accent: string
|
|
||||||
}) {
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{intro && <Paragraphs text={intro} accent={accent} />}
|
{intro && <Paragraphs text={intro} accent={accent} />}
|
||||||
{days.map((day, index) => (
|
{days.map((day, index) => (
|
||||||
<div key={day.name || index}>
|
<div key={day.name || index}>
|
||||||
{days.length > 1 && <h4>{day.name || 'Schedule'}</h4>}
|
{days.length > 1 && <h4>{day.name || 'Schedule'}</h4>}
|
||||||
<ul>{day.entries.map((entry, i) => readingEntry(entry, accent, i, tags))}</ul>
|
<ul>{day.entries.map((entry, i) => readingEntry(entry, accent, i))}</ul>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* A tab: a day, or a tag's entries from every day (087). */
|
|
||||||
type Tab = { label: string; days: Day[]; color?: string | null; tag?: boolean }
|
|
||||||
|
|
||||||
export default function ScheduleBlock({
|
export default function ScheduleBlock({
|
||||||
items,
|
items,
|
||||||
tags = [],
|
|
||||||
intro,
|
intro,
|
||||||
accent,
|
accent,
|
||||||
presentHref,
|
presentHref,
|
||||||
}: {
|
}: {
|
||||||
items: ContentBlockItem[]
|
items: ContentBlockItem[]
|
||||||
tags?: ScheduleTag[]
|
|
||||||
intro?: string | null
|
intro?: string | null
|
||||||
accent: string
|
accent: string
|
||||||
/** Where the Present button goes; no button without it. */
|
/** Where the Present button goes; no button without it. */
|
||||||
|
|
@ -463,24 +382,15 @@ export default function ScheduleBlock({
|
||||||
const reading = useReadingMode()
|
const reading = useReadingMode()
|
||||||
|
|
||||||
if (days.length === 0) return null
|
if (days.length === 0) return null
|
||||||
if (reading) return <ReadingSchedule days={days} tags={tags} intro={intro} accent={accent} />
|
if (reading) return <ReadingSchedule days={days} intro={intro} accent={accent} />
|
||||||
|
const current = days[Math.min(active, days.length - 1)]
|
||||||
const tabs: Tab[] = [
|
|
||||||
...days.map((day) => ({ label: day.name || 'Schedule', days: [day] })),
|
|
||||||
...tags
|
|
||||||
.filter((tag) => tag.tab)
|
|
||||||
.map((tag) => ({ label: tag.name, days: daysWithTag(days, tag.key), color: tag.color, tag: true }))
|
|
||||||
.filter((tab) => tab.days.length),
|
|
||||||
]
|
|
||||||
const at = Math.min(active, tabs.length - 1)
|
|
||||||
const current = tabs[at]
|
|
||||||
|
|
||||||
// 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 = days.length - 1
|
||||||
const next =
|
const next =
|
||||||
e.key === 'ArrowRight' ? (at + 1) % tabs.length
|
e.key === 'ArrowRight' ? (active + 1) % days.length
|
||||||
: e.key === 'ArrowLeft' ? (at + last) % tabs.length
|
: e.key === 'ArrowLeft' ? (active + last) % days.length
|
||||||
: e.key === 'Home' ? 0
|
: e.key === 'Home' ? 0
|
||||||
: e.key === 'End' ? last
|
: e.key === 'End' ? last
|
||||||
: null
|
: null
|
||||||
|
|
@ -491,82 +401,67 @@ export default function ScheduleBlock({
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ScheduleTags.Provider value={tags}>
|
<div className="space-y-4">
|
||||||
<div className="space-y-4">
|
{intro && (
|
||||||
{intro && (
|
<div className="space-y-3 leading-relaxed" style={{ color: BODY }}>
|
||||||
<div className="space-y-3 leading-relaxed" style={{ color: BODY }}>
|
<Paragraphs text={intro} accent={accent} />
|
||||||
<Paragraphs text={intro} accent={accent} />
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{presentHref && (
|
|
||||||
<div className="flex justify-end">
|
|
||||||
<Link
|
|
||||||
to={presentHref}
|
|
||||||
target="_blank"
|
|
||||||
className="btn inline-flex items-center gap-2 border px-4 py-2 text-sm transition-colors hover:bg-tint"
|
|
||||||
style={{ borderColor: `${withAlpha(accent, 33)}`, color: accentText(accent) }}
|
|
||||||
>
|
|
||||||
<Presentation aria-hidden="true" weight="bold" className="h-4 w-4" />
|
|
||||||
Present
|
|
||||||
<span className="sr-only">(opens in a new tab)</span>
|
|
||||||
</Link>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{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>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<div
|
|
||||||
id={`${baseId}-panel`}
|
|
||||||
role={tabs.length > 1 ? 'tabpanel' : undefined}
|
|
||||||
aria-labelledby={tabs.length > 1 ? `${baseId}-tab-${at}` : undefined}
|
|
||||||
className="border border-brand/15 bg-surface"
|
|
||||||
>
|
|
||||||
{current.days.map((day, d) => (
|
|
||||||
<Fragment key={`${at}-${d}`}>
|
|
||||||
{/* A tag's tab names each day it gathers from. */}
|
|
||||||
{current.tag && current.days.length > 1 && (
|
|
||||||
<p className="border-b border-brand/15 bg-tint px-5 py-2 text-sm font-bold text-ink">
|
|
||||||
{day.name || 'Schedule'}
|
|
||||||
</p>
|
|
||||||
)}
|
|
||||||
<ul>
|
|
||||||
{day.entries.map((entry, index) => (
|
|
||||||
<Entry key={`${at}-${d}-${index}`} entry={entry} accent={accent} />
|
|
||||||
))}
|
|
||||||
</ul>
|
|
||||||
</Fragment>
|
|
||||||
))}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
)}
|
||||||
</ScheduleTags.Provider>
|
|
||||||
|
{presentHref && (
|
||||||
|
<div className="flex justify-end">
|
||||||
|
<Link
|
||||||
|
to={presentHref}
|
||||||
|
target="_blank"
|
||||||
|
className="btn inline-flex items-center gap-2 border px-4 py-2 text-sm transition-colors hover:bg-tint"
|
||||||
|
style={{ borderColor: `${withAlpha(accent, 33)}`, color: accentText(accent) }}
|
||||||
|
>
|
||||||
|
<Presentation aria-hidden="true" weight="bold" className="h-4 w-4" />
|
||||||
|
Present
|
||||||
|
<span className="sr-only">(opens in a new tab)</span>
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{days.length > 1 && (
|
||||||
|
<div role="tablist" aria-label="Days" className="flex flex-wrap gap-2">
|
||||||
|
{days.map((day, index) => {
|
||||||
|
const selected = day === current
|
||||||
|
return (
|
||||||
|
<button
|
||||||
|
key={day.name || 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: accent, borderColor: accent, color: readableOn(accent) }
|
||||||
|
: { borderColor: `${withAlpha(accent, 33)}`, color: accentText(accent) }
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{day.name || 'Schedule'}
|
||||||
|
</button>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<ul
|
||||||
|
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"
|
||||||
|
>
|
||||||
|
{current.entries.map((entry, index) => (
|
||||||
|
<Entry key={`${current.name}-${index}`} entry={entry} accent={accent} />
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,18 +24,7 @@
|
||||||
server doesn't also declare as a column default. If you give a
|
server doesn't also declare as a column default. If you give a
|
||||||
blank row a starting value here, add the matching default: to
|
blank row a starting value here, add the matching default: to
|
||||||
that column in the server's admin-schema.js or the row will be
|
that column in the server's admin-schema.js or the row will be
|
||||||
saved as real input. `blank` can be a function instead, for a
|
saved as real input.
|
||||||
value made fresh for every new row and every copy (a schedule
|
|
||||||
tag's key); mark that column `seeded` on the server so a row with
|
|
||||||
only that in it still counts as blank.
|
|
||||||
|
|
||||||
`lends: (row) => ({ name: [{ id, label }] })` on a collection gives
|
|
||||||
the collections nested in each row (at any depth) more options,
|
|
||||||
made from that row: a schedule block lends its tags to its
|
|
||||||
entries and their sub-items.
|
|
||||||
|
|
||||||
`widget: "checklist"` is a checkbox per option of `optionsFrom`,
|
|
||||||
saved as the picked ids, comma-separated, in the options' order.
|
|
||||||
|
|
||||||
In a repeater row, `when: { path, value }` shows a field only
|
In a repeater row, `when: { path, value }` shows a field only
|
||||||
while another field of the row holds that value (or one of them,
|
while another field of the row holds that value (or one of them,
|
||||||
|
|
@ -237,49 +226,8 @@ function withoutIds(value) {
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* A new row, and the fresh values a function `blank` gives every
|
|
||||||
new row (a copy keeps the rest of what it copies). */
|
|
||||||
const newRow = (spec) => (typeof spec.blank === "function" ? spec.blank() : { ...spec.blank });
|
|
||||||
const seeded = (spec) => (typeof spec.blank === "function" ? spec.blank() : {});
|
|
||||||
|
|
||||||
const helpText = (field, row) => (typeof field.help === "function" ? field.help(row) : field.help);
|
const helpText = (field, row) => (typeof field.help === "function" ? field.help(row) : field.help);
|
||||||
|
|
||||||
/* `widget: "checklist"`: the picked ids, comma-separated. An id no
|
|
||||||
option has any more is dropped at the next change. */
|
|
||||||
function Checklist({ id, options, value, disabled, empty, onChange }: {
|
|
||||||
id: string
|
|
||||||
options: { id: string; label: string }[]
|
|
||||||
value?: string | null
|
|
||||||
disabled?: boolean
|
|
||||||
empty?: string
|
|
||||||
onChange: (value: string) => void
|
|
||||||
}) {
|
|
||||||
const picked = new Set((value ?? "").split(",").filter(Boolean));
|
|
||||||
if (options.length === 0) return <p id={id} className="text-sm text-muted">{empty ?? "Nothing to pick yet."}</p>;
|
|
||||||
const toggle = (key: string) => {
|
|
||||||
const next = new Set(picked);
|
|
||||||
if (next.has(key)) next.delete(key);
|
|
||||||
else next.add(key);
|
|
||||||
onChange(options.filter((o) => next.has(o.id)).map((o) => o.id).join(","));
|
|
||||||
};
|
|
||||||
return (
|
|
||||||
<div id={id} role="group" className="flex flex-wrap gap-x-4 gap-y-1.5">
|
|
||||||
{options.map((o) => (
|
|
||||||
<label key={o.id} className="flex items-center gap-2 text-sm text-body">
|
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
checked={picked.has(o.id)}
|
|
||||||
disabled={disabled}
|
|
||||||
onChange={() => toggle(o.id)}
|
|
||||||
className="h-4 w-4 border-muted/40 text-link focus:ring-brand/40 disabled:opacity-50"
|
|
||||||
/>
|
|
||||||
{o.label}
|
|
||||||
</label>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ── Field ───────────────────────────────────────────────────── */
|
/* ── Field ───────────────────────────────────────────────────── */
|
||||||
|
|
||||||
export function Field({ field, value, row, options, error, onChange, onPatch }: any) {
|
export function Field({ field, value, row, options, error, onChange, onPatch }: any) {
|
||||||
|
|
@ -367,15 +315,6 @@ export function Field({ field, value, row, options, error, onChange, onPatch }:
|
||||||
/>
|
/>
|
||||||
{helpText(field, row) ?? "Yes"}
|
{helpText(field, row) ?? "Yes"}
|
||||||
</label>
|
</label>
|
||||||
) : widget === "checklist" ? (
|
|
||||||
<Checklist
|
|
||||||
id={id}
|
|
||||||
options={options?.[field.optionsFrom] ?? []}
|
|
||||||
value={value}
|
|
||||||
disabled={locked}
|
|
||||||
empty={field.emptyNote}
|
|
||||||
onChange={onChange}
|
|
||||||
/>
|
|
||||||
) : widget === "textarea" ? (
|
) : widget === "textarea" ? (
|
||||||
<textarea
|
<textarea
|
||||||
{...common}
|
{...common}
|
||||||
|
|
@ -619,7 +558,7 @@ export function Repeater({
|
||||||
|
|
||||||
const add = () => {
|
const add = () => {
|
||||||
setOpen((prev) => new Set(prev).add(list.length));
|
setOpen((prev) => new Set(prev).add(list.length));
|
||||||
onChange([...list, newRow(spec)]);
|
onChange([...list, { ...spec.blank }]);
|
||||||
};
|
};
|
||||||
|
|
||||||
/* A row placed at `at`, pushing everything from there down one,
|
/* A row placed at `at`, pushing everything from there down one,
|
||||||
|
|
@ -775,13 +714,13 @@ export function Repeater({
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<IconButton
|
<IconButton
|
||||||
label="Insert a new one below"
|
label="Insert a new one below"
|
||||||
onClick={() => insertAt(index + 1, newRow(spec))}
|
onClick={() => insertAt(index + 1, { ...spec.blank })}
|
||||||
>
|
>
|
||||||
<Plus size={14} weight="bold" aria-hidden="true" />
|
<Plus size={14} weight="bold" aria-hidden="true" />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<IconButton
|
<IconButton
|
||||||
label="Duplicate"
|
label="Duplicate"
|
||||||
onClick={() => insertAt(index + 1, { ...withoutIds(row), ...seeded(spec) })}
|
onClick={() => insertAt(index + 1, withoutIds(row))}
|
||||||
>
|
>
|
||||||
<Copy size={14} weight="bold" aria-hidden="true" />
|
<Copy size={14} weight="bold" aria-hidden="true" />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
|
@ -821,7 +760,7 @@ export function Repeater({
|
||||||
<Repeater
|
<Repeater
|
||||||
spec={nested}
|
spec={nested}
|
||||||
rows={row[nested.key]}
|
rows={row[nested.key]}
|
||||||
options={spec.lends ? { ...options, ...spec.lends(row) } : options}
|
options={options}
|
||||||
errors={errors}
|
errors={errors}
|
||||||
errorPrefix={`${errorPrefix}${index}.${nested.key}.`}
|
errorPrefix={`${errorPrefix}${index}.${nested.key}.`}
|
||||||
parentRow={row}
|
parentRow={row}
|
||||||
|
|
|
||||||
|
|
@ -402,17 +402,6 @@ export const wordFields = (prefix: string, label: string, when?: any) => [
|
||||||
{ path: `${prefix}word_seconds`, label: label ? `${label}seconds per word` : "Seconds per word", widget: "number", help: "1 to 20. Default: the site's", when },
|
{ path: `${prefix}word_seconds`, label: label ? `${label}seconds per word` : "Seconds per word", widget: "number", help: "1 to 20. Default: the site's", when },
|
||||||
];
|
];
|
||||||
|
|
||||||
/* An entry's or sub-item's tags (087): the block's, lent by
|
|
||||||
blocksChild. */
|
|
||||||
const TAGS_FIELD = {
|
|
||||||
path: "tags",
|
|
||||||
label: "Tags",
|
|
||||||
widget: "checklist",
|
|
||||||
optionsFrom: "scheduleTags",
|
|
||||||
full: true,
|
|
||||||
emptyNote: "No tags yet: add them under the block's Tags.",
|
|
||||||
};
|
|
||||||
|
|
||||||
/* A block entry's sub-item (086): an entry's fields, under its
|
/* A block entry's sub-item (086): an entry's fields, under its
|
||||||
block's day. */
|
block's day. */
|
||||||
const SUB_ITEM_FIELDS = [
|
const SUB_ITEM_FIELDS = [
|
||||||
|
|
@ -448,7 +437,6 @@ const SUB_ITEM_FIELDS = [
|
||||||
help: "Optional: your own map, shown in place of the Google map and as a slide when presented",
|
help: "Optional: your own map, shown in place of the Google map and as a slide when presented",
|
||||||
},
|
},
|
||||||
{ path: "featured", label: "Featured", widget: "checkbox", help: "Makes it stand out" },
|
{ path: "featured", label: "Featured", widget: "checkbox", help: "Makes it stand out" },
|
||||||
TAGS_FIELD,
|
|
||||||
];
|
];
|
||||||
|
|
||||||
export const blocksChild = {
|
export const blocksChild = {
|
||||||
|
|
@ -548,27 +536,7 @@ export const blocksChild = {
|
||||||
},
|
},
|
||||||
...wordFields("", "", { path: "type", value: ["heading", "subheading", "paragraph", "callout", "quote"] }),
|
...wordFields("", "", { path: "type", value: ["heading", "subheading", "paragraph", "callout", "quote"] }),
|
||||||
],
|
],
|
||||||
// A schedule's tags, for its entries' and sub-items' Tags (087).
|
|
||||||
lends: (row) => ({
|
|
||||||
scheduleTags: (row.tags ?? [])
|
|
||||||
.filter((tag) => tag.name?.trim())
|
|
||||||
.map((tag) => ({ id: tag.tag_key, label: tag.name })),
|
|
||||||
}),
|
|
||||||
children: [
|
children: [
|
||||||
{
|
|
||||||
key: "tags",
|
|
||||||
label: "Tags",
|
|
||||||
addLabel: "Add tag",
|
|
||||||
note: "Tag entries with these, eg. Youth or Worship. Each tag is a tab of its own gathering the entries it's on, and can be shown alone or as a slide when the schedule is presented.",
|
|
||||||
when: { path: "type", value: "schedule" },
|
|
||||||
title: (row) => row.name || "New tag",
|
|
||||||
blank: () => ({ tag_key: crypto.randomUUID().slice(0, 8) }),
|
|
||||||
fields: [
|
|
||||||
{ path: "name", label: "Name", required: true, help: "eg. Youth" },
|
|
||||||
{ path: "color", label: "Color", widget: "color", help: "Default: the event's color" },
|
|
||||||
{ path: "no_tab", label: "No tab", widget: "checkbox", help: "Leave it out of the tabs (it still shows on entries)" },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
key: "items",
|
key: "items",
|
||||||
label: "Items",
|
label: "Items",
|
||||||
|
|
@ -685,7 +653,6 @@ export const blocksChild = {
|
||||||
when: SCHEDULE_ENTRY,
|
when: SCHEDULE_ENTRY,
|
||||||
},
|
},
|
||||||
{ path: "featured", label: "Featured", widget: "checkbox", help: "Makes the row stand out", when: SCHEDULE_ENTRY },
|
{ path: "featured", label: "Featured", widget: "checkbox", help: "Makes the row stand out", when: SCHEDULE_ENTRY },
|
||||||
{ ...TAGS_FIELD, when: SCHEDULE_ENTRY },
|
|
||||||
],
|
],
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -55,13 +55,8 @@ export type ContentBlock = {
|
||||||
/** A video block's WebVTT file, for an uploaded video (066). */
|
/** A video block's WebVTT file, for an uploaded video (066). */
|
||||||
captions?: string | null
|
captions?: string | null
|
||||||
items?: ContentBlockItem[]
|
items?: ContentBlockItem[]
|
||||||
/** A schedule's own tags (087). */
|
|
||||||
tags?: ScheduleTag[]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** A schedule's tag (087). `tab` is whether it gets a tab of its own. */
|
|
||||||
export type ScheduleTag = { key: string; name: string; color?: string | null; tab: boolean }
|
|
||||||
|
|
||||||
/** A list, link-row or schedule entry. The schedule fields are
|
/** A list, link-row or schedule entry. The schedule fields are
|
||||||
* empty on the other two (034_schedule_block.sql). */
|
* empty on the other two (034_schedule_block.sql). */
|
||||||
export type ContentBlockItem = {
|
export type ContentBlockItem = {
|
||||||
|
|
@ -87,8 +82,6 @@ export type ContentBlockItem = {
|
||||||
featured?: boolean
|
featured?: boolean
|
||||||
/** A block entry's sub-items. */
|
/** A block entry's sub-items. */
|
||||||
items?: ContentBlockItem[]
|
items?: ContentBlockItem[]
|
||||||
/** Its block's tags it has, by key (087). */
|
|
||||||
tags?: string[]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Link = {
|
export type Link = {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
|
/* ═══════════════════════════════════════════════════════════════
|
||||||
SITE VERSION: src/lib/version.ts
|
SITE VERSION: src/lib/version.ts
|
||||||
|
|
||||||
One string, bumped by hand when the working directory name
|
One string, bumped by hand when the working directory name
|
||||||
|
|
@ -6,11 +6,11 @@
|
||||||
footer.
|
footer.
|
||||||
|
|
||||||
Each version has a name, Minecraft style: the tag's words after
|
Each version has a name, Minecraft style: the tag's words after
|
||||||
the number, "v1.13.2-region-cards" → "The Region Cards Update".
|
the number, "v1.13.2-region-cards" → "The Region Cards Update".
|
||||||
A version with no words after its number has no name.
|
A version with no words after its number has no name.
|
||||||
â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
||||||
export const SITE_VERSION = "NGU-Web.v1.14.1-schedule";
|
export const SITE_VERSION = "NGU-Web.v1.14.0-profiles";
|
||||||
|
|
||||||
/** The number, eg. v1.13.2. */
|
/** The number, eg. v1.13.2. */
|
||||||
export const VERSION_NUMBER: string = SITE_VERSION.match(/v\d+(?:\.\d+)*/)?.[0] ?? SITE_VERSION
|
export const VERSION_NUMBER: string = SITE_VERSION.match(/v\d+(?:\.\d+)*/)?.[0] ?? SITE_VERSION
|
||||||
|
|
|
||||||
|
|
@ -18,35 +18,21 @@
|
||||||
the spotlight, graphic and map slides an entry does
|
the spotlight, graphic and map slides an entry does
|
||||||
graphic an entry's graphic, full screen
|
graphic an entry's graphic, full screen
|
||||||
map an entry's own map image (069), full screen
|
map an entry's own map image (069), full screen
|
||||||
tag after the days: each of the schedule's tags (087)
|
|
||||||
and everything it's on, under each day's name
|
|
||||||
A heading (086) is only a line on the overview; a break gets no
|
A heading (086) is only a line on the overview; a break gets no
|
||||||
spotlight. "Only entries tagged" (`tag=<key>`) cuts every slide
|
spotlight.
|
||||||
to what one tag is on, eg. for a screen outside the youth room.
|
|
||||||
|
|
||||||
Keys while playing: arrows step, Space pauses, Escape leaves full
|
Keys while playing: arrows step, Space pauses, Escape leaves full
|
||||||
screen (the browser's), S goes back to the setup.
|
screen (the browser's), S goes back to the setup.
|
||||||
═══════════════════════════════════════════════════════════════ */
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
||||||
import { ArrowsOut, CaretLeft, CaretRight, Gear, Pause, Play } from '@phosphor-icons/react'
|
import { ArrowsOut, CaretLeft, CaretRight, Gear, Pause, Play } from '@phosphor-icons/react'
|
||||||
import { useContext, useEffect, useMemo, useRef, useState, type ReactNode } from 'react'
|
import { useEffect, useMemo, useRef, useState, type ReactNode } from 'react'
|
||||||
import { useParams, useSearchParams } from 'react-router-dom'
|
import { useParams, useSearchParams } from 'react-router-dom'
|
||||||
|
|
||||||
import PageState from '../components/PageState.tsx'
|
import PageState from '../components/PageState.tsx'
|
||||||
import {
|
import { Avatar, FeaturedStar, featuredStyle, groupByDay, mapAlt, type Day } from '../components/ScheduleBlock.tsx'
|
||||||
Avatar,
|
|
||||||
FeaturedStar,
|
|
||||||
ScheduleTags,
|
|
||||||
TagChips,
|
|
||||||
daysWithTag,
|
|
||||||
featuredStyle,
|
|
||||||
groupByDay,
|
|
||||||
mapAlt,
|
|
||||||
withTag,
|
|
||||||
type Day,
|
|
||||||
} from '../components/ScheduleBlock.tsx'
|
|
||||||
import { Paragraphs } from '../components/InlineText.tsx'
|
import { Paragraphs } from '../components/InlineText.tsx'
|
||||||
import { useEvent, type ContentBlockItem, type ScheduleTag } from '../lib/useContent.ts'
|
import { useEvent, type ContentBlockItem } from '../lib/useContent.ts'
|
||||||
import { mediaUrl } from '../lib/media.ts'
|
import { mediaUrl } from '../lib/media.ts'
|
||||||
import { BRAND, accentText, readableOn, withAlpha } from '../lib/color.ts'
|
import { BRAND, accentText, readableOn, withAlpha } from '../lib/color.ts'
|
||||||
import { documentTitle } from '../lib/site.ts'
|
import { documentTitle } from '../lib/site.ts'
|
||||||
|
|
@ -59,7 +45,6 @@ const KINDS = [
|
||||||
{ key: 'block', label: 'Blocks', help: 'A block and the things in it, before each gets a spotlight', seconds: 15 },
|
{ key: 'block', label: 'Blocks', help: 'A block and the things in it, before each gets a spotlight', seconds: 15 },
|
||||||
{ key: 'graphic', label: 'Graphics', help: "An entry's graphic, full screen", seconds: 10 },
|
{ key: 'graphic', label: 'Graphics', help: "An entry's graphic, full screen", seconds: 10 },
|
||||||
{ key: 'map', label: 'Map images', help: "An entry's own map, full screen", seconds: 10 },
|
{ key: 'map', label: 'Map images', help: "An entry's own map, full screen", seconds: 10 },
|
||||||
{ key: 'tag', label: 'Tag slides', help: "Each tag and everything it's on, after the days", seconds: 15 },
|
|
||||||
] as const
|
] as const
|
||||||
type Kind = (typeof KINDS)[number]['key']
|
type Kind = (typeof KINDS)[number]['key']
|
||||||
|
|
||||||
|
|
@ -68,17 +53,8 @@ const ONE_COLUMN = 8
|
||||||
/* How long the controls stay up after the pointer last moved (ms). */
|
/* How long the controls stay up after the pointer last moved (ms). */
|
||||||
const CONTROLS_FOR = 2500
|
const CONTROLS_FOR = 2500
|
||||||
|
|
||||||
/* `parent` is a sub-item's block; a tag slide has its `tag` and the
|
/* `parent` is a sub-item's block. */
|
||||||
`days` it gathers from. */
|
type Slide = { kind: Kind; seconds: number; day: Day; entry?: ContentBlockItem; parent?: ContentBlockItem }
|
||||||
type Slide = {
|
|
||||||
kind: Kind
|
|
||||||
seconds: number
|
|
||||||
day: Day
|
|
||||||
entry?: ContentBlockItem
|
|
||||||
parent?: ContentBlockItem
|
|
||||||
tag?: ScheduleTag
|
|
||||||
days?: Day[]
|
|
||||||
}
|
|
||||||
|
|
||||||
/* An entry's key in the address: day index, a dot, entry index, and
|
/* An entry's key in the address: day index, a dot, entry index, and
|
||||||
for a sub-item another dot and its index. */
|
for a sub-item another dot and its index. */
|
||||||
|
|
@ -97,23 +73,20 @@ function readSettings(params: URLSearchParams, days: Day[]) {
|
||||||
return [kind.key, Number.isFinite(value) && value > 0 ? value : 0]
|
return [kind.key, Number.isFinite(value) && value > 0 ? value : 0]
|
||||||
}),
|
}),
|
||||||
) as Record<Kind, number>
|
) as Record<Kind, number>
|
||||||
return { pickedDays: new Set(pickedDays), hidden, seconds, only: params.get('tag') || null }
|
return { pickedDays: new Set(pickedDays), hidden, seconds }
|
||||||
}
|
}
|
||||||
type Settings = ReturnType<typeof readSettings>
|
type Settings = ReturnType<typeof readSettings>
|
||||||
|
|
||||||
function buildSlides(days: Day[], tags: ScheduleTag[], { pickedDays, hidden, seconds, only }: Settings): Slide[] {
|
function buildSlides(days: Day[], { pickedDays, hidden, seconds }: Settings): Slide[] {
|
||||||
const slides: Slide[] = []
|
const slides: Slide[] = []
|
||||||
const kept: Day[] = []
|
|
||||||
days.forEach((all, d) => {
|
days.forEach((all, d) => {
|
||||||
if (!pickedDays.has(d)) return
|
if (!pickedDays.has(d)) return
|
||||||
let entries = all.entries.flatMap((entry, e) => {
|
const entries = all.entries.flatMap((entry, e) => {
|
||||||
if (hidden.has(entryKey(d, e))) return []
|
if (hidden.has(entryKey(d, e))) return []
|
||||||
if (entry.kind !== 'block') return [entry]
|
if (entry.kind !== 'block') return [entry]
|
||||||
return [{ ...entry, items: (entry.items ?? []).filter((_, i) => !hidden.has(entryKey(d, e, i))) }]
|
return [{ ...entry, items: (entry.items ?? []).filter((_, i) => !hidden.has(entryKey(d, e, i))) }]
|
||||||
})
|
})
|
||||||
if (only) entries = withTag(entries, only)
|
|
||||||
if (entries.length === 0) return
|
if (entries.length === 0) return
|
||||||
kept.push({ name: all.name, entries })
|
|
||||||
const day = { ...all, entries }
|
const day = { ...all, entries }
|
||||||
if (seconds.overview) slides.push({ kind: 'overview', seconds: seconds.overview, day })
|
if (seconds.overview) slides.push({ kind: 'overview', seconds: seconds.overview, day })
|
||||||
|
|
||||||
|
|
@ -136,14 +109,6 @@ function buildSlides(days: Day[], tags: ScheduleTag[], { pickedDays, hidden, sec
|
||||||
media(entry)
|
media(entry)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
if (seconds.tag) {
|
|
||||||
for (const tag of tags) {
|
|
||||||
if (only && tag.key !== only) continue
|
|
||||||
const tagDays = daysWithTag(kept, tag.key)
|
|
||||||
if (tagDays.length) slides.push({ kind: 'tag', seconds: seconds.tag, day: { name: '', entries: [] }, tag, days: tagDays })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return slides
|
return slides
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -155,7 +120,6 @@ export default function SchedulePresent() {
|
||||||
const blockIndex = Number(params.get('block') ?? 0)
|
const blockIndex = Number(params.get('block') ?? 0)
|
||||||
const schedule = event?.blocks?.filter((block) => block.type === 'schedule')[blockIndex]
|
const schedule = event?.blocks?.filter((block) => block.type === 'schedule')[blockIndex]
|
||||||
const days = useMemo(() => groupByDay(schedule?.items ?? []), [schedule])
|
const days = useMemo(() => groupByDay(schedule?.items ?? []), [schedule])
|
||||||
const tags = schedule?.tags ?? []
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (event) document.title = documentTitle(`${event.title}: schedule`)
|
if (event) document.title = documentTitle(`${event.title}: schedule`)
|
||||||
|
|
@ -192,18 +156,16 @@ export default function SchedulePresent() {
|
||||||
const settings = readSettings(params, days)
|
const settings = readSettings(params, days)
|
||||||
if (params.get('play') === '1') {
|
if (params.get('play') === '1') {
|
||||||
return (
|
return (
|
||||||
<ScheduleTags.Provider value={tags}>
|
<Player
|
||||||
<Player
|
title={event.title}
|
||||||
title={event.title}
|
accent={accent}
|
||||||
accent={accent}
|
slides={buildSlides(days, settings)}
|
||||||
slides={buildSlides(days, tags, settings)}
|
onSetup={() => {
|
||||||
onSetup={() => {
|
const next = new URLSearchParams(params)
|
||||||
const next = new URLSearchParams(params)
|
next.delete('play')
|
||||||
next.delete('play')
|
setParams(next)
|
||||||
setParams(next)
|
}}
|
||||||
}}
|
/>
|
||||||
/>
|
|
||||||
</ScheduleTags.Provider>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
|
|
@ -212,7 +174,6 @@ export default function SchedulePresent() {
|
||||||
back={back}
|
back={back}
|
||||||
accent={accent}
|
accent={accent}
|
||||||
days={days}
|
days={days}
|
||||||
tags={tags}
|
|
||||||
settings={settings}
|
settings={settings}
|
||||||
onPlay={(next) => {
|
onPlay={(next) => {
|
||||||
// Full screen needs the click itself, so it's asked for here.
|
// Full screen needs the click itself, so it's asked for here.
|
||||||
|
|
@ -221,7 +182,6 @@ export default function SchedulePresent() {
|
||||||
if (next.pickedDays.size < days.length) out.set('days', [...next.pickedDays].sort((a, b) => a - b).join(','))
|
if (next.pickedDays.size < days.length) out.set('days', [...next.pickedDays].sort((a, b) => a - b).join(','))
|
||||||
if (next.hidden.size) out.set('hide', [...next.hidden].join(','))
|
if (next.hidden.size) out.set('hide', [...next.hidden].join(','))
|
||||||
for (const kind of KINDS) out.set(kind.key, String(next.seconds[kind.key]))
|
for (const kind of KINDS) out.set(kind.key, String(next.seconds[kind.key]))
|
||||||
if (next.only) out.set('tag', next.only)
|
|
||||||
out.set('play', '1')
|
out.set('play', '1')
|
||||||
setParams(out)
|
setParams(out)
|
||||||
}}
|
}}
|
||||||
|
|
@ -236,7 +196,6 @@ function Setup({
|
||||||
back,
|
back,
|
||||||
accent,
|
accent,
|
||||||
days,
|
days,
|
||||||
tags,
|
|
||||||
settings,
|
settings,
|
||||||
onPlay,
|
onPlay,
|
||||||
}: {
|
}: {
|
||||||
|
|
@ -244,15 +203,13 @@ function Setup({
|
||||||
back: string
|
back: string
|
||||||
accent: string
|
accent: string
|
||||||
days: Day[]
|
days: Day[]
|
||||||
tags: ScheduleTag[]
|
|
||||||
settings: Settings
|
settings: Settings
|
||||||
onPlay: (settings: Settings) => void
|
onPlay: (settings: Settings) => void
|
||||||
}) {
|
}) {
|
||||||
const [pickedDays, setPickedDays] = useState(settings.pickedDays)
|
const [pickedDays, setPickedDays] = useState(settings.pickedDays)
|
||||||
const [hidden, setHidden] = useState(settings.hidden)
|
const [hidden, setHidden] = useState(settings.hidden)
|
||||||
const [seconds, setSeconds] = useState(settings.seconds)
|
const [seconds, setSeconds] = useState(settings.seconds)
|
||||||
const [only, setOnly] = useState(settings.only)
|
const count = buildSlides(days, { pickedDays, hidden, seconds }).length
|
||||||
const count = buildSlides(days, tags, { pickedDays, hidden, seconds, only }).length
|
|
||||||
|
|
||||||
const toggle = <T,>(set: Set<T>, value: T) => {
|
const toggle = <T,>(set: Set<T>, value: T) => {
|
||||||
const next = new Set(set)
|
const next = new Set(set)
|
||||||
|
|
@ -303,30 +260,6 @@ function Setup({
|
||||||
<p className="mt-2 text-sm text-muted">0 leaves that kind of slide out.</p>
|
<p className="mt-2 text-sm text-muted">0 leaves that kind of slide out.</p>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
{tags.length > 0 && (
|
|
||||||
<section>
|
|
||||||
<h2 className="mb-4 text-2xl font-bold text-ink">Tags</h2>
|
|
||||||
<label className="flex flex-wrap items-center gap-4 bg-raised p-4 shadow-sm">
|
|
||||||
<span className="flex-1">
|
|
||||||
<span className="block font-semibold text-ink">Only entries tagged</span>
|
|
||||||
<span className="text-sm text-muted">Every slide shows only what this tag is on, eg. for one room's screen</span>
|
|
||||||
</span>
|
|
||||||
<select
|
|
||||||
value={only ?? ''}
|
|
||||||
onChange={(e) => setOnly(e.target.value || null)}
|
|
||||||
className="border border-muted/25 bg-surface px-2 py-1"
|
|
||||||
>
|
|
||||||
<option value="">Default: every entry</option>
|
|
||||||
{tags.map((tag) => (
|
|
||||||
<option key={tag.key} value={tag.key}>
|
|
||||||
{tag.name}
|
|
||||||
</option>
|
|
||||||
))}
|
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
</section>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<h2 className="mb-4 text-2xl font-bold text-ink">Days and entries</h2>
|
<h2 className="mb-4 text-2xl font-bold text-ink">Days and entries</h2>
|
||||||
<div className="space-y-6">
|
<div className="space-y-6">
|
||||||
|
|
@ -372,7 +305,7 @@ function Setup({
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
disabled={count === 0}
|
disabled={count === 0}
|
||||||
onClick={() => onPlay({ pickedDays, hidden, seconds, only })}
|
onClick={() => onPlay({ pickedDays, hidden, seconds })}
|
||||||
className="btn inline-flex items-center gap-2 px-6 py-3 disabled:opacity-50"
|
className="btn inline-flex items-center gap-2 px-6 py-3 disabled:opacity-50"
|
||||||
style={{ background: accent, color: readableOn(accent) }}
|
style={{ background: accent, color: readableOn(accent) }}
|
||||||
>
|
>
|
||||||
|
|
@ -583,36 +516,10 @@ function Rise({ order = 0, from = 'below', className = '', children }: {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* An overview's rows: each entry, a block's sub-items under it.
|
|
||||||
`start` is the first row's place in the slide's entrance. */
|
|
||||||
function OverviewEntries({ entries, accent, start = 1 }: { entries: ContentBlockItem[]; accent: string; start?: number }) {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
{entries.map((entry, i) => (
|
|
||||||
<li key={i} className="even:bg-tint-soft/60" style={entry.featured ? featuredStyle(accent) : undefined}>
|
|
||||||
<Rise order={start + i} from="left">
|
|
||||||
<OverviewLine entry={entry} accent={accent} />
|
|
||||||
{entry.kind === 'block' && entry.items?.length ? (
|
|
||||||
<ul className="ml-[14vw] pb-[1vh]">
|
|
||||||
{entry.items.map((item, j) => (
|
|
||||||
<li key={j} style={item.featured ? featuredStyle(accent) : undefined}>
|
|
||||||
<OverviewLine entry={item} accent={accent} sub />
|
|
||||||
</li>
|
|
||||||
))}
|
|
||||||
</ul>
|
|
||||||
) : null}
|
|
||||||
</Rise>
|
|
||||||
</li>
|
|
||||||
))}
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
/* One line of the day overview: an entry, or (`sub`) one of a
|
/* One line of the day overview: an entry, or (`sub`) one of a
|
||||||
block's sub-items under it. A heading is a label; a break is
|
block's sub-items under it. A heading is a label; a break is
|
||||||
quieter. */
|
quieter. */
|
||||||
function OverviewLine({ entry, accent, sub = false }: { entry: ContentBlockItem; accent: string; sub?: boolean }) {
|
function OverviewLine({ entry, accent, sub = false }: { entry: ContentBlockItem; accent: string; sub?: boolean }) {
|
||||||
const tags = useContext(ScheduleTags)
|
|
||||||
const color = accentText(accent)
|
const color = accentText(accent)
|
||||||
if (entry.kind === 'heading') {
|
if (entry.kind === 'heading') {
|
||||||
return (
|
return (
|
||||||
|
|
@ -646,11 +553,10 @@ function OverviewLine({ entry, accent, sub = false }: { entry: ContentBlockItem;
|
||||||
)}
|
)}
|
||||||
{entry.text}
|
{entry.text}
|
||||||
</span>
|
</span>
|
||||||
{(entry.location || entry.person || entry.tags?.length) && (
|
{(entry.location || entry.person) && (
|
||||||
<span className="mt-1 flex flex-wrap items-center gap-x-[1.5vw] gap-y-1 text-[clamp(0.9rem,1.4vw,1.8rem)] text-muted">
|
<span className="mt-1 flex flex-wrap items-center gap-x-[1.5vw] text-[clamp(0.9rem,1.4vw,1.8rem)] text-muted">
|
||||||
{entry.location && <span>{entry.location}</span>}
|
{entry.location && <span>{entry.location}</span>}
|
||||||
{entry.person && <span>{entry.person.name}</span>}
|
{entry.person && <span>{entry.person.name}</span>}
|
||||||
<TagChips keys={entry.tags} tags={tags} accent={accent} className="px-[0.6vw] py-[0.2vh] text-[0.8em]" />
|
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
</span>
|
</span>
|
||||||
|
|
@ -659,7 +565,6 @@ function OverviewLine({ entry, accent, sub = false }: { entry: ContentBlockItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
function SlideView({ slide, accent }: { slide: Slide; accent: string }) {
|
function SlideView({ slide, accent }: { slide: Slide; accent: string }) {
|
||||||
const tags = useContext(ScheduleTags)
|
|
||||||
const color = accentText(accent)
|
const color = accentText(accent)
|
||||||
|
|
||||||
if (slide.kind === 'overview') {
|
if (slide.kind === 'overview') {
|
||||||
|
|
@ -673,42 +578,22 @@ function SlideView({ slide, accent }: { slide: Slide; accent: string }) {
|
||||||
</h1>
|
</h1>
|
||||||
</Rise>
|
</Rise>
|
||||||
<ul className={`grid min-h-0 flex-1 content-start gap-x-[4vw] ${two ? 'grid-cols-2' : 'grid-cols-1'}`}>
|
<ul className={`grid min-h-0 flex-1 content-start gap-x-[4vw] ${two ? 'grid-cols-2' : 'grid-cols-1'}`}>
|
||||||
<OverviewEntries entries={entries} accent={accent} />
|
{entries.map((entry, i) => (
|
||||||
</ul>
|
<li key={i} className="even:bg-tint-soft/60" style={entry.featured ? featuredStyle(accent) : undefined}>
|
||||||
</div>
|
<Rise order={i + 1} from="left">
|
||||||
)
|
<OverviewLine entry={entry} accent={accent} />
|
||||||
}
|
{entry.kind === 'block' && entry.items?.length ? (
|
||||||
|
<ul className="ml-[14vw] pb-[1vh]">
|
||||||
if (slide.kind === 'tag') {
|
{entry.items.map((item, j) => (
|
||||||
const tag = slide.tag!
|
<li key={j} style={item.featured ? featuredStyle(accent) : undefined}>
|
||||||
const tagDays = slide.days ?? []
|
<OverviewLine entry={item} accent={accent} sub />
|
||||||
const tagColor = tag.color || accent
|
</li>
|
||||||
const two = tagDays.reduce((n, day) => n + 1 + lineCount(day.entries), 0) > ONE_COLUMN
|
))}
|
||||||
let order = 1
|
</ul>
|
||||||
return (
|
) : null}
|
||||||
<div className="flex h-full flex-col">
|
</Rise>
|
||||||
<Rise>
|
</li>
|
||||||
<h1 className="mb-[3vh] text-[clamp(2rem,5vw,6rem)] font-bold leading-none" style={{ color: accentText(tagColor) }}>
|
))}
|
||||||
{tag.name}
|
|
||||||
</h1>
|
|
||||||
</Rise>
|
|
||||||
<ul className={`grid min-h-0 flex-1 content-start gap-x-[4vw] ${two ? 'grid-cols-2' : 'grid-cols-1'}`}>
|
|
||||||
{tagDays.map((day, d) => {
|
|
||||||
const start = order
|
|
||||||
order += day.entries.length + 1
|
|
||||||
return (
|
|
||||||
<li key={d}>
|
|
||||||
{day.name && (
|
|
||||||
<Rise order={start} from="left">
|
|
||||||
<p className="pt-[1.5vh] pb-[0.5vh] text-[clamp(1rem,1.8vw,2.4rem)] font-bold text-ink">{day.name}</p>
|
|
||||||
</Rise>
|
|
||||||
)}
|
|
||||||
<ul>
|
|
||||||
<OverviewEntries entries={day.entries} accent={accent} start={start + 1} />
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
)
|
|
||||||
})}
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
@ -829,13 +714,6 @@ function SlideView({ slide, accent }: { slide: Slide; accent: string }) {
|
||||||
{entry.text}
|
{entry.text}
|
||||||
</h1>
|
</h1>
|
||||||
</Rise>
|
</Rise>
|
||||||
{entry.tags?.length ? (
|
|
||||||
<Rise order={2} from="right">
|
|
||||||
<p className="mt-[2vh]">
|
|
||||||
<TagChips keys={entry.tags} tags={tags} accent={accent} className="px-[1vw] py-[0.4vh] text-[clamp(0.9rem,1.6vw,2rem)]" />
|
|
||||||
</p>
|
|
||||||
</Rise>
|
|
||||||
) : null}
|
|
||||||
{entry.location && (
|
{entry.location && (
|
||||||
<Rise order={2} from="right">
|
<Rise order={2} from="right">
|
||||||
<p className="mt-[2vh] text-[clamp(1.2rem,2.4vw,3rem)] text-body">{entry.location}</p>
|
<p className="mt-[2vh] text-[clamp(1.2rem,2.4vw,3rem)] text-body">{entry.location}</p>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue