diff --git a/docs/media-uploads.md b/docs/media-uploads.md index a0e025e..bb2bfe3 100644 --- a/docs/media-uploads.md +++ b/docs/media-uploads.md @@ -38,6 +38,16 @@ Each image's `-640.webp` small copy sits beside it. Video and audio clips (Tools → Video clips) stay in the root. The Media page and every image picker have a tab per folder; a picker opens on its field's folder, and uploads there. + +**Images from before folders** (a bare name in the root) are sorted +once, when the server first starts with this version: a logo or icon +field names it → `logos/`; saved as a preview → `thumbnails/`; anything +else → `images/`. Every record that names it is rewritten to the new +path in one transaction, after the files move (if that fails, the files +move back). The journal says `uploads: moved N image(s) into folders`. +Back up the database and uploads before that first start; nothing is +needed after. + nginx needs no change: `location /uploads/` already serves the folders. ## Files copied in by hand diff --git a/docs/updating-data-in-code.md b/docs/updating-data-in-code.md index 5e6fa46..e7c9fb6 100644 --- a/docs/updating-data-in-code.md +++ b/docs/updating-data-in-code.md @@ -29,11 +29,10 @@ what a dropdown in the admin editor says. | ------------------------------------------------------------ | ---------------- | ------------------------------------ | | A record: an event, organization, person, team, award, timeline entry | the database | editing it in the admin | | The front page's words, photos, bands, stats and paths | the database | Admin → Pages → Front page | -| Blog posts, and the Community page's blog settings (headings, pins, feeds) | the database | Admin → Data → Blog posts, and Admin → Pages → Community | -| The sections of Retreats, Community, Resources, Organization and History: titles, blurbs, accents, their content blocks and presets (the blog, groups map, regions, partners, events, timeline, NGU's details) | the database | Admin → Pages → the page. A section title is 30 characters at most (it's listed in the side nav); a front page heading fits about 60. Preset names: `PRESETS` in `src/lib/adminSchema/sitePages.ts`, what each draws: `PRESETS` in `src/pages/SitePage.tsx` | +| Blog posts, and the Community page's blog section (headings, pins, feeds) | the database | Admin → Data → Blog posts, and Admin → Pages → Community blog section | | The **label** a dropdown shows in the admin | code | [one file](#renaming-what-a-dropdown-shows) | | The **list of allowed values** behind a fixed dropdown | database CHECK + code | [a migration and three files](#adding-removing-or-renaming-a-stored-value) | -| Navigation, colors, the site banner, history decades, the map grid | code | [the file named below](#other-content-that-lives-in-code) | +| Navigation, page section titles, colors, the site banner, history decades, the map grid | code | [the file named below](#other-content-that-lives-in-code) | | A static page's title and intro (also its search title and description), the site's name, description, preview image, icons, search indexing, privacy contact email | the database, over `site.json` | Admin → Panel → Site settings (superadmins). Blank uses `site.json`, which also holds the site's address and the pages' defaults. See `docs/seo.md` | | Uploaded images | disk + the `media` table | Admin → Tools → Media, or any image field. See `docs/media-uploads.md` | @@ -186,7 +185,7 @@ also in `server/src/admin-schema/` and a CHECK): | Front page → Feature | none, livestream, video, event | **yes** | `HeroStage.tsx`; the event is picked in `server/src/routes/home.js` | | Front page → Sections → Section | countdown, retreats, calendar, stats, timeline, connect, featured | **yes**, `FRONT_PAGE_SECTIONS` | `SECTIONS` in `src/pages/Home.tsx`; see [below](#front-page-section-names) | | Front page → Stats → Number Source | manual, years_since, regions, … | **yes**, `STAT_SOURCES` | `STAT_QUERIES` in `server/src/routes/home.js`; see [below](#front-page-stat-sources) | -| Front page → Featured cards → Card type (Community → Community blog: pinned community posts offers link and video only) | record, link, video | **yes**, `FEATURED_KINDS` | `FeaturedCards.tsx` (how each kind draws), `loadFeaturedCards` in `server/src/shape.js` | +| Front page → Featured cards → Card type (Community blog section → Pinned community posts offers link and video only) | record, link, video | **yes**, `FEATURED_KINDS` | `FeaturedCards.tsx` (how each kind draws), `loadFeaturedCards` in `server/src/shape.js` | | Front page → Featured cards → Record type | event, organization, person, team, award | no | `FEATURED_REFS` in `server/src/shape.js` (what each fills the card with); the triggers in `030_featured_cards.sql` | | Every list → Published / Listed / Featured filter | 1, 0 | **yes** | n/a | @@ -202,7 +201,7 @@ code): | Event → Scope (+ list filter); Front page → Countdown → Only this scope | `event_scopes` | the `event_scopes` table (migration only) | | Event hosts → Organization; affiliations; team and award "Organization" / "Awarded by"; person → Home organization | `organizations` | organizations, labeled by name | | Event hosts / event people / team members / timeline people → Person | `people` | people | -| Community → Community blog: pinned posts (ours) → Post | `blog_posts` | blog posts, newest first | +| Community blog section → Pinned posts → Post | `blog_posts` | blog posts, newest first | | Timeline → Record; Featured cards → Record | `record_refs` | every event, organization, award, person and team, narrowed by the type picked beside it | | Affiliations → Team | `teams` | teams, filtered to the chosen organization | | Person awards → Award | `awards` | awards, labeled "Award (Organization)" | @@ -220,7 +219,7 @@ each is changed in a different place: | **The heading on the page** ("National Retreats", "What's on") | **Admin → Pages → Front page → Page sections → Heading.** Blank uses the default below. | | The default heading when that field is blank | `SECTIONS` in `src/pages/Home.tsx`, the `title` of each entry | | **The name in the admin's Section dropdown** ("Events Carousel (National Retreats)") | `FRONT_PAGE_SECTIONS` in `src/lib/adminSchema/frontPage.ts` | -| The links in the header's Home dropdown | the bands shown, under their headings (`src/lib/navSections.ts`) | +| The subnav links under the header ("#Retreats", "#Calendar") | `PAGE_SECTIONS["/"]` in `src/navConfig.ts` | To rename a band **for visitors**, use the admin. To rename how it reads **in the editor's dropdown**, edit `FRONT_PAGE_SECTIONS`: @@ -268,8 +267,8 @@ The numbers band's "Number Source" dropdown works the same way: | What | File | Notes | | --- | --- | --- | -| Header and footer navigation, each page's sections (the header dropdowns, mobile menu and footer site map) | `src/navConfig.ts` | `PAGE_LINKS` (order), `NAV_ACTIONS`. Each page's sections aren't listed there: they follow the page itself, through `src/lib/navSections.ts` (the site pages' sections from Admin → Pages; the front page's bands it shows, with `src/lib/frontPageBands.ts` giving each band's anchor and default heading). A new page also needs a route in `src/App.tsx`. | -| Section titles, blurbs and colors on Feedback, Privacy, Terms | the page file in `src/pages/` | the `SECTIONS` array at the top. | +| Header and footer navigation, page subnav links | `src/navConfig.ts` | `PAGE_LINKS`, `PAGE_SECTIONS`, `NAV_ACTIONS`. A new page also needs a route in `src/App.tsx`. | +| Section titles, blurbs and colors on Retreats, Community, Leadership, Resources, Feedback, Privacy, Terms | the page file in `src/pages/` | the `SECTIONS` array at the top. A section's `id` must match its subnav `hash`. | | Site-wide announcement banner | `src/data/bannerConfig.ts` | `enabled: false` hides it. Bump `id` when the message changes, so people who dismissed the old one see the new one. | | History page decade headers | `src/data/historyDecades.ts` | Title, tagline and blurb per decade. | | Group map tiles and area names | `src/data/mapGrid.ts` | `AREAS` (tile positions) and `AREA_NAMES`. Which region paints which tile is in the database (Admin → Data → Organizations → a region → Map areas). | diff --git a/index.html b/index.html index 50ffe59..6c16a39 100644 --- a/index.html +++ b/index.html @@ -9,16 +9,22 @@ + flash: this browser's choice (ThemeToggle), else the system. --> diff --git a/package.json b/package.json index 86e7e99..14690f3 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,6 @@ }, "dependencies": { "@fontsource/montserrat": "^5.3.0", - "@fontsource/opendyslexic": "^5.3.0", "@fontsource/poppins": "^5.3.0", "@phosphor-icons/react": "^2.1.10", "qrcode": "^1.5.4", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f25676d..2266481 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,9 +11,6 @@ importers: '@fontsource/montserrat': specifier: ^5.3.0 version: 5.3.0 - '@fontsource/opendyslexic': - specifier: ^5.3.0 - version: 5.3.0 '@fontsource/poppins': specifier: ^5.3.0 version: 5.3.0 @@ -69,9 +66,6 @@ packages: '@fontsource/montserrat@5.3.0': resolution: {integrity: sha512-iQPDtZOnmM5ih4JBGaMSXisRap0ixb9bAUw2hDtY7EjVfaqiiNlKtVuJl9XclxUwtwMMHNcWXfQR6zI9x05+Tg==} - '@fontsource/opendyslexic@5.3.0': - resolution: {integrity: sha512-BVYIW/ghc1U2iAghhYTN+GFWiZ3lnCy8Jf2KkZC23aHQHBNcMqKT718zckfqVxRx4qsXJmIMPWvczirRuhmtsg==} - '@fontsource/poppins@5.3.0': resolution: {integrity: sha512-cms1nM7U6SN8epIV1WMVOV8VsA645aSm3wHfzIQnkk188U341ThbJGSl2Sv54V29gnDbT2arMPfLzvVIIVCceQ==} @@ -792,8 +786,6 @@ snapshots: '@fontsource/montserrat@5.3.0': {} - '@fontsource/opendyslexic@5.3.0': {} - '@fontsource/poppins@5.3.0': {} '@jridgewell/gen-mapping@0.3.13': diff --git a/server/src/admin-crud.js b/server/src/admin-crud.js index d7afa70..f82a0b4 100644 --- a/server/src/admin-crud.js +++ b/server/src/admin-crud.js @@ -189,9 +189,8 @@ export function readRow(db, entity, rawId) { row[ext.key] = readExtension(db, ext, id); } - // As text, for the reason readChildren gives its nested ids. for (const child of entity.children ?? []) { - row[child.key] = readChildren(db, child, String(id)); + row[child.key] = readChildren(db, child, id); } return row; @@ -237,13 +236,15 @@ function readChildren(db, child, ownerId) { ) .all(...params); - // Nested collections, to any depth: a page's sections, each - // section's blocks, each block's items. The id goes as text: a JS - // number binds as REAL, which a TEXT owner column (a section's - // blocks) holds as '13.0'; text suits an INTEGER owner just as well. for (const child2 of child.children ?? []) { for (const row of rows) { - row[child2.key] = readChildren(db, child2, String(row.id)); + row[child2.key] = db + .prepare( + `SELECT * FROM ${child2.table} + WHERE ${child2.owner.column} = ? + ORDER BY ${child2.order}`, + ) + .all(row.id); } } @@ -377,14 +378,6 @@ export function updateRow(db, entity, rawId, payload) { `UPDATE ${entity.table} SET ${sets.join(", ")} WHERE ${entity.idColumn} = ?`, ).run(...Object.values(values), id); - } else if (entity.concurrency) { - // A row that is only its collections (a site page and its - // sections) still marks the save, or the next stale save - // would pass the check above. - db.prepare( - `UPDATE ${entity.table} SET ${entity.concurrency} = datetime('now') - WHERE ${entity.idColumn} = ?`, - ).run(id); } writeExtensions(db, entity, id, payload, merged); @@ -514,10 +507,7 @@ function keyedDbErrors(prefix, fn) { } } -function writeChildren(db, entity, rawId, payload, parentValues) { - // As text: an auto id is a JS number, which binds as REAL and - // lands in a TEXT owner column (a newsletter's blocks) as '1.0'. - const id = String(rawId); +function writeChildren(db, entity, id, payload, parentValues) { for (const child of entity.children ?? []) { if (!applies(child.when, parentValues)) { deleteChildren(db, child, id); @@ -526,63 +516,80 @@ function writeChildren(db, entity, rawId, payload, parentValues) { if (payload[child.key] === undefined) continue; // not sent, not touched deleteChildren(db, child, id); - writeRows(db, child, id, payload[child.key], `${child.key}.`, parentValues); - } -} -/* One collection's rows under one owner, then each row's own nested - collections under it, to any depth. Only the top level is deleted - first (writeChildren): a nested row goes with its owner, by a - foreign key's cascade or, for a polymorphic owner like a section's - blocks, by the owner table's cleanup trigger. */ -function writeRows(db, child, ownerId, incomingRaw, prefix, parentValues) { - const incoming = Array.isArray(incomingRaw) ? incomingRaw : []; + const incoming = Array.isArray(payload[child.key]) ? payload[child.key] : []; - // index is the row's place in what the client sent, so a - // validation error still points at the row the user is looking - // at. position counts only the rows that survive, so dropping a - // blank in the middle doesn't leave a gap in sort_order. - const rows = incoming - .map((raw, index) => ({ raw, index })) - .filter(({ raw }) => child.allowBlank || !isBlankChildRow(child, raw)); + // index is the row's place in what the client sent, so a + // validation error still points at the row the user is looking + // at. position counts only the rows that survive, so dropping a + // blank in the middle doesn't leave a gap in sort_order. + const rows = incoming + .map((raw, index) => ({ raw, index })) + .filter(({ raw }) => child.allowBlank || !isBlankChildRow(child, raw)); - rows.forEach(({ raw, index }, position) => { - const rowPrefix = `${prefix}${index}.`; - const { values, errors } = coerceRow(child.columns, raw, { prefix: rowPrefix }); - if (Object.keys(errors).length) { - throw new HttpError(422, "Validation failed", errors); - } + rows.forEach(({ raw, index }, position) => { + const { values, errors } = coerceRow(child.columns, raw, { + prefix: `${child.key}.${index}.`, + }); + if (Object.keys(errors).length) { + throw new HttpError(422, "Validation failed", errors); + } - const names = [child.owner.column, ...Object.keys(values)]; - const params = [ownerId, ...Object.values(values)]; + const names = [child.owner.column, ...Object.keys(values)]; + const params = [id, ...Object.values(values)]; - if (child.owner.kindColumn) { - names.push(child.owner.kindColumn); - params.push(child.owner.kindValue); - } - for (const [column, from] of Object.entries(child.owner.inherit ?? {})) { - if (names.includes(column)) continue; - names.push(column); - params.push(parentValues[from] ?? ownerId); - } - if (child.order === "sort_order" && !names.includes("sort_order")) { - names.push("sort_order"); - params.push(position); - } + if (child.owner.kindColumn) { + names.push(child.owner.kindColumn); + params.push(child.owner.kindValue); + } + for (const [column, from] of Object.entries(child.owner.inherit ?? {})) { + if (names.includes(column)) continue; + names.push(column); + params.push(parentValues[from] ?? id); + } + if (child.order === "sort_order" && !names.includes("sort_order")) { + names.push("sort_order"); + params.push(position); + } - const result = keyedDbErrors(rowPrefix, () => - db + const result = keyedDbErrors(`${child.key}.${index}.`, () => + db .prepare( `INSERT INTO ${child.table} (${names.join(", ")}) VALUES (${names.map(() => "?").join(", ")})`, ) .run(...params), - ); + ); - for (const child2 of child.children ?? []) { - writeRows(db, child2, String(result.lastInsertRowid), raw[child2.key], `${rowPrefix}${child2.key}.`, values); - } - }); + for (const child2 of child.children ?? []) { + const incomingNested = Array.isArray(raw[child2.key]) ? raw[child2.key] : []; + const nested = incomingNested + .map((rawItem, i) => ({ rawItem, i })) + .filter(({ rawItem }) => child2.allowBlank || !isBlankChildRow(child2, rawItem)); + + nested.forEach(({ rawItem, i }, nestedPosition) => { + const item = coerceRow(child2.columns, rawItem, { + prefix: `${child.key}.${index}.${child2.key}.${i}.`, + }); + if (Object.keys(item.errors).length) { + throw new HttpError(422, "Validation failed", item.errors); + } + + const itemNames = [child2.owner.column, ...Object.keys(item.values)]; + const itemParams = [result.lastInsertRowid, ...Object.values(item.values)]; + if (!itemNames.includes("sort_order")) { + itemNames.push("sort_order"); + itemParams.push(nestedPosition); + } + + db.prepare( + `INSERT INTO ${child2.table} (${itemNames.join(", ")}) + VALUES (${itemNames.map(() => "?").join(", ")})`, + ).run(...itemParams); + }); + } + }); + } } function deleteChildren(db, child, ownerId) { diff --git a/server/src/admin-schema.js b/server/src/admin-schema.js index 5bca3db..1769d0e 100644 --- a/server/src/admin-schema.js +++ b/server/src/admin-schema.js @@ -49,16 +49,8 @@ import { teams } from "./admin-schema/teams.js"; import { awards } from "./admin-schema/awards.js"; import { timeline } from "./admin-schema/timeline.js"; import { frontPage } from "./admin-schema/frontPage.js"; -import { blogPosts } from "./admin-schema/blog.js"; +import { blogPosts, communityPage } from "./admin-schema/blog.js"; import { siteSettings } from "./admin-schema/siteSettings.js"; -import { newsletters } from "./admin-schema/newsletters.js"; -import { - communityPage, - retreatsPage, - resourcesPage, - organizationPage, - historyPage, -} from "./admin-schema/sitePages.js"; export const ENTITIES = { organizations, @@ -70,12 +62,7 @@ export const ENTITIES = { front_page: frontPage, blog_posts: blogPosts, community_page: communityPage, - retreats_page: retreatsPage, - resources_page: resourcesPage, - organization_page: organizationPage, - history_page: historyPage, site_settings: siteSettings, - newsletters, }; /* ── Options for the form's select inputs ────────────────────── */ diff --git a/server/src/admin-schema/blog.js b/server/src/admin-schema/blog.js index cb09ac8..55f3da2 100644 --- a/server/src/admin-schema/blog.js +++ b/server/src/admin-schema/blog.js @@ -1,10 +1,11 @@ -import { text, bool, date, blocksChild } from "./columns.js"; +import { text, url, int, bool, date, featuredCardsChild, blocksChild } from "./columns.js"; /* ── Blog (031_blog.sql) ───────────────────────────────────────── Posts of our own, with a content-block body and people as - authors. The Community page's blog section is edited with that - page (sitePages.js). ──────────────────────────────────────── */ + authors, and the Community page's blog section, a singleton like + the front page. The section's community posts are featured cards + owned by 'community_page'. ─────────────────────────────────── */ export const blogPosts = { key: "blog_posts", @@ -45,3 +46,48 @@ export const blogPosts = { blocksChild("blog_post"), ], }; + +export const communityPage = { + key: "community_page", + table: "community_page", + idColumn: "id", + idKind: "slug", + singleton: "community", + concurrency: "updated_at", + + list: { + columns: ["id", "blog_title", "updated_at"], + filters: [], + search: [], + order: "id", + }, + + columns: [ + text("blog_title"), + text("blog_blurb"), + text("internal_title"), + int("internal_slots"), + text("external_title"), + int("external_slots"), + url("external_url"), + text("external_label"), + ], + + children: [ + { + key: "pinned_posts", + table: "community_page_pinned_posts", + owner: { column: "page_id" }, + order: "sort_order", + columns: [text("post_id", { required: true })], + }, + featuredCardsChild("community_page"), + { + key: "feeds", + table: "community_page_feeds", + owner: { column: "page_id" }, + order: "sort_order", + columns: [url("url", { required: true }), text("label")], + }, + ], +}; diff --git a/server/src/admin-schema/columns.js b/server/src/admin-schema/columns.js index 49a0f15..0832550 100644 --- a/server/src/admin-schema/columns.js +++ b/server/src/admin-schema/columns.js @@ -150,7 +150,6 @@ export const blocksChild = (ownerKind) => ({ "schedule", "table", "cards", - "people", ], { required: true }, ), @@ -159,8 +158,6 @@ export const blocksChild = (ownerKind) => ({ url("href"), text("alt"), text("cite"), - // People blocks only (054): whose team's tiles to show. - text("team_id"), ], children: [ { @@ -203,6 +200,5 @@ export const hostsChild = { table: "event_hosts", owner: { column: "event_id" }, order: "sort_order", - // team_id (054): an organization host's team, shown in its place. - columns: [text("org_id"), text("person_id"), text("team_id")], + columns: [text("org_id"), text("person_id")], }; diff --git a/server/src/admin-schema/newsletters.js b/server/src/admin-schema/newsletters.js deleted file mode 100644 index be6d58d..0000000 --- a/server/src/admin-schema/newsletters.js +++ /dev/null @@ -1,27 +0,0 @@ -import { text, blocksChild } from "./columns.js"; - -/* ── Newsletter drafts (057_newsletters.sql) ───────────────────── - - Saved from Tools → Newsletter (AdminNewsletter.tsx), which is - their only editor: there is no list or form for them in Data. - `picks` is the builder's JSON of what's ticked. Deleting a draft - takes its blocks with it (newsletters_cleanup). */ - -export const newsletters = { - key: "newsletters", - table: "newsletters", - idColumn: "id", - idKind: "auto", - concurrency: "updated_at", - - list: { - columns: ["id", "title", "updated_at"], - filters: [], - search: ["title"], - order: "updated_at DESC, id DESC", - }, - - columns: [text("title"), text("intro"), text("footer"), text("picks")], - - children: [blocksChild("newsletter")], -}; diff --git a/server/src/admin-schema/sitePages.js b/server/src/admin-schema/sitePages.js deleted file mode 100644 index 99edd3f..0000000 --- a/server/src/admin-schema/sitePages.js +++ /dev/null @@ -1,95 +0,0 @@ -import { text, url, int, enumeration, featuredCardsChild, blocksChild } from "./columns.js"; - -/* ── The site's own pages (056_site_pages.sql) ─────────────────── - - Community, Retreats, Resources, Organization and History: one - site_pages row each, edited as its own singleton, with its - sections nested under it and each section's blocks under that - (the blocks' items under them, as on any record). A section is - either its blocks or a preset, a prebuilt part of the site - (SitePage.tsx draws both). - - Community also carries the blog section's settings: the - community_page row (same id) as an extension, and its pinned - posts, cards and feeds, all owned by that id. */ - -const sectionsChild = { - key: "sections", - table: "page_sections", - owner: { column: "page_id" }, - order: "sort_order", - columns: [ - text("anchor", { required: true }), - text("title", { required: true }), - text("blurb"), - enumeration("accent", ["teal", "deep", "green", "amber"]), - enumeration("preset", [ - "community_blog", - "group_map", - "region_list", - "partner_list", - "events", - "timeline", - "organization_details", - ]), - text("scope_id"), - enumeration("event_type", ["retreat", "class", "workshop", "meeting", "other"]), - enumeration("view", ["carousel", "grid", "map"]), - ], - children: [blocksChild("page_section")], -}; - -const sitePage = (id, more = {}) => ({ - key: `${id}_page`, - table: "site_pages", - idColumn: "id", - idKind: "slug", - singleton: id, - concurrency: "updated_at", - - list: { columns: ["id", "updated_at"], filters: [], search: [], order: "id" }, - - columns: [], - ...more, - children: [sectionsChild, ...(more.children ?? [])], -}); - -export const communityPage = sitePage("community", { - extensions: [ - { - key: "blog", - table: "community_page", - idColumn: "id", - columns: [ - text("internal_title"), - int("internal_slots"), - text("external_title"), - int("external_slots"), - url("external_url"), - text("external_label"), - ], - }, - ], - children: [ - { - key: "pinned_posts", - table: "community_page_pinned_posts", - owner: { column: "page_id" }, - order: "sort_order", - columns: [text("post_id", { required: true })], - }, - featuredCardsChild("community_page"), - { - key: "feeds", - table: "community_page_feeds", - owner: { column: "page_id" }, - order: "sort_order", - columns: [url("url", { required: true }), text("label")], - }, - ], -}); - -export const retreatsPage = sitePage("retreats"); -export const resourcesPage = sitePage("resources"); -export const organizationPage = sitePage("organization"); -export const historyPage = sitePage("history"); diff --git a/server/src/index.js b/server/src/index.js index 104101c..546041a 100644 --- a/server/src/index.js +++ b/server/src/index.js @@ -26,7 +26,6 @@ import history from "./routes/history.js"; import home from "./routes/home.js"; import directory from "./routes/directory.js"; import blog from "./routes/blog.js"; -import sitePages from "./routes/sitePages.js"; import pages from "./routes/pages.js"; import feedback from "./routes/feedback.js"; import requests from "./routes/requests.js"; @@ -39,7 +38,7 @@ import clips from "./routes/clips.js"; import imports from "./routes/import.js"; import files from "./routes/files.js"; import { CLIPS_DIR, startClipWorker } from "./clips.js"; -import { UPLOADS_DIR, writeMissingThumbs } from "./media.js"; +import { UPLOADS_DIR, sortIntoFolders, writeMissingThumbs } from "./media.js"; import { logSafe, startSessionSweeper } from "./auth.js"; import { syncDescriptorsWithSchema } from "./admin-schema-sync.js"; import { startGroupSync } from "./accessGroups.js"; @@ -58,6 +57,9 @@ syncDescriptorsWithSchema(db, ENTITIES); console.log(`db ${DB_PATH} (${db.driverName}, schema v${version})`); await mkdir(UPLOADS_DIR, { recursive: true }); console.log(`uploads ${UPLOADS_DIR}`); +// Once: images from before folders into logos/, images/, thumbnails/. +const sorted = await sortIntoFolders(db); +if (sorted) console.log(`uploads: moved ${sorted} image(s) into folders`); // In the background: pages fall back to the full file until it's done. writeMissingThumbs() .then((made) => made && console.log(`uploads: made ${made} small copies`)) @@ -170,7 +172,6 @@ app.route("/api", history); app.route("/api", home); app.route("/api", directory); app.route("/api", blog); -app.route("/api", sitePages); // Tighter limit on the write path than anything else gets. app.use("/api/feedback", rateLimit({ windowMs: 60_000, max: 5 })); diff --git a/server/src/media.js b/server/src/media.js index ccbe11f..cada7e9 100644 --- a/server/src/media.js +++ b/server/src/media.js @@ -36,7 +36,8 @@ by itself (link previews, Drive files' first pages), images/ for the rest. A stored name includes it: 'logos/3f9c….webp', served at /uploads/logos/3f9c….webp. The small copy sits beside it. Clips - keep a bare name in the root. + and files from before folders keep a bare name in the root. + sortIntoFolders() moves those older images once, at boot. ── Files copied in by hand ── A file put straight into UPLOADS_DIR has no media row, so the @@ -50,6 +51,7 @@ import { randomBytes } from "node:crypto"; +import { tx } from "./db.js"; import { mkdir, readFile, readdir, rename, stat, unlink, writeFile } from "node:fs/promises"; import path from "node:path"; @@ -371,4 +373,83 @@ export async function registerLooseFiles(db) { // Columns that hold a logo or a site icon: an image one of these // names goes in logos/. +const LOGO_COLUMNS = new Set(["logo", "org_logo", "event_logo", "favicon", "apple_touch_icon"]); +// Tables whose text never names an upload a page uses. +const NOT_CONTENT = new Set(["media", "admin_users", "sessions", "feedback", "feedback_files", "sqlite_sequence"]); + +/* Every image still in the root from before folders, moved into the + folder its uses call for (logos/ if a logo or icon field names it, + thumbnails/ if the site saved it as a preview, else images/), with + every record that names it rewritten to the new path. The files + move first; the rows change in one transaction, and if that fails + the files move back. Returns how many moved; run at boot, and a + no-op once nothing is left in the root. */ +export async function sortIntoFolders(db) { + const rows = db + .prepare( + `SELECT id, filename, original_name FROM media + WHERE instr(filename, '/') = 0 AND content_type LIKE 'image/%'`, + ) + .all(); + if (rows.length === 0) return 0; + + const columns = []; + for (const { name: table } of db + .prepare(`SELECT name FROM sqlite_schema WHERE type = 'table' AND name NOT LIKE 'sqlite_%'`) + .all()) { + if (NOT_CONTENT.has(table)) continue; + for (const col of db.prepare(`SELECT name, type FROM pragma_table_info(?)`).all(table)) { + if (col.type.toUpperCase() === "TEXT") columns.push({ table, column: col.name }); + } + } + const namesOf = (filename) => [ + ...new Set([`${PUBLIC_PREFIX}${filename}`, `${PUBLIC_PREFIX}${encodeURIComponent(filename)}`, filename]), + ]; + const holds = (table, column, values) => + db + .prepare(`SELECT 1 FROM "${table}" WHERE "${column}" IN (${values.map(() => "?").join(", ")}) LIMIT 1`) + .get(...values); + + const moved = []; + for (const row of rows) { + const values = namesOf(row.filename); + const folder = columns.some(({ table, column }) => LOGO_COLUMNS.has(column) && holds(table, column, values)) + ? "logos" + : /^preview |\(preview\)$/.test(row.original_name) || holds("drive_files", "preview", values) + ? "thumbnails" + : "images"; + const to = `${folder}/${row.filename}`; + try { + await mkdir(path.join(UPLOADS_DIR, folder), { recursive: true }); + await rename(path.join(UPLOADS_DIR, row.filename), path.join(UPLOADS_DIR, to)); + } catch (err) { + // Not on disk (deleted by hand): leave its row as it is. + if (err.code !== "ENOENT") console.warn(`media: couldn't move ${row.filename}: ${err.message}`); + continue; + } + await rename(path.join(UPLOADS_DIR, thumbName(row.filename)), path.join(UPLOADS_DIR, thumbName(to))).catch(() => {}); + moved.push({ row, to, values }); + } + + try { + tx(db, () => { + for (const { row, to, values } of moved) { + db.prepare(`UPDATE media SET filename = ? WHERE id = ?`).run(to, row.id); + for (const { table, column } of columns) { + db.prepare(`UPDATE "${table}" SET "${column}" = ? WHERE "${column}" IN (${values.map(() => "?").join(", ")})`).run( + publicPath(to), + ...values, + ); + } + } + }); + } catch (err) { + for (const { row, to } of moved) { + await rename(path.join(UPLOADS_DIR, to), path.join(UPLOADS_DIR, row.filename)).catch(() => {}); + await rename(path.join(UPLOADS_DIR, thumbName(to)), path.join(UPLOADS_DIR, thumbName(row.filename))).catch(() => {}); + } + throw err; + } + return moved.length; +} diff --git a/server/src/migrations/054_people_blocks_host_teams.sql b/server/src/migrations/054_people_blocks_host_teams.sql deleted file mode 100644 index ecb39c0..0000000 --- a/server/src/migrations/054_people_blocks_host_teams.sql +++ /dev/null @@ -1,140 +0,0 @@ --- ═══════════════════════════════════════════════════════════════ --- 054 PEOPLE BLOCKS, HOST TEAMS, THE ORGANIZATION PAGE --- --- A content block of type 'people': a team's people tiles, people --- picked one by one (items, each with a title), or both. The team --- is a new column, content_blocks.team_id; a picked person rides on --- the item's person_id, as a schedule entry's does. ContentBlocks.tsx --- draws it with PeopleTiles. The type CHECK changes, so the table is --- rebuilt as 045 did (legacy_alter_table around the rename, then its --- index and owner trigger again). --- --- An event's organization host can name a team to show instead: --- event_hosts.team_id, any organization's team. The event page then --- reads "Hosted by " linked to the team's page. v_event_hosts --- carries it (and v_events, which reads v_event_hosts, is made again --- around it, unchanged). --- --- The Leadership page is now the Organization page, at /organization: --- a page title or intro saved for /leadership in Site settings moves --- with it. --- ═══════════════════════════════════════════════════════════════ - --- ── Host teams ───────────────────────────────────────────────── - -ALTER TABLE event_hosts ADD COLUMN team_id TEXT REFERENCES teams (id) ON DELETE SET NULL; - -DROP VIEW v_events; -DROP VIEW v_event_hosts; - -CREATE VIEW v_event_hosts AS -SELECT - eh.id, - eh.event_id, - eh.sort_order, - CASE WHEN eh.person_id IS NULL THEN 'organization' ELSE 'person' END - AS host_kind, - COALESCE(eh.org_id, eh.person_id) AS host_id, - COALESCE(o.name, p.display_name) AS host_name, - o.kind AS host_org_kind, - o.logo AS host_logo, - o.color AS host_color, - p.photo AS host_photo, - COALESCE(o.is_published, p.is_published) AS host_is_published, - t.id AS host_team_id, - t.name AS host_team_name -FROM event_hosts eh -LEFT JOIN organizations o ON o.id = eh.org_id -LEFT JOIN people p ON p.id = eh.person_id -LEFT JOIN teams t ON t.id = eh.team_id AND eh.org_id IS NOT NULL AND t.is_published = 1; - -CREATE VIEW v_events AS -SELECT - e.*, - h.host_kind, - h.host_id, - h.host_name, - h.host_org_kind, - COALESCE(e.org_logo, h.host_logo) AS effective_org_logo, - COALESCE(e.color, h.host_color) AS effective_color, - COALESCE( - e.status, - CASE WHEN e.ends_on IS NOT NULL AND e.ends_on < date('now') - THEN 'past' ELSE 'upcoming' END - ) AS effective_status -FROM events e -LEFT JOIN v_event_hosts h - ON h.id = ( - SELECT x.id - FROM v_event_hosts x - WHERE x.event_id = e.id - ORDER BY x.sort_order, x.id - LIMIT 1 - ); - - --- ── People blocks ────────────────────────────────────────────── - -CREATE TABLE content_blocks_new ( - id INTEGER PRIMARY KEY AUTOINCREMENT, - owner_kind TEXT NOT NULL - CHECK (owner_kind IN ('organization', 'event', 'person', 'team', 'blog_post')), - owner_id TEXT NOT NULL, - slot TEXT NOT NULL DEFAULT 'body' CHECK (slot IN ('card', 'body')), - sort_order INTEGER NOT NULL DEFAULT 0, - - type TEXT NOT NULL - CHECK (type IN ('heading', 'subheading', 'paragraph', - 'list', 'links', 'quote', 'image', 'divider', - 'video', 'button', 'callout', 'schedule', 'table', 'cards', - 'people')), - text TEXT, - media TEXT, - href TEXT, - alt TEXT, - cite TEXT, - team_id TEXT REFERENCES teams (id) ON DELETE SET NULL -) STRICT; - -INSERT INTO content_blocks_new - (id, owner_kind, owner_id, slot, sort_order, type, text, media, href, alt, cite) -SELECT id, owner_kind, owner_id, slot, sort_order, type, text, media, href, alt, cite - FROM content_blocks; - -PRAGMA legacy_alter_table = ON; -DROP TABLE content_blocks; -ALTER TABLE content_blocks_new RENAME TO content_blocks; -PRAGMA legacy_alter_table = OFF; - -CREATE INDEX content_blocks_owner_idx - ON content_blocks (owner_kind, owner_id, slot, sort_order); - - --- ── The Organization page ────────────────────────────────────── - -UPDATE site_setting_pages SET path = '/organization' WHERE path = '/leadership'; - - --- ── Triggers last (see CLAUDE.md, Migrations) ── - -CREATE TRIGGER content_blocks_owner_exists -BEFORE INSERT ON content_blocks -BEGIN - SELECT CASE - WHEN new.owner_kind = 'event' - AND NOT EXISTS (SELECT 1 FROM events WHERE id = new.owner_id) - THEN RAISE(ABORT, 'content_blocks: no such event') - WHEN new.owner_kind = 'organization' - AND NOT EXISTS (SELECT 1 FROM organizations WHERE id = new.owner_id) - THEN RAISE(ABORT, 'content_blocks: no such organization') - WHEN new.owner_kind = 'person' - AND NOT EXISTS (SELECT 1 FROM people WHERE id = new.owner_id) - THEN RAISE(ABORT, 'content_blocks: no such person') - WHEN new.owner_kind = 'team' - AND NOT EXISTS (SELECT 1 FROM teams WHERE id = new.owner_id) - THEN RAISE(ABORT, 'content_blocks: no such team') - WHEN new.owner_kind = 'blog_post' - AND NOT EXISTS (SELECT 1 FROM blog_posts WHERE id = new.owner_id) - THEN RAISE(ABORT, 'content_blocks: no such blog post') - END; -END; diff --git a/server/src/migrations/055_organization_page.sql b/server/src/migrations/055_organization_page.sql deleted file mode 100644 index 466cd82..0000000 --- a/server/src/migrations/055_organization_page.sql +++ /dev/null @@ -1,134 +0,0 @@ --- ═══════════════════════════════════════════════════════════════ --- 055 THE ORGANIZATION PAGE'S OWN EDITOR, NAMED PATH ICONS --- --- The Organization page (/organization) is edited in the admin like --- the Community blog section (Pages → Organization page): a --- singleton row, organization_page, with --- --- mission blocks content_blocks owned 'org_page_mission': --- the Mission, Vision & Values section --- leadership blocks content_blocks owned 'org_page_leadership': --- the Leadership section, eg. a heading and a --- People block per team (Board of Trustees, --- then the Retreat Team), in the order given --- volunteering a title, a blurb and organization_page_links, --- under the leadership --- --- Two owner kinds rather than a slot, so each list is its own --- collection in the editor. The owner_kind CHECK changes, so --- content_blocks is rebuilt as 054 did, with its index and owner --- trigger (which learns the new kinds) again. --- --- And the front page's "Find your way in" paths: the baseline seeded --- them with emoji, from before the named icon list --- (src/data/pathIcons.ts). The site now draws only named icons, so --- the seeded emoji become their names and any other non-name is --- cleared (shown as a plain dot until one is picked). --- ═══════════════════════════════════════════════════════════════ - -CREATE TABLE organization_page ( - id TEXT PRIMARY KEY CHECK (id = 'organization'), - mission_title TEXT, -- null → 'Mission, Vision & Values' - leadership_title TEXT, -- null → 'Leadership' - leadership_blurb TEXT, - volunteer_title TEXT, -- null → 'Volunteering' - volunteer_blurb TEXT, - updated_at TEXT NOT NULL DEFAULT (datetime('now')) -) STRICT; - -INSERT INTO organization_page (id) VALUES ('organization'); - -CREATE TABLE organization_page_links ( - id INTEGER PRIMARY KEY AUTOINCREMENT, - page_id TEXT NOT NULL REFERENCES organization_page (id) ON DELETE CASCADE, - sort_order INTEGER NOT NULL DEFAULT 0, - label TEXT NOT NULL, - url TEXT NOT NULL -) STRICT; - -CREATE INDEX organization_page_links_idx ON organization_page_links (page_id, sort_order); - - --- ── Blocks for the page ──────────────────────────────────────── - -CREATE TABLE content_blocks_new ( - id INTEGER PRIMARY KEY AUTOINCREMENT, - owner_kind TEXT NOT NULL - CHECK (owner_kind IN ('organization', 'event', 'person', 'team', 'blog_post', - 'org_page_mission', 'org_page_leadership')), - owner_id TEXT NOT NULL, - slot TEXT NOT NULL DEFAULT 'body' CHECK (slot IN ('card', 'body')), - sort_order INTEGER NOT NULL DEFAULT 0, - - type TEXT NOT NULL - CHECK (type IN ('heading', 'subheading', 'paragraph', - 'list', 'links', 'quote', 'image', 'divider', - 'video', 'button', 'callout', 'schedule', 'table', 'cards', - 'people')), - text TEXT, - media TEXT, - href TEXT, - alt TEXT, - cite TEXT, - team_id TEXT REFERENCES teams (id) ON DELETE SET NULL -) STRICT; - -INSERT INTO content_blocks_new - (id, owner_kind, owner_id, slot, sort_order, type, text, media, href, alt, cite, team_id) -SELECT id, owner_kind, owner_id, slot, sort_order, type, text, media, href, alt, cite, team_id - FROM content_blocks; - -PRAGMA legacy_alter_table = ON; -DROP TABLE content_blocks; -ALTER TABLE content_blocks_new RENAME TO content_blocks; -PRAGMA legacy_alter_table = OFF; - -CREATE INDEX content_blocks_owner_idx - ON content_blocks (owner_kind, owner_id, slot, sort_order); - - --- ── Path icons ───────────────────────────────────────────────── - -UPDATE front_page_paths SET icon = 'compass' WHERE icon = '🧭'; -UPDATE front_page_paths SET icon = 'hands' WHERE icon = '🤲'; -UPDATE front_page_paths SET icon = 'sparkle' WHERE icon = '🌱'; -UPDATE front_page_paths SET icon = 'people' WHERE icon = '🤝'; -UPDATE front_page_paths SET icon = NULL - WHERE icon IS NOT NULL - AND icon NOT IN ('heart', 'hands', 'people', 'calendar', 'tent', 'map', 'home', 'book', - 'learn', 'chat', 'music', 'compass', 'sparkle', 'star'); - - --- ── Triggers last (see CLAUDE.md, Migrations) ── - -CREATE TRIGGER organization_page_touch -AFTER UPDATE ON organization_page -FOR EACH ROW WHEN new.updated_at = old.updated_at -BEGIN - UPDATE organization_page SET updated_at = datetime('now') WHERE id = new.id; -END; - -CREATE TRIGGER content_blocks_owner_exists -BEFORE INSERT ON content_blocks -BEGIN - SELECT CASE - WHEN new.owner_kind = 'event' - AND NOT EXISTS (SELECT 1 FROM events WHERE id = new.owner_id) - THEN RAISE(ABORT, 'content_blocks: no such event') - WHEN new.owner_kind = 'organization' - AND NOT EXISTS (SELECT 1 FROM organizations WHERE id = new.owner_id) - THEN RAISE(ABORT, 'content_blocks: no such organization') - WHEN new.owner_kind = 'person' - AND NOT EXISTS (SELECT 1 FROM people WHERE id = new.owner_id) - THEN RAISE(ABORT, 'content_blocks: no such person') - WHEN new.owner_kind = 'team' - AND NOT EXISTS (SELECT 1 FROM teams WHERE id = new.owner_id) - THEN RAISE(ABORT, 'content_blocks: no such team') - WHEN new.owner_kind = 'blog_post' - AND NOT EXISTS (SELECT 1 FROM blog_posts WHERE id = new.owner_id) - THEN RAISE(ABORT, 'content_blocks: no such blog post') - WHEN new.owner_kind IN ('org_page_mission', 'org_page_leadership') - AND NOT EXISTS (SELECT 1 FROM organization_page WHERE id = new.owner_id) - THEN RAISE(ABORT, 'content_blocks: no such organization page') - END; -END; diff --git a/server/src/migrations/056_site_pages.sql b/server/src/migrations/056_site_pages.sql deleted file mode 100644 index 8e72891..0000000 --- a/server/src/migrations/056_site_pages.sql +++ /dev/null @@ -1,221 +0,0 @@ --- ═══════════════════════════════════════════════════════════════ --- 056 PAGE EDITORS: SECTIONS FOR THE SITE'S OWN PAGES --- --- Community, Retreats, Resources, Organization and History are --- built in the admin (Pages → each page) as a list of sections. A --- section is its title (30 characters at most: it's listed in the --- page's side nav), an optional blurb, an accent and the anchor it --- sits at, and then either --- --- its own content blocks content_blocks owned 'page_section', --- owner_id the section's id --- a preset a prebuilt part of the site, drawn by --- the page (SitePage.tsx): the Community --- blog, the group map, the region list, --- the partner cards, an event list (scope, --- type and the view it opens in), the --- timeline, NGU's address and tax details --- --- Every page's sections are seeded as the code drew them, so nothing --- moves on the site. Organization takes what 055's editor held: its --- Mission and Leadership blocks, with the Volunteering title, blurb --- and links appended to the Leadership section as a heading, a --- paragraph and link buttons; 055's tables go. --- --- The Community blog's own settings (its slots, pinned posts, feeds) --- stay in community_page, now edited inside the Community page --- editor; its heading and blurb become the blog section's own, so --- community_page loses blog_title and blog_blurb. --- --- content_blocks is rebuilt for its owner_kind CHECK (as 055 did), --- moving 055's blocks across on the way. A section deleted (every --- save rewrites them) takes its blocks with it, by trigger, since --- the owner is polymorphic and can't be a foreign key. --- ═══════════════════════════════════════════════════════════════ - -CREATE TABLE site_pages ( - id TEXT PRIMARY KEY - CHECK (id IN ('community', 'retreats', 'resources', 'organization', 'history')), - updated_at TEXT NOT NULL DEFAULT (datetime('now')) -) STRICT; - -INSERT INTO site_pages (id) VALUES ('community'), ('retreats'), ('resources'), ('organization'), ('history'); - -CREATE TABLE page_sections ( - id INTEGER PRIMARY KEY AUTOINCREMENT, - page_id TEXT NOT NULL REFERENCES site_pages (id) ON DELETE CASCADE, - sort_order INTEGER NOT NULL DEFAULT 0, - anchor TEXT NOT NULL - CONSTRAINT "A section's URL ID can use only lowercase letters, numbers and hyphens, eg. leadership." - CHECK (anchor <> '' AND anchor NOT GLOB '*[^a-z0-9-]*'), - title TEXT NOT NULL - CONSTRAINT "A section title can be 30 characters at most (it's listed in the page's side nav)." - CHECK (length(title) <= 30), - blurb TEXT, - accent TEXT CHECK (accent IN ('teal', 'deep', 'green', 'amber')), - preset TEXT CHECK (preset IN ('community_blog', 'group_map', 'region_list', 'partner_list', - 'events', 'timeline', 'organization_details')), - -- An events preset's filter and first view. - scope_id TEXT REFERENCES event_scopes (id) ON DELETE SET NULL, - event_type TEXT CHECK (event_type IN ('retreat', 'class', 'workshop', 'meeting', 'other')), - view TEXT CHECK (view IN ('carousel', 'grid', 'map')), - UNIQUE (page_id, anchor) -) STRICT; - -CREATE INDEX page_sections_page_idx ON page_sections (page_id, sort_order); - -INSERT INTO page_sections (page_id, sort_order, anchor, title, blurb, accent, preset, scope_id, event_type, view) -SELECT 'community', 0, 'blog', COALESCE(blog_title, 'Community Blog'), blog_blurb, 'teal', 'community_blog', NULL, NULL, NULL - FROM community_page WHERE id = 'community'; - -INSERT INTO page_sections (page_id, sort_order, anchor, title, blurb, accent, preset, scope_id, event_type, view) VALUES - ('community', 1, 'groups', 'Local Groups', - 'Young adult groups meeting in person and online across the movement.', 'teal', 'group_map', NULL, NULL, 'map'), - ('community', 2, 'regions', 'Unity Regions', - 'The regional organizations that support groups and host their own gatherings.', 'deep', 'region_list', NULL, NULL, NULL), - ('community', 3, 'partners', 'Partner Organizations', - 'Organizations we collaborate with across the Unity movement and beyond.', 'amber', 'partner_list', NULL, NULL, NULL), - - ('retreats', 0, 'national', 'National Retreats', - 'Our flagship gatherings, open to young adults across the country.', 'teal', 'events', 'national', 'retreat', 'carousel'), - ('retreats', 1, 'regional', 'Regional Retreats', - 'Smaller gatherings hosted by regions throughout the year.', 'green', 'events', 'regional', 'retreat', 'grid'), - ('retreats', 2, 'partner', 'Partner Events', - 'Retreats hosted by organizations we collaborate with.', 'amber', 'events', 'partner', 'retreat', 'grid'), - - ('resources', 0, 'unity', 'Unity Teachings', - 'Core principles, readings, and study material from the Unity movement.', 'teal', NULL, NULL, NULL, NULL), - ('resources', 1, 'branding', 'Branding & Marketing', - 'Logos, colors, templates, and guidelines for representing NGU.', 'green', NULL, NULL, NULL, NULL), - ('resources', 2, 'partner', 'Partner Resources', - 'Material for the organizations we collaborate with.', 'amber', NULL, NULL, NULL, NULL), - - ('history', 0, 'timeline', 'NGU Timeline', 'Open a year to see what happened.', 'teal', 'timeline', NULL, NULL, NULL), - - ('organization', 2, 'contact', 'Details & Contact', NULL, 'deep', 'organization_details', NULL, NULL, NULL); - -INSERT INTO page_sections (page_id, sort_order, anchor, title, blurb, accent) -SELECT 'organization', 0, 'mission', substr(COALESCE(mission_title, 'Mission, Vision & Values'), 1, 30), NULL, 'teal' - FROM organization_page WHERE id = 'organization'; - -INSERT INTO page_sections (page_id, sort_order, anchor, title, blurb, accent) -SELECT 'organization', 1, 'leadership', substr(COALESCE(leadership_title, 'Leadership'), 1, 30), leadership_blurb, 'green' - FROM organization_page WHERE id = 'organization'; - -ALTER TABLE community_page DROP COLUMN blog_title; -ALTER TABLE community_page DROP COLUMN blog_blurb; - - --- ── Blocks: the new owner kind, 055's blocks moved across ────── - -CREATE TABLE content_blocks_new ( - id INTEGER PRIMARY KEY AUTOINCREMENT, - owner_kind TEXT NOT NULL - CHECK (owner_kind IN ('organization', 'event', 'person', 'team', 'blog_post', 'page_section')), - owner_id TEXT NOT NULL, - slot TEXT NOT NULL DEFAULT 'body' CHECK (slot IN ('card', 'body')), - sort_order INTEGER NOT NULL DEFAULT 0, - - type TEXT NOT NULL - CHECK (type IN ('heading', 'subheading', 'paragraph', - 'list', 'links', 'quote', 'image', 'divider', - 'video', 'button', 'callout', 'schedule', 'table', 'cards', - 'people')), - text TEXT, - media TEXT, - href TEXT, - alt TEXT, - cite TEXT, - team_id TEXT REFERENCES teams (id) ON DELETE SET NULL -) STRICT; - -INSERT INTO content_blocks_new - (id, owner_kind, owner_id, slot, sort_order, type, text, media, href, alt, cite, team_id) -SELECT b.id, - CASE WHEN b.owner_kind IN ('org_page_mission', 'org_page_leadership') THEN 'page_section' ELSE b.owner_kind END, - CASE b.owner_kind - WHEN 'org_page_mission' THEN - (SELECT CAST(s.id AS TEXT) FROM page_sections s WHERE s.page_id = 'organization' AND s.anchor = 'mission') - WHEN 'org_page_leadership' THEN - (SELECT CAST(s.id AS TEXT) FROM page_sections s WHERE s.page_id = 'organization' AND s.anchor = 'leadership') - ELSE b.owner_id - END, - b.slot, b.sort_order, b.type, b.text, b.media, b.href, b.alt, b.cite, b.team_id - FROM content_blocks b; - -PRAGMA legacy_alter_table = ON; -DROP TABLE content_blocks; -ALTER TABLE content_blocks_new RENAME TO content_blocks; -PRAGMA legacy_alter_table = OFF; - -CREATE INDEX content_blocks_owner_idx - ON content_blocks (owner_kind, owner_id, slot, sort_order); - --- Volunteering, appended to the Leadership section where 055 had it. -INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text) -SELECT 'page_section', CAST(s.id AS TEXT), 'body', 1000, 'heading', COALESCE(p.volunteer_title, 'Volunteering') - FROM organization_page p - JOIN page_sections s ON s.page_id = 'organization' AND s.anchor = 'leadership' - WHERE p.volunteer_title IS NOT NULL OR p.volunteer_blurb IS NOT NULL - OR EXISTS (SELECT 1 FROM organization_page_links); - -INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type, text) -SELECT 'page_section', CAST(s.id AS TEXT), 'body', 1001, 'paragraph', p.volunteer_blurb - FROM organization_page p - JOIN page_sections s ON s.page_id = 'organization' AND s.anchor = 'leadership' - WHERE p.volunteer_blurb IS NOT NULL; - -INSERT INTO content_blocks (owner_kind, owner_id, slot, sort_order, type) -SELECT 'page_section', CAST(s.id AS TEXT), 'body', 1002, 'links' - FROM page_sections s - WHERE s.page_id = 'organization' AND s.anchor = 'leadership' - AND EXISTS (SELECT 1 FROM organization_page_links); - -INSERT INTO content_block_items (block_id, sort_order, text, url) -SELECT b.id, l.sort_order, l.label, l.url - FROM organization_page_links l - JOIN content_blocks b ON b.owner_kind = 'page_section' AND b.type = 'links' AND b.sort_order = 1002; - -DROP TABLE organization_page_links; -DROP TABLE organization_page; - - --- ── Triggers last (see CLAUDE.md, Migrations) ── - -CREATE TRIGGER site_pages_touch -AFTER UPDATE ON site_pages -FOR EACH ROW WHEN new.updated_at = old.updated_at -BEGIN - UPDATE site_pages SET updated_at = datetime('now') WHERE id = new.id; -END; - -CREATE TRIGGER page_sections_cleanup -AFTER DELETE ON page_sections -BEGIN - DELETE FROM content_blocks WHERE owner_kind = 'page_section' AND owner_id = CAST(old.id AS TEXT); -END; - -CREATE TRIGGER content_blocks_owner_exists -BEFORE INSERT ON content_blocks -BEGIN - SELECT CASE - WHEN new.owner_kind = 'event' - AND NOT EXISTS (SELECT 1 FROM events WHERE id = new.owner_id) - THEN RAISE(ABORT, 'content_blocks: no such event') - WHEN new.owner_kind = 'organization' - AND NOT EXISTS (SELECT 1 FROM organizations WHERE id = new.owner_id) - THEN RAISE(ABORT, 'content_blocks: no such organization') - WHEN new.owner_kind = 'person' - AND NOT EXISTS (SELECT 1 FROM people WHERE id = new.owner_id) - THEN RAISE(ABORT, 'content_blocks: no such person') - WHEN new.owner_kind = 'team' - AND NOT EXISTS (SELECT 1 FROM teams WHERE id = new.owner_id) - THEN RAISE(ABORT, 'content_blocks: no such team') - WHEN new.owner_kind = 'blog_post' - AND NOT EXISTS (SELECT 1 FROM blog_posts WHERE id = new.owner_id) - THEN RAISE(ABORT, 'content_blocks: no such blog post') - WHEN new.owner_kind = 'page_section' - AND NOT EXISTS (SELECT 1 FROM page_sections WHERE CAST(id AS TEXT) = new.owner_id) - THEN RAISE(ABORT, 'content_blocks: no such page section') - END; -END; diff --git a/server/src/migrations/057_newsletters.sql b/server/src/migrations/057_newsletters.sql deleted file mode 100644 index 708889d..0000000 --- a/server/src/migrations/057_newsletters.sql +++ /dev/null @@ -1,111 +0,0 @@ --- ═══════════════════════════════════════════════════════════════ --- 057 NEWSLETTER DRAFTS --- --- Tools → Newsletter saves what it builds as a draft, to come back --- to, copy into Mailchimp again, or post as a blog post: --- --- title, intro the email's heading and opening lines --- footer the closing lines (blank: the site's name and --- address); no unsubscribe link, since Mailchimp --- adds its own --- picks what's ticked, as JSON: event ids, blog post --- ids, and the front page cards by their link --- ({"events": [...], "posts": [...], "cards": [...]}) --- blocks content_blocks owned 'newsletter': whatever is --- written for this issue, under the intro --- --- content_blocks is rebuilt for its owner_kind CHECK (as 056 did). A --- draft deleted takes its blocks with it, by trigger. --- ═══════════════════════════════════════════════════════════════ - -CREATE TABLE newsletters ( - id INTEGER PRIMARY KEY AUTOINCREMENT, - title TEXT, - intro TEXT, - footer TEXT, - picks TEXT NOT NULL DEFAULT '{}' CHECK (json_valid(picks)), - created_at TEXT NOT NULL DEFAULT (datetime('now')), - updated_at TEXT NOT NULL DEFAULT (datetime('now')) -) STRICT; - - --- ── Blocks: the new owner kind ───────────────────────────────── - -CREATE TABLE content_blocks_new ( - id INTEGER PRIMARY KEY AUTOINCREMENT, - owner_kind TEXT NOT NULL - CHECK (owner_kind IN ('organization', 'event', 'person', 'team', 'blog_post', 'page_section', - 'newsletter')), - owner_id TEXT NOT NULL, - slot TEXT NOT NULL DEFAULT 'body' CHECK (slot IN ('card', 'body')), - sort_order INTEGER NOT NULL DEFAULT 0, - - type TEXT NOT NULL - CHECK (type IN ('heading', 'subheading', 'paragraph', - 'list', 'links', 'quote', 'image', 'divider', - 'video', 'button', 'callout', 'schedule', 'table', 'cards', - 'people')), - text TEXT, - media TEXT, - href TEXT, - alt TEXT, - cite TEXT, - team_id TEXT REFERENCES teams (id) ON DELETE SET NULL -) STRICT; - -INSERT INTO content_blocks_new - (id, owner_kind, owner_id, slot, sort_order, type, text, media, href, alt, cite, team_id) -SELECT id, owner_kind, owner_id, slot, sort_order, type, text, media, href, alt, cite, team_id - FROM content_blocks; - -PRAGMA legacy_alter_table = ON; -DROP TABLE content_blocks; -ALTER TABLE content_blocks_new RENAME TO content_blocks; -PRAGMA legacy_alter_table = OFF; - -CREATE INDEX content_blocks_owner_idx - ON content_blocks (owner_kind, owner_id, slot, sort_order); - - --- ── Triggers last (see CLAUDE.md, Migrations) ── - -CREATE TRIGGER newsletters_touch -AFTER UPDATE ON newsletters -FOR EACH ROW WHEN new.updated_at = old.updated_at -BEGIN - UPDATE newsletters SET updated_at = datetime('now') WHERE id = new.id; -END; - -CREATE TRIGGER newsletters_cleanup -AFTER DELETE ON newsletters -BEGIN - DELETE FROM content_blocks WHERE owner_kind = 'newsletter' AND owner_id = CAST(old.id AS TEXT); -END; - -CREATE TRIGGER content_blocks_owner_exists -BEFORE INSERT ON content_blocks -BEGIN - SELECT CASE - WHEN new.owner_kind = 'event' - AND NOT EXISTS (SELECT 1 FROM events WHERE id = new.owner_id) - THEN RAISE(ABORT, 'content_blocks: no such event') - WHEN new.owner_kind = 'organization' - AND NOT EXISTS (SELECT 1 FROM organizations WHERE id = new.owner_id) - THEN RAISE(ABORT, 'content_blocks: no such organization') - WHEN new.owner_kind = 'person' - AND NOT EXISTS (SELECT 1 FROM people WHERE id = new.owner_id) - THEN RAISE(ABORT, 'content_blocks: no such person') - WHEN new.owner_kind = 'team' - AND NOT EXISTS (SELECT 1 FROM teams WHERE id = new.owner_id) - THEN RAISE(ABORT, 'content_blocks: no such team') - WHEN new.owner_kind = 'blog_post' - AND NOT EXISTS (SELECT 1 FROM blog_posts WHERE id = new.owner_id) - THEN RAISE(ABORT, 'content_blocks: no such blog post') - WHEN new.owner_kind = 'page_section' - AND NOT EXISTS (SELECT 1 FROM page_sections WHERE CAST(id AS TEXT) = new.owner_id) - THEN RAISE(ABORT, 'content_blocks: no such page section') - WHEN new.owner_kind = 'newsletter' - AND NOT EXISTS (SELECT 1 FROM newsletters WHERE CAST(id AS TEXT) = new.owner_id) - THEN RAISE(ABORT, 'content_blocks: no such newsletter') - END; -END; diff --git a/server/src/routes/blog.js b/server/src/routes/blog.js index 7c20922..d6c890a 100644 --- a/server/src/routes/blog.js +++ b/server/src/routes/blog.js @@ -191,6 +191,8 @@ blog.get("/community-blog", async (c) => { return json(c, { community_blog: { + title: page.blog_title, + blurb: page.blog_blurb, internal: { title: page.internal_title, posts: posts.map((row) => diff --git a/server/src/routes/content.js b/server/src/routes/content.js index 820086a..943dbbe 100644 --- a/server/src/routes/content.js +++ b/server/src/routes/content.js @@ -88,8 +88,7 @@ function loadHosts(db, ids) { const rows = db .prepare( - `SELECT event_id, host_kind, host_id, host_name, host_org_kind, - host_team_id, host_team_name + `SELECT event_id, host_kind, host_id, host_name, host_org_kind FROM v_event_hosts WHERE event_id IN (${marks(ids.length)}) AND host_is_published = 1 @@ -116,9 +115,6 @@ function shapeHost(row) { // Which of /regions, /groups, /partners the slug belongs to. // Null for a person, whose route needs no disambiguating. org_kind: row.host_org_kind, - // The team an organization host is shown as, when one is set - // (and published): the event page names and links it instead. - team: row.host_team_id ? { id: row.host_team_id, name: row.host_team_name } : null, }; } diff --git a/server/src/routes/sitePages.js b/server/src/routes/sitePages.js deleted file mode 100644 index 73c614d..0000000 --- a/server/src/routes/sitePages.js +++ /dev/null @@ -1,57 +0,0 @@ -/* ═══════════════════════════════════════════════════════════════ - SITE PAGE ROUTES: read-only, mounted under /api - - GET /site-pages every site page's section headings, for - the header's dropdowns and the side nav - GET /site-pages/:id one page's sections, in order: heading, - accent, preset (and an events preset's - filter and view), and its blocks - - Edited in the admin as Pages → each page - (admin-schema/sitePages.js). Blocks are shaped as on any record - page (loadBlocks), so ContentBlocks draws them. - ═══════════════════════════════════════════════════════════════ */ - -import { Hono } from "hono"; -import { json, loadBlocks } from "../shape.js"; - -const sitePages = new Hono(); - -sitePages.get("/site-pages", (c) => { - const rows = c - .get("db") - .prepare(`SELECT page_id, anchor, title FROM page_sections ORDER BY page_id, sort_order, id`) - .all(); - - const pages = {}; - for (const row of rows) (pages[row.page_id] ??= []).push({ anchor: row.anchor, title: row.title }); - return json(c, { pages }); -}); - -sitePages.get("/site-pages/:id", (c) => { - const db = c.get("db"); - const id = c.req.param("id"); - if (!db.prepare(`SELECT 1 FROM site_pages WHERE id = ?`).get(id)) { - return c.json({ error: "No such page." }, 404); - } - - const rows = db - .prepare( - `SELECT id, anchor, title, blurb, accent, preset, scope_id, event_type, view - FROM page_sections WHERE page_id = ? ORDER BY sort_order, id`, - ) - .all(id); - const blocks = loadBlocks(db, "page_section", rows.map((row) => String(row.id))); - - return json(c, { - page: { - id, - sections: rows.map(({ id: sectionId, ...section }) => ({ - ...section, - blocks: blocks.get(String(sectionId)) ?? [], - })), - }, - }); -}); - -export default sitePages; diff --git a/server/src/seed-showcase.js b/server/src/seed-showcase.js index 550f6f9..5f16645 100644 --- a/server/src/seed-showcase.js +++ b/server/src/seed-showcase.js @@ -144,10 +144,6 @@ const ALL_BLOCKS = [ { text: "A card with a picture", detail: "Its description, up to three lines, under the title. The whole card is the link.", url: "/retreats", media: IMAGE }, { text: "An outside link, text only", detail: "The card shows the site it goes to above the title.", url: "https://example.org" }, ]], - ["subheading", { text: "People" }], - ["people", { team_id: TEAM }, [ - { person_id: PERSON, text: "Picked as an item, with a title" }, - ]], ]; /* A record page's body: a handful of types, so it reads like a @@ -430,8 +426,7 @@ tx(db, () => { is_published: 1, is_listed: LISTED, }); - // Hosted by the region, shown as its team (054). - insert("event_hosts", { event_id: PAST, org_id: REGION, team_id: TEAM, sort_order: 0 }); + insert("event_hosts", { event_id: PAST, org_id: REGION, sort_order: 0 }); insert("event_people", { event_id: PAST, person_id: PERSON, role: "host", is_public: 1, sort_order: 0 }); blocks("event", PAST, "card", cardText("past event")); diff --git a/server/src/shape.js b/server/src/shape.js index 4a23395..5ea0259 100644 --- a/server/src/shape.js +++ b/server/src/shape.js @@ -66,7 +66,7 @@ export function loadBlocks(db, ownerKind, ids, slot = "body") { const blockRows = db .prepare( - `SELECT id, owner_id, type, text, media, href, alt, cite, team_id + `SELECT id, owner_id, type, text, media, href, alt, cite FROM content_blocks WHERE owner_kind = ? AND slot = ? AND owner_id IN (${placeholders(ids.length)}) ORDER BY owner_id, sort_order`, @@ -85,7 +85,6 @@ export function loadBlocks(db, ownerKind, ids, slot = "body") { href: row.href, alt: row.alt, cite: row.cite, - team_id: row.team_id, items: [], }; byId.set(row.id, block); diff --git a/site.json b/site.json index 4011a51..b8c9bb3 100644 --- a/site.json +++ b/site.json @@ -22,9 +22,9 @@ "title": "Community", "description": "Groups, regions and the people who make up Next Generation of Unity." }, - "/organization": { - "title": "Organization", - "description": "Our mission, vision and values, the people who lead Next Generation of Unity, and how to reach us." + "/leadership": { + "title": "Leadership", + "description": "The board, staff, and volunteers who keep Next Generation of Unity running." }, "/resources": { "title": "Resources", diff --git a/src/App.tsx b/src/App.tsx index 5111b83..9585533 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -49,9 +49,11 @@ const lazyPage = (load) => throw err }), ) -// Community, Retreats, Resources, Organization and History: each -// built in the admin from sections. -const SitePage = lazyPage(() => import("./pages/SitePage.tsx")) +const Retreats = lazyPage(() => import("./pages/Retreats.tsx")) +const Community = lazyPage(() => import("./pages/Community.tsx")) +const Leadership = lazyPage(() => import("./pages/Leadership.tsx")) +const Resources = lazyPage(() => import("./pages/Resources.tsx")) +const History = lazyPage(() => import("./pages/History.tsx")) const Feedback = lazyPage(() => import("./pages/Feedback.tsx")) const Request = lazyPage(() => import("./pages/Request.tsx")) const Giving = lazyPage(() => import("./pages/Giving.tsx")) @@ -78,7 +80,6 @@ const AdminHome = lazyPage(() => import("./pages/admin/AdminHome.tsx")) const AdminFeedback = lazyPage(() => import("./pages/admin/AdminFeedback.tsx")) const AdminMedia = lazyPage(() => import("./pages/admin/AdminMedia.tsx")) const AdminClips = lazyPage(() => import("./pages/admin/AdminClips.tsx")) -const AdminNewsletter = lazyPage(() => import("./pages/admin/AdminNewsletter.tsx")) const EntityList = lazyPage(() => import("./pages/admin/EntityList.tsx")) const EntityEdit = lazyPage(() => import("./pages/admin/EntityEdit.tsx")) @@ -89,9 +90,9 @@ export default function App() { {/* Layout renders the nav once and swaps page content into */} }> } /> - } /> + } /> } /> - } /> + } /> } /> } /> } /> @@ -100,9 +101,9 @@ export default function App() { } /> } /> } /> - } /> - } /> - } /> + } /> + } /> + } /> } /> } /> } /> @@ -132,7 +133,6 @@ export default function App() { } /> } /> } /> - } /> }> } /> diff --git a/src/components/AccessibilityPanel.tsx b/src/components/AccessibilityPanel.tsx deleted file mode 100644 index faf5ecc..0000000 --- a/src/components/AccessibilityPanel.tsx +++ /dev/null @@ -1,168 +0,0 @@ -/* ═══════════════════════════════════════════════════════════════ - ACCESSIBILITY PANEL - - A button fixed to the bottom right of every public page, opening - two switches that change how the whole site reads: - - Dyslexia-friendly font every typeface becomes OpenDyslexic - (self-hosted, index.css) - Reading mode the design steps back: no background - circles, motion or shadows, one column, - larger text and plain underlined links, - the same content throughout - - Each is a data attribute on (data-font, data-reading) that - index.css styles, saved in this browser (site-font, site-reading) - and set again before the first paint by index.html, so a page - never flashes the other look. Blocked storage just means the - choice lasts until the tab closes. - - The panel closes on Escape, on the button again, or a click - anywhere else, and gives focus back to the button. - ═══════════════════════════════════════════════════════════════ */ - -import { PersonArmsSpread, X } from '@phosphor-icons/react' -import { useEffect, useId, useRef, useState } from 'react' - -/* A setting: its attribute, storage key, the value that turns - it on, and its words. */ -const SETTINGS = [ - { - attribute: 'font', - key: 'site-font', - on: 'dyslexic', - label: 'Dyslexia-friendly font', - help: 'Letters shaped to be easier to tell apart.', - }, - { - attribute: 'reading', - key: 'site-reading', - on: 'on', - label: 'Reading mode', - help: 'A plain, single column with larger text and no motion.', - }, -] as const - -type Setting = (typeof SETTINGS)[number] - -const isOn = (setting: Setting) => document.documentElement.dataset[setting.attribute] === setting.on - -function apply(setting: Setting, on: boolean) { - const root = document.documentElement - if (on) root.dataset[setting.attribute] = setting.on - else delete root.dataset[setting.attribute] - try { - if (on) localStorage.setItem(setting.key, setting.on) - else localStorage.removeItem(setting.key) - } catch { - // Storage blocked: the choice holds for this page view. - } -} - -export default function AccessibilityPanel() { - const [open, setOpen] = useState(false) - const [state, setState] = useState(() => Object.fromEntries(SETTINGS.map((s) => [s.key, isOn(s)]))) - const rootRef = useRef(null) - const buttonRef = useRef(null) - const panelId = useId() - - useEffect(() => { - if (!open) return undefined - const close = () => { - setOpen(false) - buttonRef.current?.focus() - } - const onKey = (event: KeyboardEvent) => { - if (event.key === 'Escape') close() - } - const onPointer = (event: PointerEvent) => { - if (!rootRef.current?.contains(event.target as Node)) setOpen(false) - } - document.addEventListener('keydown', onKey) - document.addEventListener('pointerdown', onPointer) - return () => { - document.removeEventListener('keydown', onKey) - document.removeEventListener('pointerdown', onPointer) - } - }, [open]) - - const toggle = (setting: Setting) => { - const next = !state[setting.key] - apply(setting, next) - setState((current) => ({ ...current, [setting.key]: next })) - } - - return ( -
- {open && ( -
-
-

Accessibility

- -
- -
    - {SETTINGS.map((setting) => { - const on = state[setting.key] - const labelId = `${panelId}-${setting.attribute}` - return ( -
  • - - - - {setting.label} - - {setting.help} - -
  • - ) - })} -
-
- )} - - -
- ) -} diff --git a/src/components/ArrowLink.tsx b/src/components/ArrowLink.tsx index 0b8869f..20f5fb9 100644 --- a/src/components/ArrowLink.tsx +++ b/src/components/ArrowLink.tsx @@ -5,7 +5,7 @@ import { Link } from "react-router-dom"; ARROW LINK ═══════════════════════════════════════════════════════════════ */ -export default function ArrowLink({ to, label, color, size = "h-10 w-10" }) { +export default function ArrowLink({ to, label, color, size = "h-9 w-9" }) { return ( -

+

{SITE_BANNER.content.map((part, i) => { if (!part.href) return {part.text}; return part.external ? ( @@ -53,7 +53,7 @@ export default function Banner() { diff --git a/src/components/ComingSoon.tsx b/src/components/ComingSoon.tsx index cb1910c..8e88188 100644 --- a/src/components/ComingSoon.tsx +++ b/src/components/ComingSoon.tsx @@ -7,9 +7,7 @@ some. ═══════════════════════════════════════════════════════════════ */ -import { ORGANIZATION_DETAILS } from '../data/organizationDetails.ts' - -const CONTACT = ORGANIZATION_DETAILS.email +const CONTACT = 'info@nextgenerationofunity.org' export default function ComingSoon({ what }: { what: string }) { return ( diff --git a/src/components/ContentBlocks.tsx b/src/components/ContentBlocks.tsx index 1d53d3a..0650497 100644 --- a/src/components/ContentBlocks.tsx +++ b/src/components/ContentBlocks.tsx @@ -27,9 +27,6 @@ cards items as link cards, up to three in a row: text the title, detail, url, media the picture - people team_id's members as people tiles, then - items as more tiles: person, text their - title (an unpublished person is left out) divider nothing "Formatted" is InlineText.tsx: **bold**, *italic*, [text](url), @@ -41,7 +38,6 @@ ═══════════════════════════════════════════════════════════════ */ import { mediaUrl } from '../lib/media.ts' -import PeopleTiles from './PeopleTiles.tsx' import type { ContentBlock, ContentBlockItem } from '../lib/useContent.ts' import { Anchor, Inline, Paragraphs, isExternalUrl } from './InlineText.tsx' import VideoPlayer from './VideoPlayer.tsx' @@ -330,19 +326,6 @@ function Block({ block, accent, anchor }: { block: ContentBlock; accent: string; if (!block.items?.length) return null return - case 'people': { - const picked = (block.items ?? []) - .filter((item) => item.person) - .map((item) => ({ peopleslug: item.person!.id, title: item.text || null })) - if (!block.team_id && picked.length === 0) return null - return ( -

- {block.team_id && } - {picked.length > 0 && } -
- ) - } - case 'divider': return
diff --git a/src/components/Footer.tsx b/src/components/Footer.tsx index 6f25a42..d80f19b 100644 --- a/src/components/Footer.tsx +++ b/src/components/Footer.tsx @@ -1,9 +1,7 @@ import { Link } from "react-router-dom"; -import { PAGE_LINKS, NAV_ACTIONS } from "../navConfig.ts"; -import { useNavSections } from "../lib/navSections.ts"; +import { PAGE_LINKS, PAGE_SECTIONS, NAV_ACTIONS } from "../navConfig.ts"; import siteLogo from "../assets/logos/NGU_Logo.svg"; import PlatformIcon from "./PlatformIcon.tsx"; -import { ORGANIZATION_DETAILS as Organization_Details } from "../data/organizationDetails.ts"; const Social_Links = [ { label: "Instagram", href: "https://www.instagram.com/nextgenerationunity/", platform: "instagram" }, @@ -24,9 +22,19 @@ type TouchLink = { label: string } & ( const Get_In_Touch: TouchLink[] = [ { label: "Feedback", to: "/feedback"}, { label: "Request", to: "/request" }, - { label: "Contact Us", to: "/organization#contact" }, + { label: "Contact Us", to: "/leadership#contact" }, ]; +/* Under the logo. The street address is where NGU is, not where + to send post, and says so. */ +const Organization_Details = { + street: "1901 NW Blue Parkway", + cityLine: "Unity Village, MO 64065", + addressNote: "Physical address, not for mail", + nonprofit: "Next Generation of Unity is a qualified 501(c)(3) nonprofit organization.", + taxId: "33-2819320", +}; + const Footer_Links = [ { label: "Privacy Policy", to: "/privacy" }, { label: "Terms of Service", to: "/terms" }, @@ -35,23 +43,21 @@ const Footer_Links = [ const footerLinkClass = "text-white/65 hover:text-[#9cc47c] text-sm transition-colors"; -// inline-block with a little height of its own, so a finger can hit it. const pageLinkClass = - "inline-block py-1 text-white/80 hover:text-[#9cc47c] text-sm font-semibold transition-colors"; + "text-white/80 hover:text-[#9cc47c] text-sm font-semibold transition-colors"; const sectionLinkClass = - "inline-block py-1 text-white/65 hover:text-[#9cc47c] text-sm transition-colors"; + "text-white/65 hover:text-[#9cc47c] text-sm transition-colors"; const headingClass = "text-white/90 text-sm font-semibold mb-4"; export default function Footer() { - const sectionsOf = useNavSections(); return (