Organization cards: list partners, ministries or a hand-picked set (migration 067)
The Partners section's preset gets "Cards: list" (partners by default, ministries, or both) and an optional hand-picked list (page_section_orgs, partners or ministries only, enforced by trigger) that replaces it in its own order. /organizations takes kind=ministry and ids=; the plain list still leaves ministries out. Ministry cards link to their website only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
635dd21083
commit
fd7e1b6fc1
11 changed files with 146 additions and 23 deletions
|
|
@ -66,10 +66,15 @@ const PRESETS: Record<string, (section: SitePageSection) => Record<string, any>>
|
|||
],
|
||||
},
|
||||
}),
|
||||
partner_list: () => ({
|
||||
partner_list: (section) => ({
|
||||
Component: OrgListCards,
|
||||
request: { type: 'partner', label: 'Request a partner listing' },
|
||||
props: { kind: 'partner', pageLabel: 'Partner page', empty: '· Partner organizations coming soon ·' },
|
||||
props: {
|
||||
kind: section.org_kinds || 'partner',
|
||||
ids: section.org_ids,
|
||||
pageLabel: 'Partner page',
|
||||
empty: '· Organizations coming soon ·',
|
||||
},
|
||||
}),
|
||||
events: (section) => ({
|
||||
Component: EventListCards,
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import { useReadingMode } from '../../lib/readingMode.ts'
|
|||
page manifest and gets no control in its heading.
|
||||
|
||||
<OrgListCards kind="partner" pageLabel="Partner page" />
|
||||
<OrgListCards ids={["unity-worldwide", "unity-of-x"]} /> in that order
|
||||
|
||||
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
|
||||
|
|
@ -152,6 +153,7 @@ function Block({ title, orgs, accent, pageLabel, siteLabel }) {
|
|||
|
||||
export default function OrgListCards({
|
||||
kind,
|
||||
ids,
|
||||
title,
|
||||
groups,
|
||||
groupBy,
|
||||
|
|
@ -161,7 +163,7 @@ export default function OrgListCards({
|
|||
sort = byName,
|
||||
empty = "Nothing to show here yet.",
|
||||
}) {
|
||||
const { organizations, loading, error } = useOrganizations(kind);
|
||||
const { organizations, loading, error } = useOrganizations(kind, ids);
|
||||
|
||||
const shell = children => (
|
||||
<div className="mx-auto px-8 md:px-12" style={{ maxWidth: GRID_MAX }}>
|
||||
|
|
@ -191,7 +193,12 @@ export default function OrgListCards({
|
|||
);
|
||||
}
|
||||
|
||||
const sorted = sort ? [...organizations].sort(sort) : organizations;
|
||||
// A hand-picked list keeps its order; anything else is sorted.
|
||||
const sorted = ids?.length
|
||||
? ids.flatMap((id) => organizations.filter((org) => org.id === id))
|
||||
: sort
|
||||
? [...organizations].sort(sort)
|
||||
: organizations;
|
||||
|
||||
// No groups given means one undivided grid.
|
||||
if (!groups || !groupBy) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue