v1.14.2-present: event schedules, venues and map blocks, Present mode and its phone remote #33
8 changed files with 182 additions and 13 deletions
|
|
@ -181,9 +181,10 @@ also in `server/src/admin-schema/` and a CHECK):
|
||||||
| Links → Kind (on organizations, events, people, teams) | action, social, website, email | no | `splitLinks` in `server/src/shape.js` |
|
| Links → Kind (on organizations, events, people, teams) | action, social, website, email | no | `splitLinks` in `server/src/shape.js` |
|
||||||
| 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, 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, organizations | **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`. |
|
| 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`. |
|
||||||
|
| Content blocks → Organizations → List | (blank: only the picked ones), partner, region, group, ministry | **yes**, migration 093 | The `org_kind` field in `src/lib/adminSchema/shared.ts`; the `organizations` case in `ContentBlocks.tsx` passes it as the kind to `OrgListCards` (`nested`); items picked by `org_id` replace it |
|
||||||
| 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 |
|
||||||
|
|
|
||||||
|
|
@ -157,6 +157,8 @@ export const blocksChild = (ownerKind) => ({
|
||||||
// A venue's map, and event cards (088).
|
// A venue's map, and event cards (088).
|
||||||
"map",
|
"map",
|
||||||
"events",
|
"events",
|
||||||
|
// Organization cards (093).
|
||||||
|
"organizations",
|
||||||
],
|
],
|
||||||
{ required: true },
|
{ required: true },
|
||||||
),
|
),
|
||||||
|
|
@ -177,6 +179,8 @@ export const blocksChild = (ownerKind) => ({
|
||||||
text("venue_id"),
|
text("venue_id"),
|
||||||
// List blocks (092): null bold text, 'plain' the old look.
|
// List blocks (092): null bold text, 'plain' the old look.
|
||||||
enumeration("list_style", ["plain"]),
|
enumeration("list_style", ["plain"]),
|
||||||
|
// Organizations blocks (093): the kind listed when none are picked.
|
||||||
|
enumeration("org_kind", ["region", "group", "partner", "ministry"]),
|
||||||
],
|
],
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
|
|
@ -212,6 +216,8 @@ export const blocksChild = (ownerKind) => ({
|
||||||
// A featured event's heading and subheading (090).
|
// A featured event's heading and subheading (090).
|
||||||
text("heading"),
|
text("heading"),
|
||||||
text("subheading"),
|
text("subheading"),
|
||||||
|
// An organizations block's organization (093).
|
||||||
|
text("org_id"),
|
||||||
],
|
],
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
91
server/src/migrations/093_organizations_block.sql
Normal file
91
server/src/migrations/093_organizations_block.sql
Normal file
|
|
@ -0,0 +1,91 @@
|
||||||
|
-- ═══════════════════════════════════════════════════════════════
|
||||||
|
-- 093 ORGANIZATIONS BLOCK
|
||||||
|
--
|
||||||
|
-- An 'organizations' content block shows organizations as the
|
||||||
|
-- Partners page's cards (OrgList-Card.tsx): the ones picked as its
|
||||||
|
-- items, in their order (content_block_items.org_id), else every
|
||||||
|
-- published, listed one of its kind (content_blocks.org_kind), by
|
||||||
|
-- name.
|
||||||
|
--
|
||||||
|
-- content_blocks.type's CHECK can't change in place, so the table
|
||||||
|
-- is rebuilt (as in 088), then its index and owner trigger made
|
||||||
|
-- again.
|
||||||
|
-- ═══════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
ALTER TABLE content_block_items ADD COLUMN org_id TEXT
|
||||||
|
REFERENCES organizations (id) ON DELETE SET NULL;
|
||||||
|
|
||||||
|
CREATE TABLE content_blocks_new (
|
||||||
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
owner_kind TEXT NOT NULL
|
||||||
|
CHECK (owner_kind IN ('organization', 'event', 'person', 'team', 'blog_post', 'page_section',
|
||||||
|
'newsletter')),
|
||||||
|
owner_id TEXT NOT NULL,
|
||||||
|
slot TEXT NOT NULL DEFAULT 'body' CHECK (slot IN ('card', 'body', 'both')),
|
||||||
|
sort_order INTEGER NOT NULL DEFAULT 0,
|
||||||
|
|
||||||
|
type TEXT NOT NULL
|
||||||
|
CHECK (type IN ('heading', 'subheading', 'paragraph',
|
||||||
|
'list', 'links', 'quote', 'image', 'divider',
|
||||||
|
'video', 'button', 'callout', 'schedule', 'table', 'cards',
|
||||||
|
'people', 'tab', 'map', 'events', 'organizations')),
|
||||||
|
text TEXT,
|
||||||
|
media TEXT,
|
||||||
|
href TEXT,
|
||||||
|
alt TEXT,
|
||||||
|
cite TEXT,
|
||||||
|
team_id TEXT REFERENCES teams (id) ON DELETE SET NULL,
|
||||||
|
captions TEXT,
|
||||||
|
word_motion TEXT CHECK (word_motion IN ('slide', 'flip', 'fade', 'type', 'mirror')),
|
||||||
|
word_direction TEXT CHECK (word_direction IN ('top', 'bottom')),
|
||||||
|
word_seconds INTEGER CHECK (word_seconds BETWEEN 1 AND 20),
|
||||||
|
-- Map and schedule blocks: whose map, and whose locations.
|
||||||
|
venue_id TEXT REFERENCES venues (id) ON DELETE SET NULL,
|
||||||
|
-- List blocks (092): null bold text, 'plain' the old look.
|
||||||
|
list_style TEXT CHECK (list_style IN ('plain')),
|
||||||
|
-- Organizations blocks: the kind listed when none are picked.
|
||||||
|
org_kind TEXT CHECK (org_kind IN ('region', 'group', 'partner', 'ministry'))
|
||||||
|
) STRICT;
|
||||||
|
|
||||||
|
INSERT INTO content_blocks_new
|
||||||
|
(id, owner_kind, owner_id, slot, sort_order, type, text, media, href, alt, cite, team_id, captions,
|
||||||
|
word_motion, word_direction, word_seconds, venue_id, list_style)
|
||||||
|
SELECT id, owner_kind, owner_id, slot, sort_order, type, text, media, href, alt, cite, team_id, captions,
|
||||||
|
word_motion, word_direction, word_seconds, venue_id, list_style
|
||||||
|
FROM content_blocks;
|
||||||
|
|
||||||
|
PRAGMA legacy_alter_table = ON;
|
||||||
|
DROP TABLE content_blocks;
|
||||||
|
ALTER TABLE content_blocks_new RENAME TO content_blocks;
|
||||||
|
PRAGMA legacy_alter_table = OFF;
|
||||||
|
|
||||||
|
CREATE INDEX content_blocks_owner_idx
|
||||||
|
ON content_blocks (owner_kind, owner_id, slot, sort_order);
|
||||||
|
|
||||||
|
CREATE TRIGGER content_blocks_owner_exists
|
||||||
|
BEFORE INSERT ON content_blocks
|
||||||
|
BEGIN
|
||||||
|
SELECT CASE
|
||||||
|
WHEN new.owner_kind = 'event'
|
||||||
|
AND NOT EXISTS (SELECT 1 FROM events WHERE id = new.owner_id)
|
||||||
|
THEN RAISE(ABORT, 'content_blocks: no such event')
|
||||||
|
WHEN new.owner_kind = 'organization'
|
||||||
|
AND NOT EXISTS (SELECT 1 FROM organizations WHERE id = new.owner_id)
|
||||||
|
THEN RAISE(ABORT, 'content_blocks: no such organization')
|
||||||
|
WHEN new.owner_kind = 'person'
|
||||||
|
AND NOT EXISTS (SELECT 1 FROM people WHERE id = new.owner_id)
|
||||||
|
THEN RAISE(ABORT, 'content_blocks: no such person')
|
||||||
|
WHEN new.owner_kind = 'team'
|
||||||
|
AND NOT EXISTS (SELECT 1 FROM teams WHERE id = new.owner_id)
|
||||||
|
THEN RAISE(ABORT, 'content_blocks: no such team')
|
||||||
|
WHEN new.owner_kind = 'blog_post'
|
||||||
|
AND NOT EXISTS (SELECT 1 FROM blog_posts WHERE id = new.owner_id)
|
||||||
|
THEN RAISE(ABORT, 'content_blocks: no such blog post')
|
||||||
|
WHEN new.owner_kind = 'page_section'
|
||||||
|
AND NOT EXISTS (SELECT 1 FROM page_sections WHERE CAST(id AS TEXT) = new.owner_id)
|
||||||
|
THEN RAISE(ABORT, 'content_blocks: no such page section')
|
||||||
|
WHEN new.owner_kind = 'newsletter'
|
||||||
|
AND NOT EXISTS (SELECT 1 FROM newsletters WHERE CAST(id AS TEXT) = new.owner_id)
|
||||||
|
THEN RAISE(ABORT, 'content_blocks: no such newsletter')
|
||||||
|
END;
|
||||||
|
END;
|
||||||
|
|
@ -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, list_style
|
word_motion, word_direction, word_seconds, list_style, org_kind
|
||||||
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`,
|
||||||
|
|
@ -94,6 +94,7 @@ export function loadBlocks(db, ownerKind, ids, slot = "body", depth = 0) {
|
||||||
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,
|
list_style: row.list_style,
|
||||||
|
org_kind: row.org_kind,
|
||||||
// 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 }
|
||||||
|
|
@ -117,7 +118,7 @@ export function loadBlocks(db, ownerKind, ids, slot = "body", depth = 0) {
|
||||||
|
|
||||||
const itemRows = db
|
const itemRows = db
|
||||||
.prepare(
|
.prepare(
|
||||||
`SELECT i.id, i.block_id, i.day, i.kind, i.heading, i.subheading, ${ENTRY_FIELDS}
|
`SELECT i.id, i.block_id, i.day, i.kind, i.heading, i.subheading, i.org_id, ${ENTRY_FIELDS}
|
||||||
FROM content_block_items i
|
FROM content_block_items i
|
||||||
LEFT JOIN v_people_public p ON p.id = i.person_id AND p.is_published = 1
|
LEFT JOIN v_people_public p ON p.id = i.person_id AND p.is_published = 1
|
||||||
WHERE i.block_id IN (${placeholders(blockIds.length)})
|
WHERE i.block_id IN (${placeholders(blockIds.length)})
|
||||||
|
|
@ -135,6 +136,7 @@ export function loadBlocks(db, ownerKind, ids, slot = "body", depth = 0) {
|
||||||
kind: row.kind ?? "entry",
|
kind: row.kind ?? "entry",
|
||||||
heading: row.heading,
|
heading: row.heading,
|
||||||
subheading: row.subheading,
|
subheading: row.subheading,
|
||||||
|
org_id: row.org_id,
|
||||||
items: [],
|
items: [],
|
||||||
};
|
};
|
||||||
itemsById.set(row.id, item);
|
itemsById.set(row.id, item);
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,7 @@ import { SITE_NAME } from '../lib/site.ts'
|
||||||
import { useSmallImage } from '../lib/useSmallImage.ts'
|
import { useSmallImage } from '../lib/useSmallImage.ts'
|
||||||
import { useReadingMode } from '../lib/readingMode.ts'
|
import { useReadingMode } from '../lib/readingMode.ts'
|
||||||
import { WordMotion, Words } from './RotatingWords.tsx'
|
import { WordMotion, Words } from './RotatingWords.tsx'
|
||||||
|
import OrgListCards from '../pages/sections/OrgList-Card.tsx'
|
||||||
|
|
||||||
const BODY = 'var(--color-muted)'
|
const BODY = 'var(--color-muted)'
|
||||||
|
|
||||||
|
|
@ -595,6 +596,22 @@ function Block({
|
||||||
return <EventsBlock items={events} accent={accent} level={level} />
|
return <EventsBlock items={events} accent={accent} level={level} />
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case 'organizations': {
|
||||||
|
// Picked ones in their order, else every listed one of its kind.
|
||||||
|
const ids = (block.items ?? []).map((item) => item.org_id).filter((id): id is string => Boolean(id))
|
||||||
|
if (ids.length === 0 && !block.org_kind) return null
|
||||||
|
return (
|
||||||
|
<OrgListCards
|
||||||
|
kind={block.org_kind}
|
||||||
|
ids={ids}
|
||||||
|
accent={accent}
|
||||||
|
pageLabel="Their page"
|
||||||
|
empty="Organizations coming soon."
|
||||||
|
nested
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
case 'people': {
|
case 'people': {
|
||||||
const picked = (block.items ?? [])
|
const picked = (block.items ?? [])
|
||||||
.filter((item) => item.person)
|
.filter((item) => item.person)
|
||||||
|
|
|
||||||
|
|
@ -311,6 +311,7 @@ export const BLOCK_TYPES = [
|
||||||
["people", "People", "People tiles: a team's members, or people picked one by one as items (each with their title), or both."],
|
["people", "People", "People tiles: a team's members, or people picked one by one as items (each with their title), or both."],
|
||||||
["map", "Map", "A venue's map with its locations marked and listed beside it (Data → Venues). A schedule on the same page with the same venue links its locations here."],
|
["map", "Map", "A venue's map with its locations marked and listed beside it (Data → Venues). A schedule on the same page with the same venue links its locations here."],
|
||||||
["events", "Events", "Event cards, eg. the workshops on offer: picture, type, date, title and card text, each linking to the event's page."],
|
["events", "Events", "Event cards, eg. the workshops on offer: picture, type, date, title and card text, each linking to the event's page."],
|
||||||
|
["organizations", "Organizations", "Organization cards, as on the Partners page: picked one by one as items, or every listed one of a kind."],
|
||||||
["divider", "Divider", "A thin line between parts."],
|
["divider", "Divider", "A thin line between parts."],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
@ -340,6 +341,8 @@ export const NOT_CARD_ITEM = { scope: "parent", path: "type", value: ["list", "l
|
||||||
export const PEOPLE_ITEM = { scope: "parent", path: "type", value: "people" };
|
export const PEOPLE_ITEM = { scope: "parent", path: "type", value: "people" };
|
||||||
/* An item that's an event card on an events block (088). */
|
/* An item that's an event card on an events block (088). */
|
||||||
export const EVENT_ITEM = { scope: "parent", path: "type", value: "events" };
|
export const EVENT_ITEM = { scope: "parent", path: "type", value: "events" };
|
||||||
|
/* An item that's an organization on an organizations block (093). */
|
||||||
|
export const ORG_ITEM = { scope: "parent", path: "type", value: "organizations" };
|
||||||
|
|
||||||
/* A venues option (the /admin/options query) as a Venue: its
|
/* A venues option (the /admin/options query) as a Venue: its
|
||||||
locations arrive as JSON. */
|
locations arrive as JSON. */
|
||||||
|
|
@ -529,6 +532,20 @@ 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: "org_kind",
|
||||||
|
label: "List",
|
||||||
|
widget: "select",
|
||||||
|
options: [
|
||||||
|
["partner", "Partners"],
|
||||||
|
["region", "Regions"],
|
||||||
|
["group", "Groups"],
|
||||||
|
["ministry", "Ministries"],
|
||||||
|
],
|
||||||
|
blankLabel: "Default: only the organizations picked below",
|
||||||
|
help: "Every published, listed one of this kind, by name. Organizations picked as items replace this list.",
|
||||||
|
when: { path: "type", value: "organizations" },
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: "list_style",
|
path: "list_style",
|
||||||
label: "Style",
|
label: "Style",
|
||||||
|
|
@ -637,7 +654,7 @@ export const blocksChild = {
|
||||||
key: "items",
|
key: "items",
|
||||||
label: "Items",
|
label: "Items",
|
||||||
addLabel: "Add item",
|
addLabel: "Add item",
|
||||||
when: { path: "type", value: ["list", "links", "schedule", "cards", "people", "events"] },
|
when: { path: "type", value: ["list", "links", "schedule", "cards", "people", "events", "organizations"] },
|
||||||
title: (row) => [row.day, row.time || row.start_time, row.text].filter(Boolean).join(" · ") || "New item",
|
title: (row) => [row.day, row.time || row.start_time, row.text].filter(Boolean).join(" · ") || "New item",
|
||||||
blank: { text: "" },
|
blank: { text: "" },
|
||||||
fields: [
|
fields: [
|
||||||
|
|
@ -687,12 +704,22 @@ export const blocksChild = {
|
||||||
help: "The event the card shows and links to. An unpublished one is left out.",
|
help: "The event the card shows and links to. An unpublished one is left out.",
|
||||||
when: EVENT_ITEM,
|
when: EVENT_ITEM,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "org_id",
|
||||||
|
label: "Organization",
|
||||||
|
widget: "select",
|
||||||
|
optionsFrom: "organizations",
|
||||||
|
fills: "text",
|
||||||
|
required: true,
|
||||||
|
help: "Shown as its card, in this order. An unpublished one is left out.",
|
||||||
|
when: ORG_ITEM,
|
||||||
|
},
|
||||||
eventField(SCHEDULE_ENTRY),
|
eventField(SCHEDULE_ENTRY),
|
||||||
{
|
{
|
||||||
path: "text",
|
path: "text",
|
||||||
label: "Text",
|
label: "Text",
|
||||||
required: true,
|
required: true,
|
||||||
help: "Schedules: the entry's title. Cards: the card's title. Events: the title shown, filled from the event. People: their title on the tile, eg. Speaker",
|
help: "Schedules: the entry's title. Cards: the card's title. Events: the title shown, filled from the event. People: their title on the tile, eg. Speaker. Organizations: filled from it, only the admin shows it",
|
||||||
},
|
},
|
||||||
placeField(SCHEDULE_ENTRY),
|
placeField(SCHEDULE_ENTRY),
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,7 @@ export type ContentBlock = {
|
||||||
| 'people'
|
| 'people'
|
||||||
| 'map'
|
| 'map'
|
||||||
| 'events'
|
| 'events'
|
||||||
|
| 'organizations'
|
||||||
text?: string | null
|
text?: string | null
|
||||||
media?: string | null
|
media?: string | null
|
||||||
href?: string | null
|
href?: string | null
|
||||||
|
|
@ -56,6 +57,8 @@ export type ContentBlock = {
|
||||||
cite?: string | null
|
cite?: string | null
|
||||||
/** A list block's style (092): null bold text, 'plain' the old look. */
|
/** A list block's style (092): null bold text, 'plain' the old look. */
|
||||||
list_style?: 'plain' | null
|
list_style?: 'plain' | null
|
||||||
|
/** An organizations block's kind, listed when none are picked (093). */
|
||||||
|
org_kind?: 'region' | 'group' | 'partner' | 'ministry' | 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[]
|
||||||
|
|
@ -138,6 +141,8 @@ export type ContentBlockItem = {
|
||||||
/** A featured event's heading and subheading (090). */
|
/** A featured event's heading and subheading (090). */
|
||||||
heading?: string | null
|
heading?: string | null
|
||||||
subheading?: string | null
|
subheading?: string | null
|
||||||
|
/** An organizations block's organization (093). */
|
||||||
|
org_id?: string | null
|
||||||
/** 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). */
|
/** Its block's tags it has, by key (087). */
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,9 @@ import { useReadingMode } from '../../lib/readingMode.ts'
|
||||||
|
|
||||||
<OrgListCards kind="partner" pageLabel="Partner page" />
|
<OrgListCards kind="partner" pageLabel="Partner page" />
|
||||||
<OrgListCards ids={["unity-worldwide", "unity-of-x"]} /> in that order
|
<OrgListCards ids={["unity-worldwide", "unity-of-x"]} /> in that order
|
||||||
|
<OrgListCards ids={...} nested /> inside a content block (093):
|
||||||
|
no page gutter, names under
|
||||||
|
the block's heading
|
||||||
|
|
||||||
Where the vertical list expands in place, a card links out. The
|
Where the vertical list expands in place, a card links out. The
|
||||||
card carries as much as fits at a glance and the organization's
|
card carries as much as fits at a glance and the organization's
|
||||||
|
|
@ -123,11 +126,11 @@ function OrgCard({ org, accent, pageLabel, siteLabel, titled }) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function Block({ title, orgs, accent, pageLabel, siteLabel }) {
|
function Block({ title, orgs, accent, pageLabel, siteLabel, nested = false }) {
|
||||||
if (orgs.length === 0) return null;
|
if (orgs.length === 0) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className="mb-12">
|
<section className={nested ? undefined : "mb-12"}>
|
||||||
{title && (
|
{title && (
|
||||||
<h3 className="text-xl font-bold mb-5" style={{ color: FALLBACK_COLOR }}>
|
<h3 className="text-xl font-bold mb-5" style={{ color: FALLBACK_COLOR }}>
|
||||||
{title}
|
{title}
|
||||||
|
|
@ -147,7 +150,7 @@ function Block({ title, orgs, accent, pageLabel, siteLabel }) {
|
||||||
accent={accent}
|
accent={accent}
|
||||||
pageLabel={pageLabel}
|
pageLabel={pageLabel}
|
||||||
siteLabel={siteLabel}
|
siteLabel={siteLabel}
|
||||||
titled={!!title}
|
titled={!!title || nested}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -167,14 +170,30 @@ export default function OrgListCards({
|
||||||
siteLabel = "Visit site",
|
siteLabel = "Visit site",
|
||||||
sort = byName,
|
sort = byName,
|
||||||
empty = "Nothing to show here yet.",
|
empty = "Nothing to show here yet.",
|
||||||
|
nested = false,
|
||||||
|
}: {
|
||||||
|
kind?: string | null;
|
||||||
|
ids?: string[];
|
||||||
|
title?: string;
|
||||||
|
groups?: Array<{ key: string; title: string; pageLabel?: string; siteLabel?: string }>;
|
||||||
|
groupBy?: (org: any) => unknown;
|
||||||
|
accent?: string;
|
||||||
|
pageLabel?: string;
|
||||||
|
siteLabel?: string;
|
||||||
|
sort?: ((a: any, b: any) => number) | null;
|
||||||
|
empty?: string;
|
||||||
|
nested?: boolean;
|
||||||
}) {
|
}) {
|
||||||
const { organizations, loading, error } = useOrganizations(kind, ids);
|
const { organizations, loading, error } = useOrganizations(kind, ids);
|
||||||
|
|
||||||
const shell = children => (
|
const shell = children =>
|
||||||
<div className="mx-auto px-8 md:px-12" style={{ maxWidth: GRID_MAX }}>
|
nested ? (
|
||||||
{children}
|
<div>{children}</div>
|
||||||
</div>
|
) : (
|
||||||
);
|
<div className="mx-auto px-8 md:px-12" style={{ maxWidth: GRID_MAX }}>
|
||||||
|
{children}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
|
||||||
if (loading && organizations.length === 0) {
|
if (loading && organizations.length === 0) {
|
||||||
return shell(
|
return shell(
|
||||||
|
|
@ -214,6 +233,7 @@ export default function OrgListCards({
|
||||||
accent={accent}
|
accent={accent}
|
||||||
pageLabel={pageLabel}
|
pageLabel={pageLabel}
|
||||||
siteLabel={siteLabel}
|
siteLabel={siteLabel}
|
||||||
|
nested={nested}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue