People directories, ministries, organization contacts (migrations 062 to 064)
- People tags (062): Data → People tags (Musicians seeded); a person's Directories repeater tags them and their Specialty line shows on their tile. A People directory section preset shows a tag's first 12 and links to its full page, /directory/<tag>, with page meta and a sitemap entry. Tiles' details panels show a person's links. - Ministries (063): a new organization kind. A group picks its ministry and its page says "Ministry: <name>", linked to the ministry's website. Ministries have no public page, list, sitemap or timeline entry, and aren't offered where a record links to its organization. organizations is rebuilt for the kind CHECK. - Organization contacts (064): Data → Contact types; a private Contacts repeater on each organization (editors and up, readRole on a child collection). Tools → Newsletter → Recipients filters them by type, kind, region and published and downloads a Mailchimp CSV. - A trigger refusing a save with a sentence is shown as that message. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
07e56bfd20
commit
0ed7315156
38 changed files with 1108 additions and 29 deletions
50
src/pages/DirectoryPage.tsx
Normal file
50
src/pages/DirectoryPage.tsx
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
/* ═══════════════════════════════════════════════════════════════
|
||||
DIRECTORY PAGE: /directory/:id
|
||||
|
||||
A people tag's full directory (Data → People tags), eg.
|
||||
/directory/musician: its name and intro, then everyone carrying
|
||||
the tag (PeopleDirectory, no limit). A page section can show the
|
||||
first of them with the People directory preset, linking here.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
import { useParams } from 'react-router-dom'
|
||||
|
||||
import PageShell from '../components/PageShell.tsx'
|
||||
import PageState from '../components/PageState.tsx'
|
||||
import PeopleDirectory from './sections/PeopleDirectory.tsx'
|
||||
import { useDirectory } from '../lib/useDirectory.ts'
|
||||
import { BRAND } from '../lib/color.ts'
|
||||
|
||||
export default function DirectoryPage() {
|
||||
const { id } = useParams()
|
||||
const { data: directory, loading, error, notFound, reload } = useDirectory(id)
|
||||
|
||||
if (!directory) {
|
||||
return (
|
||||
<PageState
|
||||
loading={loading}
|
||||
error={error}
|
||||
notFound={notFound}
|
||||
onRetry={reload}
|
||||
noun="directory"
|
||||
backTo="/community"
|
||||
backLabel="Community"
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<PageShell
|
||||
title={directory.name}
|
||||
intro={directory.blurb ?? undefined}
|
||||
sections={[
|
||||
{
|
||||
id: 'people',
|
||||
title: '',
|
||||
accent: BRAND,
|
||||
content: <PeopleDirectory tag={directory.id} accent={BRAND} />,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
|
@ -251,6 +251,25 @@ function Facts({
|
|||
</span>
|
||||
)}
|
||||
|
||||
{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>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ import OrgListCards from './sections/OrgList-Card.tsx'
|
|||
import EventListCards, { EventCardsToggle } from './sections/EventList-Cards.tsx'
|
||||
import CommunityBlog from './sections/CommunityBlog.tsx'
|
||||
import HistoryTimeline from './sections/history/HistoryTimeline.tsx'
|
||||
import PeopleDirectory, { DIRECTORY_PREVIEW } from './sections/PeopleDirectory.tsx'
|
||||
|
||||
/* Year the program starts: decades ending before it get the
|
||||
pre-program look on the timeline. */
|
||||
|
|
@ -84,6 +85,10 @@ const PRESETS: Record<string, (section: SitePageSection) => Record<string, any>>
|
|||
},
|
||||
}),
|
||||
timeline: () => ({ Component: Timeline }),
|
||||
people_directory: (section) => ({
|
||||
Component: PeopleDirectory,
|
||||
props: { tag: section.tag_id, limit: DIRECTORY_PREVIEW },
|
||||
}),
|
||||
}
|
||||
|
||||
export default function SitePage({ id }: { id: string }) {
|
||||
|
|
|
|||
|
|
@ -14,6 +14,9 @@
|
|||
unpublished blog post: its blocks and picks as the post's body,
|
||||
opened in the post's editor to finish.
|
||||
|
||||
Under it, Recipients exports organization contacts as a mailing
|
||||
list (NewsletterRecipients.tsx), for editors and up.
|
||||
|
||||
Picked blog posts are read from their public pages, so only a
|
||||
post visitors can open makes it in, with its excerpt and cover.
|
||||
Links and images are the live site's (SITE_ORIGIN), since an
|
||||
|
|
@ -30,6 +33,7 @@ import { canDelete, canWrite } from '../../lib/roles.ts'
|
|||
import { slugify } from '../../lib/adminSchema.ts'
|
||||
import { blocksChild, BLOCK_TYPES } from '../../lib/adminSchema/shared.ts'
|
||||
import { Repeater } from '../../components/admin/fields.tsx'
|
||||
import NewsletterRecipients from '../../components/admin/NewsletterRecipients.tsx'
|
||||
import { useEvents } from '../../lib/eventData.ts'
|
||||
import { useFrontPage, type FeaturedCard } from '../../lib/useFrontPage.ts'
|
||||
import type { BlogPostRecord } from '../../lib/useBlog.ts'
|
||||
|
|
@ -603,6 +607,8 @@ export default function AdminNewsletter() {
|
|||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{canWrite(user) && <NewsletterRecipients />}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,6 +60,11 @@ export const DATA_NAV = {
|
|||
label: "Organizations",
|
||||
blurb: "The national organization, regions, groups and partners.",
|
||||
},
|
||||
{
|
||||
to: "/admin/contact_types",
|
||||
label: "Contact types",
|
||||
blurb: "Roles an organization's contacts hold, eg. Minister. Contacts are added on the organization.",
|
||||
},
|
||||
{
|
||||
to: "/admin/teams",
|
||||
label: "Teams",
|
||||
|
|
@ -75,6 +80,11 @@ export const DATA_NAV = {
|
|||
label: "People",
|
||||
blurb: "Bios, contact details, affiliations and awards received.",
|
||||
},
|
||||
{
|
||||
to: "/admin/person_tag_types",
|
||||
label: "People tags",
|
||||
blurb: "Directories people can be tagged into, eg. Musicians. Who carries a tag is edited on the person.",
|
||||
},
|
||||
{
|
||||
to: "/admin/blog_posts",
|
||||
label: "Blog posts",
|
||||
|
|
|
|||
80
src/pages/sections/PeopleDirectory.tsx
Normal file
80
src/pages/sections/PeopleDirectory.tsx
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
/* ═══════════════════════════════════════════════════════════════
|
||||
PEOPLE DIRECTORY
|
||||
|
||||
A tag's people (Data → People tags, eg. Musicians) as person
|
||||
tiles: the People directory preset on a page, and the whole list
|
||||
on the tag's own page (DirectoryPage.tsx, /directory/:id).
|
||||
|
||||
<PeopleDirectory tag="musician" limit={DIRECTORY_PREVIEW} />
|
||||
|
||||
Each tile's line under the name is the person's specialty (eg.
|
||||
"Vocals, piano · Gospel, folk"), or their tagline without one;
|
||||
their details panel adds their links. With a limit, the first that
|
||||
many show and a link leads to the full directory.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
import { ArrowRight } from '@phosphor-icons/react'
|
||||
import { Link } from 'react-router-dom'
|
||||
|
||||
import { PeopleTilesView } from '../../components/PeopleTiles.tsx'
|
||||
import { useDirectory } from '../../lib/useDirectory.ts'
|
||||
import { accentText, BRAND } from '../../lib/color.ts'
|
||||
|
||||
/* How many people a section shows before "See the full directory". */
|
||||
export const DIRECTORY_PREVIEW = 12
|
||||
|
||||
export const directoryHref = (tag: string) => `/directory/${encodeURIComponent(tag)}`
|
||||
|
||||
type PeopleDirectoryProps = {
|
||||
tag?: string | null
|
||||
/** Show this many, then a link to the full directory. */
|
||||
limit?: number
|
||||
accent?: string
|
||||
}
|
||||
|
||||
export default function PeopleDirectory({ tag, limit, accent = BRAND }: PeopleDirectoryProps) {
|
||||
const { data: directory, loading, error, notFound } = useDirectory(tag ?? undefined)
|
||||
|
||||
if (!tag || notFound) {
|
||||
return (
|
||||
<div className="mx-auto max-w-6xl px-6">
|
||||
<p className="notice">· This directory isn’t set up yet ·</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
if (!directory) {
|
||||
return (
|
||||
<div className="mx-auto max-w-6xl px-6">
|
||||
{error ? (
|
||||
<p className="text-danger">Couldn’t load the directory. {error}</p>
|
||||
) : (
|
||||
loading && <div className="skeleton" role="status" aria-label="Loading the directory" />
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const people = directory.people.map((person) => ({ ...person, title: person.specialty || person.tagline }))
|
||||
const shown = limit ? people.slice(0, limit) : people
|
||||
|
||||
return (
|
||||
<div className="mx-auto max-w-6xl px-6">
|
||||
<PeopleTilesView
|
||||
groups={[{ id: directory.id, people: shown }]}
|
||||
accent={accent}
|
||||
emptyMessage={`No ${directory.name.toLowerCase()} listed yet.`}
|
||||
/>
|
||||
{limit && people.length > 0 && (
|
||||
<Link
|
||||
to={directoryHref(directory.id)}
|
||||
className="mt-8 inline-block btn border px-5 py-2 text-sm transition-colors hover:bg-tint"
|
||||
style={{ borderColor: accent, color: accentText(accent) }}
|
||||
>
|
||||
{people.length > limit ? `See all ${people.length} ${directory.name.toLowerCase()}` : 'Open the full directory'}{' '}
|
||||
<ArrowRight size="1em" weight="bold" className="inline align-[-0.125em]" aria-hidden="true" />
|
||||
</Link>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue