23 KiB
Updating data that isn't in the database
Most of the site's content lives in SQLite and is edited in the admin
(/admin). Some of it deliberately lives in code instead: labels,
navigation, fixed lists, and a few pieces of editorial copy. Changing
those means editing a file, committing it on a branch, and deploying.
This guide covers where each of those lives and how to change it safely, starting with the question that comes up most: how to change what a dropdown in the admin editor says.
- Database or code?
- Admin dropdowns
- Front page section names
- Front page stat sources
- Other content that lives in code
- Writing text in the editor
- Making the change
Database or code?
| If it's… | It lives in… | Change it by… |
|---|---|---|
| A record: an event, organization, person, team, award, timeline entry | the database | editing it in the admin |
| The front page's words, photos, bands, stats and paths | the database | Admin → Pages → Front page |
| Blog posts, and the Community page's blog section (headings, pins, feeds) | the database | Admin → Data → Blog posts, and Admin → Pages → Community blog section |
| The label a dropdown shows in the admin | code | one file |
| The list of allowed values behind a fixed dropdown | database CHECK + code | a migration and three files |
| Navigation, page section titles, colors, the site banner, history decades, the map grid | code | the file named below |
| A static page's title and intro (also its search title and description), the site's name, description, preview image, icons, search indexing, privacy contact email | the database, over site.json |
Admin → Panel → Site settings (superadmins). Blank uses site.json, which also holds the site's address and the pages' defaults. See docs/seo.md |
| Uploaded images | disk + the media table |
Admin → Tools → Media, or any image field. See docs/media-uploads.md |
The rule of thumb from CLAUDE.md: data belongs in the database,
presentation belongs in code. A dropdown's values are data the
database enforces; its labels are presentation.
Admin dropdowns
The admin editor is generated from two descriptor files that describe each entity:
| File | What it holds |
|---|---|
src/lib/adminSchema/ (one file per entity, shared.ts for common fields; src/lib/adminSchema.ts lists them) |
The form: field labels, help text, dropdown labels, list columns and filters |
server/src/admin-schema/ (one file per entity, columns.js for shared helpers; server/src/admin-schema.js lists them) |
What the server accepts: columns, types, the allowed values of each enumeration(...) |
And the database itself holds the final word: most fixed lists are a
CHECK (... IN (...)) constraint on the column (read them in
server/src/migrations/023_schema.sql and any later migration).
Two kinds of dropdown
Every dropdown in the editor is one of these:
1. Filled from records (optionsFrom). The choices are rows in the
database: organizations, people, events, teams, awards, event scopes,
regions. The label is the record's own name. To change what one of
these shows, edit the record in the admin; there's nothing to
change in code. Adding a person adds them to every "Person" dropdown.
The queries behind them are OPTION_QUERIES in
server/src/admin-schema.js. Edit a query only to change which
records appear or their order, e.g. to put a disambiguating
organization name in the label, as the awards query does.
Event scopes (National, Regional, Local…) are records in the
event_scopestable, but there's no admin page for them. Their names are changed with a migration:UPDATE event_scopes SET name = '…' WHERE id = '…';
2. A fixed list in code (options). The choices are written in
the entity's file in src/lib/adminSchema/. Each option is one of two shapes:
options: ["speaker", "leader", "host"] // shows: speaker, leader, host
options: [["speaker", "Speaker"], ["leader", "Leader"]] // shows: Speaker, Leader
A bare string is shown exactly as stored. A [value, label] pair
stores the first and shows the second. That difference is what makes
relabeling cheap.
Renaming what a dropdown shows
If the stored value stays the same and you only want the dropdown to
read differently, only the file in src/lib/adminSchema/ changes. No
migration, no server change, and every existing row keeps working.
Find the field (search for its column name) and give the option a label. For example, to make the event-people Role dropdown read nicely:
// before
options: ["speaker", "leader", "facilitator", "host", "musician", "volunteer", "attendee"],
// after: values unchanged, labels added
options: [
["speaker", "Speaker"],
["leader", "Leader"],
["facilitator", "Facilitator"],
["host", "Host"],
["musician", "Musician"],
["volunteer", "Volunteer"],
["attendee", "Attendee (not shown publicly)"],
],
Things to check while you're there:
- The same list often appears twice: once on the form field and
once in the entity's
list.filters(the dropdowns above the list view). Relabel both so they agree. - Several lists are shared constants. Front page sections and stat
sources are
FRONT_PAGE_SECTIONSandSTAT_SOURCESnear the top of the front page block; change them there, once. blankLabelis the text of the empty first option, written asDefault: …saying what happens when it's left blank ("Default: brand","Default: none"). It's also just a label. A select with noblankLabelshows- Please choose from the list -(set insrc/components/admin/fields.tsx).- The value (first item) must not change. It's what's stored in the database and what the server and the CHECK constraint compare against.
Adding, removing or renaming a stored value
This changes what the database will accept, so four places move together, in one branch:
-
A new migration (
server/src/migrations/0NN_description.sql) that changes the column's CHECK. A CHECK can't be altered in place, so either:- add a new column with the new CHECK, copy the data across, and
drop the old one (see
025_hero_backdrop_feature.sql), or - rebuild the table (see
024_front_page_video.sql, and the rebuild notes inCLAUDE.mdunder Migrations).
Renaming a value also needs an
UPDATEin the same migration so existing rows move to the new value. Removing one needs you to decide what existing rows become first. - add a new column with the new CHECK, copy the data across, and
drop the old one (see
-
server/src/admin-schema/<entity>.js: theenumeration("column", [...])list for that column. -
src/lib/adminSchema/<entity>.ts: theoptionson the form field, and on the list filter if there is one. -
Anywhere the public site renders or relies on the value, listed in the table below (for example
EVENT_TYPESfor event types, or theSECTIONSmap inHome.tsxfor front page sections).
If the server descriptor and the database disagree, the API refuses to
start: admin-schema-sync.js compares them at boot and throws with a
message naming the column. That's deliberate. Fix whichever side is
wrong rather than working around it.
Every dropdown in the editor
Fixed lists (options: labels in src/lib/adminSchema/, values
also in server/src/admin-schema/ and a CHECK):
| Entity → field | Stored values | Labeled? | Also used on the public site by |
|---|---|---|---|
| Organizations → Kind (+ list filter) | national, region, group, partner | no, shows values | ORG_BASE in src/lib/hrefs.ts (the route each kind uses) and orgListHref there (its back link) |
| Organizations → Region → Scope | domestic, international, virtual | no | the Community page groups regions by it |
| Organizations → Region areas → Edge | top, bottom | no | the group map (OrgList-Map.tsx) |
| Events → Type (+ list filter) | retreat, class, workshop, meeting, other | no | EVENT_TYPES in src/lib/eventTypes.ts (public labels and plurals) |
| Events → Status (+ list filter) | upcoming, past, cancelled (shown as canceled) | no | STATUS_LABEL in src/pages/EventDetail.tsx |
| Events → Series → Repeats | weekly, monthly_date, monthly_weekday | yes | src/lib/eventSeries.ts |
| Events → People → Role | speaker, leader, facilitator, host, musician, volunteer, attendee | no | ROLE_LABEL in src/pages/EventDetail.tsx |
| People → Affiliations → Role; Teams → Members → Role | lead, board, staff, volunteer, member | no | ROLE_LABEL in src/pages/PersonDetail.tsx |
| Links → Kind (on organizations, events, people, teams) | action, social, website, email | no | splitLinks in server/src/shape.js |
| Links → Platform | instagram, facebook, discord, youtube, tiktok, x, substack, spotify, linkedin | yes, PLATFORMS |
PlatformIcon.tsx draws the icon on the button. No CHECK and no enumeration: the column is plain text, so adding one is an entry in PLATFORMS (src/lib/platforms.ts) and its icon in src/components/PlatformIcon.tsx, no migration. |
| Content blocks → Shown in (slot) | card, body | yes | paragraphs() in server/src/shape.js (card), ContentBlocks.tsx (body) |
| Content blocks → Type | heading, subheading, paragraph, list, links, quote, image, divider, video, button, callout, schedule, table | yes, BLOCK_TYPES (with each type's description) |
ContentBlocks.tsx (one renderer per type). Which fields each type shows is when on the fields in blocksChild (src/lib/adminSchema/shared.ts). |
| Timeline → Kind (+ list filter) | milestone, event, organization, award, people | no | KIND_NAMES in src/pages/sections/history/TimelineEntry.tsx |
| Timeline → Points at (+ list filter) | event, organization, award, person, team | no | refHref in src/lib/hrefs.ts |
| Timeline → Precision (and on events/orgs) | year, month, day | no | the history page's grouping |
| Front page → Countdown → Only this type | retreat, class, workshop, meeting, other | yes | server/src/routes/home.js (picks the countdown event). The same values as Events → Type, so adding a type widens both CHECKs. |
| Front page → Background | brand, photos | yes | HeroStage.tsx |
| Front page → Feature | none, livestream, video, event | yes | HeroStage.tsx; the event is picked in server/src/routes/home.js |
| Front page → Sections → Section | countdown, retreats, calendar, stats, timeline, connect, featured | yes, FRONT_PAGE_SECTIONS |
SECTIONS in src/pages/Home.tsx; see below |
| Front page → Stats → Number Source | manual, years_since, regions, … | yes, STAT_SOURCES |
STAT_QUERIES in server/src/routes/home.js; see below |
| Front page → Featured cards → Card type (Community blog section → Pinned community posts offers link and video only) | record, link, video | yes, FEATURED_KINDS |
FeaturedCards.tsx (how each kind draws), loadFeaturedCards in server/src/shape.js |
| Front page → Featured cards → Record type | event, organization, person, team, award | no | FEATURED_REFS in server/src/shape.js (what each fills the card with); the triggers in 030_featured_cards.sql |
| Every list → Published / Listed / Featured filter | 1, 0 | yes | n/a |
"No, shows values" means the dropdown currently shows the raw value, so relabeling it is just adding labels.
Lists filled from records (optionsFrom: edit the records, not
code):
| Dropdown | optionsFrom |
Comes from |
|---|---|---|
| Group → Region | regions |
organizations of kind region |
| Event → Scope (+ list filter); Front page → Countdown → Only this scope | event_scopes |
the event_scopes table (migration only) |
| Event hosts → Organization; affiliations; team and award "Organization" / "Awarded by"; person → Home organization | organizations |
organizations, labeled by name |
| Event hosts / event people / team members / timeline people → Person | people |
people |
| Community blog section → Pinned posts → Post | blog_posts |
blog posts, newest first |
| Timeline → Record; Featured cards → Record | record_refs |
every event, organization, award, person and team, narrowed by the type picked beside it |
| Affiliations → Team | teams |
teams, filtered to the chosen organization |
| Person awards → Award | awards |
awards, labeled "Award (Organization)" |
| Person awards → Presented at; Front page → Count down to; Front page → Featured event | events |
events |
Front page section names
"Section name" means three different things on the front page, and each is changed in a different place:
| What you see | Where it's set |
|---|---|
| The heading on the page ("National Retreats", "What's on") | Admin → Pages → Front page → Page sections → Heading. Blank uses the default below. |
| The default heading when that field is blank | SECTIONS in src/pages/Home.tsx, the title of each entry |
| The name in the admin's Section dropdown ("Events Carousel (National Retreats)") | FRONT_PAGE_SECTIONS in src/lib/adminSchema/frontPage.ts |
| The subnav links under the header ("#Retreats", "#Calendar") | PAGE_SECTIONS["/"] in src/navConfig.ts |
To rename a band for visitors, use the admin. To rename how it
reads in the editor's dropdown, edit FRONT_PAGE_SECTIONS:
const FRONT_PAGE_SECTIONS = [
["countdown", "Event Countdown"],
["retreats", "Events Carousel (National Retreats)"], // ← the right-hand side is the label
["calendar", "Event Calendar"],
...
];
The subnav links jump to each band by its anchor: the id passed in
each band's render in Home.tsx (#retreats, #calendar,
#numbers, #connect, and #hero for the hero). If you rename a
subnav label in navConfig.ts, leave its hash alone unless you also
change the band's id.
Adding a new kind of band (not just renaming one) is a feature,
not a relabel: it needs a component, an entry in SECTIONS in
Home.tsx, the key added to FRONT_PAGE_SECTIONS, to the
enumeration("section", …) in server/src/admin-schema/frontPage.js, to the
FrontPageSectionKey type in src/lib/useFrontPage.ts, and to the
CHECK on front_page_sections.section via a migration.
Front page stat sources
The numbers band's "Number Source" dropdown works the same way:
- Relabel a source:
STAT_SOURCESinsrc/lib/adminSchema/frontPage.ts. - Change what a count counts: its query in
STAT_QUERIESinserver/src/routes/home.js. Keep it counting exactly what the matching public page shows (published rows), or the number and the page will disagree. - Add a source: the CHECK on
front_page_stats.source(migration), theenumeration("source", …)inserver/src/admin-schema/frontPage.js,STAT_SOURCES, and a query inSTAT_QUERIES.
Other content that lives in code
| What | File | Notes |
|---|---|---|
| Header and footer navigation, page subnav links | src/navConfig.ts |
PAGE_LINKS, PAGE_SECTIONS, NAV_ACTIONS. A new page also needs a route in src/App.tsx. |
| Section titles, blurbs and colors on Retreats, Community, Leadership, Resources, Feedback, Privacy, Terms | the page file in src/pages/ |
the SECTIONS array at the top. A section's id must match its subnav hash. |
| Site-wide announcement banner | src/data/bannerConfig.ts |
enabled: false hides it. Bump id when the message changes, so people who dismissed the old one see the new one. |
| History page decade headers | src/data/historyDecades.ts |
Title, tagline and blurb per decade. |
| Group map tiles and area names | src/data/mapGrid.ts |
AREAS (tile positions) and AREA_NAMES. Which region paints which tile is in the database (Admin → Data → Organizations → a region → Map areas). |
| Feedback form types | src/data/feedbackTypes.ts and TYPES in server/src/routes/feedback.js |
Keep the ids identical in both; the server stores unknown ids as general. Labels and hints are client-only. DATA_REQUEST ('privacy') isn't a tile: the Privacy page's form sends it, and the server requires an email for it. |
Request form types (what /request can ask for) |
src/data/requestTypes.ts and CATEGORIES in server/src/routes/requests.js and the CHECK on feedback.category (046_content_requests.sql) |
Ids and allowed actions (new, update) identical in all three; a new id needs a migration. Labels, hints, the name field's question and each type's fields (the details it asks for, and where each lands in the admin editor: a field path, a link row or a description paragraph) are client-only: the server stores whatever detail keys come as JSON (feedback.details, 049), so adding a field needs no migration. A button to the form opened on one type: request: { type, label } on a section manifest entry, or <RequestLink> (src/components/RequestLink.tsx). |
| The site's colors, light and dark | the database over src/index.css |
Admin → Panel → Site settings → Colors (superadmins): pick a color, set its light and/or dark value; saving refuses anything that makes text hard to read. The defaults are THEME_DEFAULTS in server/src/themeDefaults.js (the admin and the contrast check read it) and the same values as CSS in src/index.css; the build stops if the two differ. The admin's labels for them are THEME_LABELS in src/lib/adminSchema/siteSettings.ts. Change a token's value in both modes and every use follows. Use the token utilities (text-muted, bg-surface, border-brand/20) or var(--color-…), not hex. A color that arrives as data (a page accent, an event's or region's color) goes through src/lib/color.ts: withAlpha for tints, accentText for text in it, readableOn for text on it. |
| The icons a Front page "Find your way in" path can pick | src/data/pathIcons.ts (keys and labels) and ICONS in src/pages/sections/home/Pathfinder.tsx (the Phosphor icon for each key) |
Add a line to both. A path saved with an emoji from before the list shows it as it is. |
| A page section's accent color | BRAND and ACCENTS in src/lib/color.ts |
Pages pick from these (accent: ACCENTS.green); add a color there, not a hex in a page. Each is readable as text on white and the tints. |
| The palette (the 16-color grid the theme is drawn from) | PALETTE in src/lib/color.ts |
Four families, a column each. PALETTE_LIGHT / PALETTE_DARK are the fills things colored by data use (a person's initials tile, paletteFill); the page background's circles and tones are in src/components/PageBackdrop.css; the admin home's group colors are GROUPS in src/pages/admin/AdminHome.tsx. |
| Timeline leaf colors (green now, autumn going back) | leafColor in src/lib/color.ts |
The green, gold and autumn stops, and LEAF_TURNED_BY (2000), the year before which every leaf is fully turned. |
| Privacy Policy and Terms wording | src/pages/Privacy.tsx, src/pages/Terms.tsx |
The PARTS list, and LAST_UPDATED whenever the wording changes. The Privacy page must stay true of the code: what the feedback form stores, what the browser keeps, which embeds wait for a click. |
| Event type labels and plurals (public site) | src/lib/eventTypes.ts |
Also the order of the type filter chips. |
| Event and person role labels (public site) | ROLE_LABEL in src/pages/EventDetail.tsx and src/pages/PersonDetail.tsx |
|
| Organization kind labels ("Region", "Group") | the Kind options in src/lib/adminSchema/organizations.ts (admin); orgListHref in src/lib/hrefs.ts (the public back link, "All regions") |
|
| Admin account roles | src/lib/roles.ts (labels, notes) and ROLES in server/src/auth.js |
Adding a role is also a CHECK change on admin_users.role. |
| Admin navigation | src/pages/admin/adminNav.ts |
|
| The live site's address (used by QR codes) | SITE_ORIGIN in src/lib/site.ts |
|
| Version shown on the admin home page | src/lib/version.ts |
|
| Image directories (where logos and photos are looked up) | src/lib/media.ts |
Writing text in the editor
Conventions for any label, help text or option added to the admin, so the editor reads consistently:
- Blank options say what blank means:
Default: none,Default: weekly,Default: the next upcoming event. - Examples in help text start with
eg.:eg. Board Chair, Team Lead. - Record ids are called "URL ID", not slug, in anything the editor shows.
- Cut-off text ends with an ellipsis. Anywhere a paragraph is
shortened for a row title, list cell or card, use
preview(text, max)fromsrc/lib/text.tsrather than.slice(). It cuts on a word and adds…, and only when it actually shortened something. - No em-dashes (the long dash, U+2014), in the editor or anywhere else: labels, help
text, placeholders, code comments and docs. Use a colon, a comma or
parentheses instead. An empty value in a table shows
-.
Making the change
- Branch from
main(never commit tomaindirectly). - Edit the file(s). For a stored-value change, write the migration as
well, numbered after the last one in
server/src/migrations/. - Check it:
For anything touching the server or a migration, also run it locally against a scratch database:pnpm exec tsc # type-check pnpm build # the site still builds
and open the admin editor to see the dropdown.cd server DB_PATH=./dev.db pnpm migrate DB_PATH=./dev.db pnpm dev # boot fails loudly if a descriptor and the schema disagree - Commit, push the branch, and open a pull request with
tea. - After it's merged, deploy. A migration runs automatically when the
ngu-apiservice restarts; back up/var/lib/ngu/ngu.dbfirst if the change includes one.