Feature updates v1.7.4: media, blog, featured content, editor nav, content blocks #11
31 changed files with 239 additions and 187 deletions
|
|
@ -60,6 +60,8 @@ In dev, Vite proxies `/api` to the target set in `vite.config.ts`, so the API mu
|
||||||
- **Imports need explicit extensions** (`.ts`, `.tsx`, `.js`) everywhere.
|
- **Imports need explicit extensions** (`.ts`, `.tsx`, `.js`) everywhere.
|
||||||
- **Vite resolves `.js` before `.ts`**, so a `.js` and `.ts` file with the same base name will import the wrong one. Give new hooks distinct names.
|
- **Vite resolves `.js` before `.ts`**, so a `.js` and `.ts` file with the same base name will import the wrong one. Give new hooks distinct names.
|
||||||
- **Don't use `fallback: EMPTY` in api.ts hooks.** It silently returns empty arrays and hides server errors; let the error state surface.
|
- **Don't use `fallback: EMPTY` in api.ts hooks.** It silently returns empty arrays and hides server errors; let the error state surface.
|
||||||
|
- **No em-dashes** (U+2014) anywhere: UI text, help text, comments, docs, commit messages. Use a colon, comma or parentheses. An empty table cell shows `-`.
|
||||||
|
- **Admin editor text:** blank select options read `Default: …` (what blank means), examples in help text start with `eg.`, and record ids are called "URL ID". Cut-off preview text uses `preview()` from `src/lib/text.ts`, which ends it with an ellipsis. See `docs/updating-data-in-code.md`.
|
||||||
|
|
||||||
## Admin CRUD engine
|
## Admin CRUD engine
|
||||||
Descriptor-driven: `server/admin-crud.js` and `admin-schema.js` (server) and `adminSchema.ts` (client) generate SQL and form fields from declarative entity configs. Adding an entity should mean adding a descriptor, not new CRUD code.
|
Descriptor-driven: `server/admin-crud.js` and `admin-schema.js` (server) and `adminSchema.ts` (client) generate SQL and form fields from declarative entity configs. Adding an entity should mean adding a descriptor, not new CRUD code.
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ what a dropdown in the admin editor says.
|
||||||
- [Front page section names](#front-page-section-names)
|
- [Front page section names](#front-page-section-names)
|
||||||
- [Front page stat sources](#front-page-stat-sources)
|
- [Front page stat sources](#front-page-stat-sources)
|
||||||
- [Other content that lives in code](#other-content-that-lives-in-code)
|
- [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)
|
- [Making the change](#making-the-change)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -96,7 +97,7 @@ label. For example, to make the event-people Role dropdown read nicely:
|
||||||
// before
|
// before
|
||||||
options: ["speaker", "leader", "facilitator", "host", "musician", "volunteer", "attendee"],
|
options: ["speaker", "leader", "facilitator", "host", "musician", "volunteer", "attendee"],
|
||||||
|
|
||||||
// after — values unchanged, labels added
|
// after: values unchanged, labels added
|
||||||
options: [
|
options: [
|
||||||
["speaker", "Speaker"],
|
["speaker", "Speaker"],
|
||||||
["leader", "Leader"],
|
["leader", "Leader"],
|
||||||
|
|
@ -116,8 +117,11 @@ Things to check while you're there:
|
||||||
- **Several lists are shared constants.** Front page sections and stat
|
- **Several lists are shared constants.** Front page sections and stat
|
||||||
sources are `FRONT_PAGE_SECTIONS` and `STAT_SOURCES` near the top of
|
sources are `FRONT_PAGE_SECTIONS` and `STAT_SOURCES` near the top of
|
||||||
the front page block; change them there, once.
|
the front page block; change them there, once.
|
||||||
- **`blankLabel`** is the text of the empty first option
|
- **`blankLabel`** is the text of the empty first option, written as
|
||||||
(`"— brand —"`, `"— choose —"`). It's also just a label.
|
`Default: …` saying what happens when it's left blank
|
||||||
|
(`"Default: brand"`, `"Default: none"`). It's also just a label. A
|
||||||
|
select with no `blankLabel` shows `- Please choose from the list -`
|
||||||
|
(set in `src/components/admin/fields.tsx`).
|
||||||
- The value (first item) **must not change**. It's what's stored in
|
- The value (first item) **must not change**. It's what's stored in
|
||||||
the database and what the server and the CHECK constraint compare
|
the database and what the server and the CHECK constraint compare
|
||||||
against.
|
against.
|
||||||
|
|
@ -173,9 +177,9 @@ also in `admin-schema.js` and a CHECK):
|
||||||
| Timeline → Points at (+ list filter) | event, organization, award, person, team | no | `refHref` in `src/lib/hrefs.ts` |
|
| 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 |
|
| Timeline → Precision (and on events/orgs) | year, month, day | no | the history page's grouping |
|
||||||
| Front page → Background | brand, photos | **yes** | `HeroStage.tsx` |
|
| Front page → Background | brand, photos | **yes** | `HeroStage.tsx` |
|
||||||
| Front page → Beside the words | none, livestream, video | **yes** | `HeroStage.tsx` |
|
| Front page → Feature | none, livestream, video | **yes** | `HeroStage.tsx` |
|
||||||
| Front page → Sections → Section | countdown, retreats, calendar, stats, timeline, connect | **yes**, `FRONT_PAGE_SECTIONS` | `SECTIONS` in `src/pages/Home.tsx`; see [below](#front-page-section-names) |
|
| Front page → Sections → Section | countdown, retreats, calendar, stats, timeline, connect | **yes**, `FRONT_PAGE_SECTIONS` | `SECTIONS` in `src/pages/Home.tsx`; see [below](#front-page-section-names) |
|
||||||
| Front page → Stats → Where it comes from | manual, years_since, regions, … | **yes**, `STAT_SOURCES` | `STAT_QUERIES` in `server/src/routes/home.js`; see [below](#front-page-stat-sources) |
|
| 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) |
|
||||||
| Every list → Published / Featured filter | 1, 0 | **yes** | n/a |
|
| Every list → Published / Featured filter | 1, 0 | **yes** | n/a |
|
||||||
|
|
||||||
"No, shows values" means the dropdown currently shows the raw value,
|
"No, shows values" means the dropdown currently shows the raw value,
|
||||||
|
|
@ -191,7 +195,7 @@ code):
|
||||||
| Event hosts → Organization; affiliations; team and award "Organization" / "Awarded by"; person → Home organization | `organizations` | organizations, labelled by name |
|
| Event hosts → Organization; affiliations; team and award "Organization" / "Awarded by"; person → Home organization | `organizations` | organizations, labelled by name |
|
||||||
| Event hosts / event people / team members / timeline people → Person | `people` | people |
|
| Event hosts / event people / team members / timeline people → Person | `people` | people |
|
||||||
| Affiliations → Team | `teams` | teams, filtered to the chosen organization |
|
| Affiliations → Team | `teams` | teams, filtered to the chosen organization |
|
||||||
| Person awards → Award | `awards` | awards, labelled "Award — Organization" |
|
| Person awards → Award | `awards` | awards, labelled "Award (Organization)" |
|
||||||
| Person awards → Presented at; Front page → Count down to | `events` | events |
|
| Person awards → Presented at; Front page → Count down to | `events` | events |
|
||||||
| Timeline → Record | `timeline_refs` | all five kinds, filtered by "Points at" |
|
| Timeline → Record | `timeline_refs` | all five kinds, filtered by "Points at" |
|
||||||
|
|
||||||
|
|
@ -206,7 +210,7 @@ each is changed in a different place:
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| **The heading on the page** ("National Retreats", "What's on") | **Admin → Front page → Page sections → Heading.** Blank uses the default below. |
|
| **The heading on the page** ("National Retreats", "What's on") | **Admin → 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 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** ("National Retreats carousel") | `FRONT_PAGE_SECTIONS` in `src/lib/adminSchema.ts` |
|
| **The name in the admin's Section dropdown** ("Events Carousel (National Retreats)") | `FRONT_PAGE_SECTIONS` in `src/lib/adminSchema.ts` |
|
||||||
| The subnav links under the header ("#Retreats", "#Calendar") | `PAGE_SECTIONS["/"]` in `src/navConfig.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
|
To rename a band **for visitors**, use the admin. To rename how it
|
||||||
|
|
@ -214,9 +218,9 @@ reads **in the editor's dropdown**, edit `FRONT_PAGE_SECTIONS`:
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
const FRONT_PAGE_SECTIONS = [
|
const FRONT_PAGE_SECTIONS = [
|
||||||
["countdown", "Countdown to the next event"],
|
["countdown", "Event Countdown"],
|
||||||
["retreats", "National Retreats carousel"], // ← the right-hand side is the label
|
["retreats", "Events Carousel (National Retreats)"], // ← the right-hand side is the label
|
||||||
["calendar", "Event calendar"],
|
["calendar", "Event Calendar"],
|
||||||
...
|
...
|
||||||
];
|
];
|
||||||
```
|
```
|
||||||
|
|
@ -238,7 +242,7 @@ CHECK on `front_page_sections.section` via a migration.
|
||||||
|
|
||||||
## Front page stat sources
|
## Front page stat sources
|
||||||
|
|
||||||
The numbers band's "Where it comes from" dropdown works the same way:
|
The numbers band's "Number Source" dropdown works the same way:
|
||||||
|
|
||||||
- **Relabel a source:** `STAT_SOURCES` in `src/lib/adminSchema.ts`.
|
- **Relabel a source:** `STAT_SOURCES` in `src/lib/adminSchema.ts`.
|
||||||
- **Change what a count counts:** its query in `STAT_QUERIES` in
|
- **Change what a count counts:** its query in `STAT_QUERIES` in
|
||||||
|
|
@ -272,6 +276,26 @@ The numbers band's "Where it comes from" dropdown works the same way:
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## 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)`
|
||||||
|
from `src/lib/text.ts` rather 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
|
## Making the change
|
||||||
|
|
||||||
1. Branch from `main` (never commit to `main` directly).
|
1. Branch from `main` (never commit to `main` directly).
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
it wants to exist, the engine deletes and reinserts in array
|
it wants to exist, the engine deletes and reinserts in array
|
||||||
order, and sort_order becomes the index. That makes drag-to-
|
order, and sort_order becomes the index. That makes drag-to-
|
||||||
reorder free and removes a whole class of "which row is this"
|
reorder free and removes a whole class of "which row is this"
|
||||||
bugs, at the cost of churning autoincrement ids — which is fine
|
bugs, at the cost of churning autoincrement ids, which is fine
|
||||||
precisely because nothing references them.
|
precisely because nothing references them.
|
||||||
|
|
||||||
A column that isn't present in the payload at all is left out of
|
A column that isn't present in the payload at all is left out of
|
||||||
|
|
@ -51,7 +51,7 @@ function coerceValue(column, raw, errors, prefix = "") {
|
||||||
|
|
||||||
// Absent from the payload. Fall back to the descriptor default
|
// Absent from the payload. Fall back to the descriptor default
|
||||||
// if it declares one, otherwise let the column's own DEFAULT do
|
// if it declares one, otherwise let the column's own DEFAULT do
|
||||||
// the work — which needs the column omitted, not nulled.
|
// the work, which needs the column omitted, not nulled.
|
||||||
if (raw === undefined) {
|
if (raw === undefined) {
|
||||||
if (column.default !== undefined) return column.default;
|
if (column.default !== undefined) return column.default;
|
||||||
if (column.required) errors[key] = "Required.";
|
if (column.required) errors[key] = "Required.";
|
||||||
|
|
@ -183,8 +183,8 @@ export function readRow(db, entity, rawId) {
|
||||||
/* A 1:1 side table is found one of two ways. `idColumn` is the
|
/* A 1:1 side table is found one of two ways. `idColumn` is the
|
||||||
original: the side table's key IS the parent's id, which is how
|
original: the side table's key IS the parent's id, which is how
|
||||||
regions and person_private work. `owner` is the same block children
|
regions and person_private work. `owner` is the same block children
|
||||||
already use — a foreign key column plus an optional kind discriminator
|
already use (a foreign key column plus an optional kind discriminator),
|
||||||
— and it exists because a timeline entry is keyed by (ref_kind,
|
and it exists because a timeline entry is keyed by (ref_kind,
|
||||||
ref_id) rather than by the event's own slug. Same upsert either way;
|
ref_id) rather than by the event's own slug. Same upsert either way;
|
||||||
only the WHERE differs. */
|
only the WHERE differs. */
|
||||||
function extensionWhere(ext, id) {
|
function extensionWhere(ext, id) {
|
||||||
|
|
@ -257,7 +257,7 @@ export function createRow(db, entity, payload) {
|
||||||
|
|
||||||
// idKind "auto": the table assigns the id, so there is nothing to
|
// idKind "auto": the table assigns the id, so there is nothing to
|
||||||
// validate, nothing to check for collisions, and nothing for the
|
// validate, nothing to check for collisions, and nothing for the
|
||||||
// client to have sent. Timeline entries use this — they have no
|
// client to have sent. Timeline entries use this: they have no
|
||||||
// natural name to slug, and one gets created every time somebody
|
// natural name to slug, and one gets created every time somebody
|
||||||
// ticks a checkbox on an event.
|
// ticks a checkbox on an event.
|
||||||
const auto = entity.idKind === "auto";
|
const auto = entity.idKind === "auto";
|
||||||
|
|
@ -390,8 +390,8 @@ export function deleteRow(db, entity, rawId) {
|
||||||
function writeExtensions(db, entity, id, payload, parentValues) {
|
function writeExtensions(db, entity, id, payload, parentValues) {
|
||||||
for (const ext of entity.extensions ?? []) {
|
for (const ext of entity.extensions ?? []) {
|
||||||
if (!applies(ext.when, parentValues)) {
|
if (!applies(ext.when, parentValues)) {
|
||||||
// The gate closed — the kind changed away from this side
|
// The gate closed (the kind changed away from this side
|
||||||
// table, or a checkbox was unticked — so its row (and anything
|
// table, or a checkbox was unticked), so its row (and anything
|
||||||
// cascading off it) goes.
|
// cascading off it) goes.
|
||||||
const gone = extensionWhere(ext, id);
|
const gone = extensionWhere(ext, id);
|
||||||
db.prepare(`DELETE FROM ${ext.table} WHERE ${gone.sql}`).run(...gone.params);
|
db.prepare(`DELETE FROM ${ext.table} WHERE ${gone.sql}`).run(...gone.params);
|
||||||
|
|
@ -587,7 +587,7 @@ function deleteChildren(db, child, ownerId) {
|
||||||
|
|
||||||
/* SQLite's constraint messages are accurate and unreadable. Turn
|
/* SQLite's constraint messages are accurate and unreadable. Turn
|
||||||
the ones that users actually cause into something actionable,
|
the ones that users actually cause into something actionable,
|
||||||
and name the column wherever the message carries it — a missing
|
and name the column wherever the message carries it: a missing
|
||||||
field is the client's problem to fix, not a 500.
|
field is the client's problem to fix, not a 500.
|
||||||
|
|
||||||
The descriptor and the schema agreeing (see admin-schema-sync.js)
|
The descriptor and the schema agreeing (see admin-schema-sync.js)
|
||||||
|
|
@ -635,7 +635,7 @@ function wrapDbErrors(fn) {
|
||||||
|
|
||||||
// The polymorphic tables stand in for a foreign key with a
|
// The polymorphic tables stand in for a foreign key with a
|
||||||
// BEFORE INSERT trigger, and a trigger's RAISE(ABORT) matches none
|
// BEFORE INSERT trigger, and a trigger's RAISE(ABORT) matches none
|
||||||
// of the patterns above — so without this, pointing a content
|
// of the patterns above, so without this, pointing a content
|
||||||
// block, link or timeline entry at a row that isn't there is a 500
|
// block, link or timeline entry at a row that isn't there is a 500
|
||||||
// rather than something the form can show.
|
// rather than something the form can show.
|
||||||
const ghost = /^(\w+): no such (\w+)$/.exec(message);
|
const ghost = /^(\w+): no such (\w+)$/.exec(message);
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
field instead of SQLite catching it as a 500;
|
field instead of SQLite catching it as a 500;
|
||||||
- reports a descriptor column the table doesn't have;
|
- reports a descriptor column the table doesn't have;
|
||||||
- reports a NOT NULL, no-DEFAULT column that no descriptor
|
- reports a NOT NULL, no-DEFAULT column that no descriptor
|
||||||
column and no engine-supplied column covers — nothing can
|
column and no engine-supplied column covers: nothing can
|
||||||
ever set it, so every insert through the admin will fail.
|
ever set it, so every insert through the admin will fail.
|
||||||
|
|
||||||
The first is a silent repair. The other two are deployment bugs,
|
The first is a silent repair. The other two are deployment bugs,
|
||||||
|
|
@ -122,7 +122,7 @@ export function syncDescriptorsWithSchema(db, entities, { strict = true } = {})
|
||||||
if (group.engineSupplied.includes(columnName)) continue;
|
if (group.engineSupplied.includes(columnName)) continue;
|
||||||
problems.push(
|
problems.push(
|
||||||
`${name}: ${group.table}.${columnName} is NOT NULL with no default, ` +
|
`${name}: ${group.table}.${columnName} is NOT NULL with no default, ` +
|
||||||
`but no descriptor column covers it — every insert will fail.`,
|
`but no descriptor column covers it, so every insert will fail.`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
ADMIN ENTITY DESCRIPTORS
|
ADMIN ENTITY DESCRIPTORS
|
||||||
|
|
||||||
One object per editable entity. Everything the CRUD handlers do
|
One object per editable entity. Everything the CRUD handlers do
|
||||||
— validation, SQL, nesting — is read from here, so adding a
|
(validation, SQL, nesting) is read from here, so adding a
|
||||||
table later is a descriptor rather than another set of
|
table later is a descriptor rather than another set of
|
||||||
hand-written statements to keep in step with the schema.
|
hand-written statements to keep in step with the schema.
|
||||||
|
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
owner by free-text owner_id, so renaming a slug in place would
|
owner by free-text owner_id, so renaming a slug in place would
|
||||||
silently orphan every link and content block attached to it.
|
silently orphan every link and content block attached to it.
|
||||||
|
|
||||||
affiliations is edited from both ends — a person's roles, and a
|
affiliations is edited from both ends: a person's roles, and a
|
||||||
team's members. Each side deletes and reinserts only its own
|
team's members. Each side deletes and reinserts only its own
|
||||||
slice (WHERE person_id = ?, WHERE team_id = ?) and declares
|
slice (WHERE person_id = ?, WHERE team_id = ?) and declares
|
||||||
every column of the row, so a save from one side round-trips
|
every column of the row, so a save from one side round-trips
|
||||||
|
|
@ -81,7 +81,7 @@ const affiliationRole = [
|
||||||
editor and by the in_timeline extension on events and organizations.
|
editor and by the in_timeline extension on events and organizations.
|
||||||
|
|
||||||
occurred_on is text, not date. "2012" and "2025-07" are legitimate
|
occurred_on is text, not date. "2012" and "2025-07" are legitimate
|
||||||
values — a backfilled entry often knows the year and nothing more —
|
values (a backfilled entry often knows the year and nothing more),
|
||||||
and the date coercion would reject both. `precision` is what says how
|
and the date coercion would reject both. `precision` is what says how
|
||||||
much of it to believe. */
|
much of it to believe. */
|
||||||
const timelineFields = [
|
const timelineFields = [
|
||||||
|
|
@ -180,7 +180,7 @@ const blocksChild = (ownerKind) => ({
|
||||||
});
|
});
|
||||||
|
|
||||||
/* Hosts. One row is one host, ordered, each either an organization
|
/* Hosts. One row is one host, ordered, each either an organization
|
||||||
or a person — the CHECK on event_hosts rejects both and the blank
|
or a person. The CHECK on event_hosts rejects both and the blank
|
||||||
filter drops neither, so the only bad row that reaches SQLite is
|
filter drops neither, so the only bad row that reaches SQLite is
|
||||||
one with both selects filled, and that comes back keyed to the
|
one with both selects filled, and that comes back keyed to the
|
||||||
row like any other field error.
|
row like any other field error.
|
||||||
|
|
@ -496,7 +496,7 @@ const people = {
|
||||||
// · org_id cannot be changed once anyone is filed under the
|
// · org_id cannot be changed once anyone is filed under the
|
||||||
// team. The composite foreign key has no ON UPDATE CASCADE, so
|
// team. The composite foreign key has no ON UPDATE CASCADE, so
|
||||||
// SQLite aborts the UPDATE. That surfaces as a constraint
|
// SQLite aborts the UPDATE. That surfaces as a constraint
|
||||||
// error, which is the correct answer — reassign the members
|
// error, which is the correct answer: reassign the members
|
||||||
// first.
|
// first.
|
||||||
//
|
//
|
||||||
// · deleting a team with members fails the same way, rather than
|
// · deleting a team with members fails the same way, rather than
|
||||||
|
|
@ -655,8 +655,8 @@ const timeline = {
|
||||||
row impossible even without it.
|
row impossible even without it.
|
||||||
|
|
||||||
Every collection here is owned by page_id and replaced wholesale.
|
Every collection here is owned by page_id and replaced wholesale.
|
||||||
That is safe for the same reason it is for links and blocks —
|
That is safe for the same reason it is for links and blocks
|
||||||
nothing has a foreign key into these tables — and paths carry
|
(nothing has a foreign key into these tables), and paths carry
|
||||||
their actions as a nested collection, the shape content blocks
|
their actions as a nested collection, the shape content blocks
|
||||||
and their items already use. */
|
and their items already use. */
|
||||||
|
|
||||||
|
|
@ -811,13 +811,13 @@ export const OPTION_QUERIES = {
|
||||||
ORDER BY kind, label`,
|
ORDER BY kind, label`,
|
||||||
|
|
||||||
// The awarding organization is folded into the label instead,
|
// The awarding organization is folded into the label instead,
|
||||||
// because a person can receive an award from any organization —
|
// because a person can receive an award from any organization:
|
||||||
// there is nothing to filter on, only something to disambiguate
|
// there is nothing to filter on, only something to disambiguate
|
||||||
// when two orgs name an award the same thing.
|
// when two orgs name an award the same thing.
|
||||||
awards: `
|
awards: `
|
||||||
SELECT a.id,
|
SELECT a.id,
|
||||||
CASE WHEN o.name IS NULL THEN a.name
|
CASE WHEN o.name IS NULL THEN a.name
|
||||||
ELSE a.name || ' — ' || o.name END AS label,
|
ELSE a.name || ' (' || o.name || ')' END AS label,
|
||||||
a.org_id
|
a.org_id
|
||||||
FROM awards a
|
FROM awards a
|
||||||
LEFT JOIN organizations o ON o.id = a.org_id
|
LEFT JOIN organizations o ON o.id = a.org_id
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
Everything that decides who someone is. Routes decide what they
|
Everything that decides who someone is. Routes decide what they
|
||||||
may do.
|
may do.
|
||||||
|
|
||||||
Password storage is scrypt from node:crypto — no native module,
|
Password storage is scrypt from node:crypto: no native module,
|
||||||
nothing to compile, nothing for pnpm to get wrong. The stored
|
nothing to compile, nothing for pnpm to get wrong. The stored
|
||||||
string carries its own parameters, so raising the cost later
|
string carries its own parameters, so raising the cost later
|
||||||
doesn't invalidate existing hashes.
|
doesn't invalidate existing hashes.
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
--
|
--
|
||||||
-- A fourth hero mode, 'video': a recorded video beside the words,
|
-- A fourth hero mode, 'video': a recorded video beside the words,
|
||||||
-- the way 'livestream' puts a stream there, but without the LIVE
|
-- the way 'livestream' puts a stream there, but without the LIVE
|
||||||
-- badge and without autoplay — a visitor presses play.
|
-- badge and without autoplay: a visitor presses play.
|
||||||
--
|
--
|
||||||
-- Its own two columns rather than reusing the livestream's, so a
|
-- Its own two columns rather than reusing the livestream's, so a
|
||||||
-- featured video and a stream can both be set up ahead of time and
|
-- featured video and a stream can both be set up ahead of time and
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
feedback routes. Both sit under the same requireAuth.
|
feedback routes. Both sit under the same requireAuth.
|
||||||
|
|
||||||
:entity is matched against the descriptor map, never
|
:entity is matched against the descriptor map, never
|
||||||
interpolated into SQL from the URL — an unknown name is a 404
|
interpolated into SQL from the URL; an unknown name is a 404
|
||||||
before anything touches the database.
|
before anything touches the database.
|
||||||
═══════════════════════════════════════════════════════════════ */
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ admin.get("/feedback", (c) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
/* ── PATCH /api/admin/feedback/:id ───────────────────────────────
|
/* ── PATCH /api/admin/feedback/:id ───────────────────────────────
|
||||||
{ status?, admin_note? } — either, both, partial.
|
{ status?, admin_note? }: either, both, partial.
|
||||||
───────────────────────────────────────────────────────────── */
|
───────────────────────────────────────────────────────────── */
|
||||||
|
|
||||||
admin.patch("/feedback/:id", requireRole("editor"), async (c) => {
|
admin.patch("/feedback/:id", requireRole("editor"), async (c) => {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/* ═══════════════════════════════════════════════════════════════
|
/* ═══════════════════════════════════════════════════════════════
|
||||||
DIRECTORY ROUTE — read-only, mounted under /api
|
DIRECTORY ROUTE: read-only, mounted under /api
|
||||||
|
|
||||||
GET /directory every public record that has a page
|
GET /directory every public record that has a page
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
/* ═══════════════════════════════════════════════════════════════
|
/* ═══════════════════════════════════════════════════════════════
|
||||||
PANEL ROUTES — server/src/routes/panel.js
|
PANEL ROUTES: server/src/routes/panel.js
|
||||||
|
|
||||||
GET /api/admin/panel/overview
|
GET /api/admin/panel/overview
|
||||||
PATCH /api/admin/panel/users/:id role, is_active
|
PATCH /api/admin/panel/users/:id role, is_active
|
||||||
DELETE /api/admin/panel/users/:id/sessions sign out everywhere
|
DELETE /api/admin/panel/users/:id/sessions sign out everywhere
|
||||||
|
|
||||||
Everything here is superadmin-only, enforced once at the top
|
Everything here is superadmin-only, enforced once at the top
|
||||||
rather than per route — there's no read here that an ordinary
|
rather than per route; there's no read here that an ordinary
|
||||||
admin should have either. Account records and live session
|
admin should have either. Account records and live session
|
||||||
counts are a different class of thing from content.
|
counts are a different class of thing from content.
|
||||||
|
|
||||||
|
|
@ -88,7 +88,7 @@ panel.get("/overview", (c) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
/* A table that hasn't been created yet shouldn't take the whole
|
/* A table that hasn't been created yet shouldn't take the whole
|
||||||
page down — the panel is where you go when something is wrong. */
|
page down: the panel is where you go when something is wrong. */
|
||||||
function count(db, table, where) {
|
function count(db, table, where) {
|
||||||
try {
|
try {
|
||||||
const sql = `SELECT COUNT(*) AS n FROM ${table}${where ? ` WHERE ${where}` : ""}`;
|
const sql = `SELECT COUNT(*) AS n FROM ${table}${where ? ` WHERE ${where}` : ""}`;
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@
|
||||||
under 6% of the code, well inside what 'H' repairs, and never
|
under 6% of the code, well inside what 'H' repairs, and never
|
||||||
reaches the three corner finder patterns.
|
reaches the three corner finder patterns.
|
||||||
|
|
||||||
Everything is drawn in the SVG itself — no CSS, no external
|
Everything is drawn in the SVG itself (no CSS, no external
|
||||||
references — so the element serialises to a file that looks the
|
references), so the element serialises to a file that looks the
|
||||||
same outside the page. `ref` reaches the <svg> for exactly that.
|
same outside the page. `ref` reaches the <svg> for exactly that.
|
||||||
═══════════════════════════════════════════════════════════════ */
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@
|
||||||
an ordered collection of them, and nests one level for content
|
an ordered collection of them, and nests one level for content
|
||||||
blocks and their items.
|
blocks and their items.
|
||||||
|
|
||||||
Ordering is array position — the server writes sort_order from
|
Ordering is array position (the server writes sort_order from
|
||||||
the index — so moving a row is a splice, not a number to
|
the index), so moving a row is a splice, not a number to
|
||||||
hand-edit. Rows can be dragged by the handle or moved with the
|
hand-edit. Rows can be dragged by the handle or moved with the
|
||||||
arrow buttons; the arrows are the keyboard path and stay whether
|
arrow buttons; the arrows are the keyboard path and stay whether
|
||||||
or not a pointer is in use.
|
or not a pointer is in use.
|
||||||
|
|
@ -135,7 +135,7 @@ export function Field({ field, value, row, options, error, onChange }: any) {
|
||||||
/>
|
/>
|
||||||
) : widget === "select" ? (
|
) : widget === "select" ? (
|
||||||
// A select has no readOnly, so this one really does have
|
// A select has no readOnly, so this one really does have
|
||||||
// to be disabled — there's no way to keep it focusable
|
// to be disabled: there's no way to keep it focusable
|
||||||
// and still refuse a new choice.
|
// and still refuse a new choice.
|
||||||
<select
|
<select
|
||||||
{...common}
|
{...common}
|
||||||
|
|
@ -144,8 +144,8 @@ export function Field({ field, value, row, options, error, onChange }: any) {
|
||||||
orphaned && !locked ? inputError : ""
|
orphaned && !locked ? inputError : ""
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<option value="">{field.blankLabel ?? "— choose —"}</option>
|
<option value="">{field.blankLabel ?? "- Please choose from the list -"}</option>
|
||||||
{orphaned && <option value={value}>{value} — no longer exists</option>}
|
{orphaned && <option value={value}>{value} no longer exists</option>}
|
||||||
{list.map(([id2, label]) => (
|
{list.map(([id2, label]) => (
|
||||||
<option key={id2} value={id2}>
|
<option key={id2} value={id2}>
|
||||||
{label}
|
{label}
|
||||||
|
|
@ -294,7 +294,7 @@ export function Repeater({ spec, rows, options, errors, errorPrefix, onChange })
|
||||||
}}
|
}}
|
||||||
onDragOver={(e) => {
|
onDragOver={(e) => {
|
||||||
// A null dragIndex means the drag started in some
|
// A null dragIndex means the drag started in some
|
||||||
// other collection — leave it to whoever owns it.
|
// other collection; leave it to whoever owns it.
|
||||||
if (dragIndex === null) return;
|
if (dragIndex === null) return;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
|
||||||
|
|
@ -8,13 +8,15 @@
|
||||||
nested paths ('region.scope') match the side-table keys.
|
nested paths ('region.scope') match the side-table keys.
|
||||||
|
|
||||||
Adding a field is one entry. Adding an entity is one object here
|
Adding a field is one entry. Adding an entity is one object here
|
||||||
plus one descriptor on the server — no new page component.
|
plus one descriptor on the server, with no new page component.
|
||||||
|
|
||||||
A value seeded in a repeater's `blank` must also be declared as
|
A value seeded in a repeater's `blank` must also be declared as
|
||||||
a default: on the matching server column, or a row the user adds
|
a default: on the matching server column, or a row the user adds
|
||||||
and never fills in reads as real input instead of being skipped.
|
and never fills in reads as real input instead of being skipped.
|
||||||
═══════════════════════════════════════════════════════════════ */
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
||||||
|
import { preview } from "./text.ts";
|
||||||
|
|
||||||
const PLACE_FIELDS = [
|
const PLACE_FIELDS = [
|
||||||
{ path: "venue", label: "Venue" },
|
{ path: "venue", label: "Venue" },
|
||||||
{ path: "address", label: "Address", full: true },
|
{ path: "address", label: "Address", full: true },
|
||||||
|
|
@ -36,17 +38,17 @@ const PUBLISH_FIELDS = [
|
||||||
{ path: "sort_order", label: "Sort order", widget: "number" },
|
{ path: "sort_order", label: "Sort order", widget: "number" },
|
||||||
];
|
];
|
||||||
|
|
||||||
/* The parts of an affiliation that read the same from either end —
|
/* The parts of an affiliation that read the same from either end:
|
||||||
the person's list of roles, and the team's list of members. */
|
the person's list of roles, and the team's list of members. */
|
||||||
const AFFILIATION_ROLE_FIELDS = [
|
const AFFILIATION_ROLE_FIELDS = [
|
||||||
{ path: "title", label: "Title", help: "Board Chair, Chapter Lead" },
|
{ path: "title", label: "Title", help: "eg. Board Chair, Team Lead" },
|
||||||
{
|
{
|
||||||
path: "role",
|
path: "role",
|
||||||
label: "Role",
|
label: "Role",
|
||||||
widget: "select",
|
widget: "select",
|
||||||
options: ["lead", "board", "staff", "volunteer", "member"],
|
options: ["lead", "board", "staff", "volunteer", "member"],
|
||||||
},
|
},
|
||||||
{ path: "is_owner", label: "Owner", widget: "checkbox", help: "Listed first" },
|
{ path: "is_owner", label: "Owner", widget: "checkbox", help: "Listed first (can be more than one)" },
|
||||||
{ path: "started_on", label: "Started", widget: "date" },
|
{ path: "started_on", label: "Started", widget: "date" },
|
||||||
{ path: "ended_on", label: "Ended", widget: "date", help: "Blank means current" },
|
{ path: "ended_on", label: "Ended", widget: "date", help: "Blank means current" },
|
||||||
{ path: "is_public", label: "Public", widget: "checkbox" },
|
{ path: "is_public", label: "Public", widget: "checkbox" },
|
||||||
|
|
@ -57,7 +59,7 @@ const AFFILIATION_ROLE_FIELDS = [
|
||||||
'region.scope' and 'private.notes' are.
|
'region.scope' and 'private.notes' are.
|
||||||
|
|
||||||
Everything here is an override. Left blank, the history page falls
|
Everything here is an override. Left blank, the history page falls
|
||||||
back to the record's own title, date and logo through v_timeline —
|
back to the record's own title, date and logo through v_timeline,
|
||||||
which is the point of referencing rather than copying. */
|
which is the point of referencing rather than copying. */
|
||||||
const timelineExtensionFields = (noun) => [
|
const timelineExtensionFields = (noun) => [
|
||||||
{
|
{
|
||||||
|
|
@ -105,7 +107,7 @@ const timelineExtensionFields = (noun) => [
|
||||||
const timelineGroup = (noun) => ({
|
const timelineGroup = (noun) => ({
|
||||||
legend: "Timeline",
|
legend: "Timeline",
|
||||||
note:
|
note:
|
||||||
`Adds this ${noun} to the history page. Nothing is copied — the entry ` +
|
`Adds this ${noun} to the history page. Nothing is copied, the entry ` +
|
||||||
`reads this record, so editing it here updates the timeline too.`,
|
`reads this record, so editing it here updates the timeline too.`,
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
|
|
@ -146,7 +148,7 @@ const linksChild = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Hosts. One row is one host, ordered, and each is either an
|
/* Hosts. One row is one host, ordered, and each is either an
|
||||||
organization or a person — never both, which the CHECK on
|
organization or a person, never both, which the CHECK on
|
||||||
event_hosts enforces and this form can only ask nicely about.
|
event_hosts enforces and this form can only ask nicely about.
|
||||||
|
|
||||||
The first row supplies the logo and colour when the event sets
|
The first row supplies the logo and colour when the event sets
|
||||||
|
|
@ -169,15 +171,16 @@ const hostsChild = {
|
||||||
label: "Organization",
|
label: "Organization",
|
||||||
widget: "select",
|
widget: "select",
|
||||||
optionsFrom: "organizations",
|
optionsFrom: "organizations",
|
||||||
blankLabel: "— none —",
|
blankLabel: "Default: none",
|
||||||
|
help: "Host Organization"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "person_id",
|
path: "person_id",
|
||||||
label: "Person",
|
label: "Person",
|
||||||
widget: "select",
|
widget: "select",
|
||||||
optionsFrom: "people",
|
optionsFrom: "people",
|
||||||
blankLabel: "— none —",
|
blankLabel: "Default: none",
|
||||||
help: "One or the other, not both. First host supplies the logo and colour.",
|
help: "Use if the host is an individual, choose between person and org host, not both.",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
@ -186,7 +189,7 @@ const blocksChild = {
|
||||||
key: "content_blocks",
|
key: "content_blocks",
|
||||||
label: "Content blocks",
|
label: "Content blocks",
|
||||||
addLabel: "Add block",
|
addLabel: "Add block",
|
||||||
title: (row) => `${row.type ?? "block"} — ${(row.text ?? "").slice(0, 40) || "empty"}`,
|
title: (row) => `${row.type ?? "block"}: ${preview(row.text, 40) || "empty"}`,
|
||||||
blank: { slot: "body", type: "paragraph", text: "" },
|
blank: { slot: "body", type: "paragraph", text: "" },
|
||||||
fields: [
|
fields: [
|
||||||
{ path: "slot", label: "Slot", widget: "select", options: ["card", "body"] },
|
{ path: "slot", label: "Slot", widget: "select", options: ["card", "body"] },
|
||||||
|
|
@ -231,7 +234,7 @@ const organizations = {
|
||||||
key: "organizations",
|
key: "organizations",
|
||||||
label: "Organizations",
|
label: "Organizations",
|
||||||
singular: "organization",
|
singular: "organization",
|
||||||
idLabel: "Slug",
|
idLabel: "URL ID",
|
||||||
slugFrom: "name",
|
slugFrom: "name",
|
||||||
|
|
||||||
list: {
|
list: {
|
||||||
|
|
@ -264,7 +267,7 @@ const organizations = {
|
||||||
{ path: "short_name", label: "Short name" },
|
{ path: "short_name", label: "Short name" },
|
||||||
{ path: "tagline", label: "Tagline", full: true },
|
{ path: "tagline", label: "Tagline", full: true },
|
||||||
{ path: "color", label: "Colour", widget: "color" },
|
{ path: "color", label: "Colour", widget: "color" },
|
||||||
{ path: "logo", label: "Logo", help: "Filename in public/org-logos/" },
|
{ path: "logo", label: "Logo", help: "Filename in /org-logos/" },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -290,7 +293,7 @@ const organizations = {
|
||||||
label: "Region",
|
label: "Region",
|
||||||
widget: "select",
|
widget: "select",
|
||||||
optionsFrom: "regions",
|
optionsFrom: "regions",
|
||||||
blankLabel: "— none —",
|
blankLabel: "Default: none",
|
||||||
},
|
},
|
||||||
{ path: "chapter.meets", label: "Meets", help: "2nd Sundays, 6:00pm" },
|
{ path: "chapter.meets", label: "Meets", help: "2nd Sundays, 6:00pm" },
|
||||||
{ path: "chapter.started", label: "Started", help: "Since 2021" },
|
{ path: "chapter.started", label: "Started", help: "Since 2021" },
|
||||||
|
|
@ -311,16 +314,16 @@ const organizations = {
|
||||||
title: (row) => row.area_code || "New area",
|
title: (row) => row.area_code || "New area",
|
||||||
blank: { area_code: "", share: 1 },
|
blank: { area_code: "", share: 1 },
|
||||||
fields: [
|
fields: [
|
||||||
{ path: "area_code", label: "Area code", required: true, help: "WA, CA, CANADA" },
|
{ path: "area_code", label: "Area code", required: true, help: "Two letter state code or Country name" },
|
||||||
{ path: "share", label: "Share", widget: "number", help: "1 for the whole tile, 0.5 for half" },
|
{ path: "share", label: "Share", widget: "number", help: "1 for the whole tile, 0.5 for half" },
|
||||||
{
|
{
|
||||||
path: "edge",
|
path: "edge",
|
||||||
label: "Edge",
|
label: "Edge",
|
||||||
widget: "select",
|
widget: "select",
|
||||||
options: ["top", "bottom"],
|
options: ["top", "bottom"],
|
||||||
blankLabel: "— whole tile —",
|
blankLabel: "Default: whole tile",
|
||||||
},
|
},
|
||||||
{ path: "note", label: "Note", help: "north, Salt Lake City area" },
|
{ path: "note", label: "Note", help: "details to explain why it's half or other note" },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
linksChild,
|
linksChild,
|
||||||
|
|
@ -331,8 +334,8 @@ const organizations = {
|
||||||
/* ── Events ──────────────────────────────────────────────────── */
|
/* ── Events ──────────────────────────────────────────────────── */
|
||||||
|
|
||||||
/* The panel the Series checkbox opens. Starts and Ends above stay
|
/* The panel the Series checkbox opens. Starts and Ends above stay
|
||||||
the series' bounds — the first meeting and the last day it can
|
the series' bounds (the first meeting and the last day it can
|
||||||
meet — so nothing here repeats them. */
|
meet), so nothing here repeats them. */
|
||||||
const SERIES_WEEKDAYS = [
|
const SERIES_WEEKDAYS = [
|
||||||
["sun", "Sunday"],
|
["sun", "Sunday"],
|
||||||
["mon", "Monday"],
|
["mon", "Monday"],
|
||||||
|
|
@ -358,10 +361,10 @@ const seriesGroup = {
|
||||||
widget: "select",
|
widget: "select",
|
||||||
options: [
|
options: [
|
||||||
["weekly", "Weekly, on the days ticked below"],
|
["weekly", "Weekly, on the days ticked below"],
|
||||||
["monthly_date", "Monthly, on the start date's day (the 13th)"],
|
["monthly_date", "Monthly, on the day of the start date (eg. the 13th)"],
|
||||||
["monthly_weekday", "Monthly, on the start date's weekday (2nd Tuesday)"],
|
["monthly_weekday", "Monthly, on the weekday of the start date (eg. 2nd Tuesday)"],
|
||||||
],
|
],
|
||||||
blankLabel: "— weekly —",
|
blankLabel: "Default: weekly",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "series_interval",
|
path: "series_interval",
|
||||||
|
|
@ -390,7 +393,7 @@ const events = {
|
||||||
key: "events",
|
key: "events",
|
||||||
label: "Events",
|
label: "Events",
|
||||||
singular: "event",
|
singular: "event",
|
||||||
idLabel: "Slug",
|
idLabel: "URL ID",
|
||||||
slugFrom: "title",
|
slugFrom: "title",
|
||||||
|
|
||||||
list: {
|
list: {
|
||||||
|
|
@ -424,7 +427,7 @@ const events = {
|
||||||
widget: "select",
|
widget: "select",
|
||||||
optionsFrom: "event_scopes",
|
optionsFrom: "event_scopes",
|
||||||
required: true,
|
required: true,
|
||||||
help: "Whose gathering this is. Only national, regional and partner appear on the Retreats page",
|
help: "Whose gathering this is.",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "event_type",
|
path: "event_type",
|
||||||
|
|
@ -447,20 +450,20 @@ const events = {
|
||||||
{
|
{
|
||||||
path: "date_label",
|
path: "date_label",
|
||||||
label: "Date label",
|
label: "Date label",
|
||||||
help: "What the card shows — 'March/April 2026' is fine here",
|
help: "Text override of what the card shows (eg. March/April 2026)",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "status",
|
path: "status",
|
||||||
label: "Status",
|
label: "Status",
|
||||||
widget: "select",
|
widget: "select",
|
||||||
options: ["upcoming", "past", "cancelled"],
|
options: ["upcoming", "past", "cancelled"],
|
||||||
blankLabel: "— derive from end date —",
|
blankLabel: "Default: derive from end date",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "is_series",
|
path: "is_series",
|
||||||
label: "Series",
|
label: "Series",
|
||||||
widget: "checkbox",
|
widget: "checkbox",
|
||||||
help: "Repeats on a schedule — a weekly class, a monthly meeting",
|
help: "Repeats on a schedule, such as a weekly class, a monthly meeting",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
@ -469,7 +472,7 @@ const events = {
|
||||||
{
|
{
|
||||||
legend: "Appearance",
|
legend: "Appearance",
|
||||||
fields: [
|
fields: [
|
||||||
{ path: "event_logo", label: "Event logo", help: "Filename in public/event-logos/" },
|
{ path: "event_logo", label: "Event logo", help: "Filename in /event-logos/" },
|
||||||
{ path: "org_logo", label: "Org logo override" },
|
{ path: "org_logo", label: "Org logo override" },
|
||||||
{ path: "color", label: "Colour", widget: "color" },
|
{ path: "color", label: "Colour", widget: "color" },
|
||||||
{ path: "gradient", label: "Gradient", full: true },
|
{ path: "gradient", label: "Gradient", full: true },
|
||||||
|
|
@ -511,7 +514,7 @@ const events = {
|
||||||
"attendee",
|
"attendee",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{ path: "title", label: "Title", help: "Keynote Speaker" },
|
{ path: "title", label: "Title", help: "eg. Keynote Speaker" },
|
||||||
{ path: "is_public", label: "Show on the site", widget: "checkbox" },
|
{ path: "is_public", label: "Show on the site", widget: "checkbox" },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
@ -526,7 +529,7 @@ const people = {
|
||||||
key: "people",
|
key: "people",
|
||||||
label: "People",
|
label: "People",
|
||||||
singular: "person",
|
singular: "person",
|
||||||
idLabel: "Slug",
|
idLabel: "URL ID",
|
||||||
slugFrom: "display_name",
|
slugFrom: "display_name",
|
||||||
|
|
||||||
list: {
|
list: {
|
||||||
|
|
@ -549,13 +552,13 @@ const people = {
|
||||||
{ path: "sort_name", label: "Sort name", help: "Doe, Jane" },
|
{ path: "sort_name", label: "Sort name", help: "Doe, Jane" },
|
||||||
{ path: "pronouns", label: "Pronouns" },
|
{ path: "pronouns", label: "Pronouns" },
|
||||||
{ path: "tagline", label: "Tagline", full: true },
|
{ path: "tagline", label: "Tagline", full: true },
|
||||||
{ path: "photo", label: "Photo", help: "Filename in public/people/" },
|
{ path: "photo", label: "Photo", help: "Filename in /people/" },
|
||||||
{
|
{
|
||||||
path: "primary_org_id",
|
path: "primary_org_id",
|
||||||
label: "Home organization",
|
label: "Home organization",
|
||||||
widget: "select",
|
widget: "select",
|
||||||
optionsFrom: "organizations",
|
optionsFrom: "organizations",
|
||||||
blankLabel: "— none —",
|
blankLabel: "Default: none",
|
||||||
help: "Optional. Shown above their bio",
|
help: "Optional. Shown above their bio",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -591,7 +594,7 @@ const people = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
legend: "Publishing",
|
legend: "Publishing",
|
||||||
note: "Unpublished people are invisible everywhere, including as chapter leads.",
|
note: "Unpublished people are invisible everywhere.",
|
||||||
fields: [PUBLISHED_FIELD],
|
fields: [PUBLISHED_FIELD],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
@ -622,7 +625,7 @@ const people = {
|
||||||
label: "Team",
|
label: "Team",
|
||||||
widget: "select",
|
widget: "select",
|
||||||
optionsFrom: "teams",
|
optionsFrom: "teams",
|
||||||
blankLabel: "— none —",
|
blankLabel: "Default: none",
|
||||||
// A team belongs to an org; offering one from another
|
// A team belongs to an org; offering one from another
|
||||||
// org would fail the composite foreign key on save.
|
// org would fail the composite foreign key on save.
|
||||||
filterBy: (option, row) => option.org_id === row.org_id,
|
filterBy: (option, row) => option.org_id === row.org_id,
|
||||||
|
|
@ -652,7 +655,7 @@ const people = {
|
||||||
label: "Presented at",
|
label: "Presented at",
|
||||||
widget: "select",
|
widget: "select",
|
||||||
optionsFrom: "events",
|
optionsFrom: "events",
|
||||||
blankLabel: "— none —",
|
blankLabel: "Default: none",
|
||||||
},
|
},
|
||||||
{ path: "awarded_on", label: "Date", widget: "date" },
|
{ path: "awarded_on", label: "Date", widget: "date" },
|
||||||
{ path: "citation", label: "Citation", widget: "textarea", full: true },
|
{ path: "citation", label: "Citation", widget: "textarea", full: true },
|
||||||
|
|
@ -670,7 +673,7 @@ const teams = {
|
||||||
key: "teams",
|
key: "teams",
|
||||||
label: "Teams",
|
label: "Teams",
|
||||||
singular: "team",
|
singular: "team",
|
||||||
idLabel: "Slug",
|
idLabel: "URL ID",
|
||||||
// teams.id is a global primary key, not scoped to the org, so
|
// teams.id is a global primary key, not scoped to the org, so
|
||||||
// 'board' can only exist once across the whole site. Composing
|
// 'board' can only exist once across the whole site. Composing
|
||||||
// the slug from both fields is what keeps NGU's board and the
|
// the slug from both fields is what keeps NGU's board and the
|
||||||
|
|
@ -694,7 +697,7 @@ const teams = {
|
||||||
{
|
{
|
||||||
legend: "Identity",
|
legend: "Identity",
|
||||||
note:
|
note:
|
||||||
"Pick the organization first: the slug is built from it, " +
|
"Pick the organization first: the id is built from it, " +
|
||||||
"and it can't be changed once anyone is filed under this team.",
|
"and it can't be changed once anyone is filed under this team.",
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
|
|
@ -708,7 +711,7 @@ const teams = {
|
||||||
{ path: "name", label: "Name", required: true, help: "Board, Leadership Team" },
|
{ path: "name", label: "Name", required: true, help: "Board, Leadership Team" },
|
||||||
{ path: "tagline", label: "Tagline", full: true },
|
{ path: "tagline", label: "Tagline", full: true },
|
||||||
{ path: "color", label: "Colour", widget: "color" },
|
{ path: "color", label: "Colour", widget: "color" },
|
||||||
{ path: "logo", label: "Logo", help: "Filename in public/org-logos/" },
|
{ path: "logo", label: "Logo", help: "Filename in /org-logos/" },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{ legend: "Publishing", fields: PUBLISH_FIELDS },
|
{ legend: "Publishing", fields: PUBLISH_FIELDS },
|
||||||
|
|
@ -749,7 +752,7 @@ const awards = {
|
||||||
key: "awards",
|
key: "awards",
|
||||||
label: "Awards",
|
label: "Awards",
|
||||||
singular: "award",
|
singular: "award",
|
||||||
idLabel: "Slug",
|
idLabel: "URL ID",
|
||||||
slugFrom: "name",
|
slugFrom: "name",
|
||||||
|
|
||||||
list: {
|
list: {
|
||||||
|
|
@ -777,7 +780,7 @@ const awards = {
|
||||||
label: "Awarded by",
|
label: "Awarded by",
|
||||||
widget: "select",
|
widget: "select",
|
||||||
optionsFrom: "organizations",
|
optionsFrom: "organizations",
|
||||||
blankLabel: "— unattributed —",
|
blankLabel: "- unattributed -",
|
||||||
help: "The organization that gives this award",
|
help: "The organization that gives this award",
|
||||||
},
|
},
|
||||||
{ path: "name", label: "Name", required: true },
|
{ path: "name", label: "Name", required: true },
|
||||||
|
|
@ -843,7 +846,7 @@ const timeline = {
|
||||||
note:
|
note:
|
||||||
"An entry either points at a record or stands on its own. " +
|
"An entry either points at a record or stands on its own. " +
|
||||||
"Pointing at one means its title, date and logo come from that " +
|
"Pointing at one means its title, date and logo come from that " +
|
||||||
"record \u2014 nothing is copied, so editing the record updates this.",
|
"record and nothing is copied, so editing the record updates this.",
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
path: "kind",
|
path: "kind",
|
||||||
|
|
@ -858,15 +861,15 @@ const timeline = {
|
||||||
label: "Points at",
|
label: "Points at",
|
||||||
widget: "select",
|
widget: "select",
|
||||||
options: ["event", "organization", "award", "person", "team"],
|
options: ["event", "organization", "award", "person", "team"],
|
||||||
blankLabel: "\u2014 nothing, this stands alone \u2014",
|
blankLabel: "Default: nothing",
|
||||||
help: "Changing this leaves the record below orphaned \u2014 pick a new one",
|
help: "Changing this leaves the record below orphaned, pick a new one",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "ref_id",
|
path: "ref_id",
|
||||||
label: "Record",
|
label: "Record",
|
||||||
widget: "select",
|
widget: "select",
|
||||||
optionsFrom: "timeline_refs",
|
optionsFrom: "timeline_refs",
|
||||||
blankLabel: "\u2014 none \u2014",
|
blankLabel: "Default: none",
|
||||||
// One flat list of every referenceable row, narrowed to the
|
// One flat list of every referenceable row, narrowed to the
|
||||||
// kind chosen above. Five dropdowns of which four are always
|
// kind chosen above. Five dropdowns of which four are always
|
||||||
// wrong would be worse.
|
// wrong would be worse.
|
||||||
|
|
@ -879,7 +882,7 @@ const timeline = {
|
||||||
legend: "When",
|
legend: "When",
|
||||||
note:
|
note:
|
||||||
"Blank takes the referenced record's own date. Precision is what " +
|
"Blank takes the referenced record's own date. Precision is what " +
|
||||||
"says how much of the date to believe \u2014 a backfilled entry that " +
|
"says how much of the date to believe, a backfilled entry that " +
|
||||||
"only knows the year should say so.",
|
"only knows the year should say so.",
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
|
|
@ -927,7 +930,7 @@ const timeline = {
|
||||||
addLabel: "Add person",
|
addLabel: "Add person",
|
||||||
note:
|
note:
|
||||||
"For an entry about people. A 'people' entry pointing at a team " +
|
"For an entry about people. A 'people' entry pointing at a team " +
|
||||||
"already shows that team's members \u2014 this is for the cases where " +
|
"already shows that team's members, this is for the cases where " +
|
||||||
"the list is editorial rather than structural.",
|
"the list is editorial rather than structural.",
|
||||||
title: (row, options) =>
|
title: (row, options) =>
|
||||||
options?.people?.find((p) => p.id === row.person_id)?.label ?? "New person",
|
options?.people?.find((p) => p.id === row.person_id)?.label ?? "New person",
|
||||||
|
|
@ -959,23 +962,23 @@ const timeline = {
|
||||||
what the page and the API key on. */
|
what the page and the API key on. */
|
||||||
|
|
||||||
const FRONT_PAGE_SECTIONS = [
|
const FRONT_PAGE_SECTIONS = [
|
||||||
["countdown", "Countdown to the next event"],
|
["countdown", "Event Countdown"],
|
||||||
["retreats", "National Retreats carousel"],
|
["retreats", "Events Carousel (National Retreats)"],
|
||||||
["calendar", "Event calendar"],
|
["calendar", "Event Calendar"],
|
||||||
["stats", "Numbers"],
|
["stats", "Stats"],
|
||||||
["timeline", "Featured timeline"],
|
["timeline", "Featured Timeline"],
|
||||||
["connect", "Find your way in"],
|
["connect", "Connect Nav"],
|
||||||
];
|
];
|
||||||
|
|
||||||
const STAT_SOURCES = [
|
const STAT_SOURCES = [
|
||||||
["manual", "Typed in — shows Value"],
|
["manual", "Print Value Field"],
|
||||||
["years_since", "Years since — Value is the year"],
|
["years_since", "Years Since Value"],
|
||||||
["regions", "Count: published regions"],
|
["regions", "Count: regions"],
|
||||||
["chapters", "Count: published chapters"],
|
["chapters", "Count: chapters"],
|
||||||
["partners", "Count: published partners"],
|
["partners", "Count: partners"],
|
||||||
["events_held", "Count: past events"],
|
["events_held", "Count: past events"],
|
||||||
["retreats_held", "Count: past retreats"],
|
["retreats_held", "Count: past retreats"],
|
||||||
["people", "Count: published people"],
|
["people", "Count: people in database"],
|
||||||
["awards_given", "Count: public awards given"],
|
["awards_given", "Count: public awards given"],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
@ -990,7 +993,7 @@ const frontPage = {
|
||||||
|
|
||||||
groups: [
|
groups: [
|
||||||
{
|
{
|
||||||
legend: "Hero",
|
legend: "Hero - Primary Section",
|
||||||
note: "The first thing a visitor sees. Blank buttons don't render.",
|
note: "The first thing a visitor sees. Blank buttons don't render.",
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
|
|
@ -998,29 +1001,29 @@ const frontPage = {
|
||||||
label: "Background",
|
label: "Background",
|
||||||
widget: "select",
|
widget: "select",
|
||||||
options: [
|
options: [
|
||||||
["brand", "Brand — animated colour and the dove"],
|
["brand", "Brand: animated colour and the dove"],
|
||||||
["photos", "Photos — cycles through the photos below"],
|
["photos", "Photos: cycles through the photos below"],
|
||||||
],
|
],
|
||||||
blankLabel: "— brand —",
|
blankLabel: "Default: brand",
|
||||||
help: "Photos with none added shows the brand background",
|
help: "Photos with none added shows the brand background",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "hero_feature",
|
path: "hero_feature",
|
||||||
label: "Beside the words",
|
label: "Feature",
|
||||||
widget: "select",
|
widget: "select",
|
||||||
options: [
|
options: [
|
||||||
["none", "Nothing — the words fill the hero"],
|
["none", "Nothing: No additional overlay"],
|
||||||
["livestream", "Livestream — the stream, with a LIVE badge"],
|
["livestream", "Livestream: the stream, with a LIVE badge"],
|
||||||
["video", "Featured video — click to play"],
|
["video", "Featured video: click to play"],
|
||||||
],
|
],
|
||||||
blankLabel: "— nothing —",
|
blankLabel: "Default: nothing",
|
||||||
help: "Switch to Livestream when you go live, and back when you're done",
|
help: "Switch to Livestream when you go live, and back when you're done",
|
||||||
},
|
},
|
||||||
{ path: "eyebrow", label: "Eyebrow", help: "Small line above the headline" },
|
{ path: "eyebrow", label: "Eyebrow", help: "Small line above the headline" },
|
||||||
{ path: "headline", label: "Headline", full: true },
|
{ path: "headline", label: "Headline", full: true },
|
||||||
{ path: "subhead", label: "Subhead", widget: "textarea", full: true },
|
{ path: "subhead", label: "Subhead", widget: "textarea", full: true },
|
||||||
{ path: "primary_label", label: "Main button label" },
|
{ path: "primary_label", label: "Main button label" },
|
||||||
{ path: "primary_url", label: "Main button link", help: "/retreats, #connect or a full URL" },
|
{ path: "primary_url", label: "Main button link", help: "/page, #section-id or a full URL" },
|
||||||
{ path: "secondary_label", label: "Second button label" },
|
{ path: "secondary_label", label: "Second button label" },
|
||||||
{ path: "secondary_url", label: "Second button link" },
|
{ path: "secondary_url", label: "Second button link" },
|
||||||
],
|
],
|
||||||
|
|
@ -1032,7 +1035,7 @@ const frontPage = {
|
||||||
path: "slide_seconds",
|
path: "slide_seconds",
|
||||||
label: "Seconds per photo",
|
label: "Seconds per photo",
|
||||||
widget: "number",
|
widget: "number",
|
||||||
help: "Photos mode. 3 to 60",
|
help: "Photos Background. Set from 3 to 60 seconds",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "livestream_url",
|
path: "livestream_url",
|
||||||
|
|
@ -1047,7 +1050,7 @@ const frontPage = {
|
||||||
full: true,
|
full: true,
|
||||||
help:
|
help:
|
||||||
"A YouTube, Vimeo or Facebook link, or a video file: a filename in " +
|
"A YouTube, Vimeo or Facebook link, or a video file: a filename in " +
|
||||||
"public/front-page/ or a link ending in .mp4 or .webm",
|
"/front-page/ or a link ending in .mp4 or .webm",
|
||||||
},
|
},
|
||||||
{ path: "video_title", label: "Video title", full: true, help: "Shown after \"Featured video\" above the headline" },
|
{ path: "video_title", label: "Video title", full: true, help: "Shown after \"Featured video\" above the headline" },
|
||||||
],
|
],
|
||||||
|
|
@ -1060,7 +1063,7 @@ const frontPage = {
|
||||||
label: "Count down to",
|
label: "Count down to",
|
||||||
widget: "select",
|
widget: "select",
|
||||||
optionsFrom: "events",
|
optionsFrom: "events",
|
||||||
blankLabel: "— the next upcoming event —",
|
blankLabel: "Default: the next upcoming event ",
|
||||||
help: "Leave blank almost always. A pinned event that's over falls back to the next one",
|
help: "Leave blank almost always. A pinned event that's over falls back to the next one",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
@ -1084,7 +1087,7 @@ const frontPage = {
|
||||||
options: FRONT_PAGE_SECTIONS,
|
options: FRONT_PAGE_SECTIONS,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
{ path: "title", label: "Heading", help: "Blank for the section's own" },
|
{ path: "title", label: "Heading", help: "Heading Override" },
|
||||||
{ path: "blurb", label: "Blurb", full: true },
|
{ path: "blurb", label: "Blurb", full: true },
|
||||||
{ path: "is_hidden", label: "Hidden", widget: "checkbox", help: "Hide for now" },
|
{ path: "is_hidden", label: "Hidden", widget: "checkbox", help: "Hide for now" },
|
||||||
],
|
],
|
||||||
|
|
@ -1097,7 +1100,7 @@ const frontPage = {
|
||||||
title: (row) => row.caption || row.media || "New photo",
|
title: (row) => row.caption || row.media || "New photo",
|
||||||
blank: { media: "", alt: "", caption: "" },
|
blank: { media: "", alt: "", caption: "" },
|
||||||
fields: [
|
fields: [
|
||||||
{ path: "media", label: "Photo", required: true, help: "Filename in public/front-page/, or a URL" },
|
{ path: "media", label: "Photo", required: true, help: "Filename in /front-page/, or a URL" },
|
||||||
{ path: "alt", label: "Description", help: "For screen readers" },
|
{ path: "alt", label: "Description", help: "For screen readers" },
|
||||||
{ path: "caption", label: "Caption", full: true },
|
{ path: "caption", label: "Caption", full: true },
|
||||||
{ path: "link_url", label: "Link", help: "Optional; makes the caption a link" },
|
{ path: "link_url", label: "Link", help: "Optional; makes the caption a link" },
|
||||||
|
|
@ -1114,26 +1117,26 @@ const frontPage = {
|
||||||
{ path: "label", label: "Label", required: true },
|
{ path: "label", label: "Label", required: true },
|
||||||
{
|
{
|
||||||
path: "source",
|
path: "source",
|
||||||
label: "Where it comes from",
|
label: "Number Source",
|
||||||
widget: "select",
|
widget: "select",
|
||||||
options: STAT_SOURCES,
|
options: STAT_SOURCES,
|
||||||
blankLabel: "— typed in —",
|
blankLabel: "Default: Print Value",
|
||||||
},
|
},
|
||||||
{ path: "value", label: "Value", help: "Typed in: the number. Years since: the year" },
|
{ path: "value", label: "Value", help: "The number thats printed" },
|
||||||
{ path: "suffix", label: "Suffix", help: "+, k, % …" },
|
{ path: "suffix", label: "Suffix", help: "+, k, % …" },
|
||||||
{ path: "note", label: "Note", full: true },
|
{ path: "note", label: "Note", full: true },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: "paths",
|
key: "paths",
|
||||||
label: "Find your way in",
|
label: "Connect Nav",
|
||||||
note: "Each path is a choice a visitor can pick; its actions appear when they do.",
|
note: "Each path is a choice a visitor can pick; its actions appear when they do.",
|
||||||
addLabel: "Add path",
|
addLabel: "Add path",
|
||||||
title: (row) => [row.icon, row.label].filter(Boolean).join(" ") || "New path",
|
title: (row) => [row.icon, row.label].filter(Boolean).join(" ") || "New path",
|
||||||
blank: { label: "", icon: "", blurb: "" },
|
blank: { label: "", icon: "", blurb: "" },
|
||||||
fields: [
|
fields: [
|
||||||
{ path: "label", label: "Label", required: true, help: "Attend, Serve…" },
|
{ path: "label", label: "Label", required: true, help: "eg. Attend, Serve…" },
|
||||||
{ path: "icon", label: "Icon", help: "One emoji" },
|
{ path: "icon", label: "Icon", help: "Emoji" },
|
||||||
{ path: "blurb", label: "Blurb", full: true },
|
{ path: "blurb", label: "Blurb", full: true },
|
||||||
],
|
],
|
||||||
children: [
|
children: [
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@
|
||||||
|
|
||||||
The layout knows which section you're in; only the page knows
|
The layout knows which section you're in; only the page knows
|
||||||
which record is on screen. Rather than have both write
|
which record is on screen. Rather than have both write
|
||||||
document.title and race — child effects run before parent
|
document.title and race (child effects run before parent
|
||||||
effects, so the layout would win and the record name would
|
effects, so the layout would win and the record name would
|
||||||
never survive — the page publishes a string and the layout is
|
never survive), the page publishes a string and the layout is
|
||||||
the single writer.
|
the single writer.
|
||||||
|
|
||||||
Null is the normal state. A page that publishes nothing, or one
|
Null is the normal state. A page that publishes nothing, or one
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@
|
||||||
EMBEDS
|
EMBEDS
|
||||||
|
|
||||||
Turns the link an admin pastes into the URL an <iframe> can
|
Turns the link an admin pastes into the URL an <iframe> can
|
||||||
load. People paste the page they're looking at — a YouTube watch
|
load. People paste the page they're looking at (a YouTube watch
|
||||||
or live link, a Facebook video, a Vimeo page — not the embed
|
or live link, a Facebook video, a Vimeo page), not the embed
|
||||||
form, so those are recognised and rewritten. Anything else that
|
form, so those are recognised and rewritten. Anything else that
|
||||||
is https is assumed to already be an embed URL and passed
|
is https is assumed to already be an embed URL and passed
|
||||||
through; anything that isn't https is refused, so the hero never
|
through; anything that isn't https is refused, so the hero never
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
Streams start playing, muted: browsers only autoplay muted
|
Streams start playing, muted: browsers only autoplay muted
|
||||||
video, and a hero that starts shouting is worse than one that
|
video, and a hero that starts shouting is worse than one that
|
||||||
asks. A featured video doesn't start at all — it's a recording,
|
asks. A featured video doesn't start at all: it's a recording,
|
||||||
so the visitor presses play.
|
so the visitor presses play.
|
||||||
|
|
||||||
A featured video can also be a file rather than a link: a
|
A featured video can also be a file rather than a link: a
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/* ═══════════════════════════════════════════════════════════════
|
/* ═══════════════════════════════════════════════════════════════
|
||||||
ROLES — src/lib/roles.ts
|
ROLES: src/lib/roles.ts
|
||||||
|
|
||||||
The same ladder as server/src/auth.js, and it has to stay the
|
The same ladder as server/src/auth.js, and it has to stay the
|
||||||
same ladder. This copy exists to decide what to draw; the
|
same ladder. This copy exists to decide what to draw; the
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
SITE
|
SITE
|
||||||
|
|
||||||
The public address of the live site. Used where a URL has to
|
The public address of the live site. Used where a URL has to
|
||||||
leave the browser and still work — a printed QR code made on
|
leave the browser and still work: a printed QR code made on
|
||||||
localhost or a preview has to point here, not at wherever it was
|
localhost or a preview has to point here, not at wherever it was
|
||||||
generated. Everything inside the site links by path, not this.
|
generated. Everything inside the site links by path, not this.
|
||||||
═══════════════════════════════════════════════════════════════ */
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
|
||||||
23
src/lib/text.ts
Normal file
23
src/lib/text.ts
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
/* ═══════════════════════════════════════════════════════════════
|
||||||
|
TEXT
|
||||||
|
|
||||||
|
Shared helpers for showing a short piece of longer text.
|
||||||
|
|
||||||
|
preview() is for anywhere a paragraph is cut to fit a row title,
|
||||||
|
a list cell or a card: it collapses whitespace and, when it has
|
||||||
|
to cut, stops at the last whole word and ends with an ellipsis,
|
||||||
|
so a shortened line always reads as shortened. Text that already
|
||||||
|
fits comes back unchanged, with no ellipsis.
|
||||||
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
||||||
|
export function preview(text: string | null | undefined, max: number): string {
|
||||||
|
const flat = (text ?? '').replace(/\s+/g, ' ').trim()
|
||||||
|
if (flat.length <= max) return flat
|
||||||
|
|
||||||
|
const cut = flat.slice(0, max)
|
||||||
|
const lastSpace = cut.lastIndexOf(' ')
|
||||||
|
// Break on a word if one ends in the back half; otherwise a single
|
||||||
|
// long word would leave almost nothing.
|
||||||
|
const clean = lastSpace > max / 2 ? cut.slice(0, lastSpace) : cut
|
||||||
|
return `${clean.replace(/[\s.,;:!?]+$/, '')}…`
|
||||||
|
}
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
visible sections in order, counted stats, paths with actions,
|
visible sections in order, counted stats, paths with actions,
|
||||||
and the countdown's event. Edited in the admin under Front page.
|
and the countdown's event. Edited in the admin under Front page.
|
||||||
|
|
||||||
No fallback content. If the request fails the page says so — a
|
No fallback content. If the request fails the page says so: a
|
||||||
plausible default home page would hide a broken server behind
|
plausible default home page would hide a broken server behind
|
||||||
something that looks fine.
|
something that looks fine.
|
||||||
═══════════════════════════════════════════════════════════════ */
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
@ -61,7 +61,7 @@ export type FrontPageSection = {
|
||||||
|
|
||||||
export type FrontPageStat = {
|
export type FrontPageStat = {
|
||||||
label: string
|
label: string
|
||||||
/** Already counted or typed; never null — the API drops those. */
|
/** Already counted or typed; never null, since the API drops those. */
|
||||||
value: string
|
value: string
|
||||||
suffix?: string | null
|
suffix?: string | null
|
||||||
note?: string | null
|
note?: string | null
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import PageShell from '../components/PageShell.tsx'
|
||||||
import QrCodeMaker from './sections/QrCodeMaker.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
|
A QR code for any page on the site, for flyers, slides and
|
||||||
signs. Unlisted: not in navConfig, so neither the header nor the
|
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
|
Reads /api/admin/feedback, writes status and notes back through
|
||||||
PATCH, and deletes through DELETE. Deliberately a flat list
|
PATCH, and deletes through DELETE. Deliberately a flat list
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
Two capabilities, two ranks. Editors and above can change a
|
Two capabilities, two ranks. Editors and above can change a
|
||||||
status or leave a note; deleting is admin and above, matching
|
status or leave a note; deleting is admin and above, matching
|
||||||
requireRole on the server. Both come from the roles ladder
|
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.
|
"admin", and reading it that way is what hid these controls.
|
||||||
|
|
||||||
Every read passes ttl: 0. The api cache exists for public
|
Every read passes ttl: 0. The api cache exists for public
|
||||||
|
|
@ -156,7 +156,7 @@ function FeedbackCard({ row, onChange, onRemove, canWrite, canRemove }) {
|
||||||
rows={2}
|
rows={2}
|
||||||
value={note}
|
value={note}
|
||||||
disabled={busy}
|
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)}
|
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"
|
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 [loading, setLoading] = useState(true);
|
||||||
const [error, setError] = useState<any>(null);
|
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 canWrite = roleCanWrite(user);
|
||||||
const canRemove = canDelete(user);
|
const canRemove = canDelete(user);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
/* ═══════════════════════════════════════════════════════════════
|
/* ═══════════════════════════════════════════════════════════════
|
||||||
ADMIN HOME
|
ADMIN HOME
|
||||||
|
|
||||||
Where login lands. Two columns: the cards are the navigation —
|
Where login lands. Two columns: the cards are the navigation
|
||||||
the header deliberately drops its tab row here so the same links
|
(the header deliberately drops its tab row here so the same links
|
||||||
aren't drawn twice — and a standing info panel on the right.
|
aren't drawn twice), and a standing info panel on the right.
|
||||||
|
|
||||||
The cards come from adminNav.ts, the same list the CMS header
|
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.
|
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 }) {
|
function NavCard({ item }) {
|
||||||
const to = target(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.
|
// "All organizations" under Organizations.
|
||||||
const extras = (item.children ?? []).filter((child) => child.to !== to);
|
const extras = (item.children ?? []).filter((child) => child.to !== to);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
ADMIN LAYOUT
|
ADMIN LAYOUT
|
||||||
|
|
||||||
Bare on purpose. No PageShell, no announcement banner, no
|
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.
|
/admin should never appear in navConfig.
|
||||||
|
|
||||||
Three areas share this chrome: Home, the CMS and the Panel. The
|
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
|
The tab row is drawn everywhere except Home, where the card grid
|
||||||
is the navigation and drawing both would say the same thing
|
is the navigation and drawing both would say the same thing
|
||||||
twice. Which tabs appear depends on the signed-in user —
|
twice. Which tabs appear depends on the signed-in user
|
||||||
navFor() drops the superadmin-only ones — but that's cosmetics.
|
(navFor() drops the superadmin-only ones), but that's cosmetics.
|
||||||
The route guard and the API are what actually say no.
|
The route guard and the API are what actually say no.
|
||||||
═══════════════════════════════════════════════════════════════ */
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
||||||
|
|
@ -53,7 +53,7 @@ export default function AdminLayout() {
|
||||||
matches(pathname, child.to),
|
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
|
// name, or null on a list. setDetail is stable so publishing
|
||||||
// can't loop.
|
// can't loop.
|
||||||
const [detail, setDetail] = useState<any>(null);
|
const [detail, setDetail] = useState<any>(null);
|
||||||
|
|
|
||||||
|
|
@ -8,13 +8,13 @@
|
||||||
|
|
||||||
Three blocks, deliberately boring:
|
Three blocks, deliberately boring:
|
||||||
|
|
||||||
System — what's actually running, for when something is off
|
System what's actually running, for when something is off
|
||||||
Content — row counts, the cheapest "is the database there"
|
Content row counts, the cheapest "is the database there"
|
||||||
Accounts — roles, access and live sessions
|
Accounts roles, access and live sessions
|
||||||
|
|
||||||
The role select is driven by ROLES from lib/roles.ts, so a new
|
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
|
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.
|
point where "Editor" explains itself.
|
||||||
|
|
||||||
Every account write signs that person out, which the server
|
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 { useNavigate } from "react-router-dom";
|
||||||
import { ROLES, ROLE_LABELS, ROLE_NOTES } from "../../lib/roles.ts";
|
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
|
marker that says so. Left alone, browsers read it as local time
|
||||||
and last-login drifts by the timezone offset. */
|
and last-login drifts by the timezone offset. */
|
||||||
function when(value) {
|
function when(value) {
|
||||||
if (!value) return "—";
|
if (!value) return "-";
|
||||||
const iso = value.includes("T") ? value : `${value.replace(" ", "T")}Z`;
|
const iso = value.includes("T") ? value : `${value.replace(" ", "T")}Z`;
|
||||||
const date = new Date(iso);
|
const date = new Date(iso);
|
||||||
return Number.isNaN(date.getTime()) ? value : date.toLocaleString();
|
return Number.isNaN(date.getTime()) ? value : date.toLocaleString();
|
||||||
}
|
}
|
||||||
|
|
||||||
function uptime(seconds) {
|
function uptime(seconds) {
|
||||||
if (seconds == null) return "—";
|
if (seconds == null) return "-";
|
||||||
const d = Math.floor(seconds / 86400);
|
const d = Math.floor(seconds / 86400);
|
||||||
const h = Math.floor((seconds % 86400) / 3600);
|
const h = Math.floor((seconds % 86400) / 3600);
|
||||||
const m = Math.floor((seconds % 3600) / 60);
|
const m = Math.floor((seconds % 3600) / 60);
|
||||||
|
|
@ -104,7 +104,7 @@ export default function AdminPanel() {
|
||||||
}, [load]);
|
}, [load]);
|
||||||
|
|
||||||
/* Replace the one row the server returns rather than refetching
|
/* 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) {
|
function mergeUser(updated) {
|
||||||
setData((current) =>
|
setData((current) =>
|
||||||
current
|
current
|
||||||
|
|
@ -199,7 +199,7 @@ export default function AdminPanel() {
|
||||||
>
|
>
|
||||||
{row.label}{" "}
|
{row.label}{" "}
|
||||||
<strong className="font-semibold text-[#0f2f36]">
|
<strong className="font-semibold text-[#0f2f36]">
|
||||||
{row.count ?? "—"}
|
{row.count ?? "-"}
|
||||||
</strong>
|
</strong>
|
||||||
</span>
|
</span>
|
||||||
))}
|
))}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
/* ═══════════════════════════════════════════════════════════════
|
/* ═══════════════════════════════════════════════════════════════
|
||||||
ADMIN — ENTITY EDIT
|
ADMIN: ENTITY EDIT
|
||||||
|
|
||||||
Create and edit for every entity in the manifest. The form holds
|
Create and edit for every entity in the manifest. The form holds
|
||||||
the whole nested object — parent row, side tables, child
|
the whole nested object (parent row, side tables, child
|
||||||
collections — and PATCH sends the lot. The server replaces
|
collections) and PATCH sends the lot. The server replaces
|
||||||
children wholesale, so what you see here is exactly what will
|
children wholesale, so what you see here is exactly what will
|
||||||
exist afterwards.
|
exist afterwards.
|
||||||
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
A field the form never sets is left out of the payload entirely,
|
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
|
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.
|
field is what used to turn a default into a constraint failure.
|
||||||
|
|
||||||
updated_at rides along untouched. If someone else saved while
|
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
|
Two capabilities, not one role. An editor may create and update
|
||||||
but not delete, so the action bar asks canWrite/canDelete rather
|
but not delete, so the action bar asks canWrite/canDelete rather
|
||||||
than comparing user.role to a string. The comparison this
|
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
|
the moment a rank above admin existed, which is what an equality
|
||||||
test against a ladder always eventually does.
|
test against a ladder always eventually does.
|
||||||
|
|
||||||
|
|
@ -35,8 +35,8 @@
|
||||||
|
|
||||||
slugFrom may name one field or several. Most ids are unique
|
slugFrom may name one field or several. Most ids are unique
|
||||||
because the name is: two organizations aren't both called
|
because the name is: two organizations aren't both called
|
||||||
Northwest. Team ids are the exception — teams.id is a global
|
Northwest. Team ids are the exception: teams.id is a global
|
||||||
primary key, so every org's 'Board' would collide — which is
|
primary key, so every org's 'Board' would collide, which is
|
||||||
why the array form exists and teams uses it.
|
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
|
// Some entities have no slug: the table assigns an integer id, so
|
||||||
// there is nothing to type on create and nothing to compose from
|
// 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.
|
// references an event has no name of its own.
|
||||||
const autoId = manifest?.idKind === "auto";
|
const autoId = manifest?.idKind === "auto";
|
||||||
|
|
||||||
|
|
@ -224,7 +224,7 @@ export default function EntityEdit() {
|
||||||
setForm((prev) => {
|
setForm((prev) => {
|
||||||
let next = setPath(prev, path, value);
|
let next = setPath(prev, path, value);
|
||||||
// Recompose the id whenever one of its sources moves. The
|
// 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
|
// different one has to change the slug, or it would claim a
|
||||||
// team belongs somewhere it doesn't. The tail only follows
|
// team belongs somewhere it doesn't. The tail only follows
|
||||||
// the name until someone types over it.
|
// the name until someone types over it.
|
||||||
|
|
@ -319,7 +319,7 @@ export default function EntityEdit() {
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
{/* Slug. An auto-id entity has nothing to ask for on create, and
|
{/* 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. */}
|
than a disabled box pretending to be a field. */}
|
||||||
{singleton ? (
|
{singleton ? (
|
||||||
updatedAt && (
|
updatedAt && (
|
||||||
|
|
@ -347,7 +347,7 @@ export default function EntityEdit() {
|
||||||
placeholder: isNew && qualifierPaths.length ? "board" : undefined,
|
placeholder: isNew && qualifierPaths.length ? "board" : undefined,
|
||||||
readOnly: !isNew,
|
readOnly: !isNew,
|
||||||
help: !isNew
|
help: !isNew
|
||||||
? "Fixed once created — links and content blocks reference it."
|
? "Fixed once created, since links and content blocks reference it."
|
||||||
: qualifierPaths.length
|
: qualifierPaths.length
|
||||||
? "The prefix comes from the organization. Type the rest."
|
? "The prefix comes from the organization. Type the rest."
|
||||||
: "Lowercase, hyphens, no spaces. Can't be changed later.",
|
: "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
|
{/* 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)) && (
|
{children.some((child) => visible(child.when)) && (
|
||||||
<div className="mt-6 rounded-2xl border border-[#138ba0]/20 bg-white p-5">
|
<div className="mt-6 rounded-2xl border border-[#138ba0]/20 bg-white p-5">
|
||||||
{children
|
{children
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/* ═══════════════════════════════════════════════════════════════
|
/* ═══════════════════════════════════════════════════════════════
|
||||||
ADMIN — ENTITY LIST
|
ADMIN: ENTITY LIST
|
||||||
|
|
||||||
One component for organizations, events and people. The :entity
|
One component for organizations, events and people. The :entity
|
||||||
route param picks the manifest; nothing here knows what a
|
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
|
The "New X" link follows the same rule as EntityEdit's save
|
||||||
button: atLeast(user, "editor"), matching requireRole("editor")
|
button: atLeast(user, "editor"), matching requireRole("editor")
|
||||||
on POST /api/admin/:entity. Drawing it is not permission — the
|
on POST /api/admin/:entity. Drawing it is not permission (the
|
||||||
server decides — it only avoids offering a click that 403s, and
|
server decides); it only avoids offering a click that 403s, and
|
||||||
avoids hiding one that wouldn't.
|
avoids hiding one that wouldn't.
|
||||||
═══════════════════════════════════════════════════════════════ */
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
||||||
|
|
@ -34,7 +34,7 @@ export default function EntityList() {
|
||||||
const [query, setQuery] = useState(params.get("q") ?? "");
|
const [query, setQuery] = useState(params.get("q") ?? "");
|
||||||
|
|
||||||
// Minimum rank, never equality. POST /api/admin/:entity is gated
|
// 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
|
// equality test this replaced hid the button from superadmins as
|
||||||
// well as editors, which is the failure mode an == against a
|
// well as editors, which is the failure mode an == against a
|
||||||
// ladder always produces once a rank is added above it.
|
// ladder always produces once a rank is added above it.
|
||||||
|
|
@ -178,8 +178,8 @@ export default function EntityList() {
|
||||||
{column.widget === "bool"
|
{column.widget === "bool"
|
||||||
? row[column.key]
|
? row[column.key]
|
||||||
? "Yes"
|
? "Yes"
|
||||||
: "—"
|
: "-"
|
||||||
: row[column.key] || "—"}
|
: row[column.key] || "-"}
|
||||||
</td>
|
</td>
|
||||||
))}
|
))}
|
||||||
<td className="px-4 py-3 font-mono text-xs text-[#4a6b72]">{row.id}</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
|
Sits inside RequireAuth, never instead of it: by the time this
|
||||||
renders, the session question has already been answered. All
|
renders, the session question has already been answered. All
|
||||||
this decides is whether the answer was good enough.
|
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
|
data. /api/admin/panel/* is superadmin-only on the server, and
|
||||||
that's the part that matters. Without it, a bookmarked URL 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
|
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
|
Lifted out of AdminLayout because two things read it now: the
|
||||||
header tabs and the card grid on the home page. Adding an entity
|
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
|
list to keep in step, it just isn't inside the layout file
|
||||||
any more.
|
any more.
|
||||||
|
|
||||||
|
|
@ -32,8 +32,8 @@ export const AREA_TITLES = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* The CMS tabs. Teams and Awards live under Organizations because
|
/* The CMS tabs. Teams and Awards live under Organizations because
|
||||||
that's where they belong conceptually — a team is part of an org,
|
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
|
an award is given by one), even though each is its own table and
|
||||||
its own page. */
|
its own page. */
|
||||||
export const CMS_NAV = [
|
export const CMS_NAV = [
|
||||||
{
|
{
|
||||||
|
|
@ -44,7 +44,7 @@ export const CMS_NAV = [
|
||||||
{
|
{
|
||||||
to: "/admin/organizations",
|
to: "/admin/organizations",
|
||||||
label: "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: [
|
children: [
|
||||||
{ to: "/admin/organizations", label: "All organizations" },
|
{ to: "/admin/organizations", label: "All organizations" },
|
||||||
{ to: "/admin/teams", label: "Teams" },
|
{ to: "/admin/teams", label: "Teams" },
|
||||||
|
|
@ -64,7 +64,7 @@ export const CMS_NAV = [
|
||||||
label: "Timeline",
|
label: "Timeline",
|
||||||
blurb: "What the history page shows, and the order it shows it in.",
|
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",
|
to: "/admin/front_page",
|
||||||
label: "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. */
|
outside the CMS rather than as another tab within it. */
|
||||||
export const PANEL_NAV = {
|
export const PANEL_NAV = {
|
||||||
to: ADMIN_PANEL,
|
to: ADMIN_PANEL,
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ function groupsFor(kind: Kind, directory: Directory | null): Group[] {
|
||||||
{
|
{
|
||||||
choices: directory.teams.map((t) => ({
|
choices: directory.teams.map((t) => ({
|
||||||
path: teamHref(t.id),
|
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:
|
Backdrop, what fills the background:
|
||||||
|
|
||||||
brand drifting colour and slow concentric rings — many
|
brand drifting colour and slow concentric rings (many
|
||||||
circles, one centre — with the dove at that centre
|
circles, one centre) with the dove at that centre
|
||||||
photos the hero photos, crossfading with a slow zoom, a
|
photos the hero photos, crossfading with a slow zoom, a
|
||||||
progress bar per photo and a pause button (anything
|
progress bar per photo and a pause button (anything
|
||||||
that moves on its own for more than five seconds
|
that moves on its own for more than five seconds
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue