Tidy the admin editor's text: previews, blank options, no em-dashes
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>
This commit is contained in:
parent
e35d09b172
commit
54bf649b8d
31 changed files with 239 additions and 187 deletions
|
|
@ -2,7 +2,7 @@ import PageShell from '../components/PageShell.tsx'
|
|||
import QrCodeMaker from './sections/QrCodeMaker.tsx'
|
||||
|
||||
/* ═══════════════════════════════════════════════════════════════
|
||||
QR CODES PAGE — /qr
|
||||
QR CODES PAGE: /qr
|
||||
|
||||
A QR code for any page on the site, for flyers, slides and
|
||||
signs. Unlisted: not in navConfig, so neither the header nor the
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/* ═══════════════════════════════════════════════════════════════
|
||||
ADMIN — FEEDBACK TRIAGE
|
||||
ADMIN: FEEDBACK TRIAGE
|
||||
|
||||
Reads /api/admin/feedback, writes status and notes back through
|
||||
PATCH, and deletes through DELETE. Deliberately a flat list
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
Two capabilities, two ranks. Editors and above can change a
|
||||
status or leave a note; deleting is admin and above, matching
|
||||
requireRole on the server. Both come from the roles ladder
|
||||
rather than an equality check — a superadmin is not role ===
|
||||
rather than an equality check: a superadmin is not role ===
|
||||
"admin", and reading it that way is what hid these controls.
|
||||
|
||||
Every read passes ttl: 0. The api cache exists for public
|
||||
|
|
@ -156,7 +156,7 @@ function FeedbackCard({ row, onChange, onRemove, canWrite, canRemove }) {
|
|||
rows={2}
|
||||
value={note}
|
||||
disabled={busy}
|
||||
placeholder="Internal note — who's handling it, what was done"
|
||||
placeholder="Internal note: who's handling it, what was done"
|
||||
onChange={(e) => setNote(e.target.value)}
|
||||
className="mt-3 w-full resize-y rounded-lg border border-[#4a6b72]/25 bg-white px-3 py-2 text-sm text-[#26454c] outline-none focus:border-[#138ba0] focus:ring-2 focus:ring-[#138ba0]/25"
|
||||
/>
|
||||
|
|
@ -238,7 +238,7 @@ export default function AdminFeedback() {
|
|||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState<any>(null);
|
||||
|
||||
// Minimums, not equality — see lib/roles.ts.
|
||||
// Minimums, not equality; see lib/roles.ts.
|
||||
const canWrite = roleCanWrite(user);
|
||||
const canRemove = canDelete(user);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
/* ═══════════════════════════════════════════════════════════════
|
||||
ADMIN HOME
|
||||
|
||||
Where login lands. Two columns: the cards are the navigation —
|
||||
the header deliberately drops its tab row here so the same links
|
||||
aren't drawn twice — and a standing info panel on the right.
|
||||
Where login lands. Two columns: the cards are the navigation
|
||||
(the header deliberately drops its tab row here so the same links
|
||||
aren't drawn twice), and a standing info panel on the right.
|
||||
|
||||
The cards come from adminNav.ts, the same list the CMS header
|
||||
reads, so a new entity shows up here the moment it's registered.
|
||||
|
|
@ -31,7 +31,7 @@ import { CMS_NAV, FORMS_NAV, PANEL_NAV, target } from "./adminNav.ts";
|
|||
function NavCard({ item }) {
|
||||
const to = target(item);
|
||||
|
||||
// Drop the child that just repeats the card's own destination —
|
||||
// Drop the child that just repeats the card's own destination:
|
||||
// "All organizations" under Organizations.
|
||||
const extras = (item.children ?? []).filter((child) => child.to !== to);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
ADMIN LAYOUT
|
||||
|
||||
Bare on purpose. No PageShell, no announcement banner, no
|
||||
footer site map — none of that belongs around a staff tool, and
|
||||
footer site map. None of that belongs around a staff tool, and
|
||||
/admin should never appear in navConfig.
|
||||
|
||||
Three areas share this chrome: Home, the CMS and the Panel. The
|
||||
|
|
@ -11,8 +11,8 @@
|
|||
|
||||
The tab row is drawn everywhere except Home, where the card grid
|
||||
is the navigation and drawing both would say the same thing
|
||||
twice. Which tabs appear depends on the signed-in user —
|
||||
navFor() drops the superadmin-only ones — but that's cosmetics.
|
||||
twice. Which tabs appear depends on the signed-in user
|
||||
(navFor() drops the superadmin-only ones), but that's cosmetics.
|
||||
The route guard and the API are what actually say no.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
|
|
@ -53,7 +53,7 @@ export default function AdminLayout() {
|
|||
matches(pathname, child.to),
|
||||
);
|
||||
|
||||
// What the page below has published about itself — a record
|
||||
// What the page below has published about itself: a record
|
||||
// name, or null on a list. setDetail is stable so publishing
|
||||
// can't loop.
|
||||
const [detail, setDetail] = useState<any>(null);
|
||||
|
|
|
|||
|
|
@ -8,13 +8,13 @@
|
|||
|
||||
Three blocks, deliberately boring:
|
||||
|
||||
System — what's actually running, for when something is off
|
||||
Content — row counts, the cheapest "is the database there"
|
||||
Accounts — roles, access and live sessions
|
||||
System what's actually running, for when something is off
|
||||
Content row counts, the cheapest "is the database there"
|
||||
Accounts roles, access and live sessions
|
||||
|
||||
The role select is driven by ROLES from lib/roles.ts, so a new
|
||||
rung on the ladder appears here without this file changing. The
|
||||
legend beside it is the same list — four roles is past the
|
||||
legend beside it is the same list: four roles is past the
|
||||
point where "Editor" explains itself.
|
||||
|
||||
Every account write signs that person out, which the server
|
||||
|
|
@ -30,18 +30,18 @@ import { isUnauthorized, useAuth } from "../../lib/auth.tsx";
|
|||
import { useNavigate } from "react-router-dom";
|
||||
import { ROLES, ROLE_LABELS, ROLE_NOTES } from "../../lib/roles.ts";
|
||||
|
||||
/* SQLite hands back "2026-09-22 04:11:07" — UTC, but without the
|
||||
/* SQLite hands back "2026-09-22 04:11:07": UTC, but without the
|
||||
marker that says so. Left alone, browsers read it as local time
|
||||
and last-login drifts by the timezone offset. */
|
||||
function when(value) {
|
||||
if (!value) return "—";
|
||||
if (!value) return "-";
|
||||
const iso = value.includes("T") ? value : `${value.replace(" ", "T")}Z`;
|
||||
const date = new Date(iso);
|
||||
return Number.isNaN(date.getTime()) ? value : date.toLocaleString();
|
||||
}
|
||||
|
||||
function uptime(seconds) {
|
||||
if (seconds == null) return "—";
|
||||
if (seconds == null) return "-";
|
||||
const d = Math.floor(seconds / 86400);
|
||||
const h = Math.floor((seconds % 86400) / 3600);
|
||||
const m = Math.floor((seconds % 3600) / 60);
|
||||
|
|
@ -104,7 +104,7 @@ export default function AdminPanel() {
|
|||
}, [load]);
|
||||
|
||||
/* Replace the one row the server returns rather than refetching
|
||||
the whole overview — the counts didn't change. */
|
||||
the whole overview; the counts didn't change. */
|
||||
function mergeUser(updated) {
|
||||
setData((current) =>
|
||||
current
|
||||
|
|
@ -199,7 +199,7 @@ export default function AdminPanel() {
|
|||
>
|
||||
{row.label}{" "}
|
||||
<strong className="font-semibold text-[#0f2f36]">
|
||||
{row.count ?? "—"}
|
||||
{row.count ?? "-"}
|
||||
</strong>
|
||||
</span>
|
||||
))}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
/* ═══════════════════════════════════════════════════════════════
|
||||
ADMIN — ENTITY EDIT
|
||||
ADMIN: ENTITY EDIT
|
||||
|
||||
Create and edit for every entity in the manifest. The form holds
|
||||
the whole nested object — parent row, side tables, child
|
||||
collections — and PATCH sends the lot. The server replaces
|
||||
the whole nested object (parent row, side tables, child
|
||||
collections) and PATCH sends the lot. The server replaces
|
||||
children wholesale, so what you see here is exactly what will
|
||||
exist afterwards.
|
||||
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
A field the form never sets is left out of the payload entirely,
|
||||
and the server lets the column's own DEFAULT apply. So a blank
|
||||
new-record form is deliberate, not lazy — writing "" into every
|
||||
new-record form is deliberate, not lazy: writing "" into every
|
||||
field is what used to turn a default into a constraint failure.
|
||||
|
||||
updated_at rides along untouched. If someone else saved while
|
||||
|
|
@ -26,7 +26,7 @@
|
|||
Two capabilities, not one role. An editor may create and update
|
||||
but not delete, so the action bar asks canWrite/canDelete rather
|
||||
than comparing user.role to a string. The comparison this
|
||||
replaced — role === "admin" — locked superadmins out of saving
|
||||
replaced (role === "admin") locked superadmins out of saving
|
||||
the moment a rank above admin existed, which is what an equality
|
||||
test against a ladder always eventually does.
|
||||
|
||||
|
|
@ -35,8 +35,8 @@
|
|||
|
||||
slugFrom may name one field or several. Most ids are unique
|
||||
because the name is: two organizations aren't both called
|
||||
Northwest. Team ids are the exception — teams.id is a global
|
||||
primary key, so every org's 'Board' would collide — which is
|
||||
Northwest. Team ids are the exception: teams.id is a global
|
||||
primary key, so every org's 'Board' would collide, which is
|
||||
why the array form exists and teams uses it.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
|
|
@ -72,7 +72,7 @@ export default function EntityEdit() {
|
|||
|
||||
// Some entities have no slug: the table assigns an integer id, so
|
||||
// there is nothing to type on create and nothing to compose from
|
||||
// other fields. Timeline entries are the first — an entry that
|
||||
// other fields. Timeline entries are the first: an entry that
|
||||
// references an event has no name of its own.
|
||||
const autoId = manifest?.idKind === "auto";
|
||||
|
||||
|
|
@ -224,7 +224,7 @@ export default function EntityEdit() {
|
|||
setForm((prev) => {
|
||||
let next = setPath(prev, path, value);
|
||||
// Recompose the id whenever one of its sources moves. The
|
||||
// prefix always follows the organization — picking a
|
||||
// prefix always follows the organization; picking a
|
||||
// different one has to change the slug, or it would claim a
|
||||
// team belongs somewhere it doesn't. The tail only follows
|
||||
// the name until someone types over it.
|
||||
|
|
@ -319,7 +319,7 @@ export default function EntityEdit() {
|
|||
</h1>
|
||||
|
||||
{/* Slug. An auto-id entity has nothing to ask for on create, and
|
||||
nothing editable afterwards — so it gets a plain line rather
|
||||
nothing editable afterwards, so it gets a plain line rather
|
||||
than a disabled box pretending to be a field. */}
|
||||
{singleton ? (
|
||||
updatedAt && (
|
||||
|
|
@ -347,7 +347,7 @@ export default function EntityEdit() {
|
|||
placeholder: isNew && qualifierPaths.length ? "board" : undefined,
|
||||
readOnly: !isNew,
|
||||
help: !isNew
|
||||
? "Fixed once created — links and content blocks reference it."
|
||||
? "Fixed once created, since links and content blocks reference it."
|
||||
: qualifierPaths.length
|
||||
? "The prefix comes from the organization. Type the rest."
|
||||
: "Lowercase, hyphens, no spaces. Can't be changed later.",
|
||||
|
|
@ -394,7 +394,7 @@ export default function EntityEdit() {
|
|||
))}
|
||||
|
||||
{/* Child collections. Awards own none, so the panel would be
|
||||
an empty white box — skip it rather than render it. */}
|
||||
an empty white box; skip it rather than render it. */}
|
||||
{children.some((child) => visible(child.when)) && (
|
||||
<div className="mt-6 rounded-2xl border border-[#138ba0]/20 bg-white p-5">
|
||||
{children
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/* ═══════════════════════════════════════════════════════════════
|
||||
ADMIN — ENTITY LIST
|
||||
ADMIN: ENTITY LIST
|
||||
|
||||
One component for organizations, events and people. The :entity
|
||||
route param picks the manifest; nothing here knows what a
|
||||
|
|
@ -7,8 +7,8 @@
|
|||
|
||||
The "New X" link follows the same rule as EntityEdit's save
|
||||
button: atLeast(user, "editor"), matching requireRole("editor")
|
||||
on POST /api/admin/:entity. Drawing it is not permission — the
|
||||
server decides — it only avoids offering a click that 403s, and
|
||||
on POST /api/admin/:entity. Drawing it is not permission (the
|
||||
server decides); it only avoids offering a click that 403s, and
|
||||
avoids hiding one that wouldn't.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
|
|
@ -34,7 +34,7 @@ export default function EntityList() {
|
|||
const [query, setQuery] = useState(params.get("q") ?? "");
|
||||
|
||||
// Minimum rank, never equality. POST /api/admin/:entity is gated
|
||||
// at "editor", so anyone from editor upward may create — and the
|
||||
// at "editor", so anyone from editor upward may create, and the
|
||||
// equality test this replaced hid the button from superadmins as
|
||||
// well as editors, which is the failure mode an == against a
|
||||
// ladder always produces once a rank is added above it.
|
||||
|
|
@ -178,8 +178,8 @@ export default function EntityList() {
|
|||
{column.widget === "bool"
|
||||
? row[column.key]
|
||||
? "Yes"
|
||||
: "—"
|
||||
: row[column.key] || "—"}
|
||||
: "-"
|
||||
: row[column.key] || "-"}
|
||||
</td>
|
||||
))}
|
||||
<td className="px-4 py-3 font-mono text-xs text-[#4a6b72]">{row.id}</td>
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
/* ═══════════════════════════════════════════════════════════════
|
||||
ROLE GUARD — src/pages/admin/RequireRole.tsx
|
||||
ROLE GUARD: src/pages/admin/RequireRole.tsx
|
||||
|
||||
Sits inside RequireAuth, never instead of it: by the time this
|
||||
renders, the session question has already been answered. All
|
||||
this decides is whether the answer was good enough.
|
||||
|
||||
Same caveat as RequireAuth — this hides the interface, not the
|
||||
Same caveat as RequireAuth: this hides the interface, not the
|
||||
data. /api/admin/panel/* is superadmin-only on the server, and
|
||||
that's the part that matters. Without it, a bookmarked URL and
|
||||
a disabled select would be the only thing between a viewer and
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
/* ═══════════════════════════════════════════════════════════════
|
||||
ADMIN NAVIGATION — src/pages/admin/adminNav.ts
|
||||
ADMIN NAVIGATION: src/pages/admin/adminNav.ts
|
||||
|
||||
Lifted out of AdminLayout because two things read it now: the
|
||||
header tabs and the card grid on the home page. Adding an entity
|
||||
stays one entry here plus a descriptor — there's still no second
|
||||
stays one entry here plus a descriptor; there's still no second
|
||||
list to keep in step, it just isn't inside the layout file
|
||||
any more.
|
||||
|
||||
|
|
@ -32,8 +32,8 @@ export const AREA_TITLES = {
|
|||
};
|
||||
|
||||
/* The CMS tabs. Teams and Awards live under Organizations because
|
||||
that's where they belong conceptually — a team is part of an org,
|
||||
an award is given by one — even though each is its own table and
|
||||
that's where they belong conceptually (a team is part of an org,
|
||||
an award is given by one), even though each is its own table and
|
||||
its own page. */
|
||||
export const CMS_NAV = [
|
||||
{
|
||||
|
|
@ -44,7 +44,7 @@ export const CMS_NAV = [
|
|||
{
|
||||
to: "/admin/organizations",
|
||||
label: "Organizations",
|
||||
blurb: "Regions, chapters and partners — plus the teams and awards they own.",
|
||||
blurb: "Regions, chapters and partners, plus the teams and awards they own.",
|
||||
children: [
|
||||
{ to: "/admin/organizations", label: "All organizations" },
|
||||
{ to: "/admin/teams", label: "Teams" },
|
||||
|
|
@ -64,7 +64,7 @@ export const CMS_NAV = [
|
|||
label: "Timeline",
|
||||
blurb: "What the history page shows, and the order it shows it in.",
|
||||
},
|
||||
// One record, not a list — the tab opens it directly.
|
||||
// One record, not a list: the tab opens it directly.
|
||||
{
|
||||
to: "/admin/front_page",
|
||||
label: "Front page",
|
||||
|
|
@ -89,7 +89,7 @@ export const FORMS_NAV = {
|
|||
],
|
||||
};
|
||||
|
||||
/* Accounts and server state, not content — which is why it sits
|
||||
/* Accounts and server state, not content, which is why it sits
|
||||
outside the CMS rather than as another tab within it. */
|
||||
export const PANEL_NAV = {
|
||||
to: ADMIN_PANEL,
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ function groupsFor(kind: Kind, directory: Directory | null): Group[] {
|
|||
{
|
||||
choices: directory.teams.map((t) => ({
|
||||
path: teamHref(t.id),
|
||||
label: `${t.name} — ${t.org_name}`,
|
||||
label: `${t.name} (${t.org_name})`,
|
||||
})),
|
||||
},
|
||||
]
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
|
||||
Backdrop, what fills the background:
|
||||
|
||||
brand drifting colour and slow concentric rings — many
|
||||
circles, one centre — with the dove at that centre
|
||||
brand drifting colour and slow concentric rings (many
|
||||
circles, one centre) with the dove at that centre
|
||||
photos the hero photos, crossfading with a slow zoom, a
|
||||
progress bar per photo and a pause button (anything
|
||||
that moves on its own for more than five seconds
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue