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:
parent
07c15ce96d
commit
b55b088e16
23 changed files with 344 additions and 93 deletions
|
|
@ -29,6 +29,7 @@ what a dropdown in the admin editor says.
|
||||||
| ------------------------------------------------------------ | ---------------- | ------------------------------------ |
|
| ------------------------------------------------------------ | ---------------- | ------------------------------------ |
|
||||||
| A record: an event, organization, person, team, award, timeline entry | the database | editing it in the admin |
|
| A record: an event, organization, person, team, award, timeline entry | the database | editing it in the admin |
|
||||||
| People tags (directories, eg. Musicians, at `/directory/<tag>`) and contact types (Minister, General info), and organizations' contacts | the database | Admin → Data → People tags, Contact types; who carries a tag is set on the person, contacts on the organization |
|
| People tags (directories, eg. Musicians, at `/directory/<tag>`) and contact types (Minister, General info), and organizations' contacts | the database | Admin → Data → People tags, Contact types; who carries a tag is set on the person, contacts on the organization |
|
||||||
|
| Tags for organizations and events (Online, In-Person; URL ID `online` marks an event online for the calendar filter) | the database | Admin → Data → Tags; who carries a tag is set on the organization or event |
|
||||||
| The front page's words, photos, bands, stats and paths | the database | Admin → Pages → Front page |
|
| The front page's words, photos, bands, stats and paths | the database | Admin → Pages → Front page |
|
||||||
| Blog posts, and the Community page's blog settings (headings, pins, feeds) | the database | Admin → Data → Blog posts, and Admin → Pages → Community |
|
| Blog posts, and the Community page's blog settings (headings, pins, feeds) | the database | Admin → Data → Blog posts, and Admin → Pages → Community |
|
||||||
| The sections of Retreats, Community, Resources, Organization and History: titles, blurbs, accents, their content blocks and presets (the blog, groups map, regions, partners, events, timeline, a people directory) | the database | Admin → Pages → the page. A section title is 30 characters at most (it's listed in the side nav); a front page heading fits about 60. Preset names: `PRESETS` in `src/lib/adminSchema/sitePages.ts`, what each draws: `PRESETS` in `src/pages/SitePage.tsx` |
|
| The sections of Retreats, Community, Resources, Organization and History: titles, blurbs, accents, their content blocks and presets (the blog, groups map, regions, partners, events, timeline, a people directory) | the database | Admin → Pages → the page. A section title is 30 characters at most (it's listed in the side nav); a front page heading fits about 60. Preset names: `PRESETS` in `src/lib/adminSchema/sitePages.ts`, what each draws: `PRESETS` in `src/pages/SitePage.tsx` |
|
||||||
|
|
@ -204,6 +205,7 @@ code):
|
||||||
| Group → Region | `regions` | organizations of kind region |
|
| Group → Region | `regions` | organizations of kind region |
|
||||||
| Group → Ministry | `ministries` | organizations of kind ministry |
|
| Group → Ministry | `ministries` | organizations of kind ministry |
|
||||||
| People → Directories → Tag; Pages → Sections → Directory: tag | `person_tag_types` | Data → People tags |
|
| People → Directories → Tag; Pages → Sections → Directory: tag | `person_tag_types` | Data → People tags |
|
||||||
|
| Organizations and Events → Tags → Tag | `tags` | Data → Tags |
|
||||||
| Organizations → Contacts → Type | `contact_types` | Data → Contact types |
|
| Organizations → Contacts → Type | `contact_types` | Data → Contact types |
|
||||||
| Event → Scope (+ list filter); Front page → Countdown → Only this scope | `event_scopes` | the `event_scopes` table (migration only) |
|
| Event → Scope (+ list filter); Front page → Countdown → Only this scope | `event_scopes` | the `event_scopes` table (migration only) |
|
||||||
| Event hosts → Organization; affiliations; team and award "Organization" / "Awarded by"; person → Home organization | `organizations` | organizations, labeled by name, except ministries (they have no page to link to) |
|
| Event hosts → Organization; affiliations; team and award "Organization" / "Awarded by"; person → Home organization | `organizations` | organizations, labeled by name, except ministries (they have no page to link to) |
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@ import { blogPosts } from "./admin-schema/blog.js";
|
||||||
import { siteSettings } from "./admin-schema/siteSettings.js";
|
import { siteSettings } from "./admin-schema/siteSettings.js";
|
||||||
import { newsletters } from "./admin-schema/newsletters.js";
|
import { newsletters } from "./admin-schema/newsletters.js";
|
||||||
import { personTagTypes } from "./admin-schema/personTags.js";
|
import { personTagTypes } from "./admin-schema/personTags.js";
|
||||||
|
import { tags } from "./admin-schema/tags.js";
|
||||||
import { contactTypes } from "./admin-schema/contactTypes.js";
|
import { contactTypes } from "./admin-schema/contactTypes.js";
|
||||||
import { redirects } from "./admin-schema/redirects.js";
|
import { redirects } from "./admin-schema/redirects.js";
|
||||||
import {
|
import {
|
||||||
|
|
@ -70,6 +71,7 @@ export const ENTITIES = {
|
||||||
events,
|
events,
|
||||||
people,
|
people,
|
||||||
person_tag_types: personTagTypes,
|
person_tag_types: personTagTypes,
|
||||||
|
tags,
|
||||||
contact_types: contactTypes,
|
contact_types: contactTypes,
|
||||||
redirects,
|
redirects,
|
||||||
teams,
|
teams,
|
||||||
|
|
@ -105,6 +107,7 @@ export const OPTION_QUERIES = {
|
||||||
events: "SELECT id, title AS label FROM events ORDER BY starts_on DESC, title",
|
events: "SELECT id, title AS label FROM events ORDER BY starts_on DESC, title",
|
||||||
people: "SELECT id, display_name AS label FROM people ORDER BY sort_name, display_name",
|
people: "SELECT id, display_name AS label FROM people ORDER BY sort_name, display_name",
|
||||||
person_tag_types: "SELECT id, name AS label FROM person_tag_types ORDER BY sort_order, name",
|
person_tag_types: "SELECT id, name AS label FROM person_tag_types ORDER BY sort_order, name",
|
||||||
|
tags: "SELECT id, name AS label FROM tags ORDER BY sort_order, name",
|
||||||
contact_types: "SELECT id, name AS label FROM contact_types ORDER BY sort_order, name",
|
contact_types: "SELECT id, name AS label FROM contact_types ORDER BY sort_order, name",
|
||||||
// Link fields with `redirects: true` pick from these (068).
|
// Link fields with `redirects: true` pick from these (068).
|
||||||
redirects: "SELECT id, id || ' (' || target_url || ')' AS label FROM redirects ORDER BY id",
|
redirects: "SELECT id, id || ' (' || target_url || ')' AS label FROM redirects ORDER BY id",
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@ export const placeColumns = [
|
||||||
text("location_label"),
|
text("location_label"),
|
||||||
real("latitude"),
|
real("latitude"),
|
||||||
real("longitude"),
|
real("longitude"),
|
||||||
bool("is_online"),
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/* The affiliation's own fields, minus whichever end owns the row.
|
/* The affiliation's own fields, minus whichever end owns the row.
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import { text, int, bool, date, time, enumeration, placeColumns, timelineExtension, linksChild, blocksChild, hostsChild } from "./columns.js";
|
import { text, int, bool, date, time, enumeration, placeColumns, timelineExtension, linksChild, blocksChild, hostsChild } from "./columns.js";
|
||||||
|
import { tagsChild } from "./tags.js";
|
||||||
|
|
||||||
/* ── Events ──────────────────────────────────────────────────── */
|
/* ── Events ──────────────────────────────────────────────────── */
|
||||||
|
|
||||||
|
|
@ -85,6 +86,7 @@ export const events = {
|
||||||
|
|
||||||
children: [
|
children: [
|
||||||
hostsChild,
|
hostsChild,
|
||||||
|
tagsChild("event_tags", "event_id"),
|
||||||
linksChild("event"),
|
linksChild("event"),
|
||||||
blocksChild("event"),
|
blocksChild("event"),
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import { text, int, real, bool, enumeration, placeColumns, timelineExtension, linksChild, blocksChild } from "./columns.js";
|
import { text, int, real, bool, enumeration, placeColumns, timelineExtension, linksChild, blocksChild } from "./columns.js";
|
||||||
|
import { tagsChild } from "./tags.js";
|
||||||
|
|
||||||
/* ── Organizations ───────────────────────────────────────────── */
|
/* ── Organizations ───────────────────────────────────────────── */
|
||||||
|
|
||||||
|
|
@ -67,6 +68,7 @@ export const organizations = {
|
||||||
],
|
],
|
||||||
|
|
||||||
children: [
|
children: [
|
||||||
|
tagsChild("organization_tags", "org_id"),
|
||||||
linksChild("organization"),
|
linksChild("organization"),
|
||||||
blocksChild("organization"),
|
blocksChild("organization"),
|
||||||
// Who to write to there, by role (064_org_contacts.sql): private,
|
// Who to write to there, by role (064_org_contacts.sql): private,
|
||||||
|
|
|
||||||
35
server/src/admin-schema/tags.js
Normal file
35
server/src/admin-schema/tags.js
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
import { text, int } from "./columns.js";
|
||||||
|
|
||||||
|
/* ── Tags (070_tags.sql) ─────────────────────────────────────────
|
||||||
|
|
||||||
|
Descriptor tags for organizations and events (Online, In-Person).
|
||||||
|
Its own entity, not a repeater, because organization_tags and
|
||||||
|
event_tags point at it: deleting a tag takes it off every record
|
||||||
|
(cascade). Which records carry a tag is edited on the record. The
|
||||||
|
URL ID "online" is what v_events reads as an online event. */
|
||||||
|
|
||||||
|
export const tags = {
|
||||||
|
key: "tags",
|
||||||
|
table: "tags",
|
||||||
|
idColumn: "id",
|
||||||
|
idKind: "slug",
|
||||||
|
|
||||||
|
list: {
|
||||||
|
columns: ["id", "name", "sort_order"],
|
||||||
|
filters: [],
|
||||||
|
search: ["name", "id"],
|
||||||
|
order: "sort_order, name",
|
||||||
|
},
|
||||||
|
|
||||||
|
columns: [text("name", { required: true }), int("sort_order")],
|
||||||
|
};
|
||||||
|
|
||||||
|
/* The Tags repeater on an organization or event: owner is the
|
||||||
|
record's id column in that tag table. */
|
||||||
|
export const tagsChild = (table, owner) => ({
|
||||||
|
key: "tags",
|
||||||
|
table,
|
||||||
|
owner: { column: owner },
|
||||||
|
order: "sort_order",
|
||||||
|
columns: [text("tag_id", { required: true })],
|
||||||
|
});
|
||||||
84
server/src/migrations/070_tags.sql
Normal file
84
server/src/migrations/070_tags.sql
Normal file
|
|
@ -0,0 +1,84 @@
|
||||||
|
-- ═══════════════════════════════════════════════════════════════
|
||||||
|
-- 070 TAGS
|
||||||
|
--
|
||||||
|
-- Descriptor tags for organizations and events (Data → Tags), in
|
||||||
|
-- place of the Online checkbox: Online and In-Person to start, more
|
||||||
|
-- as they're needed. A record's tags show on its page and, for
|
||||||
|
-- groups, on the Community map's list and grid.
|
||||||
|
--
|
||||||
|
-- The tag with URL ID "online" still means online to the site:
|
||||||
|
-- v_events turns it back into is_online, which the calendar's
|
||||||
|
-- online filter, the "Online" place line and an event's search data
|
||||||
|
-- read. Records ticked Online get the tag; nothing gets In-Person
|
||||||
|
-- automatically.
|
||||||
|
-- ═══════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
CREATE TABLE tags (
|
||||||
|
id TEXT PRIMARY KEY
|
||||||
|
CONSTRAINT "A tag's URL ID can use only lowercase letters, numbers and hyphens, eg. in-person."
|
||||||
|
CHECK (id <> '' AND id NOT GLOB '*[^a-z0-9-]*'),
|
||||||
|
name TEXT NOT NULL, -- 'In-Person', as shown
|
||||||
|
sort_order INTEGER NOT NULL DEFAULT 0
|
||||||
|
) STRICT;
|
||||||
|
|
||||||
|
INSERT INTO tags (id, name, sort_order) VALUES
|
||||||
|
('online', 'Online', 0),
|
||||||
|
('in-person', 'In-Person', 1);
|
||||||
|
|
||||||
|
CREATE TABLE organization_tags (
|
||||||
|
org_id TEXT NOT NULL REFERENCES organizations (id) ON DELETE CASCADE,
|
||||||
|
tag_id TEXT NOT NULL REFERENCES tags (id) ON DELETE CASCADE,
|
||||||
|
sort_order INTEGER NOT NULL DEFAULT 0,
|
||||||
|
PRIMARY KEY (org_id, tag_id)
|
||||||
|
) STRICT;
|
||||||
|
CREATE INDEX organization_tags_tag_idx ON organization_tags (tag_id);
|
||||||
|
|
||||||
|
CREATE TABLE event_tags (
|
||||||
|
event_id TEXT NOT NULL REFERENCES events (id) ON DELETE CASCADE,
|
||||||
|
tag_id TEXT NOT NULL REFERENCES tags (id) ON DELETE CASCADE,
|
||||||
|
sort_order INTEGER NOT NULL DEFAULT 0,
|
||||||
|
PRIMARY KEY (event_id, tag_id)
|
||||||
|
) STRICT;
|
||||||
|
CREATE INDEX event_tags_tag_idx ON event_tags (tag_id);
|
||||||
|
|
||||||
|
INSERT INTO organization_tags (org_id, tag_id) SELECT id, 'online' FROM organizations WHERE is_online = 1;
|
||||||
|
INSERT INTO event_tags (event_id, tag_id) SELECT id, 'online' FROM events WHERE is_online = 1;
|
||||||
|
|
||||||
|
-- v_events reads e.*, so it goes while the column does and comes
|
||||||
|
-- back with is_online from the tag.
|
||||||
|
DROP VIEW v_events;
|
||||||
|
ALTER TABLE organizations DROP COLUMN is_online;
|
||||||
|
ALTER TABLE events DROP COLUMN is_online;
|
||||||
|
|
||||||
|
CREATE VIEW v_events AS
|
||||||
|
SELECT
|
||||||
|
e.*,
|
||||||
|
EXISTS (SELECT 1 FROM event_tags et WHERE et.event_id = e.id AND et.tag_id = 'online')
|
||||||
|
AS is_online,
|
||||||
|
CASE WHEN eh.id IS NULL THEN NULL
|
||||||
|
WHEN eh.person_id IS NULL THEN 'organization' ELSE 'person' END
|
||||||
|
AS host_kind,
|
||||||
|
COALESCE(eh.org_id, eh.person_id) AS host_id,
|
||||||
|
COALESCE(o.name, p.display_name) AS host_name,
|
||||||
|
o.kind AS host_org_kind,
|
||||||
|
COALESCE(e.org_logo, o.logo) AS effective_org_logo,
|
||||||
|
COALESCE(e.color, o.color) AS effective_color,
|
||||||
|
COALESCE(
|
||||||
|
e.status,
|
||||||
|
CASE WHEN e.ends_on IS NOT NULL AND e.ends_on < date('now')
|
||||||
|
THEN 'past' ELSE 'upcoming' END
|
||||||
|
) AS effective_status
|
||||||
|
FROM events e
|
||||||
|
LEFT JOIN event_hosts eh
|
||||||
|
ON eh.id = (
|
||||||
|
SELECT x.id
|
||||||
|
FROM event_hosts x
|
||||||
|
LEFT JOIN organizations xo ON xo.id = x.org_id
|
||||||
|
LEFT JOIN people xp ON xp.id = x.person_id
|
||||||
|
WHERE x.event_id = e.id
|
||||||
|
AND COALESCE(xo.is_published, xp.is_published) = 1
|
||||||
|
ORDER BY x.sort_order, x.id
|
||||||
|
LIMIT 1
|
||||||
|
)
|
||||||
|
LEFT JOIN organizations o ON o.id = eh.org_id
|
||||||
|
LEFT JOIN people p ON p.id = eh.person_id;
|
||||||
|
|
@ -62,6 +62,7 @@ import {
|
||||||
paragraphs,
|
paragraphs,
|
||||||
shapeSeries,
|
shapeSeries,
|
||||||
splitLinks,
|
splitLinks,
|
||||||
|
attachTags,
|
||||||
} from "../shape.js";
|
} from "../shape.js";
|
||||||
|
|
||||||
const content = new Hono();
|
const content = new Hono();
|
||||||
|
|
@ -166,7 +167,7 @@ function shapeEvent(row, links, cardBlocks, hosts = []) {
|
||||||
/* The common card surface every organization has, whatever kind it
|
/* The common card surface every organization has, whatever kind it
|
||||||
is. Kind-specific fields go in `details`, attached by the caller. */
|
is. Kind-specific fields go in `details`, attached by the caller. */
|
||||||
function shapeOrganization(row, links, cardBlocks, bodyBlocks) {
|
function shapeOrganization(row, links, cardBlocks, bodyBlocks) {
|
||||||
const { actions, socials, website, email, instagram } = splitLinks(links);
|
const { actions, socials, websites, emails, website, email, instagram } = splitLinks(links);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: row.id,
|
id: row.id,
|
||||||
|
|
@ -183,16 +184,18 @@ function shapeOrganization(row, links, cardBlocks, bodyBlocks) {
|
||||||
state_code: row.state_code,
|
state_code: row.state_code,
|
||||||
country: row.country,
|
country: row.country,
|
||||||
location_label: row.location_label,
|
location_label: row.location_label,
|
||||||
is_online: asBool(row.is_online),
|
|
||||||
sort_order: row.sort_order,
|
sort_order: row.sort_order,
|
||||||
|
|
||||||
description: paragraphs(cardBlocks),
|
description: paragraphs(cardBlocks),
|
||||||
blocks: bodyBlocks,
|
blocks: bodyBlocks,
|
||||||
links: actions,
|
links: actions,
|
||||||
socials,
|
socials,
|
||||||
|
websites,
|
||||||
|
emails,
|
||||||
website,
|
website,
|
||||||
email,
|
email,
|
||||||
instagram,
|
instagram,
|
||||||
|
tags: [],
|
||||||
|
|
||||||
details: {},
|
details: {},
|
||||||
leadership: [],
|
leadership: [],
|
||||||
|
|
@ -583,14 +586,10 @@ content.get("/events/:id", (c) => {
|
||||||
citation: r.citation,
|
citation: r.citation,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
return json(c, {
|
const event = { ...shapeEvent(row, links, cards, hosts), blocks: body, people, awards };
|
||||||
event: {
|
attachTags(db, "event", [event]);
|
||||||
...shapeEvent(row, links, cards, hosts),
|
|
||||||
blocks: body,
|
return json(c, { event });
|
||||||
people,
|
|
||||||
awards,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/* ── Organizations ─────────────────────────────────────────────
|
/* ── Organizations ─────────────────────────────────────────────
|
||||||
|
|
@ -647,6 +646,7 @@ content.get("/organizations", (c) => {
|
||||||
|
|
||||||
attachRegionDetails(db, organizations);
|
attachRegionDetails(db, organizations);
|
||||||
attachGroupDetails(db, organizations);
|
attachGroupDetails(db, organizations);
|
||||||
|
attachTags(db, "organization", organizations);
|
||||||
|
|
||||||
return json(c, { organizations });
|
return json(c, { organizations });
|
||||||
});
|
});
|
||||||
|
|
@ -669,6 +669,7 @@ content.get("/organizations/:id", (c) => {
|
||||||
|
|
||||||
attachRegionDetails(db, one);
|
attachRegionDetails(db, one);
|
||||||
attachGroupDetails(db, one);
|
attachGroupDetails(db, one);
|
||||||
|
attachTags(db, "organization", one);
|
||||||
attachLeadership(db, one);
|
attachLeadership(db, one);
|
||||||
attachTeams(db, one);
|
attachTeams(db, one);
|
||||||
attachAwards(db, one);
|
attachAwards(db, one);
|
||||||
|
|
|
||||||
|
|
@ -179,6 +179,10 @@ const standardLinks = (name) => [
|
||||||
{ kind: "social", platform: "youtube", label: "YouTube", url: "https://youtube.com/@showcase" },
|
{ kind: "social", platform: "youtube", label: "YouTube", url: "https://youtube.com/@showcase" },
|
||||||
{ kind: "website", label: "Website", url: "https://example.org" },
|
{ kind: "website", label: "Website", url: "https://example.org" },
|
||||||
{ kind: "email", label: "showcase@example.org", url: "mailto:showcase@example.org" },
|
{ kind: "email", label: "showcase@example.org", url: "mailto:showcase@example.org" },
|
||||||
|
// A second of each, labeled unlike its address: both listed, each
|
||||||
|
// going to its own URL.
|
||||||
|
{ kind: "website", label: "Our blog", url: "https://example.org/blog" },
|
||||||
|
{ kind: "email", label: "Prayer requests", url: "prayer@example.org" },
|
||||||
];
|
];
|
||||||
|
|
||||||
/* ── Writing ───────────────────────────────────────────────── */
|
/* ── Writing ───────────────────────────────────────────────── */
|
||||||
|
|
@ -246,7 +250,6 @@ tx(db, () => {
|
||||||
color: "#7a5ea8",
|
color: "#7a5ea8",
|
||||||
logo: IMAGE,
|
logo: IMAGE,
|
||||||
...place,
|
...place,
|
||||||
is_online: 0,
|
|
||||||
is_published: 1,
|
is_published: 1,
|
||||||
is_listed: LISTED,
|
is_listed: LISTED,
|
||||||
sort_order: 99,
|
sort_order: 99,
|
||||||
|
|
@ -269,12 +272,12 @@ tx(db, () => {
|
||||||
logo: IMAGE,
|
logo: IMAGE,
|
||||||
...place,
|
...place,
|
||||||
venue: "Showcase Community Hall",
|
venue: "Showcase Community Hall",
|
||||||
is_online: 1,
|
|
||||||
is_published: 1,
|
is_published: 1,
|
||||||
is_listed: LISTED,
|
is_listed: LISTED,
|
||||||
sort_order: 99,
|
sort_order: 99,
|
||||||
});
|
});
|
||||||
insert("groups", { id: GROUP, region_id: REGION, meets: "2nd Sundays, 6:00pm", started: "Since 2021" });
|
insert("groups", { id: GROUP, region_id: REGION, meets: "2nd Sundays, 6:00pm", started: "Since 2021" });
|
||||||
|
["in-person", "online"].forEach((tag_id, i) => insert("organization_tags", { org_id: GROUP, tag_id, sort_order: i }));
|
||||||
links("organization", GROUP, standardLinks("Showcase Group"));
|
links("organization", GROUP, standardLinks("Showcase Group"));
|
||||||
blocks("organization", GROUP, "card", cardText("group"));
|
blocks("organization", GROUP, "card", cardText("group"));
|
||||||
blocks("organization", GROUP, "body", pageBody("group"));
|
blocks("organization", GROUP, "body", pageBody("group"));
|
||||||
|
|
@ -364,7 +367,6 @@ tx(db, () => {
|
||||||
ends_on: db.prepare(`SELECT date('now', '+47 days') AS d`).get().d,
|
ends_on: db.prepare(`SELECT date('now', '+47 days') AS d`).get().d,
|
||||||
date_label: "Three days, six weeks from now",
|
date_label: "Three days, six weeks from now",
|
||||||
...place,
|
...place,
|
||||||
is_online: 0,
|
|
||||||
org_logo: IMAGE,
|
org_logo: IMAGE,
|
||||||
event_logo: IMAGE,
|
event_logo: IMAGE,
|
||||||
color: "#d62976",
|
color: "#d62976",
|
||||||
|
|
@ -402,7 +404,6 @@ tx(db, () => {
|
||||||
starts_on: db.prepare(`SELECT date('now', '-14 days') AS d`).get().d,
|
starts_on: db.prepare(`SELECT date('now', '-14 days') AS d`).get().d,
|
||||||
ends_on: db.prepare(`SELECT date('now', '+90 days') AS d`).get().d,
|
ends_on: db.prepare(`SELECT date('now', '+90 days') AS d`).get().d,
|
||||||
location_label: "Online",
|
location_label: "Online",
|
||||||
is_online: 1,
|
|
||||||
color: "#138ba0",
|
color: "#138ba0",
|
||||||
is_series: 1,
|
is_series: 1,
|
||||||
series_frequency: "weekly",
|
series_frequency: "weekly",
|
||||||
|
|
@ -416,6 +417,7 @@ tx(db, () => {
|
||||||
is_listed: LISTED,
|
is_listed: LISTED,
|
||||||
});
|
});
|
||||||
insert("event_hosts", { event_id: SERIES, org_id: GROUP, sort_order: 0 });
|
insert("event_hosts", { event_id: SERIES, org_id: GROUP, sort_order: 0 });
|
||||||
|
insert("event_tags", { event_id: SERIES, tag_id: "online" });
|
||||||
links("event", SERIES, [{ kind: "action", label: "Join on Zoom", url: "https://example.org/zoom" }]);
|
links("event", SERIES, [{ kind: "action", label: "Join on Zoom", url: "https://example.org/zoom" }]);
|
||||||
blocks("event", SERIES, "card", cardText("series"));
|
blocks("event", SERIES, "card", cardText("series"));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -160,12 +160,42 @@ export function paragraphs(blocks = []) {
|
||||||
underlying rows are the same table.
|
underlying rows are the same table.
|
||||||
───────────────────────────────────────────────────────────── */
|
───────────────────────────────────────────────────────────── */
|
||||||
|
|
||||||
|
/* ── Tags (070_tags.sql) ───────────────────────────────────────
|
||||||
|
Sets `tags` ([{ id, name }], in the record's order) on each of
|
||||||
|
these shaped organizations or events, in one query. */
|
||||||
|
const TAG_TABLES = { organization: ["organization_tags", "org_id"], event: ["event_tags", "event_id"] };
|
||||||
|
|
||||||
|
export function attachTags(db, kind, records) {
|
||||||
|
if (records.length === 0) return;
|
||||||
|
const [table, owner] = TAG_TABLES[kind];
|
||||||
|
const rows = db
|
||||||
|
.prepare(
|
||||||
|
`SELECT x.${owner} AS owner_id, t.id, t.name
|
||||||
|
FROM ${table} x
|
||||||
|
JOIN tags t ON t.id = x.tag_id
|
||||||
|
WHERE x.${owner} IN (${placeholders(records.length)})
|
||||||
|
ORDER BY x.sort_order, t.sort_order, t.name`,
|
||||||
|
)
|
||||||
|
.all(...records.map((record) => record.id));
|
||||||
|
for (const record of records) {
|
||||||
|
record.tags = rows.filter((row) => row.owner_id === record.id).map(({ id, name }) => ({ id, name }));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function splitLinks(links = []) {
|
export function splitLinks(links = []) {
|
||||||
|
const websites = links.filter((link) => link.kind === "website");
|
||||||
|
// An email row's URL is the address, with or without mailto:.
|
||||||
|
const emails = links
|
||||||
|
.filter((link) => link.kind === "email")
|
||||||
|
.map((link) => ({ ...link, url: link.url.replace(/^mailto:/i, "") }));
|
||||||
return {
|
return {
|
||||||
actions: links.filter((link) => link.kind === "action"),
|
actions: links.filter((link) => link.kind === "action"),
|
||||||
socials: links.filter((link) => link.kind === "social"),
|
socials: links.filter((link) => link.kind === "social"),
|
||||||
website: links.find((link) => link.kind === "website")?.url ?? null,
|
// Every one, for a record's own page; the first, for cards.
|
||||||
email: links.find((link) => link.kind === "email")?.label ?? null,
|
websites,
|
||||||
|
emails,
|
||||||
|
website: websites[0]?.url ?? null,
|
||||||
|
email: emails[0]?.url ?? null,
|
||||||
instagram:
|
instagram:
|
||||||
links.find((link) => link.platform === "instagram")?.label ?? null,
|
links.find((link) => link.platform === "instagram")?.label ?? null,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ function PlatformName({ platform, label }: { platform?: string | null; label?: s
|
||||||
|
|
||||||
export default function OrgContact({ org, accent }: { org: OrganizationRecord; accent: string }) {
|
export default function OrgContact({ org, accent }: { org: OrganizationRecord; accent: string }) {
|
||||||
const hasAny =
|
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
|
if (!hasAny) return null
|
||||||
|
|
||||||
|
|
@ -43,15 +43,14 @@ export default function OrgContact({ org, accent }: { org: OrganizationRecord; a
|
||||||
</a>
|
</a>
|
||||||
))}
|
))}
|
||||||
|
|
||||||
{/* website and email arrive as bare strings (splitLinks in
|
{/* Every website and email row, each its own button with its
|
||||||
shape.js); socials are whole link rows. */}
|
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.websites,
|
||||||
org.email ? { url: `mailto:${org.email}`, label: org.email, platform: null } : null,
|
...org.emails.map((link) => ({ ...link, url: `mailto:${link.url}` })),
|
||||||
...org.socials,
|
...org.socials,
|
||||||
]
|
].map((link) => (
|
||||||
.filter((link): link is NonNullable<typeof link> => Boolean(link))
|
|
||||||
.map((link) => (
|
|
||||||
<a
|
<a
|
||||||
key={link.url}
|
key={link.url}
|
||||||
href={link.url}
|
href={link.url}
|
||||||
|
|
|
||||||
22
src/components/Tags.tsx
Normal file
22
src/components/Tags.tsx
Normal 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>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
@ -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
|
one place that translates between the two, so adding a Mexico
|
||||||
band later means a line here and nothing in SQL.
|
band later means a line here and nothing in SQL.
|
||||||
|
|
||||||
Returns null for anything with no tile, which covers virtual
|
Returns null for anything with no tile: a group with no state
|
||||||
groups and any country not drawn.
|
(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 = {
|
const COUNTRY_AREA = {
|
||||||
CA: "CANADA", // ISO country code, not California
|
CA: "CANADA", // ISO country code, not California
|
||||||
|
|
@ -98,7 +99,6 @@ const COUNTRY_AREA = {
|
||||||
|
|
||||||
export function areaForGroup(group) {
|
export function areaForGroup(group) {
|
||||||
if (!group) return null;
|
if (!group) return null;
|
||||||
if (group.is_online) return null;
|
|
||||||
|
|
||||||
if (group.country === "US") {
|
if (group.country === "US") {
|
||||||
return AREA_BY_CODE[group.state_code] ? group.state_code : null;
|
return AREA_BY_CODE[group.state_code] ? group.state_code : null;
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ import { frontPage } from "./adminSchema/frontPage.ts";
|
||||||
import { blogPosts } from "./adminSchema/blog.ts";
|
import { blogPosts } from "./adminSchema/blog.ts";
|
||||||
import { siteSettings } from "./adminSchema/siteSettings.ts";
|
import { siteSettings } from "./adminSchema/siteSettings.ts";
|
||||||
import { personTagTypes } from "./adminSchema/personTags.ts";
|
import { personTagTypes } from "./adminSchema/personTags.ts";
|
||||||
|
import { tags } from "./adminSchema/tags.ts";
|
||||||
import { contactTypes } from "./adminSchema/contactTypes.ts";
|
import { contactTypes } from "./adminSchema/contactTypes.ts";
|
||||||
import { redirects } from "./adminSchema/redirects.ts";
|
import { redirects } from "./adminSchema/redirects.ts";
|
||||||
import {
|
import {
|
||||||
|
|
@ -43,6 +44,7 @@ export const ADMIN_ENTITIES: Record<string, any> = {
|
||||||
events,
|
events,
|
||||||
people,
|
people,
|
||||||
person_tag_types: personTagTypes,
|
person_tag_types: personTagTypes,
|
||||||
|
tags,
|
||||||
contact_types: contactTypes,
|
contact_types: contactTypes,
|
||||||
redirects,
|
redirects,
|
||||||
teams,
|
teams,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { mediaUrl } from "../media.ts";
|
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 ──────────────────────────────────────────────────── */
|
/* ── Events ──────────────────────────────────────────────────── */
|
||||||
|
|
||||||
|
|
@ -178,6 +178,7 @@ export const events = {
|
||||||
|
|
||||||
children: [
|
children: [
|
||||||
hostsChild,
|
hostsChild,
|
||||||
|
tagsChild,
|
||||||
{
|
{
|
||||||
key: "event_people",
|
key: "event_people",
|
||||||
label: "People at this event",
|
label: "People at this event",
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { mediaUrl } from "../media.ts";
|
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 ───────────────────────────────────────────── */
|
/* ── Organizations ───────────────────────────────────────────── */
|
||||||
|
|
||||||
|
|
@ -89,6 +89,7 @@ export const organizations = {
|
||||||
],
|
],
|
||||||
|
|
||||||
children: [
|
children: [
|
||||||
|
tagsChild,
|
||||||
{
|
{
|
||||||
key: "region_areas",
|
key: "region_areas",
|
||||||
label: "Map areas",
|
label: "Map areas",
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ export const PLACE_FIELDS = [
|
||||||
{ path: "location_label", label: "Display location", help: "Overrides the line built from city and state" },
|
{ path: "location_label", label: "Display location", help: "Overrides the line built from city and state" },
|
||||||
{ path: "latitude", label: "Latitude", widget: "number" },
|
{ path: "latitude", label: "Latitude", widget: "number" },
|
||||||
{ path: "longitude", label: "Longitude", 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" };
|
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. */
|
/* The two collections every entity carries. */
|
||||||
export const linksChild = {
|
export const linksChild = {
|
||||||
key: "links",
|
key: "links",
|
||||||
|
|
|
||||||
32
src/lib/adminSchema/tags.ts
Normal file
32
src/lib/adminSchema/tags.ts
Normal 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" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
@ -114,6 +114,9 @@ export type EventAward = {
|
||||||
citation?: string | null
|
citation?: string | null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** A descriptor tag (070_tags.sql), eg. Online or In-Person. */
|
||||||
|
export type Tag = { id: string; name: string }
|
||||||
|
|
||||||
export type EventRecord = {
|
export type EventRecord = {
|
||||||
id: string
|
id: string
|
||||||
/** Whose gathering it is: an event_scopes id. */
|
/** Whose gathering it is: an event_scopes id. */
|
||||||
|
|
@ -133,7 +136,10 @@ export type EventRecord = {
|
||||||
locality?: string | null
|
locality?: string | null
|
||||||
state_code?: string | null
|
state_code?: string | null
|
||||||
country?: string | null
|
country?: string | null
|
||||||
|
/** The event carries the "online" tag (v_events). */
|
||||||
is_online: boolean
|
is_online: boolean
|
||||||
|
/** Its tags: on the event's own page only. */
|
||||||
|
tags?: Tag[]
|
||||||
org_logo?: string | null
|
org_logo?: string | null
|
||||||
event_logo?: string | null
|
event_logo?: string | null
|
||||||
color?: string | null
|
color?: string | null
|
||||||
|
|
@ -231,13 +237,17 @@ export type OrganizationRecord = {
|
||||||
state_code?: string | null
|
state_code?: string | null
|
||||||
country?: string | null
|
country?: string | null
|
||||||
location_label?: string | null
|
location_label?: string | null
|
||||||
is_online: boolean
|
tags: Tag[]
|
||||||
description: string[]
|
description: string[]
|
||||||
blocks: ContentBlock[]
|
blocks: ContentBlock[]
|
||||||
links: Link[]
|
links: Link[]
|
||||||
socials: Link[]
|
socials: Link[]
|
||||||
/* splitLinks in shape.js lifts these out as bare strings: the
|
/** Every website and email row (an email's url is the bare address). */
|
||||||
website's url, the email's label, the instagram handle. */
|
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
|
website?: string | null
|
||||||
email?: string | null
|
email?: string | null
|
||||||
instagram?: string | null
|
instagram?: string | null
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ import PageShell, { type ShellSection } from '../components/PageShell.tsx'
|
||||||
import PageState from '../components/PageState.tsx'
|
import PageState from '../components/PageState.tsx'
|
||||||
import PlatformIcon from '../components/PlatformIcon.tsx'
|
import PlatformIcon from '../components/PlatformIcon.tsx'
|
||||||
import ContentBlocks from '../components/ContentBlocks.tsx'
|
import ContentBlocks from '../components/ContentBlocks.tsx'
|
||||||
|
import Tags from '../components/Tags.tsx'
|
||||||
import PeopleTiles, { type PeopleGroupInput } from '../components/PeopleTiles.tsx'
|
import PeopleTiles, { type PeopleGroupInput } from '../components/PeopleTiles.tsx'
|
||||||
import {
|
import {
|
||||||
useEvent,
|
useEvent,
|
||||||
|
|
@ -243,8 +244,7 @@ export default function EventDetail() {
|
||||||
function Facts({ event, accent }: { event: EventRecord; accent: string }) {
|
function Facts({ event, accent }: { event: EventRecord; accent: string }) {
|
||||||
const where =
|
const where =
|
||||||
event.location_label ||
|
event.location_label ||
|
||||||
[event.locality, event.state_code].filter(Boolean).join(', ') ||
|
[event.locality, event.state_code].filter(Boolean).join(', ')
|
||||||
(event.is_online ? 'Online' : null)
|
|
||||||
|
|
||||||
const schedule = seriesLabel(event.series, event.starts_on)
|
const schedule = seriesLabel(event.series, event.starts_on)
|
||||||
// A series with no label of its own is described by its schedule
|
// 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>}
|
{when && <span style={{ color: BODY }}>{when}</span>}
|
||||||
{schedule && <span style={{ color: BODY }}>{schedule}</span>}
|
{schedule && <span style={{ color: BODY }}>{schedule}</span>}
|
||||||
{where && <span style={{ color: BODY }}>{where}</span>}
|
{where && <span style={{ color: BODY }}>{where}</span>}
|
||||||
{event.is_online && where !== 'Online' && (
|
<Tags tags={event.tags} accent={accent} />
|
||||||
<span style={{ color: BODY }}>Online too</span>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{(event.hosts?.length ?? 0) > 0 && (
|
{(event.hosts?.length ?? 0) > 0 && (
|
||||||
<span style={{ color: BODY }}>
|
<span style={{ color: BODY }}>
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@
|
||||||
Organization page); its contact buttons are OrgContact.
|
Organization page); its contact buttons are OrgContact.
|
||||||
═══════════════════════════════════════════════════════════════ */
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
||||||
|
import type { ReactNode } from 'react'
|
||||||
import { Link, Navigate, useLocation, useParams } from 'react-router-dom'
|
import { Link, Navigate, useLocation, useParams } from 'react-router-dom'
|
||||||
|
|
||||||
import PageShell from '../components/PageShell.tsx'
|
import PageShell from '../components/PageShell.tsx'
|
||||||
|
|
@ -21,6 +22,7 @@ import PageState from '../components/PageState.tsx'
|
||||||
import ContentBlocks from '../components/ContentBlocks.tsx'
|
import ContentBlocks from '../components/ContentBlocks.tsx'
|
||||||
import OrgTeams, { hasTeams } from '../components/OrgTeams.tsx'
|
import OrgTeams, { hasTeams } from '../components/OrgTeams.tsx'
|
||||||
import OrgContact from '../components/OrgContact.tsx'
|
import OrgContact from '../components/OrgContact.tsx'
|
||||||
|
import Tags from '../components/Tags.tsx'
|
||||||
import EventListCards from './sections/EventList-Cards.tsx'
|
import EventListCards from './sections/EventList-Cards.tsx'
|
||||||
import {
|
import {
|
||||||
useOrganization,
|
useOrganization,
|
||||||
|
|
@ -220,6 +222,12 @@ export default function OrganizationDetail() {
|
||||||
|
|
||||||
/* ── Pieces ──────────────────────────────────────────────────── */
|
/* ── 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({
|
function Facts({
|
||||||
org,
|
org,
|
||||||
accent,
|
accent,
|
||||||
|
|
@ -229,50 +237,49 @@ function Facts({
|
||||||
}) {
|
}) {
|
||||||
const where =
|
const where =
|
||||||
org.location_label || [org.locality, org.state_code].filter(Boolean).join(', ')
|
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'
|
||||||
|
|
||||||
return (
|
const facts = ([
|
||||||
<div className="flex flex-wrap items-center gap-x-6 gap-y-3 text-sm">
|
['City', where],
|
||||||
{where && <span style={{ color: BODY }}>{where}</span>}
|
[
|
||||||
|
'Part of',
|
||||||
{org.kind === 'group' && org.details.region_id && (
|
group?.region_id && (
|
||||||
<span style={{ color: BODY }}>
|
<Link to={orgHref(group.region_id, 'region')} className={link} style={{ color: accentText(group.region_color || accent) }}>
|
||||||
Part of{' '}
|
{regionName(group.region_name)}
|
||||||
<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>
|
</Link>
|
||||||
</span>
|
),
|
||||||
)}
|
],
|
||||||
|
[
|
||||||
{org.kind === 'group' && org.details.ministry_name && (
|
'Ministry',
|
||||||
<span style={{ color: BODY }}>
|
group?.ministry_name &&
|
||||||
Ministry:{' '}
|
(group.ministry_url ? (
|
||||||
{org.details.ministry_url ? (
|
<a href={group.ministry_url} target="_blank" rel="noreferrer" className={link} style={{ color: accentText(accent) }}>
|
||||||
<a
|
{group.ministry_name}
|
||||||
href={org.details.ministry_url}
|
|
||||||
target="_blank"
|
|
||||||
rel="noreferrer"
|
|
||||||
className="font-medium hover:underline"
|
|
||||||
style={{ color: accentText(accent) }}
|
|
||||||
>
|
|
||||||
{org.details.ministry_name}
|
|
||||||
</a>
|
</a>
|
||||||
) : (
|
) : (
|
||||||
org.details.ministry_name
|
group.ministry_name
|
||||||
)}
|
)),
|
||||||
</span>
|
],
|
||||||
)}
|
['Meets', group?.meets],
|
||||||
|
['Since', group?.started],
|
||||||
|
] as [string, ReactNode][]).filter(([, value]) => Boolean(value))
|
||||||
|
|
||||||
{org.kind === 'group' && org.details.meets && (
|
if (facts.length === 0 && org.tags.length === 0) return null
|
||||||
<span style={{ color: BODY }}>Meets {org.details.meets}</span>
|
|
||||||
|
return (
|
||||||
|
<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.started && (
|
<Tags tags={org.tags} accent={accent} className={facts.length > 0 ? 'mt-4' : ''} />
|
||||||
<span style={{ color: BODY }}>Since {org.details.started}</span>
|
|
||||||
)}
|
|
||||||
{org.is_online && <span style={{ color: BODY }}>Online</span>}
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,11 @@ export const DATA_NAV = {
|
||||||
label: "People tags",
|
label: "People tags",
|
||||||
blurb: "Directories people can be tagged into, eg. Musicians. Who carries a tag is edited on the person.",
|
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",
|
to: "/admin/redirects",
|
||||||
label: "Links/redirects",
|
label: "Links/redirects",
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import { useOrganization } from "../../lib/useContent.ts";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import ArrowLink from "../../components/ArrowLink.tsx";
|
import ArrowLink from "../../components/ArrowLink.tsx";
|
||||||
import OrgLogo from "../../components/OrgLogo.tsx";
|
import OrgLogo from "../../components/OrgLogo.tsx";
|
||||||
|
import Tags from "../../components/Tags.tsx";
|
||||||
import { orgPath } from "../../lib/organizations.ts";
|
import { orgPath } from "../../lib/organizations.ts";
|
||||||
import { AREAS, AREA_NAMES } from "../../data/mapGrid.ts";
|
import { AREAS, AREA_NAMES } from "../../data/mapGrid.ts";
|
||||||
import { accentText, readableOn } from '../../lib/color.ts'
|
import { accentText, readableOn } from '../../lib/color.ts'
|
||||||
|
|
@ -467,6 +468,7 @@ function RegionBlock({
|
||||||
{c.location_label}
|
{c.location_label}
|
||||||
{c.meets ? ` · ${c.meets}` : ""}
|
{c.meets ? ` · ${c.meets}` : ""}
|
||||||
</p>
|
</p>
|
||||||
|
<Tags tags={c.tags} accent={colorOf(region)} className="mt-1.5" />
|
||||||
{(c.website || c.email) && (
|
{(c.website || c.email) && (
|
||||||
<p className="text-sm mt-1 flex gap-4">
|
<p className="text-sm mt-1 flex gap-4">
|
||||||
{c.website && (
|
{c.website && (
|
||||||
|
|
@ -563,6 +565,7 @@ function GroupCard({ group, color, open, onOpen }) {
|
||||||
{group.meets}
|
{group.meets}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
|
<Tags tags={group.tags} accent={color} className="mt-1.5" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Two controls, two destinations: the chevron opens the
|
{/* Two controls, two destinations: the chevron opens the
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue