Organizations block: the Partners page's cards, picked one by one or every one of a kind

Migration 093 adds the 'organizations' block type (rebuilding
content_blocks for its CHECK, as 088 did), content_blocks.org_kind and
content_block_items.org_id. OrgListCards takes `nested` for a block:
no page gutter, names a level under the block's heading.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-11-11 03:23:58 -06:00
parent e9ea75a68d
commit bd271ef02d
8 changed files with 182 additions and 13 deletions

View file

@ -71,6 +71,7 @@ import { SITE_NAME } from '../lib/site.ts'
import { useSmallImage } from '../lib/useSmallImage.ts'
import { useReadingMode } from '../lib/readingMode.ts'
import { WordMotion, Words } from './RotatingWords.tsx'
import OrgListCards from '../pages/sections/OrgList-Card.tsx'
const BODY = 'var(--color-muted)'
@ -595,6 +596,22 @@ function Block({
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': {
const picked = (block.items ?? [])
.filter((item) => item.person)

View file

@ -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."],
["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."],
["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."],
];
@ -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" };
/* An item that's an event card on an events block (088). */
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
locations arrive as JSON. */
@ -529,6 +532,20 @@ export const blocksChild = {
when: { path: "type", value: TEXT_TYPES },
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",
label: "Style",
@ -637,7 +654,7 @@ export const blocksChild = {
key: "items",
label: "Items",
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",
blank: { text: "" },
fields: [
@ -687,12 +704,22 @@ export const blocksChild = {
help: "The event the card shows and links to. An unpublished one is left out.",
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),
{
path: "text",
label: "Text",
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),
{

View file

@ -45,6 +45,7 @@ export type ContentBlock = {
| 'people'
| 'map'
| 'events'
| 'organizations'
text?: string | null
media?: string | null
href?: string | null
@ -56,6 +57,8 @@ export type ContentBlock = {
cite?: string | null
/** A list block's style (092): null bold text, 'plain' the old look. */
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). */
captions?: string | null
items?: ContentBlockItem[]
@ -138,6 +141,8 @@ export type ContentBlockItem = {
/** A featured event's heading and subheading (090). */
heading?: string | null
subheading?: string | null
/** An organizations block's organization (093). */
org_id?: string | null
/** A block entry's sub-items. */
items?: ContentBlockItem[]
/** Its block's tags it has, by key (087). */

View file

@ -19,6 +19,9 @@ import { useReadingMode } from '../../lib/readingMode.ts'
<OrgListCards kind="partner" pageLabel="Partner page" />
<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
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;
return (
<section className="mb-12">
<section className={nested ? undefined : "mb-12"}>
{title && (
<h3 className="text-xl font-bold mb-5" style={{ color: FALLBACK_COLOR }}>
{title}
@ -147,7 +150,7 @@ function Block({ title, orgs, accent, pageLabel, siteLabel }) {
accent={accent}
pageLabel={pageLabel}
siteLabel={siteLabel}
titled={!!title}
titled={!!title || nested}
/>
))}
</div>
@ -167,14 +170,30 @@ export default function OrgListCards({
siteLabel = "Visit site",
sort = byName,
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 shell = children => (
<div className="mx-auto px-8 md:px-12" style={{ maxWidth: GRID_MAX }}>
{children}
</div>
);
const shell = children =>
nested ? (
<div>{children}</div>
) : (
<div className="mx-auto px-8 md:px-12" style={{ maxWidth: GRID_MAX }}>
{children}
</div>
);
if (loading && organizations.length === 0) {
return shell(
@ -214,6 +233,7 @@ export default function OrgListCards({
accent={accent}
pageLabel={pageLabel}
siteLabel={siteLabel}
nested={nested}
/>
);
}