Add a blog: posts at /blog/:id and a Community page section

Admin → Blog → Posts (migration 031): our own posts with a
content-block body, cover image, excerpt, date, tags, and authors
shown as person tiles, either People records or a guest name and
photo. A post is a draft until published; Listed works as it does
elsewhere. Posts are on the QR page too.

Admin → Blog → Community section: the first section of the
Community page, with its heading and blurb from the admin, in two
halves, each pinned first and then newest up to its slots. Our posts
come from blog_posts; community posts are pinned link or video cards
(reusing featured cards and Fetch preview), then the newest items
from a list of RSS or Atom feeds. Feeds are read through the link
preview's guarded fetch and cached for 30 minutes, and a failing feed
keeps its last good items.

content_blocks and featured_cards are rebuilt to accept the new owner
kinds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-09-27 16:27:00 -05:00
parent d4f65d93b4
commit d374f9ac17
21 changed files with 1275 additions and 15 deletions

114
src/pages/BlogPost.tsx Normal file
View file

@ -0,0 +1,114 @@
/* ═══════════════════════════════════════════════════════════════
BLOG POST: /blog/:id
One of our own posts: cover, date and tags, the content-block
body, then its authors as person tiles. Authors are published
people (linked to their pages) and, when the post names one, a
guest with no people record (a tile that links nowhere).
There's no /blog index on purpose: the Community page's blog
section is where posts are listed, so "back" goes there.
═══════════════════════════════════════════════════════════════ */
import { Link, useParams } from 'react-router-dom'
import PageShell, { type ShellSection } from '../components/PageShell.tsx'
import PageState from '../components/PageState.tsx'
import ContentBlocks from '../components/ContentBlocks.tsx'
import PeopleTiles from '../components/PeopleTiles.tsx'
import { blogImage, personPhoto } from '../lib/media.ts'
import { postDate, useBlogPost } from '../lib/useBlog.ts'
const ACCENT = '#138ba0'
const BODY = '#4a6b72'
/* Where "back" goes: the section on the Community page. */
const BACK = { to: '/community#blog', label: 'Community Blog' }
export default function BlogPost() {
const { id } = useParams()
const { data: post, loading, error, notFound, reload } = useBlogPost(id)
if (!post) {
return (
<PageState
loading={loading}
error={error}
notFound={notFound}
onRetry={reload}
noun="post"
backTo={BACK.to}
backLabel={BACK.label}
/>
)
}
const date = postDate(post.published_on)
const cover = blogImage(post.cover_image)
const byline = [
...post.authors.map((author) => author.name),
...(post.guest ? [post.guest.name] : []),
].join(', ')
const authors = [
...post.authors.map((author) => ({
id: author.id,
name: author.name,
tagline: author.tagline,
pronouns: author.pronouns,
photo: personPhoto(author.photo),
})),
...(post.guest ? [{ name: post.guest.name, title: 'Guest author', photo: blogImage(post.guest.photo) }] : []),
]
const sections: ShellSection[] = [
{
id: 'post',
title: 'Post',
accent: ACCENT,
background: '#ffffff',
content: (
<article className="mx-auto max-w-3xl space-y-8 px-6">
<div className="flex flex-wrap items-center gap-x-4 gap-y-2 text-sm" style={{ color: BODY }}>
{date && <time dateTime={post.published_on ?? undefined}>{date}</time>}
{byline && <span>By {byline}</span>}
{post.tags.map((tag) => (
<span
key={tag}
className="rounded-full px-3 py-0.5 text-xs font-semibold"
style={{ background: '#eef9fb', color: ACCENT }}
>
{tag}
</span>
))}
<Link to={BACK.to} className="ml-auto hover:underline" style={{ color: ACCENT }}>
{BACK.label}
</Link>
</div>
{cover && (
<img src={cover} alt="" className="aspect-video w-full rounded-2xl object-cover" />
)}
<ContentBlocks blocks={post.blocks} accent={ACCENT} />
</article>
),
},
]
if (authors.length > 0) {
sections.push({
id: 'authors',
title: authors.length === 1 ? 'About the author' : 'About the authors',
accent: ACCENT,
background: '#eef9fb',
content: (
<div className="mx-auto max-w-6xl px-6">
<PeopleTiles size="md" accent={ACCENT} people={authors} />
</div>
),
})
}
return <PageShell title={post.title} intro={post.excerpt ?? undefined} sections={sections} />
}