People blocks and host teams

- A "People" content block: a team's members as people tiles, people
  picked one by one as items (each with a title), or both.
  content_blocks gains team_id (migration 054 rebuilds it for the
  type CHECK); a picked person rides on the item's person_id.
- An organization host can name a team (any organization's) to show
  in its place: event_hosts.team_id, carried by v_event_hosts. The
  event page reads "Hosted by" the team, linked to its page.
- Admin fields can show on `when: { path, filled: true }`.
- The showcase post has a people block; the past showcase event is
  hosted by the region shown as its team.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-09-30 20:26:26 -05:00
parent 6f86a113e0
commit 7c7cdaac14
10 changed files with 228 additions and 11 deletions

View file

@ -27,6 +27,9 @@
cards items as link cards, up to three in a row:
text the title, detail, url, media the
picture
people team_id's members as people tiles, then
items as more tiles: person, text their
title (an unpublished person is left out)
divider nothing
"Formatted" is InlineText.tsx: **bold**, *italic*, [text](url),
@ -38,6 +41,7 @@
═══════════════════════════════════════════════════════════════ */
import { mediaUrl } from '../lib/media.ts'
import PeopleTiles from './PeopleTiles.tsx'
import type { ContentBlock, ContentBlockItem } from '../lib/useContent.ts'
import { Anchor, Inline, Paragraphs, isExternalUrl } from './InlineText.tsx'
import VideoPlayer from './VideoPlayer.tsx'
@ -326,6 +330,19 @@ function Block({ block, accent, anchor }: { block: ContentBlock; accent: string;
if (!block.items?.length) return null
return <ScheduleBlock items={block.items} intro={block.text} accent={accent} />
case 'people': {
const picked = (block.items ?? [])
.filter((item) => item.person)
.map((item) => ({ peopleslug: item.person!.id, title: item.text || null }))
if (!block.team_id && picked.length === 0) return null
return (
<div className="space-y-6">
{block.team_id && <PeopleTiles size="lg" teams={block.team_id} accent={accent} />}
{picked.length > 0 && <PeopleTiles size="lg" people={picked} accent={accent} />}
</div>
)
}
case 'divider':
return <hr className="border-0 h-px" style={{ background: accent, opacity: 0.3 }} />

View file

@ -163,10 +163,14 @@ export function setPath(object, path, value) {
/* ── Conditional fields ──────────────────────────────────────── */
/* `when: { path, value }` shows a field when the other field holds
that value (or one of a list); `when: { path, filled: true }` when
it holds anything at all. */
export function fieldShown(field, row, parent?) {
if (!field.when) return true;
const want = Array.isArray(field.when.value) ? field.when.value : [field.when.value];
const source = field.when.scope === "parent" ? parent : row;
if (field.when.filled) return Boolean(source?.[field.when.path]);
const want = Array.isArray(field.when.value) ? field.when.value : [field.when.value];
return want.includes(source?.[field.when.path]);
}

View file

@ -230,6 +230,11 @@ export const linksChild = {
The first row supplies the logo and color when the event sets
neither, so the order here is data rather than a display choice.
An organization host can name a team (any organization's) to show
in its place: the event page reads "Hosted by" that team, linked
to its page, while the logo and color still come from the
organization.
A person supplies neither: there is no color on a person and a
headshot is not a logo, so a person-hosted event with no color
of its own falls through to the section default. */
@ -259,6 +264,15 @@ export const hostsChild = {
blankLabel: "Default: none",
help: "Use if the host is an individual, choose between person and org host, not both.",
},
{
path: "team_id",
label: "Shown as team",
widget: "select",
optionsFrom: "teams",
blankLabel: "Default: the organization",
help: "Optional: a team to name as the host instead, eg. the retreat team. Any organization's team.",
when: { path: "org_id", filled: true },
},
],
};
@ -280,6 +294,7 @@ export const BLOCK_TYPES = [
["schedule", "Schedule", "Entries in one tab per day, each folding out for more. The text is an optional intro."],
["table", "Table", "A grid of text, eg. a comparison chart: one row per line, cells split by |, the first row the header."],
["cards", "Link cards", "Cards with a picture, title and description, each a link to a page or a file, like a link shared in a chat; up to three in a row. Paste a link and press Fetch preview, or Choose a file."],
["people", "People", "People tiles: a team's members, or people picked one by one as items (each with their title), or both."],
["divider", "Divider", "A thin line between parts."],
];
@ -288,6 +303,8 @@ export const SCHEDULE_ENTRY = { scope: "parent", path: "type", value: "schedule"
/* Item fields for a link card, and for every other kind of item. */
export const CARD_ITEM = { scope: "parent", path: "type", value: "cards" };
export const NOT_CARD_ITEM = { scope: "parent", path: "type", value: ["list", "links", "schedule"] };
/* An item that's a person on a people block. */
export const PEOPLE_ITEM = { scope: "parent", path: "type", value: "people" };
export const blockTypeLabel = (type) => BLOCK_TYPES.find(([value]) => value === type)?.[1] ?? type;
@ -384,13 +401,22 @@ export const blocksChild = {
when: { path: "type", value: "image" },
help: "Describes the picture for someone who can't see it, eg. Campers around a fire at dusk",
},
{
path: "team_id",
label: "Team",
widget: "select",
optionsFrom: "teams",
blankLabel: "Default: none, just the people below",
help: "Shows the team's members as tiles, its leads first. People added as items show after it.",
when: { path: "type", value: "people" },
},
],
children: [
{
key: "items",
label: "Items",
addLabel: "Add item",
when: { path: "type", value: ["list", "links", "schedule", "cards"] },
when: { path: "type", value: ["list", "links", "schedule", "cards", "people"] },
title: (row) => [row.day, row.time, row.text].filter(Boolean).join(" · ") || "New item",
blank: { text: "" },
fields: [
@ -412,7 +438,16 @@ export const blocksChild = {
help: "A page on this site (eg. /retreats), anywhere else, or a file (Choose a file). Fetch preview fills the title, description and picture from a page; a file fills its name and first-page picture.",
when: CARD_ITEM,
},
{ path: "text", label: "Text", required: true, help: "Schedules: the entry's title. Cards: the card's title" },
{
path: "person_id",
label: "Person",
widget: "select",
optionsFrom: "people",
required: true,
help: "Shown as a tile with their photo, linked to their page",
when: PEOPLE_ITEM,
},
{ path: "text", label: "Text", required: true, help: "Schedules: the entry's title. Cards: the card's title. People: their title on the tile, eg. Speaker" },
{
path: "location",
label: "Location",

View file

@ -38,11 +38,14 @@ export type ContentBlock = {
| 'schedule'
| 'table'
| 'cards'
| 'people'
text?: string | null
media?: string | null
href?: string | null
/** An image's alt text. */
alt?: string | null
/** A people block's team, shown as its members' tiles. */
team_id?: string | null
/** Who a quote is by. */
cite?: string | null
items?: ContentBlockItem[]
@ -84,6 +87,8 @@ export type EventHost = {
id: string
name: string
org_kind?: string | null
/** An organization host's team, shown in its place (054). */
team?: { id: string; name: string } | null
}
/* ── Events ──────────────────────────────────────────────────── */

View file

@ -295,12 +295,14 @@ function Facts({ event, accent }: { event: EventRecord; accent: string }) {
sentence, so they're joined with commas and an "and" rather than
stacked. A host whose id didn't resolve to a route renders as
plain text, refHref returns null for that, because a dead link
is worse than a name. */
is worse than a name. An organization host with a team set shows
the team instead, linked to the team's page. */
function HostList({ hosts, accent }: { hosts: EventHost[]; accent: string }) {
return (
<>
{hosts.map((host, index) => {
const to = refHref(host.kind, host.id, host.org_kind)
const to = host.team ? refHref('team', host.team.id) : refHref(host.kind, host.id, host.org_kind)
const name = host.team?.name ?? host.name
return (
<span key={`${host.kind}:${host.id}`}>
@ -312,10 +314,10 @@ function HostList({ hosts, accent }: { hosts: EventHost[]; accent: string }) {
className="font-medium hover:underline"
style={{ color: accentText(accent) }}
>
{host.name}
{name}
</Link>
) : (
<span className="font-medium">{host.name}</span>
<span className="font-medium">{name}</span>
)}
</span>
)