List block: bold text and a plain detail by default, with a Style to keep the old look
Migration 092 adds content_blocks.list_style: blank is bold text and a detail in the body color, 'plain' the plain text and gray detail lists had before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
6a0271efd9
commit
e9ea75a68d
7 changed files with 44 additions and 11 deletions
|
|
@ -183,6 +183,7 @@ also in `server/src/admin-schema/` and a CHECK):
|
||||||
| 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, cards, people, map, events | **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, cards, people, map, events | **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 `EventPresent.tsx` (which slides each kind gets; the presentation cuts the event's page into sections at its Heading blocks). 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. A schedule's Venue (088) lends its locations (Data → Venues, `venue_locations`) to its entries' Map location, named by `location_key` the same way; an entry's Event (a workshop) fills what it leaves blank in `shape.js` (`attachEvents`). |
|
| 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 `EventPresent.tsx` (which slides each kind gets; the presentation cuts the event's page into sections at its Heading blocks). 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. A schedule's Venue (088) lends its locations (Data → Venues, `venue_locations`) to its entries' Map location, named by `location_key` the same way; an entry's Event (a workshop) fills what it leaves blank in `shape.js` (`attachEvents`). |
|
||||||
|
| Content blocks → List → Style | (blank: bold text, normal detail), plain (plain text, gray detail) | **yes**, migration 092 | The Style field in `src/lib/adminSchema/shared.ts`; drawn by the `list` case in `ContentBlocks.tsx`. |
|
||||||
| 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 |
|
||||||
|
|
|
||||||
|
|
@ -175,6 +175,8 @@ export const blocksChild = (ownerKind) => ({
|
||||||
text("team_id"),
|
text("team_id"),
|
||||||
// Map and schedule blocks (088): whose map and locations.
|
// Map and schedule blocks (088): whose map and locations.
|
||||||
text("venue_id"),
|
text("venue_id"),
|
||||||
|
// List blocks (092): null bold text, 'plain' the old look.
|
||||||
|
enumeration("list_style", ["plain"]),
|
||||||
],
|
],
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
13
server/src/migrations/092_list_style.sql
Normal file
13
server/src/migrations/092_list_style.sql
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
-- ═══════════════════════════════════════════════════════════════
|
||||||
|
-- 092 A LIST BLOCK'S STYLE
|
||||||
|
--
|
||||||
|
-- How a list block's items read:
|
||||||
|
--
|
||||||
|
-- null the item's text bold, its detail in the body color
|
||||||
|
-- plain the text plain, the detail gray (the look before 092)
|
||||||
|
--
|
||||||
|
-- Other block types ignore it.
|
||||||
|
-- ═══════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
ALTER TABLE content_blocks ADD COLUMN list_style TEXT
|
||||||
|
CHECK (list_style IN ('plain'));
|
||||||
|
|
@ -71,7 +71,7 @@ export function loadBlocks(db, ownerKind, ids, slot = "body", depth = 0) {
|
||||||
const blockRows = db
|
const blockRows = db
|
||||||
.prepare(
|
.prepare(
|
||||||
`SELECT id, owner_id, type, text, media, href, alt, cite, captions, team_id, venue_id,
|
`SELECT id, owner_id, type, text, media, href, alt, cite, captions, team_id, venue_id,
|
||||||
word_motion, word_direction, word_seconds
|
word_motion, word_direction, word_seconds, list_style
|
||||||
FROM content_blocks
|
FROM content_blocks
|
||||||
WHERE owner_kind = ? AND slot IN (?, 'both') AND owner_id IN (${placeholders(ids.length)})
|
WHERE owner_kind = ? AND slot IN (?, 'both') AND owner_id IN (${placeholders(ids.length)})
|
||||||
ORDER BY owner_id, sort_order`,
|
ORDER BY owner_id, sort_order`,
|
||||||
|
|
@ -93,6 +93,7 @@ export function loadBlocks(db, ownerKind, ids, slot = "body", depth = 0) {
|
||||||
captions: row.captions,
|
captions: row.captions,
|
||||||
team_id: row.team_id,
|
team_id: row.team_id,
|
||||||
venue_id: row.venue_id,
|
venue_id: row.venue_id,
|
||||||
|
list_style: row.list_style,
|
||||||
// Its rotating words' motion (084), when it has its own.
|
// Its rotating words' motion (084), when it has its own.
|
||||||
words: row.word_motion || row.word_direction || row.word_seconds
|
words: row.word_motion || row.word_direction || row.word_seconds
|
||||||
? { motion: row.word_motion, direction: row.word_direction, seconds: row.word_seconds }
|
? { motion: row.word_motion, direction: row.word_direction, seconds: row.word_seconds }
|
||||||
|
|
|
||||||
|
|
@ -389,7 +389,10 @@ function Block({
|
||||||
</h4>
|
</h4>
|
||||||
)
|
)
|
||||||
|
|
||||||
case 'list':
|
case 'list': {
|
||||||
|
// Bold text and a plain detail, unless the block is set Plain
|
||||||
|
// (092): plain text, gray detail.
|
||||||
|
const plain = block.list_style === 'plain'
|
||||||
return (
|
return (
|
||||||
<ul className="space-y-2">
|
<ul className="space-y-2">
|
||||||
{(block.items ?? []).map((item, index) => (
|
{(block.items ?? []).map((item, index) => (
|
||||||
|
|
@ -397,20 +400,23 @@ function Block({
|
||||||
<span aria-hidden="true" style={{ color: accentText(accent) }}>
|
<span aria-hidden="true" style={{ color: accentText(accent) }}>
|
||||||
•
|
•
|
||||||
</span>
|
</span>
|
||||||
<span style={{ color: BODY }}>
|
<span style={{ color: plain ? BODY : 'var(--color-body)' }}>
|
||||||
{item.url ? (
|
<span className={plain ? undefined : 'font-bold'}>
|
||||||
<Anchor href={item.url} className="underline" style={{ color: accentText(accent) }}>
|
{item.url ? (
|
||||||
{item.text}
|
<Anchor href={item.url} className="underline" style={{ color: accentText(accent) }}>
|
||||||
</Anchor>
|
{item.text}
|
||||||
) : (
|
</Anchor>
|
||||||
<Inline text={item.text} accent={accent} />
|
) : (
|
||||||
)}
|
<Inline text={item.text} accent={accent} />
|
||||||
{item.detail && <span className="opacity-70">: {item.detail}</span>}
|
)}
|
||||||
|
</span>
|
||||||
|
{item.detail && <span className={plain ? 'opacity-70' : undefined}>: {item.detail}</span>}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
|
||||||
case 'links':
|
case 'links':
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -529,6 +529,14 @@ export const blocksChild = {
|
||||||
when: { path: "type", value: TEXT_TYPES },
|
when: { path: "type", value: TEXT_TYPES },
|
||||||
help: (row) => TEXT_HELP[row?.type],
|
help: (row) => TEXT_HELP[row?.type],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "list_style",
|
||||||
|
label: "Style",
|
||||||
|
widget: "select",
|
||||||
|
options: [["plain", "Plain text, gray detail"]],
|
||||||
|
blankLabel: "Default: bold text, normal detail",
|
||||||
|
when: { path: "type", value: "list" },
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: "cite",
|
path: "cite",
|
||||||
label: "Attribution",
|
label: "Attribution",
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,8 @@ export type ContentBlock = {
|
||||||
team_id?: string | null
|
team_id?: string | null
|
||||||
/** Who a quote is by. */
|
/** Who a quote is by. */
|
||||||
cite?: string | null
|
cite?: string | null
|
||||||
|
/** A list block's style (092): null bold text, 'plain' the old look. */
|
||||||
|
list_style?: 'plain' | null
|
||||||
/** 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[]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue