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>
30 lines
1.4 KiB
TypeScript
30 lines
1.4 KiB
TypeScript
/* ═══════════════════════════════════════════════════════════════
|
|
ADMIN TITLE
|
|
|
|
The layout knows which section you're in; only the page knows
|
|
which record is on screen. Rather than have both write
|
|
document.title and race (child effects run before parent
|
|
effects, so the layout would win and the record name would
|
|
never survive), the page publishes a string and the layout is
|
|
the single writer.
|
|
|
|
Null is the normal state. A page that publishes nothing, or one
|
|
still loading, simply leaves the section title showing.
|
|
═══════════════════════════════════════════════════════════════ */
|
|
|
|
import { createContext, useContext, useEffect } from "react";
|
|
|
|
export const AdminTitleContext = createContext<any>(null);
|
|
|
|
/* Publish the name of whatever this page is showing. Clears on
|
|
unmount, so navigating away can't leave a stale record name in
|
|
the tab. */
|
|
export function useAdminDetail(name) {
|
|
const setDetail = useContext(AdminTitleContext)?.setDetail;
|
|
|
|
useEffect(() => {
|
|
if (!setDetail) return undefined;
|
|
setDetail(name || null);
|
|
return () => setDetail(null);
|
|
}, [setDetail, name]);
|
|
}
|