Your wording pass on adminSchema.ts and fields.tsx: "Default: ..."
blank options, "eg." examples, "URL ID" for slugs, and relabelled
front page sections, stat sources and hero fields.
On top of it:
- Content block row titles end with an ellipsis when the paragraph
is cut. preview() in src/lib/text.ts does it for anything that
shortens text: it collapses whitespace, cuts on a word and adds
"..." only when it actually shortened.
- No em-dashes in the editor, front end or server: placeholders
("Internal note: ..."), the Organizations blurb, the URL ID help,
empty table cells (now "-"), the Award dropdown ("Torch Award
(NGU)" in OPTION_QUERIES), a boot error message, and every comment
in the admin files. Also cleared from the files added this branch
(QR page, directory route, embeds, hero, migration 024), and the
QR page's team labels read "Board (NGU)".
- A few comments where removing the dash had run two sentences
together get a comma, colon or parentheses back.
- docs/updating-data-in-code.md matches the new labels and gains a
"Writing text in the editor" section with these conventions;
CLAUDE.md lists them under Rules and gotchas.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
77 lines
2.5 KiB
JavaScript
77 lines
2.5 KiB
JavaScript
/* ═══════════════════════════════════════════════════════════════
|
|
DIRECTORY ROUTE: read-only, mounted under /api
|
|
|
|
GET /directory every public record that has a page
|
|
|
|
One flat list per kind, each row just enough to name a record
|
|
and build its URL: id and name, plus the organization's kind,
|
|
which decides whether its page is /regions, /chapters or
|
|
/partners. The QR code page reads it to offer "any page on the
|
|
site" without five list requests carrying descriptions, links
|
|
and blocks it would throw away.
|
|
|
|
Each list applies the same visibility rule as that record's own
|
|
page, so nothing here leads to a 404:
|
|
|
|
events published
|
|
organizations published
|
|
teams published, and so is the organization
|
|
awards published
|
|
people published
|
|
|
|
The site already serves each of these at its own URL; this only
|
|
lists them in one place.
|
|
═══════════════════════════════════════════════════════════════ */
|
|
|
|
import { Hono } from "hono";
|
|
|
|
const directory = new Hono();
|
|
|
|
const CACHE = "public, max-age=60, stale-while-revalidate=300";
|
|
|
|
directory.get("/directory", (c) => {
|
|
const db = c.get("db");
|
|
const all = (sql) => db.prepare(sql).all();
|
|
|
|
return c.json(
|
|
{
|
|
directory: {
|
|
events: all(
|
|
`SELECT id, title AS name, starts_on
|
|
FROM events
|
|
WHERE is_published = 1
|
|
ORDER BY starts_on IS NULL, starts_on DESC, title`,
|
|
),
|
|
organizations: all(
|
|
`SELECT id, name, kind
|
|
FROM organizations
|
|
WHERE is_published = 1
|
|
ORDER BY kind, name`,
|
|
),
|
|
teams: all(
|
|
`SELECT t.id, t.name, o.name AS org_name
|
|
FROM teams t
|
|
JOIN organizations o ON o.id = t.org_id AND o.is_published = 1
|
|
WHERE t.is_published = 1
|
|
ORDER BY o.name, t.sort_order, t.name`,
|
|
),
|
|
awards: all(
|
|
`SELECT id, name
|
|
FROM awards
|
|
WHERE is_published = 1
|
|
ORDER BY name`,
|
|
),
|
|
people: all(
|
|
`SELECT id, display_name AS name
|
|
FROM people
|
|
WHERE is_published = 1
|
|
ORDER BY COALESCE(sort_name, display_name)`,
|
|
),
|
|
},
|
|
},
|
|
200,
|
|
{ "Cache-Control": CACHE },
|
|
);
|
|
});
|
|
|
|
export default directory;
|