Page management, step 3: section types with their own settings; the front page as sections
Migration 083 gives the section types that need more than blocks their own tables (hero, slides, countdown, stats, paths, featured cards, the Community blog's slots, pinned posts and feeds) and turns the front page into Home's sections: the hero, then its bands in order. Any section can be hidden. The Front page editor, its tables and the Community page's are gone; /api/front-page and /api/community-blog fold into the page's sections (sectionData.js). The admin engine reads and writes a child collection's own side tables and gated nested collections. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
f33c0008fe
commit
f1a0b06ac2
46 changed files with 1525 additions and 1339 deletions
|
|
@ -15,8 +15,8 @@ what a dropdown in the admin editor says.
|
|||
- [Renaming what a dropdown shows](#renaming-what-a-dropdown-shows)
|
||||
- [Adding, removing or renaming a stored value](#adding-removing-or-renaming-a-stored-value)
|
||||
- [Every dropdown in the editor](#every-dropdown-in-the-editor)
|
||||
- [Front page section names](#front-page-section-names)
|
||||
- [Front page stat sources](#front-page-stat-sources)
|
||||
- [Front page sections](#front-page-sections)
|
||||
- [Stat sources](#stat-sources)
|
||||
- [Other content that lives in code](#other-content-that-lives-in-code)
|
||||
- [Writing text in the editor](#writing-text-in-the-editor)
|
||||
- [Making the change](#making-the-change)
|
||||
|
|
@ -154,8 +154,9 @@ together, in one branch:
|
|||
3. **`src/lib/adminSchema/<entity>.ts`**: the `options` on the form field, and on
|
||||
the list filter if there is one.
|
||||
4. **Anywhere the public site renders or relies on the value**, listed in
|
||||
the table below (for example `EVENT_TYPES` for event types, or the
|
||||
`SECTIONS` map in `Home.tsx` for front page sections).
|
||||
the table below (for example `EVENT_TYPES` for event types, or
|
||||
`PRESETS` in `SitePage.tsx` and `BANDS` in `sections/Bands.tsx` for
|
||||
section types).
|
||||
|
||||
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
|
||||
|
|
@ -184,16 +185,15 @@ also in `server/src/admin-schema/` and a CHECK):
|
|||
| 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-section-names) |
|
||||
| Front page → Stats → Number Source | manual, years_since, regions, … | **yes**, `STAT_SOURCES` | `STAT_QUERIES` in `server/src/routes/home.js`; see [below](#front-page-stat-sources) |
|
||||
| Front page → Featured cards → Card type (Community → Community blog: 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 Content → Columns (073) | 2, 3, 4 | **yes**, inline in `src/lib/adminSchema/frontPage.ts` | `GRID_COLUMNS` in `FeaturedCards.tsx`; the CHECK on `front_page.featured_columns` |
|
||||
| Front page → Featured cards → Size (073; front page only, regions and the Community blog stay automatic) | normal, wide, tall, large | **yes**, inline in `src/lib/adminSchema/frontPage.ts` | `SPANS` and `sizeOf` in `FeaturedCards.tsx`; the CHECK on `featured_cards.size` |
|
||||
| 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` |
|
||||
| Pages → Sections → Preset | community_blog, group_map, region_list, partner_list, events, timeline, people_directory | **yes**, `PRESETS` in `src/lib/adminSchema/sitePages.ts` (which pages offer which, the list passed to each `sitePage`) | `PRESETS` in `src/pages/SitePage.tsx`. A People directory shows its tag's first `DIRECTORY_PREVIEW` people (`src/pages/sections/PeopleDirectory.tsx`), linking to `/directory/<tag>`. |
|
||||
| Pages → Sections → Countdown: only this type | retreat, class, workshop, meeting, other | **yes** | `server/src/sectionData.js` (picks the countdown event). The same values as Events → Type, so adding a type widens both CHECKs. |
|
||||
| Pages → Sections → Hero: background | brand, photos | **yes** | `HeroStage.tsx` |
|
||||
| Pages → Sections → Hero: feature | none, livestream, video, event | **yes** | `HeroStage.tsx`; the event is picked in `server/src/sectionData.js` |
|
||||
| Pages → Sections → Numbers → Number Source | manual, years_since, regions, … | **yes**, `STAT_SOURCES` in `src/lib/adminSchema/sitePages.ts` | `STAT_QUERIES` in `server/src/sectionData.js`; see [below](#stat-sources) |
|
||||
| Featured cards → Card type (a Community blog's pinned community posts offer link and video only) | record, link, video | **yes**, `FEATURED_KINDS` | `FeaturedCards.tsx` (how each kind draws), `loadFeaturedCards` in `server/src/shape.js` |
|
||||
| Pages → Sections → Featured cards: columns (073) | 2, 3, 4 | **yes**, inline in `src/lib/adminSchema/sitePages.ts` | `GRID_COLUMNS` in `FeaturedCards.tsx`; the CHECK on `section_featured.columns` |
|
||||
| Featured cards → Size (073; featured card sections only, regions and the Community blog stay automatic) | normal, wide, tall, large | **yes**, inline in `src/lib/adminSchema/sitePages.ts` | `SPANS` and `sizeOf` in `FeaturedCards.tsx`; the CHECK on `featured_cards.size` |
|
||||
| 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` |
|
||||
| Pages → Sections → Preset (section type) | community_blog, group_map, region_list, partner_list, events, timeline, people_directory, feedback_form, request_form, data_request_form, giving, qr_maker, hero, countdown, calendar, stats, featured_cards, connect | **yes**, `PRESETS` in `src/lib/adminSchema/sitePages.ts`, every page offers them all | `PRESETS` in `src/pages/SitePage.tsx`; the bands (hero, countdown, calendar, numbers, featured cards, connect, and a timeline shown as a rail) in `src/pages/sections/Bands.tsx`, their data from `server/src/sectionData.js`; forms and embeds in `src/pages/sections/FormSections.tsx`. A People directory shows each tag's first `DIRECTORY_PREVIEW` people (`src/pages/sections/PeopleDirectory.tsx`), linking to `/directory/<tag>`. |
|
||||
| Pages → Sections → Cards: list (organization cards preset, 067) | partner, ministry, partner,ministry | **yes**, inline in `src/lib/adminSchema/sitePages.ts` | `partner_list` in `PRESETS` in `src/pages/SitePage.tsx` passes it as the kind to `OrgListCards`; a section's hand-picked Cards: organizations (`page_section_orgs`) replace it |
|
||||
| Every list → Published / Listed / Featured filter | 1, 0 | **yes** | n/a |
|
||||
|
||||
|
|
@ -210,67 +210,49 @@ code):
|
|||
| People → Directories → Tag; Pages → Sections → Directory: tag | `person_tag_types` | Data → People tags |
|
||||
| Organizations and Events → Tags → Tag | `tags` | Data → Tags |
|
||||
| Organizations → Contacts → Type | `contact_types` | Data → Contact types |
|
||||
| Event → Scope (+ list filter); Front page → Countdown → Only this scope | `event_scopes` | the `event_scopes` table (migration only) |
|
||||
| Event → Scope (+ list filter); Pages → Sections → 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, except ministries (they have no page to link to) |
|
||||
| Event hosts / event people / team members / timeline people → Person | `people` | people |
|
||||
| Community → Community blog: pinned posts (ours) → Post | `blog_posts` | blog posts, newest first |
|
||||
| Pages → Sections → Blog: pinned posts (ours) → Post | `blog_posts` | blog posts, newest first |
|
||||
| Timeline → Record; Featured cards → Record | `record_refs` | every event, organization (but ministries), 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 |
|
||||
| Person awards → Presented at; Pages → Sections → Count down to, Hero: featured event | `events` | events |
|
||||
|
||||
---
|
||||
|
||||
## Front page section names
|
||||
## Front page sections
|
||||
|
||||
"Section name" means three different things on the front page, and
|
||||
each is changed in a different place:
|
||||
The front page is a page of sections like the others (Admin → Pages →
|
||||
Page management → Home, migration 083): the hero first, then its
|
||||
bands, each a section with a type. Its heading is the section's title
|
||||
(up to 60 characters on the front page), its anchor the section's URL
|
||||
ID (`#retreats`, `#calendar`, `#numbers`, `#connect`), which the
|
||||
header's Home dropdown lists (not the hero or the countdown). Rename
|
||||
a heading freely; change a URL ID only if you mean to break links to
|
||||
it. The names in the section type dropdown are `PRESETS` in
|
||||
`src/lib/adminSchema/sitePages.ts`.
|
||||
|
||||
| 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 links in the header's Home dropdown | the bands shown, under their headings (`src/lib/navSections.ts`) |
|
||||
|
||||
To rename a band **for visitors**, use the admin. To rename how it
|
||||
reads **in the editor's dropdown**, edit `FRONT_PAGE_SECTIONS`:
|
||||
|
||||
```ts
|
||||
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
|
||||
heading in Front page → Sections, its anchor stays: leave the band's
|
||||
`id` alone unless you mean to break links to it.
|
||||
|
||||
**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.
|
||||
**Adding a new kind of band** is a feature, not a relabel: its
|
||||
component and an entry in `BANDS` (`src/pages/sections/Bands.tsx`),
|
||||
its settings table (a migration) and extension or collection in
|
||||
`sectionsChild` (`server/src/admin-schema/sitePages.js`), its data in
|
||||
`server/src/sectionData.js`, its fields in `src/lib/adminSchema/sitePages.ts`,
|
||||
and its value added to the CHECK on `page_sections.preset`.
|
||||
|
||||
---
|
||||
|
||||
## Front page stat sources
|
||||
## Stat sources
|
||||
|
||||
The numbers band's "Number Source" dropdown works the same way:
|
||||
A Numbers section's "Number Source" dropdown works the same way:
|
||||
|
||||
- **Relabel a source:** `STAT_SOURCES` in `src/lib/adminSchema/frontPage.ts`.
|
||||
- **Relabel a source:** `STAT_SOURCES` in `src/lib/adminSchema/sitePages.ts`.
|
||||
- **Change what a count counts:** its query in `STAT_QUERIES` in
|
||||
`server/src/routes/home.js`. Keep it counting exactly what the
|
||||
`server/src/sectionData.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),
|
||||
the `enumeration("source", …)` in `server/src/admin-schema/frontPage.js`,
|
||||
- **Add a source:** the CHECK on `section_stats.source` (migration),
|
||||
the `enumeration("source", …)` in `server/src/admin-schema/sitePages.js`,
|
||||
`STAT_SOURCES`, and a query in `STAT_QUERIES`.
|
||||
|
||||
---
|
||||
|
|
@ -279,15 +261,14 @@ The numbers band's "Number Source" dropdown works the same way:
|
|||
|
||||
| What | File | Notes |
|
||||
| --- | --- | --- |
|
||||
| Header and footer navigation, each page's sections (the header dropdowns, mobile menu and footer site map) | Admin → Pages → Navigation (the database, `075_site_nav.sql`); `src/navConfig.ts` is only the defaults the app starts from before it loads | Links: where each shows (header pages, header buttons, footer Get in Touch, footer bottom row), order, label, a header page set under another's menu, a filled button, new tab. Each page's sections aren't listed there: they follow the page itself, through `src/lib/navSections.ts` (the site pages' sections from Admin → Pages; the front page's bands it shows, with `src/lib/frontPageBands.ts` giving each band's anchor and default heading). A new page is made in Page management, no code: it's a page of sections at the address given. |
|
||||
| Section titles, blurbs and colors on Feedback, Privacy, Terms | the page file in `src/pages/` | the `SECTIONS` array at the top. |
|
||||
| Header and footer navigation, each page's sections (the header dropdowns, mobile menu and footer site map) | Admin → Pages → Navigation (the database, `075_site_nav.sql`); `src/navConfig.ts` is only the defaults the app starts from before it loads | Links: where each shows (header pages, header buttons, footer Get in Touch, footer bottom row), order, label, a header page set under another's menu, a filled button, new tab. Each page's sections aren't listed there: they follow the page itself, through `src/lib/navSections.ts` (every page's sections from Admin → Pages → Page management, the front page's included, but its hero and countdown). A new page is made in Page management, no code: it's a page of sections at the address given. |
|
||||
| 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. |
|
||||
| The icons a Connect nav section's 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 layers (how many circles, their sizes and parallax speeds) are `LAYERS` in `src/components/PageBackdrop.tsx` and its shades are in `PageBackdrop.css`; the admin home's two alternating group colors are `BLOCK_COLORS` in `src/pages/admin/AdminHome.tsx`. |
|
||||
| The accessibility panel's choices (bottom right of every public page) | `SETTINGS` in `src/components/AccessibilityPanel.tsx`; the color blind modes are `VISIONS` and `SWAPS` in `src/lib/color.ts` | Each choice is an attribute on `<html>` styled in `src/index.css`, and `index.html` sets it again before the first paint, so a new one goes in all three. A color blind mode replaces all three color families, teal, green and amber (`SWAPS`, picked by simulating each type: see the comment there), in code, in data colors as they load (`src/lib/api.ts`, never under /admin), in CSS (the `--pal-*` variables in `src/index.css`, which hold the same values as `SWAPS`: change both) and in the theme tokens drawn from them. A palette hex in a component or CSS file should be `var(--pal-<family>-<shade>)` (eg. `var(--pal-amber-2)`), or a color blind mode won't reach it. Reading mode is `src/components/ReaderView.tsx`, which reads the hidden page and writes out its headings, paragraphs, links and described pictures. A part it can't read well (a carousel, tabs, details behind a click, a map) draws its own text version when `useReadingMode()` (`src/lib/readingMode.ts`) is on: the hero, pathfinder, stats, history rail, event lists, calendar (the next six weeks), featured cards, org lists and groups map, history timeline, schedule, people tiles and video player; the countdown draws nothing. A new component with any of those should do the same. Something saved or sent (the newsletter's colors) is a stored hex, which is never swapped. |
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue