Third audit, UI half; side nav on top; request button colors
- Event cards: lazy -640 photo, only nearby slides drawn, a counter past 12 events, past grid paged with Show more - Community map: search over list and grid, 12 per region then Show all, list no longer redrawn on hover - People tiles: one clip check for the list, Show all past 30 - Person pages: 6 events and posts then Show all; excerpts load only the first paragraph - Admin: filter box on long pickers and the QR select, options sent per form, Media thumbnails from the small copy, debounced searches that drop stale answers - Pages show their last data while refreshing after the cache TTL - Side nav stacks above page content (the carousel arrows) - No event request button on National Retreats; request buttons take their section's accent - Version v1.11.1-audit Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
11a4555683
commit
222c9e69a2
22 changed files with 686 additions and 259 deletions
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
import { Hono } from "hono";
|
||||
|
||||
import { asBool, json, loadBlocks, loadFeaturedCards, marks, paragraphs } from "../shape.js";
|
||||
import { asBool, json, loadBlocks, loadFeaturedCards, marks } from "../shape.js";
|
||||
import { readFeeds } from "../feeds.js";
|
||||
|
||||
const blog = new Hono();
|
||||
|
|
@ -64,12 +64,32 @@ function loadAuthors(db, ids) {
|
|||
return byPost;
|
||||
}
|
||||
|
||||
function shapeSummary(row, authors, body) {
|
||||
/* The first paragraph of each post with no excerpt of its own, the
|
||||
card's fallback text, by post id. Only that one row per post: a
|
||||
card doesn't need the rest of the body. */
|
||||
function firstParagraphs(db, rows) {
|
||||
const ids = rows.filter((row) => !row.excerpt).map((row) => row.id);
|
||||
if (ids.length === 0) return new Map();
|
||||
const found = db
|
||||
.prepare(
|
||||
`SELECT owner_id, text FROM (
|
||||
SELECT owner_id, text, ROW_NUMBER() OVER (PARTITION BY owner_id ORDER BY sort_order) AS n
|
||||
FROM content_blocks
|
||||
WHERE owner_kind = 'blog_post' AND slot = 'body' AND type = 'paragraph'
|
||||
AND text IS NOT NULL AND text <> ''
|
||||
AND owner_id IN (${marks(ids.length)})
|
||||
) WHERE n = 1`,
|
||||
)
|
||||
.all(...ids);
|
||||
return new Map(found.map((row) => [row.owner_id, row.text]));
|
||||
}
|
||||
|
||||
function shapeSummary(row, authors, firstParagraph) {
|
||||
return {
|
||||
id: row.id,
|
||||
title: row.title,
|
||||
// The card's text: the excerpt, else the body's first paragraph.
|
||||
excerpt: row.excerpt || paragraphs(body)[0] || null,
|
||||
excerpt: row.excerpt || firstParagraph || null,
|
||||
cover_image: row.cover_image,
|
||||
published_on: row.published_on,
|
||||
tags: splitTags(row.tags),
|
||||
|
|
@ -94,8 +114,8 @@ export function postsBy(db, personId) {
|
|||
.all(personId);
|
||||
const ids = rows.map((row) => row.id);
|
||||
const authors = loadAuthors(db, ids);
|
||||
const bodies = loadBlocks(db, "blog_post", ids, "body");
|
||||
return rows.map((row) => shapeSummary(row, authors.get(row.id) ?? [], bodies.get(row.id) ?? []));
|
||||
const first = firstParagraphs(db, rows);
|
||||
return rows.map((row) => shapeSummary(row, authors.get(row.id) ?? [], first.get(row.id)));
|
||||
}
|
||||
|
||||
/* ── One post ──────────────────────────────────────────────── */
|
||||
|
|
@ -164,7 +184,7 @@ blog.get("/community-blog", async (c) => {
|
|||
const posts = [...pinned, ...newest];
|
||||
const ids = posts.map((row) => row.id);
|
||||
const authors = loadAuthors(db, ids);
|
||||
const bodies = loadBlocks(db, "blog_post", ids, "body");
|
||||
const first = firstParagraphs(db, posts);
|
||||
|
||||
// Theirs: pinned cards, then the feeds' newest.
|
||||
const cards = loadFeaturedCards(db, "community_page", PAGE_ID);
|
||||
|
|
@ -194,7 +214,7 @@ blog.get("/community-blog", async (c) => {
|
|||
internal: {
|
||||
title: page.internal_title,
|
||||
posts: posts.map((row) =>
|
||||
shapeSummary(row, authors.get(row.id) ?? [], bodies.get(row.id) ?? []),
|
||||
shapeSummary(row, authors.get(row.id) ?? [], first.get(row.id)),
|
||||
),
|
||||
},
|
||||
external: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue