Replace the front page with an admin-driven home
The home page is rebuilt from scratch and configured from a new Front page tab in the admin, backed by migration 017 and served by GET /api/front-page. Hero: brand, photos (crossfading slideshow with progress and pause) or livestream (YouTube/Facebook/Vimeo embed with a LIVE badge), switched by hand. After it, bands the admin can reorder, retitle or hide: a countdown to the next event (series-aware), the National Retreats carousel, a numbers band (typed in or counted from the database), a horizontal rail of featured timeline entries, and a "Find your way in" pathfinder replacing the old connect section. The CRUD engine gains a `singleton` flag: the entity has one row, made by its migration, and create and delete are refused. The list screen opens that row and the editor drops the slug, back link and delete. shapeSeries moves to shape.js so /front-page can share it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
b4b013209b
commit
6a69084de2
25 changed files with 2299 additions and 494 deletions
|
|
@ -249,6 +249,12 @@ export function normalizeId(entity, id) {
|
|||
}
|
||||
|
||||
export function createRow(db, entity, payload) {
|
||||
// A singleton's one row comes from its migration. There is no
|
||||
// second one to create, and the CHECK on its id would refuse it.
|
||||
if (entity.singleton) {
|
||||
throw new HttpError(405, "There is only one of these; edit it instead.");
|
||||
}
|
||||
|
||||
// idKind "auto": the table assigns the id, so there is nothing to
|
||||
// validate, nothing to check for collisions, and nothing for the
|
||||
// client to have sent. Timeline entries use this — they have no
|
||||
|
|
@ -366,6 +372,12 @@ export function updateRow(db, entity, rawId, payload) {
|
|||
}
|
||||
|
||||
export function deleteRow(db, entity, rawId) {
|
||||
// Deleting a singleton would leave the page it drives with nothing
|
||||
// to read, and the admin with no way to make another.
|
||||
if (entity.singleton) {
|
||||
throw new HttpError(405, "This can't be deleted, only edited.");
|
||||
}
|
||||
|
||||
const id = normalizeId(entity, rawId);
|
||||
const result = wrapDbErrors(() =>
|
||||
db.prepare(`DELETE FROM ${entity.table} WHERE ${entity.idColumn} = ?`).run(id),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue