Group pages: framed facts, tags for organizations and events, every website and email (migration 070)

- Email buttons went to the link's label, not its URL (splitLinks took
  the label); they use the URL now, with or without mailto:.
- Every website and email row is listed, each with its own label,
  instead of only the first.
- The facts at the top of an organization page sit in a framed card:
  City, Part of <name> Region, Ministry, Meets, Since, and its tags.
- Tags (070): Data -> Tags (Online, In-Person to start) replace the
  Online checkbox on organizations and events. Ticked records get the
  Online tag; v_events reads the "online" tag as is_online, so the
  calendar filter and place lines are unchanged. Tags show on the
  record's page and on group entries in the Community map list and
  grid. The map no longer keeps online groups off their state's tile.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-10-06 04:58:56 -05:00
parent 07c15ce96d
commit b55b088e16
23 changed files with 344 additions and 93 deletions

View file

@ -22,7 +22,7 @@ function PlatformName({ platform, label }: { platform?: string | null; label?: s
export default function OrgContact({ org, accent }: { org: OrganizationRecord; accent: string }) {
const hasAny =
org.links.length > 0 || org.socials.length > 0 || org.website || org.email
org.links.length > 0 || org.socials.length > 0 || org.websites.length > 0 || org.emails.length > 0
if (!hasAny) return null
@ -43,28 +43,27 @@ export default function OrgContact({ org, accent }: { org: OrganizationRecord; a
</a>
))}
{/* website and email arrive as bare strings (splitLinks in
shape.js); socials are whole link rows. */}
{/* Every website and email row, each its own button with its
own label; an email's url is the bare address (splitLinks
in shape.js). */}
{[
org.website ? { url: org.website, label: 'Website', platform: null } : null,
org.email ? { url: `mailto:${org.email}`, label: org.email, platform: null } : null,
...org.websites,
...org.emails.map((link) => ({ ...link, url: `mailto:${link.url}` })),
...org.socials,
]
.filter((link): link is NonNullable<typeof link> => Boolean(link))
.map((link) => (
<a
key={link.url}
href={link.url}
target="_blank"
rel="noreferrer"
className="inline-flex items-center gap-2 btn border px-4 py-1.5 text-sm transition-colors hover:bg-tint"
style={{ borderColor: accent, color: accentText(accent) }}
>
<PlatformIcon platform={link.platform} />
<PlatformName platform={link.platform} label={link.label} />
{link.label}
</a>
))}
].map((link) => (
<a
key={link.url}
href={link.url}
target="_blank"
rel="noreferrer"
className="inline-flex items-center gap-2 btn border px-4 py-1.5 text-sm transition-colors hover:bg-tint"
style={{ borderColor: accent, color: accentText(accent) }}
>
<PlatformIcon platform={link.platform} />
<PlatformName platform={link.platform} label={link.label} />
{link.label}
</a>
))}
</div>
)
}

22
src/components/Tags.tsx Normal file
View file

@ -0,0 +1,22 @@
/* A record's descriptor tags (070_tags.sql), eg. Online, In-Person,
as small outlined chips in its accent. Nothing when it has none. */
import type { Tag } from '../lib/useContent.ts'
import { withAlpha, accentText } from '../lib/color.ts'
export default function Tags({ tags, accent, className = '' }: { tags?: Tag[]; accent: string; className?: string }) {
if (!tags?.length) return null
return (
<ul className={`flex flex-wrap gap-1.5 ${className}`} aria-label="Tags">
{tags.map((tag) => (
<li
key={tag.id}
className="border px-2 py-0.5 text-xs font-semibold"
style={{ borderColor: withAlpha(accent, 45), color: accentText(accent) }}
>
{tag.name}
</li>
))}
</ul>
)
}

View file

@ -89,8 +89,9 @@ export const AREA_BY_CODE = Object.fromEntries(AREAS.map((a) => [a.code, a]));
one place that translates between the two, so adding a Mexico
band later means a line here and nothing in SQL.
Returns null for anything with no tile, which covers virtual
groups and any country not drawn.
Returns null for anything with no tile: a group with no state
(an online one, often) and any country not drawn. Tags, Online
included, don't keep a group off its state's tile.
───────────────────────────────────────────────────────────── */
const COUNTRY_AREA = {
CA: "CANADA", // ISO country code, not California
@ -98,7 +99,6 @@ const COUNTRY_AREA = {
export function areaForGroup(group) {
if (!group) return null;
if (group.is_online) return null;
if (group.country === "US") {
return AREA_BY_CODE[group.state_code] ? group.state_code : null;

View file

@ -28,6 +28,7 @@ import { frontPage } from "./adminSchema/frontPage.ts";
import { blogPosts } from "./adminSchema/blog.ts";
import { siteSettings } from "./adminSchema/siteSettings.ts";
import { personTagTypes } from "./adminSchema/personTags.ts";
import { tags } from "./adminSchema/tags.ts";
import { contactTypes } from "./adminSchema/contactTypes.ts";
import { redirects } from "./adminSchema/redirects.ts";
import {
@ -43,6 +44,7 @@ export const ADMIN_ENTITIES: Record<string, any> = {
events,
people,
person_tag_types: personTagTypes,
tags,
contact_types: contactTypes,
redirects,
teams,

View file

@ -1,5 +1,5 @@
import { mediaUrl } from "../media.ts";
import { PLACE_FIELDS, PUBLISHED_FIELD, LISTED_FIELD, timelineGroup, timelineDetailGroup, linksChild, hostsChild, blocksChild } from "./shared.ts";
import { PLACE_FIELDS, PUBLISHED_FIELD, LISTED_FIELD, timelineGroup, timelineDetailGroup, linksChild, hostsChild, blocksChild, tagsChild } from "./shared.ts";
/* ── Events ──────────────────────────────────────────────────── */
@ -178,6 +178,7 @@ export const events = {
children: [
hostsChild,
tagsChild,
{
key: "event_people",
label: "People at this event",

View file

@ -1,5 +1,5 @@
import { mediaUrl } from "../media.ts";
import { PLACE_FIELDS, PUBLISH_FIELDS, timelineGroup, timelineDetailGroup, linksChild, blocksChild } from "./shared.ts";
import { PLACE_FIELDS, PUBLISH_FIELDS, timelineGroup, timelineDetailGroup, linksChild, blocksChild, tagsChild } from "./shared.ts";
/* ── Organizations ───────────────────────────────────────────── */
@ -89,6 +89,7 @@ export const organizations = {
],
children: [
tagsChild,
{
key: "region_areas",
label: "Map areas",

View file

@ -15,7 +15,6 @@ export const PLACE_FIELDS = [
{ path: "location_label", label: "Display location", help: "Overrides the line built from city and state" },
{ path: "latitude", label: "Latitude", widget: "number" },
{ path: "longitude", label: "Longitude", widget: "number" },
{ path: "is_online", label: "Online", widget: "checkbox" },
];
export const PUBLISHED_FIELD = { path: "is_published", label: "Published", widget: "checkbox" };
@ -198,6 +197,18 @@ export const featuredCardsChild = {
],
};
/* An organization's or event's tags (070_tags.sql): Online,
In-Person and whatever else Data → Tags holds. */
export const tagsChild = {
key: "tags",
label: "Tags",
note: "Shown on its page, eg. Online or In-Person. Tags are made under Data → Tags.",
addLabel: "Add tag",
title: (row, options) => options?.tags?.find((t) => t.id === row.tag_id)?.label ?? "New tag",
blank: { tag_id: "" },
fields: [{ path: "tag_id", label: "Tag", widget: "select", optionsFrom: "tags", required: true }],
};
/* The two collections every entity carries. */
export const linksChild = {
key: "links",

View file

@ -0,0 +1,32 @@
/* ── Tags (070_tags.sql) ─────────────────────────────────────────
Data → Tags: descriptors an organization or event can carry, eg.
Online, In-Person, shown on its page (and on a group's entry in
the Community map). Which records carry a tag is edited on the
record. Server side: server/src/admin-schema/tags.js. */
export const tags = {
key: "tags",
label: "Tags",
singular: "tag",
idLabel: "URL ID",
slugFrom: "name",
list: {
columns: [
{ key: "name", label: "Name", primary: true },
{ key: "sort_order", label: "Order" },
],
filters: [],
},
groups: [
{
legend: "Tag",
note: "The tag with URL ID online marks an event as online: the calendar's Online filter and its place line read it.",
fields: [
{ path: "name", label: "Name", required: true, help: "As shown, eg. In-Person" },
{ path: "sort_order", label: "Sort order", widget: "number" },
],
},
],
};

View file

@ -114,6 +114,9 @@ export type EventAward = {
citation?: string | null
}
/** A descriptor tag (070_tags.sql), eg. Online or In-Person. */
export type Tag = { id: string; name: string }
export type EventRecord = {
id: string
/** Whose gathering it is: an event_scopes id. */
@ -133,7 +136,10 @@ export type EventRecord = {
locality?: string | null
state_code?: string | null
country?: string | null
/** The event carries the "online" tag (v_events). */
is_online: boolean
/** Its tags: on the event's own page only. */
tags?: Tag[]
org_logo?: string | null
event_logo?: string | null
color?: string | null
@ -231,13 +237,17 @@ export type OrganizationRecord = {
state_code?: string | null
country?: string | null
location_label?: string | null
is_online: boolean
tags: Tag[]
description: string[]
blocks: ContentBlock[]
links: Link[]
socials: Link[]
/* splitLinks in shape.js lifts these out as bare strings: the
website's url, the email's label, the instagram handle. */
/** Every website and email row (an email's url is the bare address). */
websites: Link[]
emails: Link[]
/* splitLinks in shape.js lifts these out as bare strings, for
cards: the first website's url, the first email's address, the
instagram handle. */
website?: string | null
email?: string | null
instagram?: string | null

View file

@ -22,6 +22,7 @@ import PageShell, { type ShellSection } from '../components/PageShell.tsx'
import PageState from '../components/PageState.tsx'
import PlatformIcon from '../components/PlatformIcon.tsx'
import ContentBlocks from '../components/ContentBlocks.tsx'
import Tags from '../components/Tags.tsx'
import PeopleTiles, { type PeopleGroupInput } from '../components/PeopleTiles.tsx'
import {
useEvent,
@ -243,8 +244,7 @@ export default function EventDetail() {
function Facts({ event, accent }: { event: EventRecord; accent: string }) {
const where =
event.location_label ||
[event.locality, event.state_code].filter(Boolean).join(', ') ||
(event.is_online ? 'Online' : null)
[event.locality, event.state_code].filter(Boolean).join(', ')
const schedule = seriesLabel(event.series, event.starts_on)
// A series with no label of its own is described by its schedule
@ -283,9 +283,7 @@ function Facts({ event, accent }: { event: EventRecord; accent: string }) {
{when && <span style={{ color: BODY }}>{when}</span>}
{schedule && <span style={{ color: BODY }}>{schedule}</span>}
{where && <span style={{ color: BODY }}>{where}</span>}
{event.is_online && where !== 'Online' && (
<span style={{ color: BODY }}>Online too</span>
)}
<Tags tags={event.tags} accent={accent} />
{(event.hosts?.length ?? 0) > 0 && (
<span style={{ color: BODY }}>

View file

@ -14,6 +14,7 @@
Organization page); its contact buttons are OrgContact.
═══════════════════════════════════════════════════════════════ */
import type { ReactNode } from 'react'
import { Link, Navigate, useLocation, useParams } from 'react-router-dom'
import PageShell from '../components/PageShell.tsx'
@ -21,6 +22,7 @@ import PageState from '../components/PageState.tsx'
import ContentBlocks from '../components/ContentBlocks.tsx'
import OrgTeams, { hasTeams } from '../components/OrgTeams.tsx'
import OrgContact from '../components/OrgContact.tsx'
import Tags from '../components/Tags.tsx'
import EventListCards from './sections/EventList-Cards.tsx'
import {
useOrganization,
@ -220,6 +222,12 @@ export default function OrganizationDetail() {
/* ── Pieces ──────────────────────────────────────────────────── */
/* "Mid-Atlantic" reads as "Mid-Atlantic Region"; a name that already
ends in Region keeps it. */
const regionName = (name?: string | null) => (name && !/region$/i.test(name.trim()) ? `${name} Region` : name)
/* The facts at the top, framed: one labeled cell each (city, region,
ministry, meeting time, since) and the record's tags. */
function Facts({
org,
accent,
@ -229,50 +237,49 @@ function Facts({
}) {
const where =
org.location_label || [org.locality, org.state_code].filter(Boolean).join(', ')
const group = org.kind === 'group' ? org.details : null
const link = 'font-semibold hover:underline'
const facts = ([
['City', where],
[
'Part of',
group?.region_id && (
<Link to={orgHref(group.region_id, 'region')} className={link} style={{ color: accentText(group.region_color || accent) }}>
{regionName(group.region_name)}
</Link>
),
],
[
'Ministry',
group?.ministry_name &&
(group.ministry_url ? (
<a href={group.ministry_url} target="_blank" rel="noreferrer" className={link} style={{ color: accentText(accent) }}>
{group.ministry_name}
</a>
) : (
group.ministry_name
)),
],
['Meets', group?.meets],
['Since', group?.started],
] as [string, ReactNode][]).filter(([, value]) => Boolean(value))
if (facts.length === 0 && org.tags.length === 0) return null
return (
<div className="flex flex-wrap items-center gap-x-6 gap-y-3 text-sm">
{where && <span style={{ color: BODY }}>{where}</span>}
{org.kind === 'group' && org.details.region_id && (
<span style={{ color: BODY }}>
Part of{' '}
<Link
to={orgHref(org.details.region_id, 'region')}
className="font-medium hover:underline"
style={{ color: org.details.region_color || accent }}
>
{org.details.region_name}
</Link>
</span>
<div className="max-w-3xl border-t-4 bg-raised p-5 shadow-sm" style={{ borderColor: accent }}>
{facts.length > 0 && (
<dl className="grid grid-cols-1 gap-x-8 gap-y-4 sm:grid-cols-2">
{facts.map(([label, value]) => (
<div key={label}>
<dt className="text-xs font-semibold uppercase tracking-wide text-muted">{label}</dt>
<dd className="mt-0.5 font-semibold text-ink">{value}</dd>
</div>
))}
</dl>
)}
{org.kind === 'group' && org.details.ministry_name && (
<span style={{ color: BODY }}>
Ministry:{' '}
{org.details.ministry_url ? (
<a
href={org.details.ministry_url}
target="_blank"
rel="noreferrer"
className="font-medium hover:underline"
style={{ color: accentText(accent) }}
>
{org.details.ministry_name}
</a>
) : (
org.details.ministry_name
)}
</span>
)}
{org.kind === 'group' && org.details.meets && (
<span style={{ color: BODY }}>Meets {org.details.meets}</span>
)}
{org.kind === 'group' && org.details.started && (
<span style={{ color: BODY }}>Since {org.details.started}</span>
)}
{org.is_online && <span style={{ color: BODY }}>Online</span>}
<Tags tags={org.tags} accent={accent} className={facts.length > 0 ? 'mt-4' : ''} />
</div>
)
}

View file

@ -85,6 +85,11 @@ export const DATA_NAV = {
label: "People tags",
blurb: "Directories people can be tagged into, eg. Musicians. Who carries a tag is edited on the person.",
},
{
to: "/admin/tags",
label: "Tags",
blurb: "Descriptors for organizations and events, eg. Online, In-Person. Who carries a tag is edited on the record.",
},
{
to: "/admin/redirects",
label: "Links/redirects",

View file

@ -5,6 +5,7 @@ import { useOrganization } from "../../lib/useContent.ts";
import { Link } from "react-router-dom";
import ArrowLink from "../../components/ArrowLink.tsx";
import OrgLogo from "../../components/OrgLogo.tsx";
import Tags from "../../components/Tags.tsx";
import { orgPath } from "../../lib/organizations.ts";
import { AREAS, AREA_NAMES } from "../../data/mapGrid.ts";
import { accentText, readableOn } from '../../lib/color.ts'
@ -467,6 +468,7 @@ function RegionBlock({
{c.location_label}
{c.meets ? ` · ${c.meets}` : ""}
</p>
<Tags tags={c.tags} accent={colorOf(region)} className="mt-1.5" />
{(c.website || c.email) && (
<p className="text-sm mt-1 flex gap-4">
{c.website && (
@ -563,6 +565,7 @@ function GroupCard({ group, color, open, onOpen }) {
{group.meets}
</p>
)}
<Tags tags={group.tags} accent={color} className="mt-1.5" />
</div>
{/* Two controls, two destinations: the chevron opens the