Compare commits
No commits in common. "45b422641a36e8740a0f1ffa342e9fbbf5b2bfd4" and "1da79c128be066c63d5e360b052ead7a9e46ab9c" have entirely different histories.
45b422641a
...
1da79c128b
31 changed files with 365 additions and 592 deletions
|
|
@ -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
|
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
|
image picker have a tab per folder; a picker opens on its field's
|
||||||
folder, and uploads there.
|
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.
|
nginx needs no change: `location /uploads/` already serves the folders.
|
||||||
|
|
||||||
## Files copied in by hand
|
## Files copied in by hand
|
||||||
|
|
|
||||||
|
|
@ -267,7 +267,7 @@ The numbers band's "Number Source" dropdown works the same way:
|
||||||
|
|
||||||
| What | File | Notes |
|
| 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), `PAGE_SECTIONS`, `NAV_ACTIONS`. The front page's sections aren't listed there: they follow the bands it shows (Front page → Sections), through `src/lib/navSections.ts` and `src/lib/frontPageBands.ts` (each band's anchor and default heading). A new page also needs a route in `src/App.tsx`. |
|
| 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, Organization, 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`. |
|
| Section titles, blurbs and colors on Retreats, Community, Organization, 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. |
|
| 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. |
|
| History page decade headers | `src/data/historyDecades.ts` | Title, tagline and blurb per decade. |
|
||||||
|
|
|
||||||
10
index.html
10
index.html
|
|
@ -13,6 +13,16 @@
|
||||||
and the accessibility choices, for the same reason. -->
|
and the accessibility choices, for the same reason. -->
|
||||||
<script>
|
<script>
|
||||||
try {
|
try {
|
||||||
|
// Once: browser keys used to start "ngu-"; move them to "site-"
|
||||||
|
// so a visitor keeps their theme and closed notices.
|
||||||
|
for (var i = localStorage.length - 1; i >= 0; i--) {
|
||||||
|
var k = localStorage.key(i);
|
||||||
|
if (k && k.indexOf("ngu-") === 0) {
|
||||||
|
var nk = "site-" + k.slice(4);
|
||||||
|
if (localStorage.getItem(nk) === null) localStorage.setItem(nk, localStorage.getItem(k));
|
||||||
|
localStorage.removeItem(k);
|
||||||
|
}
|
||||||
|
}
|
||||||
var t = localStorage.getItem("site-theme");
|
var t = localStorage.getItem("site-theme");
|
||||||
document.documentElement.dataset.theme =
|
document.documentElement.dataset.theme =
|
||||||
t === "dark" || t === "light" ? t : matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
t === "dark" || t === "light" ? t : matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,6 @@ import { timeline } from "./admin-schema/timeline.js";
|
||||||
import { frontPage } from "./admin-schema/frontPage.js";
|
import { frontPage } from "./admin-schema/frontPage.js";
|
||||||
import { blogPosts, communityPage } from "./admin-schema/blog.js";
|
import { blogPosts, communityPage } from "./admin-schema/blog.js";
|
||||||
import { siteSettings } from "./admin-schema/siteSettings.js";
|
import { siteSettings } from "./admin-schema/siteSettings.js";
|
||||||
import { organizationPage } from "./admin-schema/organizationPage.js";
|
|
||||||
|
|
||||||
export const ENTITIES = {
|
export const ENTITIES = {
|
||||||
organizations,
|
organizations,
|
||||||
|
|
@ -63,7 +62,6 @@ export const ENTITIES = {
|
||||||
front_page: frontPage,
|
front_page: frontPage,
|
||||||
blog_posts: blogPosts,
|
blog_posts: blogPosts,
|
||||||
community_page: communityPage,
|
community_page: communityPage,
|
||||||
organization_page: organizationPage,
|
|
||||||
site_settings: siteSettings,
|
site_settings: siteSettings,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
||||||
/* The Organization page (/organization): one row, its blocks and its
|
|
||||||
volunteering links (055_organization_page.sql). Two block
|
|
||||||
collections, each its own owner kind, so the editor shows them
|
|
||||||
apart: the Mission, Vision & Values section, and the Leadership
|
|
||||||
section (a People block per team, in order). */
|
|
||||||
|
|
||||||
import { text, url, blocksChild } from "./columns.js";
|
|
||||||
|
|
||||||
export const organizationPage = {
|
|
||||||
key: "organization_page",
|
|
||||||
table: "organization_page",
|
|
||||||
idColumn: "id",
|
|
||||||
idKind: "slug",
|
|
||||||
singleton: "organization",
|
|
||||||
concurrency: "updated_at",
|
|
||||||
|
|
||||||
list: {
|
|
||||||
columns: ["id", "updated_at"],
|
|
||||||
filters: [],
|
|
||||||
search: [],
|
|
||||||
order: "id",
|
|
||||||
},
|
|
||||||
|
|
||||||
columns: [
|
|
||||||
text("mission_title"),
|
|
||||||
text("leadership_title"),
|
|
||||||
text("leadership_blurb"),
|
|
||||||
text("volunteer_title"),
|
|
||||||
text("volunteer_blurb"),
|
|
||||||
],
|
|
||||||
|
|
||||||
children: [
|
|
||||||
{ ...blocksChild("org_page_mission"), key: "mission_blocks" },
|
|
||||||
{ ...blocksChild("org_page_leadership"), key: "leadership_blocks" },
|
|
||||||
{
|
|
||||||
key: "volunteer_links",
|
|
||||||
table: "organization_page_links",
|
|
||||||
owner: { column: "page_id" },
|
|
||||||
order: "sort_order",
|
|
||||||
columns: [text("label", { required: true }), url("url", { required: true })],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
|
@ -26,7 +26,6 @@ import history from "./routes/history.js";
|
||||||
import home from "./routes/home.js";
|
import home from "./routes/home.js";
|
||||||
import directory from "./routes/directory.js";
|
import directory from "./routes/directory.js";
|
||||||
import blog from "./routes/blog.js";
|
import blog from "./routes/blog.js";
|
||||||
import organizationPage from "./routes/organizationPage.js";
|
|
||||||
import pages from "./routes/pages.js";
|
import pages from "./routes/pages.js";
|
||||||
import feedback from "./routes/feedback.js";
|
import feedback from "./routes/feedback.js";
|
||||||
import requests from "./routes/requests.js";
|
import requests from "./routes/requests.js";
|
||||||
|
|
@ -39,7 +38,7 @@ import clips from "./routes/clips.js";
|
||||||
import imports from "./routes/import.js";
|
import imports from "./routes/import.js";
|
||||||
import files from "./routes/files.js";
|
import files from "./routes/files.js";
|
||||||
import { CLIPS_DIR, startClipWorker } from "./clips.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 { logSafe, startSessionSweeper } from "./auth.js";
|
||||||
import { syncDescriptorsWithSchema } from "./admin-schema-sync.js";
|
import { syncDescriptorsWithSchema } from "./admin-schema-sync.js";
|
||||||
import { startGroupSync } from "./accessGroups.js";
|
import { startGroupSync } from "./accessGroups.js";
|
||||||
|
|
@ -58,6 +57,9 @@ syncDescriptorsWithSchema(db, ENTITIES);
|
||||||
console.log(`db ${DB_PATH} (${db.driverName}, schema v${version})`);
|
console.log(`db ${DB_PATH} (${db.driverName}, schema v${version})`);
|
||||||
await mkdir(UPLOADS_DIR, { recursive: true });
|
await mkdir(UPLOADS_DIR, { recursive: true });
|
||||||
console.log(`uploads ${UPLOADS_DIR}`);
|
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.
|
// In the background: pages fall back to the full file until it's done.
|
||||||
writeMissingThumbs()
|
writeMissingThumbs()
|
||||||
.then((made) => made && console.log(`uploads: made ${made} small copies`))
|
.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", home);
|
||||||
app.route("/api", directory);
|
app.route("/api", directory);
|
||||||
app.route("/api", blog);
|
app.route("/api", blog);
|
||||||
app.route("/api", organizationPage);
|
|
||||||
|
|
||||||
// Tighter limit on the write path than anything else gets.
|
// Tighter limit on the write path than anything else gets.
|
||||||
app.use("/api/feedback", rateLimit({ windowMs: 60_000, max: 5 }));
|
app.use("/api/feedback", rateLimit({ windowMs: 60_000, max: 5 }));
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,8 @@
|
||||||
by itself (link previews, Drive files' first pages), images/ for
|
by itself (link previews, Drive files' first pages), images/ for
|
||||||
the rest. A stored name includes it: 'logos/3f9c….webp', served at
|
the rest. A stored name includes it: 'logos/3f9c….webp', served at
|
||||||
/uploads/logos/3f9c….webp. The small copy sits beside it. Clips
|
/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 ──
|
── Files copied in by hand ──
|
||||||
A file put straight into UPLOADS_DIR has no media row, so the
|
A file put straight into UPLOADS_DIR has no media row, so the
|
||||||
|
|
@ -50,6 +51,7 @@
|
||||||
|
|
||||||
import { randomBytes } from "node:crypto";
|
import { randomBytes } from "node:crypto";
|
||||||
|
|
||||||
|
import { tx } from "./db.js";
|
||||||
import { mkdir, readFile, readdir, rename, stat, unlink, writeFile } from "node:fs/promises";
|
import { mkdir, readFile, readdir, rename, stat, unlink, writeFile } from "node:fs/promises";
|
||||||
import path from "node:path";
|
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
|
// Columns that hold a logo or a site icon: an image one of these
|
||||||
// names goes in logos/.
|
// 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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;
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
||||||
/* ═══════════════════════════════════════════════════════════════
|
|
||||||
ORGANIZATION PAGE ROUTE: read-only, mounted under /api
|
|
||||||
|
|
||||||
GET /organization-page the Organization page's own content:
|
|
||||||
its section titles, the Mission and
|
|
||||||
Leadership blocks, and Volunteering
|
|
||||||
(title, blurb, links)
|
|
||||||
|
|
||||||
Edited in the admin as Pages → Organization page
|
|
||||||
(admin-schema/organizationPage.js). The blocks are shaped as on
|
|
||||||
any record page (loadBlocks), so ContentBlocks draws them.
|
|
||||||
═══════════════════════════════════════════════════════════════ */
|
|
||||||
|
|
||||||
import { Hono } from "hono";
|
|
||||||
import { json, loadBlocks } from "../shape.js";
|
|
||||||
|
|
||||||
const ID = "organization";
|
|
||||||
const organizationPage = new Hono();
|
|
||||||
|
|
||||||
organizationPage.get("/organization-page", (c) => {
|
|
||||||
const db = c.get("db");
|
|
||||||
const row = db.prepare(`SELECT * FROM organization_page WHERE id = ?`).get(ID) ?? {};
|
|
||||||
const links = db
|
|
||||||
.prepare(`SELECT label, url FROM organization_page_links WHERE page_id = ? ORDER BY sort_order, id`)
|
|
||||||
.all(ID);
|
|
||||||
|
|
||||||
return json(c, {
|
|
||||||
page: {
|
|
||||||
mission_title: row.mission_title ?? null,
|
|
||||||
mission_blocks: loadBlocks(db, "org_page_mission", [ID]).get(ID) ?? [],
|
|
||||||
leadership_title: row.leadership_title ?? null,
|
|
||||||
leadership_blurb: row.leadership_blurb ?? null,
|
|
||||||
leadership_blocks: loadBlocks(db, "org_page_leadership", [ID]).get(ID) ?? [],
|
|
||||||
volunteer: {
|
|
||||||
title: row.volunteer_title ?? null,
|
|
||||||
blurb: row.volunteer_blurb ?? null,
|
|
||||||
links,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
export default organizationPage;
|
|
||||||
|
|
@ -21,6 +21,9 @@
|
||||||
the app's own not-found page with a 404 status, so search engines
|
the app's own not-found page with a 404 status, so search engines
|
||||||
drop it.
|
drop it.
|
||||||
|
|
||||||
|
A page that moved answers with a 301 to where it is now (MOVED),
|
||||||
|
so old links, QR codes and search results keep working.
|
||||||
|
|
||||||
If the metadata can't be built (no site.json at SITE_CONFIG, say),
|
If the metadata can't be built (no site.json at SITE_CONFIG, say),
|
||||||
the page is still served, as built, and the cause is logged once:
|
the page is still served, as built, and the cause is logged once:
|
||||||
a preview is never worth a page that won't load.
|
a preview is never worth a page that won't load.
|
||||||
|
|
@ -89,12 +92,23 @@ pages.get("/sitemap.xml", (c) => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* Pages that have moved: old path → new, query string kept. */
|
||||||
|
const MOVED = {
|
||||||
|
"/leadership": "/organization",
|
||||||
|
};
|
||||||
|
|
||||||
pages.get("*", (c, next) => {
|
pages.get("*", (c, next) => {
|
||||||
const pathname = c.req.path;
|
const pathname = c.req.path;
|
||||||
// The API's own paths, and an upload that isn't there, stay plain
|
// The API's own paths, and an upload that isn't there, stay plain
|
||||||
// 404s rather than becoming a page.
|
// 404s rather than becoming a page.
|
||||||
if (/^\/(api|uploads)(\/|$)/.test(pathname)) return next();
|
if (/^\/(api|uploads)(\/|$)/.test(pathname)) return next();
|
||||||
|
|
||||||
|
const moved = MOVED[pathname.replace(/(.)\/+$/, "$1")];
|
||||||
|
if (moved) {
|
||||||
|
const query = new URL(c.req.url).search;
|
||||||
|
return c.redirect(moved + query, 301);
|
||||||
|
}
|
||||||
|
|
||||||
let html;
|
let html;
|
||||||
try {
|
try {
|
||||||
html = indexHtml();
|
html = indexHtml();
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import { PAGE_LINKS, NAV_ACTIONS } from "../navConfig.ts";
|
import { PAGE_LINKS, PAGE_SECTIONS, NAV_ACTIONS } from "../navConfig.ts";
|
||||||
import { useNavSections } from "../lib/navSections.ts";
|
|
||||||
import siteLogo from "../assets/logos/NGU_Logo.svg";
|
import siteLogo from "../assets/logos/NGU_Logo.svg";
|
||||||
import PlatformIcon from "./PlatformIcon.tsx";
|
import PlatformIcon from "./PlatformIcon.tsx";
|
||||||
import { ORGANIZATION_DETAILS as Organization_Details } from "../data/organizationDetails.ts";
|
import { ORGANIZATION_DETAILS as Organization_Details } from "../data/organizationDetails.ts";
|
||||||
|
|
@ -45,7 +44,6 @@ const sectionLinkClass =
|
||||||
const headingClass = "text-white/90 text-sm font-semibold mb-4";
|
const headingClass = "text-white/90 text-sm font-semibold mb-4";
|
||||||
|
|
||||||
export default function Footer() {
|
export default function Footer() {
|
||||||
const sectionsOf = useNavSections();
|
|
||||||
return (
|
return (
|
||||||
<footer className="py-16 px-6" style={{ background: "#001011" }}>
|
<footer className="py-16 px-6" style={{ background: "#001011" }}>
|
||||||
<div className="max-w-6xl mx-auto">
|
<div className="max-w-6xl mx-auto">
|
||||||
|
|
@ -87,7 +85,7 @@ export default function Footer() {
|
||||||
<h2 className={headingClass}>Site Map</h2>
|
<h2 className={headingClass}>Site Map</h2>
|
||||||
<ul className="grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-x-6 gap-y-6">
|
<ul className="grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-x-6 gap-y-6">
|
||||||
{PAGE_LINKS.map((page) => {
|
{PAGE_LINKS.map((page) => {
|
||||||
const sections = sectionsOf(page.path);
|
const sections = PAGE_SECTIONS[page.path] ?? [];
|
||||||
return (
|
return (
|
||||||
<li key={page.path}>
|
<li key={page.path}>
|
||||||
<Link to={page.path} className={pageLinkClass}>
|
<Link to={page.path} className={pageLinkClass}>
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
import { X, List } from "@phosphor-icons/react";
|
import { X, List } from "@phosphor-icons/react";
|
||||||
import { Suspense, useState, useEffect, useRef } from "react";
|
import { Suspense, useState, useEffect, useRef } from "react";
|
||||||
import { NavLink, Link, Outlet, useLocation } from "react-router-dom";
|
import { NavLink, Link, Outlet, useLocation } from "react-router-dom";
|
||||||
import { PAGE_LINKS, NAV_ACTIONS } from "../navConfig.ts";
|
import { PAGE_LINKS, PAGE_SECTIONS, NAV_ACTIONS } from "../navConfig.ts";
|
||||||
import { useNavSections } from "../lib/navSections.ts";
|
|
||||||
import Banner from "./Banner.tsx";
|
import Banner from "./Banner.tsx";
|
||||||
import siteLogo from "../assets/logos/NGU_Logo.svg";
|
import siteLogo from "../assets/logos/NGU_Logo.svg";
|
||||||
import Footer from "./Footer.tsx";
|
import Footer from "./Footer.tsx";
|
||||||
|
|
@ -77,18 +76,23 @@ const navActions = NAV_ACTIONS as NavActionItem[];
|
||||||
|
|
||||||
export default function Layout() {
|
export default function Layout() {
|
||||||
const [mobileMenuOpen, setMobileMenuOpen] = useState(false);
|
const [mobileMenuOpen, setMobileMenuOpen] = useState(false);
|
||||||
// Measured below; this first guess keeps the content from jumping
|
const [activeSection, setActiveSection] = useState<string | null>(null);
|
||||||
// when it lands.
|
// Measured below; this first guess (nav, plus the section strip on
|
||||||
const [headerHeight, setHeaderHeight] = useState(72);
|
// pages that have one) keeps the content from jumping when it lands.
|
||||||
|
const [headerHeight, setHeaderHeight] = useState(() =>
|
||||||
|
72 + ((PAGE_SECTIONS[window.location.pathname] ?? []).length ? 36 : 0),
|
||||||
|
);
|
||||||
const headerRef = useRef<HTMLElement>(null);
|
const headerRef = useRef<HTMLElement>(null);
|
||||||
const closeMenuRef = useRef<HTMLButtonElement>(null);
|
const closeMenuRef = useRef<HTMLButtonElement>(null);
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
|
|
||||||
const sectionsOf = useNavSections();
|
const sections = PAGE_SECTIONS[location.pathname] ?? [];
|
||||||
|
const activePage = PAGE_LINKS.find((p) => p.path === location.pathname);
|
||||||
|
|
||||||
// Close the mobile menu whenever the route changes
|
// Close the mobile menu whenever the route changes
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setMobileMenuOpen(false);
|
setMobileMenuOpen(false);
|
||||||
|
setActiveSection(null);
|
||||||
}, [location.pathname]);
|
}, [location.pathname]);
|
||||||
|
|
||||||
// The open menu is modal: focus starts on its close button, Escape
|
// The open menu is modal: focus starts on its close button, Escape
|
||||||
|
|
@ -101,9 +105,9 @@ export default function Layout() {
|
||||||
return () => window.removeEventListener("keydown", onKey);
|
return () => window.removeEventListener("keydown", onKey);
|
||||||
}, [mobileMenuOpen]);
|
}, [mobileMenuOpen]);
|
||||||
|
|
||||||
// The header grows and shrinks: the banner can be dismissed, and
|
// The header grows and shrinks: the banner can be dismissed and the
|
||||||
// wraps on a narrow screen. Measure it instead of guessing, so the
|
// subnav only exists on some pages. Measure it instead of guessing,
|
||||||
// spacer below always matches.
|
// so the spacer below always matches.
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const el = headerRef.current;
|
const el = headerRef.current;
|
||||||
if (!el) return;
|
if (!el) return;
|
||||||
|
|
@ -128,6 +132,33 @@ export default function Layout() {
|
||||||
window.scrollTo({ top: 0 });
|
window.scrollTo({ top: 0 });
|
||||||
}, [location.pathname, location.hash, location.key]);
|
}, [location.pathname, location.hash, location.key]);
|
||||||
|
|
||||||
|
// Highlight whichever section is currently in view
|
||||||
|
useEffect(() => {
|
||||||
|
if (sections.length === 0) return;
|
||||||
|
|
||||||
|
const targets = sections
|
||||||
|
.map((s) => document.querySelector(s.hash))
|
||||||
|
.filter(Boolean);
|
||||||
|
if (targets.length === 0) return;
|
||||||
|
|
||||||
|
const observer = new IntersectionObserver(
|
||||||
|
(entries) => {
|
||||||
|
const visible = entries
|
||||||
|
.filter((e) => e.isIntersecting)
|
||||||
|
.sort(
|
||||||
|
(a, b) => a.boundingClientRect.top - b.boundingClientRect.top
|
||||||
|
)[0];
|
||||||
|
if (visible) setActiveSection(`#${visible.target.id}`);
|
||||||
|
},
|
||||||
|
// Top margin tracks the live header height so the highlight stays
|
||||||
|
// accurate whether or not the banner is showing.
|
||||||
|
{ rootMargin: `-${headerHeight + 30}px 0px -60% 0px`, threshold: 0 }
|
||||||
|
);
|
||||||
|
|
||||||
|
targets.forEach((t) => observer.observe(t));
|
||||||
|
return () => observer.disconnect();
|
||||||
|
}, [location.pathname, headerHeight]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
// overflow-x-clip, not -hidden: hidden makes this div a scroll
|
// overflow-x-clip, not -hidden: hidden makes this div a scroll
|
||||||
// container, and then nothing inside it can be position: sticky
|
// container, and then nothing inside it can be position: sticky
|
||||||
|
|
@ -164,51 +195,23 @@ export default function Layout() {
|
||||||
<img src={siteLogo} alt="Next Generation of Unity" className="h-10 w-auto" />
|
<img src={siteLogo} alt="Next Generation of Unity" className="h-10 w-auto" />
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
{/* Each page, and under it on hover or keyboard focus its
|
|
||||||
sections (navSections.ts): the sections live in these
|
|
||||||
dropdowns rather than a strip of their own. */}
|
|
||||||
<div className="hidden lg:flex items-center gap-6">
|
<div className="hidden lg:flex items-center gap-6">
|
||||||
{PAGE_LINKS.map((page) => {
|
{PAGE_LINKS.map((page) => (
|
||||||
const pageSections = sectionsOf(page.path);
|
<NavLink
|
||||||
return (
|
key={page.path}
|
||||||
<div key={page.path} className="group relative">
|
to={page.path}
|
||||||
<NavLink
|
end={page.path === "/"}
|
||||||
to={page.path}
|
className={({ isActive }) =>
|
||||||
end={page.path === "/"}
|
`text-base font-bold pb-1 border-b-2 transition-colors duration-200 ${
|
||||||
className={({ isActive }) =>
|
isActive
|
||||||
`block text-base font-bold pb-1 border-b-2 transition-colors duration-200 ${
|
? "text-white border-[#9cc47c]"
|
||||||
isActive
|
: "text-white/75 hover:text-white border-transparent"
|
||||||
? "text-white border-[#9cc47c]"
|
}`
|
||||||
: "text-white/75 hover:text-white border-transparent"
|
}
|
||||||
}`
|
>
|
||||||
}
|
{page.label}
|
||||||
>
|
</NavLink>
|
||||||
{page.label}
|
))}
|
||||||
</NavLink>
|
|
||||||
{pageSections.length > 0 && (
|
|
||||||
// pt-3 is the bridge the pointer crosses from the
|
|
||||||
// link into the menu without it closing.
|
|
||||||
<div className="invisible absolute top-full left-0 z-10 pt-3 opacity-0 transition-opacity duration-150 group-hover:visible group-hover:opacity-100 group-focus-within:visible group-focus-within:opacity-100">
|
|
||||||
<ul
|
|
||||||
className="min-w-56 py-2 shadow-xl"
|
|
||||||
style={{ background: "rgba(0, 16, 17, 0.97)", borderTop: "2px solid #9cc47c" }}
|
|
||||||
>
|
|
||||||
{pageSections.map((section) => (
|
|
||||||
<li key={section.hash}>
|
|
||||||
<Link
|
|
||||||
to={`${page.path}${section.hash}`}
|
|
||||||
className="block px-4 py-2 text-sm text-white/80 transition-colors hover:bg-white/10 hover:text-[#f0bd4f] focus-visible:bg-white/10"
|
|
||||||
>
|
|
||||||
{section.label}
|
|
||||||
</Link>
|
|
||||||
</li>
|
|
||||||
))}
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -232,6 +235,43 @@ export default function Layout() {
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
|
{/* Tier 2, sections of the current page */}
|
||||||
|
{sections.length > 0 && (
|
||||||
|
<nav
|
||||||
|
className="hidden md:flex items-center px-6 py-2"
|
||||||
|
aria-label={`On this page: ${activePage?.label}`}
|
||||||
|
style={{
|
||||||
|
background: "rgba(0, 16, 17, 0.92)",
|
||||||
|
borderBottom: "1px solid rgba(92, 231, 255, 0.15)",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<span className="text-xs text-white/65">{activePage?.label}</span>
|
||||||
|
|
||||||
|
{/* Separates the page label from its sections */}
|
||||||
|
<span
|
||||||
|
aria-hidden
|
||||||
|
className="mx-5 h-4 w-px"
|
||||||
|
style={{ background: "rgba(92, 231, 255, 0.3)" }}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div className="flex items-center gap-6">
|
||||||
|
{sections.map((section) => (
|
||||||
|
<a
|
||||||
|
key={section.hash}
|
||||||
|
href={section.hash}
|
||||||
|
aria-current={activeSection === section.hash ? "location" : undefined}
|
||||||
|
className={`text-sm transition-colors duration-200 ${
|
||||||
|
activeSection === section.hash
|
||||||
|
? "text-[#9cc47c]"
|
||||||
|
: "text-white/75 hover:text-[#9cc47c]"
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
{section.label}
|
||||||
|
</a>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
)}
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<PageBackdrop />
|
<PageBackdrop />
|
||||||
|
|
@ -273,7 +313,7 @@ export default function Layout() {
|
||||||
|
|
||||||
<div className="w-64">
|
<div className="w-64">
|
||||||
{PAGE_LINKS.map((page) => {
|
{PAGE_LINKS.map((page) => {
|
||||||
const pageSections = sectionsOf(page.path);
|
const pageSections = PAGE_SECTIONS[page.path] ?? [];
|
||||||
const isActive = location.pathname === page.path;
|
const isActive = location.pathname === page.path;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,6 @@
|
||||||
heading with a blurb and rule. Sections paint no background of
|
heading with a blurb and rule. Sections paint no background of
|
||||||
their own: the page's (PageBackdrop.tsx) runs behind all of them.
|
their own: the page's (PageBackdrop.tsx) runs behind all of them.
|
||||||
|
|
||||||
`sideNav` adds an "On this page" column at the left from lg up, the
|
|
||||||
admin editors' own (SectionNav), sticky under the header, listing
|
|
||||||
the sections with the one being read lit. Below lg the menu lists
|
|
||||||
the sections instead.
|
|
||||||
|
|
||||||
Whatever goes inside a section is passed as `content`, the shell
|
Whatever goes inside a section is passed as `content`, the shell
|
||||||
doesn't care what it is.
|
doesn't care what it is.
|
||||||
|
|
||||||
|
|
@ -38,7 +33,6 @@ import { useEffect, type ReactNode } from "react";
|
||||||
|
|
||||||
import { documentTitle } from "../lib/site.ts";
|
import { documentTitle } from "../lib/site.ts";
|
||||||
import { accentText, BRAND } from '../lib/color.ts'
|
import { accentText, BRAND } from '../lib/color.ts'
|
||||||
import { SectionNav } from "./admin/SectionNav.tsx";
|
|
||||||
|
|
||||||
|
|
||||||
export type ShellSection = {
|
export type ShellSection = {
|
||||||
|
|
@ -54,8 +48,6 @@ type PageShellProps = {
|
||||||
title: ReactNode;
|
title: ReactNode;
|
||||||
intro?: ReactNode;
|
intro?: ReactNode;
|
||||||
sections: ShellSection[];
|
sections: ShellSection[];
|
||||||
/** An "On this page" column beside the sections, from lg up. */
|
|
||||||
sideNav?: boolean;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export function Section({ section }: { section: ShellSection }) {
|
export function Section({ section }: { section: ShellSection }) {
|
||||||
|
|
@ -97,7 +89,7 @@ export function Section({ section }: { section: ShellSection }) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function PageShell({ title, intro, sections, sideNav = false }: PageShellProps) {
|
export default function PageShell({ title, intro, sections }: PageShellProps) {
|
||||||
// The tab's title as the visitor moves around. The first load's
|
// The tab's title as the visitor moves around. The first load's
|
||||||
// comes from the server (pageMeta.js), which also sets the page's
|
// comes from the server (pageMeta.js), which also sets the page's
|
||||||
// description and preview for search and link sharing.
|
// description and preview for search and link sharing.
|
||||||
|
|
@ -105,15 +97,6 @@ export default function PageShell({ title, intro, sections, sideNav = false }: P
|
||||||
if (typeof title === "string") document.title = documentTitle(title);
|
if (typeof title === "string") document.title = documentTitle(title);
|
||||||
}, [title]);
|
}, [title]);
|
||||||
|
|
||||||
const bands = sections.map((section, i) => (
|
|
||||||
<div key={section.id}>
|
|
||||||
{/* Thin solid banner between sections */}
|
|
||||||
<div className="h-2" style={{ background: section.accent }} />
|
|
||||||
<Section section={section} />
|
|
||||||
{i === sections.length - 1 && <div className="h-2" style={{ background: section.accent }} />}
|
|
||||||
</div>
|
|
||||||
));
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{/* Page header */}
|
{/* Page header */}
|
||||||
|
|
@ -126,18 +109,16 @@ export default function PageShell({ title, intro, sections, sideNav = false }: P
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{sideNav ? (
|
{sections.map((section, i) => (
|
||||||
<div className="lg:grid lg:grid-cols-[13rem_minmax(0,1fr)]">
|
<div key={section.id}>
|
||||||
<aside className="hidden lg:block">
|
{/* Thin solid banner between sections */}
|
||||||
<div className="sticky pt-8 pl-6" style={{ top: "calc(var(--header-h, 5rem) + 1rem)" }}>
|
<div className="h-2" style={{ background: section.accent }} />
|
||||||
<SectionNav sections={sections.map((s) => ({ id: s.id, label: s.title }))} />
|
<Section section={section} />
|
||||||
</div>
|
{i === sections.length - 1 && (
|
||||||
</aside>
|
<div className="h-2" style={{ background: section.accent }} />
|
||||||
<div className="min-w-0">{bands}</div>
|
)}
|
||||||
</div>
|
</div>
|
||||||
) : (
|
))}
|
||||||
bands
|
|
||||||
)}
|
|
||||||
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
/* ═══════════════════════════════════════════════════════════════
|
/* ═══════════════════════════════════════════════════════════════
|
||||||
EDITOR SECTION NAV
|
EDITOR SECTION NAV
|
||||||
|
|
||||||
The record editor's table of contents, and the public pages'
|
The record editor's table of contents. On a wide screen it's a
|
||||||
"On this page" column too (PageShell's sideNav). On a wide screen it's a
|
|
||||||
sticky column left of the form; below lg it's a slim sticky bar
|
sticky column left of the form; below lg it's a slim sticky bar
|
||||||
with a "Jump to" menu. Both list the same sections, which
|
with a "Jump to" menu. Both list the same sections, which
|
||||||
EntityEdit derives from the manifest (field groups, then child
|
EntityEdit derives from the manifest (field groups, then child
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,9 @@
|
||||||
Connect Nav → Icon), as [key, label]. The admin's dropdown lists
|
Connect Nav → Icon), as [key, label]. The admin's dropdown lists
|
||||||
the labels; Pathfinder.tsx draws the Phosphor icon for each key.
|
the labels; Pathfinder.tsx draws the Phosphor icon for each key.
|
||||||
Adding one is a line here and one in ICONS in Pathfinder.tsx.
|
Adding one is a line here and one in ICONS in Pathfinder.tsx.
|
||||||
A path with none set shows a dot.
|
|
||||||
|
A path saved before this list existed may hold an emoji instead
|
||||||
|
of a key; Pathfinder shows that as it is.
|
||||||
═══════════════════════════════════════════════════════════════ */
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
||||||
export const PATH_ICONS: [string, string][] = [
|
export const PATH_ICONS: [string, string][] = [
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@ import { timeline } from "./adminSchema/timeline.ts";
|
||||||
import { frontPage } from "./adminSchema/frontPage.ts";
|
import { frontPage } from "./adminSchema/frontPage.ts";
|
||||||
import { blogPosts, communityPage } from "./adminSchema/blog.ts";
|
import { blogPosts, communityPage } from "./adminSchema/blog.ts";
|
||||||
import { siteSettings } from "./adminSchema/siteSettings.ts";
|
import { siteSettings } from "./adminSchema/siteSettings.ts";
|
||||||
import { organizationPage } from "./adminSchema/organizationPage.ts";
|
|
||||||
|
|
||||||
export const ADMIN_ENTITIES: Record<string, any> = {
|
export const ADMIN_ENTITIES: Record<string, any> = {
|
||||||
organizations,
|
organizations,
|
||||||
|
|
@ -39,7 +38,6 @@ export const ADMIN_ENTITIES: Record<string, any> = {
|
||||||
front_page: frontPage,
|
front_page: frontPage,
|
||||||
blog_posts: blogPosts,
|
blog_posts: blogPosts,
|
||||||
community_page: communityPage,
|
community_page: communityPage,
|
||||||
organization_page: organizationPage,
|
|
||||||
site_settings: siteSettings,
|
site_settings: siteSettings,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,71 +0,0 @@
|
||||||
/* Pages → Organization page: the /organization page's own content.
|
|
||||||
Server side: server/src/admin-schema/organizationPage.js. Each
|
|
||||||
section's blocks are their own collection; the Leadership blocks
|
|
||||||
are where the teams go, a People block each, in order. */
|
|
||||||
|
|
||||||
import { blocksChild } from "./shared.ts";
|
|
||||||
|
|
||||||
/* A block collection for one section: the shared block editor,
|
|
||||||
without "Shown in" (these blocks only ever show on the page). */
|
|
||||||
const sectionBlocks = (key: string, label: string, note: string) => ({
|
|
||||||
...blocksChild,
|
|
||||||
key,
|
|
||||||
label,
|
|
||||||
note,
|
|
||||||
fields: blocksChild.fields.filter((field) => field.path !== "slot"),
|
|
||||||
});
|
|
||||||
|
|
||||||
export const organizationPage = {
|
|
||||||
key: "organization_page",
|
|
||||||
label: "Organization page",
|
|
||||||
singular: "organization page",
|
|
||||||
idLabel: "Page",
|
|
||||||
singleton: "organization",
|
|
||||||
|
|
||||||
list: { columns: [], filters: [] },
|
|
||||||
|
|
||||||
groups: [
|
|
||||||
{
|
|
||||||
legend: "Mission, Vision & Values",
|
|
||||||
note: "The page's first section. Its content is the Mission blocks below.",
|
|
||||||
fields: [{ path: "mission_title", label: "Heading", help: "Default: Mission, Vision & Values" }],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
legend: "Leadership",
|
|
||||||
note: "The second section: the Leadership blocks below, then Volunteering.",
|
|
||||||
fields: [
|
|
||||||
{ path: "leadership_title", label: "Heading", help: "Default: Leadership" },
|
|
||||||
{ path: "leadership_blurb", label: "Blurb", widget: "textarea", full: true },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
legend: "Volunteering",
|
|
||||||
note: "Under the leadership: a title, a line or two and the links below.",
|
|
||||||
fields: [
|
|
||||||
{ path: "volunteer_title", label: "Title", help: "Default: Volunteering" },
|
|
||||||
{ path: "volunteer_blurb", label: "Blurb", widget: "textarea", full: true },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
|
|
||||||
children: [
|
|
||||||
sectionBlocks("mission_blocks", "Mission blocks", "The Mission, Vision & Values section: headings, paragraphs, lists, whatever it needs."),
|
|
||||||
sectionBlocks(
|
|
||||||
"leadership_blocks",
|
|
||||||
"Leadership blocks",
|
|
||||||
"The Leadership section, in order: eg. a People block for the Board of Trustees, then one for the Retreat Team.",
|
|
||||||
),
|
|
||||||
{
|
|
||||||
key: "volunteer_links",
|
|
||||||
label: "Volunteering links",
|
|
||||||
note: "Buttons under the volunteering blurb.",
|
|
||||||
addLabel: "Add link",
|
|
||||||
title: (row) => row.label || row.url || "New link",
|
|
||||||
blank: { label: "", url: "" },
|
|
||||||
fields: [
|
|
||||||
{ path: "label", label: "Label", required: true, help: "eg. Volunteer at a retreat" },
|
|
||||||
{ path: "url", label: "Link", required: true, full: true, help: "A page on this site (eg. /request) or anywhere else" },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
|
@ -1,38 +0,0 @@
|
||||||
/* ═══════════════════════════════════════════════════════════════
|
|
||||||
FRONT PAGE BANDS
|
|
||||||
|
|
||||||
Each band the front page can show (front_page_sections.section):
|
|
||||||
the anchor it sits at, and the heading it gets when the admin gives
|
|
||||||
it none. Home.tsx draws the bands; the nav and footer list the ones
|
|
||||||
the front page is showing (navSections.ts). The countdown has no
|
|
||||||
anchor: it's a card under the hero, not a section to jump to.
|
|
||||||
═══════════════════════════════════════════════════════════════ */
|
|
||||||
|
|
||||||
import type { FrontPage, FrontPageSectionKey } from './useFrontPage.ts'
|
|
||||||
|
|
||||||
export const FRONT_PAGE_BANDS: Record<FrontPageSectionKey, { id: string | null; title: string }> = {
|
|
||||||
countdown: { id: null, title: 'Next up' },
|
|
||||||
retreats: { id: 'retreats', title: 'National Retreats' },
|
|
||||||
calendar: { id: 'calendar', title: 'What’s on' },
|
|
||||||
stats: { id: 'numbers', title: 'By the numbers' },
|
|
||||||
timeline: { id: 'story', title: 'Our story so far' },
|
|
||||||
connect: { id: 'connect', title: 'Find your way in' },
|
|
||||||
featured: { id: 'featured', title: 'Featured' },
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Whether a band has anything to draw: Home.tsx leaves out a band
|
|
||||||
with nothing in it, and so does the nav. */
|
|
||||||
export function bandShows(page: FrontPage, key: FrontPageSectionKey): boolean {
|
|
||||||
switch (key) {
|
|
||||||
case 'countdown':
|
|
||||||
return Boolean(page.countdown)
|
|
||||||
case 'stats':
|
|
||||||
return page.stats.length > 0
|
|
||||||
case 'connect':
|
|
||||||
return page.paths.length > 0
|
|
||||||
case 'featured':
|
|
||||||
return page.featured.length > 0
|
|
||||||
default:
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
||||||
/* ═══════════════════════════════════════════════════════════════
|
|
||||||
NAV SECTIONS: the sections listed under each page in the header's
|
|
||||||
dropdowns, the mobile menu and the footer's site map
|
|
||||||
|
|
||||||
The static pages' lists are PAGE_SECTIONS in navConfig.ts. The
|
|
||||||
front page's comes from the front page itself: the bands it is
|
|
||||||
showing, in the admin's order, each under its heading (Front page
|
|
||||||
→ Sections), so hiding a band or renaming it changes the menus too.
|
|
||||||
═══════════════════════════════════════════════════════════════ */
|
|
||||||
|
|
||||||
import { useCallback } from 'react'
|
|
||||||
|
|
||||||
import { PAGE_SECTIONS } from '../navConfig.ts'
|
|
||||||
import { useFrontPage } from './useFrontPage.ts'
|
|
||||||
import { FRONT_PAGE_BANDS, bandShows } from './frontPageBands.ts'
|
|
||||||
|
|
||||||
export type NavSection = { label: string; hash: string }
|
|
||||||
|
|
||||||
export function useNavSections(): (path: string) => NavSection[] {
|
|
||||||
const { data: page } = useFrontPage()
|
|
||||||
|
|
||||||
return useCallback(
|
|
||||||
(path: string) => {
|
|
||||||
if (path !== '/') return PAGE_SECTIONS[path] ?? []
|
|
||||||
if (!page) return []
|
|
||||||
return page.sections.flatMap((section) => {
|
|
||||||
const band = FRONT_PAGE_BANDS[section.section]
|
|
||||||
if (!band?.id || !bandShows(page, section.section)) return []
|
|
||||||
return [{ label: section.title || band.title, hash: `#${band.id}` }]
|
|
||||||
})
|
|
||||||
},
|
|
||||||
[page],
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
@ -7,4 +7,4 @@
|
||||||
box or a build banner can read the same value later.
|
box or a build banner can read the same value later.
|
||||||
═══════════════════════════════════════════════════════════════ */
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
||||||
export const SITE_VERSION = "NGU-Web.v1.10.5";
|
export const SITE_VERSION = "NGU-Web.v1.10.4";
|
||||||
|
|
|
||||||
|
|
@ -5,15 +5,21 @@ export const PAGE_LINKS = [
|
||||||
{ label: "Home", path: "/" },
|
{ label: "Home", path: "/" },
|
||||||
{ label: "Retreats", path: "/retreats" },
|
{ label: "Retreats", path: "/retreats" },
|
||||||
{ label: "Community", path: "/community" },
|
{ label: "Community", path: "/community" },
|
||||||
{ label: "Resources", path: "/resources" },
|
|
||||||
{ label: "Organization", path: "/organization" },
|
{ label: "Organization", path: "/organization" },
|
||||||
|
{ label: "Resources", path: "/resources" },
|
||||||
{ label: "History", path: "/history" },
|
{ label: "History", path: "/history" },
|
||||||
];
|
];
|
||||||
|
|
||||||
// Sections belong to a page, keyed by that page's path: the header's
|
// Sections belong to a page, keyed by that page's path.
|
||||||
// dropdowns, the mobile menu and the footer list them (navSections.ts).
|
// A page with no sections gets no subnav row.
|
||||||
// The front page's aren't here: they follow the bands it's showing.
|
export const PAGE_SECTIONS = {
|
||||||
export const PAGE_SECTIONS: Record<string, Array<{ label: string; hash: string }>> = {
|
"/": [
|
||||||
|
{ label: "#Featured", hash: "#hero" },
|
||||||
|
{ label: "#Connect", hash: "#connect" },
|
||||||
|
{ label: "#Retreats", hash: "#retreats" },
|
||||||
|
{ label: "#Calendar", hash: "#calendar" },
|
||||||
|
{ label: "#About", hash: "#numbers" },
|
||||||
|
],
|
||||||
"/retreats": [
|
"/retreats": [
|
||||||
{ label: "National", hash: "#national" },
|
{ label: "National", hash: "#national" },
|
||||||
{ label: "Regional", hash: "#regional" },
|
{ label: "Regional", hash: "#regional" },
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,6 @@ export default function CommunityPage() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageShell
|
<PageShell
|
||||||
sideNav
|
|
||||||
title={PAGE.title}
|
title={PAGE.title}
|
||||||
intro={PAGE.description}
|
intro={PAGE.description}
|
||||||
sections={sections}
|
sections={sections}
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,6 @@ export default function History() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageShell
|
<PageShell
|
||||||
sideNav
|
|
||||||
title={PAGE.title}
|
title={PAGE.title}
|
||||||
intro={PAGE.description}
|
intro={PAGE.description}
|
||||||
sections={[
|
sections={[
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,6 @@ import {
|
||||||
type FrontPageSection,
|
type FrontPageSection,
|
||||||
type FrontPageSectionKey,
|
type FrontPageSectionKey,
|
||||||
} from '../lib/useFrontPage.ts'
|
} from '../lib/useFrontPage.ts'
|
||||||
import { FRONT_PAGE_BANDS, bandShows } from '../lib/frontPageBands.ts'
|
|
||||||
import './sections/home/home.css'
|
import './sections/home/home.css'
|
||||||
|
|
||||||
type BandProps = {
|
type BandProps = {
|
||||||
|
|
@ -52,26 +51,56 @@ type BandProps = {
|
||||||
position: number
|
position: number
|
||||||
}
|
}
|
||||||
|
|
||||||
/* How each band renders. Its anchor, its heading when the admin
|
/* Default headings for a band the admin didn't title, and how each
|
||||||
gave it none, and whether it has anything to draw are
|
one renders. The ids are the page anchors, #connect is what the
|
||||||
frontPageBands.ts's, which the nav and footer read too; #connect is
|
hero's second button points at out of the box. */
|
||||||
what the hero's second button points at out of the box. */
|
const SECTIONS: Record<
|
||||||
const id = (key: FrontPageSectionKey) => FRONT_PAGE_BANDS[key].id ?? undefined
|
FrontPageSectionKey,
|
||||||
|
{ title: string; render: (props: BandProps) => ReactNode }
|
||||||
const BANDS: Record<FrontPageSectionKey, (props: BandProps) => ReactNode> = {
|
> = {
|
||||||
countdown: ({ page, position }) => <NextEventCountdown event={page.countdown!} overlap={position === 0} />,
|
countdown: {
|
||||||
retreats: ({ section, title }) => <RetreatsBand id={id('retreats')!} title={title} blurb={section.blurb} />,
|
title: 'Next up',
|
||||||
calendar: ({ section, title }) => <CalendarBand id={id('calendar')!} title={title} blurb={section.blurb} />,
|
render: ({ page, position }) =>
|
||||||
stats: ({ page, section, title }) => (
|
page.countdown && <NextEventCountdown event={page.countdown} overlap={position === 0} />,
|
||||||
<StatsBand id={id('stats')!} title={title} blurb={section.blurb} stats={page.stats} />
|
},
|
||||||
),
|
retreats: {
|
||||||
timeline: ({ section, title }) => <FeaturedTimelineRail id={id('timeline')!} title={title} blurb={section.blurb} />,
|
title: 'National Retreats',
|
||||||
connect: ({ page, section, title }) => (
|
render: ({ section, title }) => (
|
||||||
<Pathfinder id={id('connect')!} title={title} blurb={section.blurb} paths={page.paths} />
|
<RetreatsBand id="retreats" title={title} blurb={section.blurb} />
|
||||||
),
|
),
|
||||||
featured: ({ page, section, title }) => (
|
},
|
||||||
<FeaturedBand id={id('featured')!} title={title} blurb={section.blurb} cards={page.featured} />
|
calendar: {
|
||||||
),
|
title: 'What’s on',
|
||||||
|
render: ({ section, title }) => (
|
||||||
|
<CalendarBand id="calendar" title={title} blurb={section.blurb} />
|
||||||
|
),
|
||||||
|
},
|
||||||
|
stats: {
|
||||||
|
title: 'By the numbers',
|
||||||
|
render: ({ page, section, title }) =>
|
||||||
|
page.stats.length > 0 && (
|
||||||
|
<StatsBand id="numbers" title={title} blurb={section.blurb} stats={page.stats} />
|
||||||
|
),
|
||||||
|
},
|
||||||
|
timeline: {
|
||||||
|
title: 'Our story so far',
|
||||||
|
render: ({ section, title }) => (
|
||||||
|
<FeaturedTimelineRail id="story" title={title} blurb={section.blurb} />
|
||||||
|
),
|
||||||
|
},
|
||||||
|
connect: {
|
||||||
|
title: 'Find your way in',
|
||||||
|
render: ({ page, section, title }) => (
|
||||||
|
<Pathfinder id="connect" title={title} blurb={section.blurb} paths={page.paths} />
|
||||||
|
),
|
||||||
|
},
|
||||||
|
featured: {
|
||||||
|
title: 'Featured',
|
||||||
|
render: ({ page, section, title }) =>
|
||||||
|
page.featured.length > 0 && (
|
||||||
|
<FeaturedBand id="featured" title={title} blurb={section.blurb} cards={page.featured} />
|
||||||
|
),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
|
|
@ -109,16 +138,15 @@ export default function Home() {
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{page?.sections.map((section, position) => {
|
{page?.sections.map((section, position) => {
|
||||||
const render = BANDS[section.section]
|
const band = SECTIONS[section.section]
|
||||||
// A key the CHECK has gained since this file was written, or a
|
// A key the CHECK has gained since this file was written.
|
||||||
// band with nothing to draw.
|
if (!band) return null
|
||||||
if (!render || !bandShows(page, section.section)) return null
|
|
||||||
return (
|
return (
|
||||||
<div key={section.section}>
|
<div key={section.section}>
|
||||||
{render({
|
{band.render({
|
||||||
page,
|
page,
|
||||||
section,
|
section,
|
||||||
title: section.title || FRONT_PAGE_BANDS[section.section].title,
|
title: section.title || band.title,
|
||||||
position,
|
position,
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,49 +1,50 @@
|
||||||
/* ═══════════════════════════════════════════════════════════════
|
/* ═══════════════════════════════════════════════════════════════
|
||||||
ORGANIZATION: /organization
|
ORGANIZATION: /organization (it was /leadership, which the API
|
||||||
|
redirects here)
|
||||||
|
|
||||||
NGU itself, in three parts, edited in the admin as Pages →
|
NGU itself, in three parts:
|
||||||
Organization page (GET /organization-page):
|
|
||||||
|
|
||||||
mission Mission, Vision & Values: the page's mission blocks
|
mission Mission, Vision & Values: the national organization
|
||||||
leadership its leadership blocks, in order (a People block per
|
record's own description and content blocks (Data →
|
||||||
team: the Board of Trustees, then the Retreat Team),
|
Organizations → NGU), so editors change them with the
|
||||||
then Volunteering: a title, a blurb and its links
|
block editor
|
||||||
|
leadership that record's teams, each with its people (OrgTeams):
|
||||||
|
the Board of Trustees, the Retreat Team, committees
|
||||||
|
and volunteers, in the admin's order
|
||||||
contact NGU's address, nonprofit status and email
|
contact NGU's address, nonprofit status and email
|
||||||
(src/data/organizationDetails.ts)
|
(src/data/organizationDetails.ts), and the record's
|
||||||
|
own contact links (OrgContact)
|
||||||
|
|
||||||
A section with nothing written yet says so (ComingSoon) rather
|
The record is the one organization of kind national, found rather
|
||||||
than showing a heading over nothing.
|
than named, so its URL ID can change.
|
||||||
═══════════════════════════════════════════════════════════════ */
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
||||||
import PageShell from '../components/PageShell.tsx'
|
import PageShell from '../components/PageShell.tsx'
|
||||||
import ComingSoon from '../components/ComingSoon.tsx'
|
import ComingSoon from '../components/ComingSoon.tsx'
|
||||||
import ContentBlocks from '../components/ContentBlocks.tsx'
|
import ContentBlocks from '../components/ContentBlocks.tsx'
|
||||||
import HomeLink from './sections/home/HomeLink.tsx'
|
import OrgTeams, { hasTeams } from '../components/OrgTeams.tsx'
|
||||||
|
import OrgContact from '../components/OrgContact.tsx'
|
||||||
import { sitePage } from '../lib/site.ts'
|
import { sitePage } from '../lib/site.ts'
|
||||||
import { useRecord } from '../lib/useRecord.ts'
|
import { useOrganizations } from '../lib/organizations.ts'
|
||||||
import type { ContentBlock } from '../lib/useContent.ts'
|
import { useOrganization, type OrganizationRecord } from '../lib/useContent.ts'
|
||||||
import { ORGANIZATION_DETAILS } from '../data/organizationDetails.ts'
|
import { ORGANIZATION_DETAILS } from '../data/organizationDetails.ts'
|
||||||
import { ACCENTS, BRAND } from '../lib/color.ts'
|
import { ACCENTS, BRAND } from '../lib/color.ts'
|
||||||
|
|
||||||
/* Title and intro: site.json, which also gives the search metadata. */
|
/* Title and intro: site.json, which also gives the search metadata. */
|
||||||
const PAGE = sitePage('/organization')
|
const PAGE = sitePage('/organization')
|
||||||
|
|
||||||
type OrganizationPage = {
|
|
||||||
mission_title?: string | null
|
|
||||||
mission_blocks: ContentBlock[]
|
|
||||||
leadership_title?: string | null
|
|
||||||
leadership_blurb?: string | null
|
|
||||||
leadership_blocks: ContentBlock[]
|
|
||||||
volunteer: { title?: string | null; blurb?: string | null; links: Array<{ label: string; url: string }> }
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function Organization() {
|
export default function Organization() {
|
||||||
const { data: page, loading, error } = useRecord<OrganizationPage>('/organization-page', 'page')
|
const national = useOrganizations('national')
|
||||||
|
const id = national.organizations[0]?.id
|
||||||
|
const record = useOrganization(id)
|
||||||
|
const org = record.data ?? null
|
||||||
|
const failed = national.error || record.error
|
||||||
|
const loading = !failed && !org && (national.loading || record.loading || Boolean(id))
|
||||||
|
|
||||||
const pending = (what: string) =>
|
const pending = (what: string) =>
|
||||||
error ? (
|
failed ? (
|
||||||
<p className="mx-auto max-w-6xl px-6 text-danger">Couldn’t load {what} right now.</p>
|
<p className="mx-auto max-w-6xl px-6 text-danger">Couldn’t load {what} right now.</p>
|
||||||
) : loading || !page ? (
|
) : loading ? (
|
||||||
<div className="mx-auto max-w-6xl px-6">
|
<div className="mx-auto max-w-6xl px-6">
|
||||||
<div className="skeleton !min-h-40" aria-label={`Loading ${what}`} />
|
<div className="skeleton !min-h-40" aria-label={`Loading ${what}`} />
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -53,78 +54,59 @@ export default function Organization() {
|
||||||
<PageShell
|
<PageShell
|
||||||
title={PAGE.title}
|
title={PAGE.title}
|
||||||
intro={PAGE.description}
|
intro={PAGE.description}
|
||||||
sideNav
|
|
||||||
sections={[
|
sections={[
|
||||||
{
|
{
|
||||||
id: 'mission',
|
id: 'mission',
|
||||||
title: page?.mission_title || 'Mission, Vision & Values',
|
title: 'Mission, Vision & Values',
|
||||||
accent: BRAND,
|
accent: BRAND,
|
||||||
content:
|
content: pending('our mission') ?? <Mission org={org} />,
|
||||||
pending('our mission') ??
|
|
||||||
(page!.mission_blocks.length > 0 ? (
|
|
||||||
<div className="mx-auto max-w-6xl px-6">
|
|
||||||
<div className="max-w-3xl">
|
|
||||||
<ContentBlocks blocks={page!.mission_blocks} accent={BRAND} />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
<ComingSoon what="our mission, vision and values" />
|
|
||||||
)),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'leadership',
|
id: 'leadership',
|
||||||
title: page?.leadership_title || 'Leadership',
|
title: 'Leadership',
|
||||||
blurb: page?.leadership_blurb ?? undefined,
|
blurb: 'Our board, retreat team, committees and volunteers.',
|
||||||
accent: ACCENTS.green,
|
accent: ACCENTS.green,
|
||||||
content: pending('our leadership') ?? <Leadership page={page!} />,
|
content:
|
||||||
|
pending('our leadership') ??
|
||||||
|
(org && hasTeams(org) ? (
|
||||||
|
<div className="mx-auto max-w-6xl px-6">
|
||||||
|
<OrgTeams org={org} accent={ACCENTS.green} />
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<ComingSoon what="our leadership list" />
|
||||||
|
)),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'contact',
|
id: 'contact',
|
||||||
title: 'Details & Contact',
|
title: 'Details & Contact',
|
||||||
accent: ACCENTS.deep,
|
accent: ACCENTS.deep,
|
||||||
content: <Contact />,
|
content: <Contact org={org} />,
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function Leadership({ page }: { page: OrganizationPage }) {
|
function Mission({ org }: { org: OrganizationRecord | null }) {
|
||||||
const { volunteer } = page
|
const paragraphs = org?.description ?? []
|
||||||
const hasVolunteering = Boolean(volunteer.title || volunteer.blurb || volunteer.links.length)
|
const blocks = org?.blocks ?? []
|
||||||
|
if (paragraphs.length === 0 && blocks.length === 0) return <ComingSoon what="our mission, vision and values" />
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mx-auto max-w-6xl space-y-14 px-6">
|
<div className="mx-auto max-w-6xl space-y-6 px-6">
|
||||||
{page.leadership_blocks.length > 0 ? (
|
{paragraphs.map((paragraph, index) => (
|
||||||
<ContentBlocks blocks={page.leadership_blocks} accent={ACCENTS.green} />
|
<p key={index} className="max-w-3xl text-lg leading-relaxed text-body">
|
||||||
) : (
|
{paragraph}
|
||||||
<ComingSoon what="our leadership list" />
|
</p>
|
||||||
)}
|
))}
|
||||||
|
<div className="max-w-3xl">
|
||||||
{hasVolunteering && (
|
<ContentBlocks blocks={blocks} accent={BRAND} />
|
||||||
<div className="max-w-3xl">
|
</div>
|
||||||
<h3 className="text-2xl font-bold text-ink">{volunteer.title || 'Volunteering'}</h3>
|
|
||||||
{volunteer.blurb && <p className="mt-2 leading-relaxed text-body">{volunteer.blurb}</p>}
|
|
||||||
{volunteer.links.length > 0 && (
|
|
||||||
<div className="mt-5 flex flex-wrap gap-3">
|
|
||||||
{volunteer.links.map((link) => (
|
|
||||||
<HomeLink
|
|
||||||
key={`${link.url}-${link.label}`}
|
|
||||||
url={link.url}
|
|
||||||
className="btn inline-block bg-action px-5 py-2.5 text-white transition-colors hover:bg-action-hover"
|
|
||||||
>
|
|
||||||
{link.label}
|
|
||||||
</HomeLink>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function Contact() {
|
function Contact({ org }: { org: OrganizationRecord | null }) {
|
||||||
const details = ORGANIZATION_DETAILS
|
const details = ORGANIZATION_DETAILS
|
||||||
return (
|
return (
|
||||||
<div className="mx-auto grid max-w-6xl gap-8 px-6 md:grid-cols-2">
|
<div className="mx-auto grid max-w-6xl gap-8 px-6 md:grid-cols-2">
|
||||||
|
|
@ -140,13 +122,14 @@ function Contact() {
|
||||||
{details.nonprofit} Tax ID: {details.taxId}.
|
{details.nonprofit} Tax ID: {details.taxId}.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div className="space-y-4">
|
||||||
<a
|
<a
|
||||||
href={`mailto:${details.email}`}
|
href={`mailto:${details.email}`}
|
||||||
className="btn inline-block border border-link px-6 py-2.5 text-link transition-colors hover:bg-tint"
|
className="btn inline-block border border-link px-6 py-2.5 text-link transition-colors hover:bg-tint"
|
||||||
>
|
>
|
||||||
{details.email}
|
{details.email}
|
||||||
</a>
|
</a>
|
||||||
|
{org && <OrgContact org={org} accent={ACCENTS.deep} />}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,6 @@ const SECTIONS = [
|
||||||
export default function ResourcesPage() {
|
export default function ResourcesPage() {
|
||||||
return (
|
return (
|
||||||
<PageShell
|
<PageShell
|
||||||
sideNav
|
|
||||||
title={PAGE.title}
|
title={PAGE.title}
|
||||||
intro={PAGE.description}
|
intro={PAGE.description}
|
||||||
sections={SECTIONS}
|
sections={SECTIONS}
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,6 @@ export default function RetreatsPage() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageShell
|
<PageShell
|
||||||
sideNav
|
|
||||||
title={PAGE.title}
|
title={PAGE.title}
|
||||||
intro={PAGE.description}
|
intro={PAGE.description}
|
||||||
sections={sections}
|
sections={sections}
|
||||||
|
|
|
||||||
|
|
@ -105,11 +105,6 @@ export const PAGES_NAV = {
|
||||||
label: "Community blog section",
|
label: "Community blog section",
|
||||||
blurb: "The Community page's blog: headings, pinned posts and feeds.",
|
blurb: "The Community page's blog: headings, pinned posts and feeds.",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
to: "/admin/organization_page",
|
|
||||||
label: "Organization page",
|
|
||||||
blurb: "Mission, vision and values, the leadership teams in order, and volunteering.",
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,7 @@
|
||||||
import { CaretDown } from '@phosphor-icons/react';
|
import { CaretDown } from '@phosphor-icons/react';
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { post, ApiError } from "../../lib/api.ts";
|
import { post, ApiError } from "../../lib/api.ts";
|
||||||
import { PAGE_LINKS } from "../../navConfig.ts";
|
import { PAGE_LINKS, PAGE_SECTIONS } from "../../navConfig.ts";
|
||||||
import { useNavSections, type NavSection } from "../../lib/navSections.ts";
|
|
||||||
import { DATA_REQUEST, FEEDBACK_TYPES } from "../../data/feedbackTypes.ts";
|
import { DATA_REQUEST, FEEDBACK_TYPES } from "../../data/feedbackTypes.ts";
|
||||||
import { accentText, BRAND } from '../../lib/color.ts'
|
import { accentText, BRAND } from '../../lib/color.ts'
|
||||||
|
|
||||||
|
|
@ -176,8 +175,7 @@ export function TilePicker({
|
||||||
/* ── Where on the site ───────────────────────────────────────── */
|
/* ── Where on the site ───────────────────────────────────────── */
|
||||||
|
|
||||||
function LocationPicker({ page, section, onPageChange, onSectionChange }) {
|
function LocationPicker({ page, section, onPageChange, onSectionChange }) {
|
||||||
const sectionsOf = useNavSections();
|
const sections = page === SITE_WIDE ? [] : PAGE_SECTIONS[page] ?? [];
|
||||||
const sections = page === SITE_WIDE ? [] : sectionsOf(page);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
|
@ -230,10 +228,10 @@ function LocationPicker({ page, section, onPageChange, onSectionChange }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Human-readable version of the picked location, for the thank-you panel.
|
// Human-readable version of the picked location, for the thank-you panel.
|
||||||
function describeLocation(page, section, sectionsOf: (path: string) => NavSection[]) {
|
function describeLocation(page, section) {
|
||||||
if (page === SITE_WIDE) return null;
|
if (page === SITE_WIDE) return null;
|
||||||
const pageLabel = PAGE_LINKS.find((p) => p.path === page)?.label ?? page;
|
const pageLabel = PAGE_LINKS.find((p) => p.path === page)?.label ?? page;
|
||||||
const sectionLabel = sectionsOf(page).find(
|
const sectionLabel = (PAGE_SECTIONS[page] ?? []).find(
|
||||||
(s) => s.hash === section,
|
(s) => s.hash === section,
|
||||||
)?.label;
|
)?.label;
|
||||||
return sectionLabel ? `${pageLabel} → ${sectionLabel}` : pageLabel;
|
return sectionLabel ? `${pageLabel} → ${sectionLabel}` : pageLabel;
|
||||||
|
|
@ -242,7 +240,6 @@ function describeLocation(page, section, sectionsOf: (path: string) => NavSectio
|
||||||
/* ── The form ────────────────────────────────────────────────── */
|
/* ── The form ────────────────────────────────────────────────── */
|
||||||
|
|
||||||
export default function FeedbackForm({ fixedType }: { fixedType?: string } = {}) {
|
export default function FeedbackForm({ fixedType }: { fixedType?: string } = {}) {
|
||||||
const sectionsOf = useNavSections();
|
|
||||||
const request = fixedType === DATA_REQUEST.id;
|
const request = fixedType === DATA_REQUEST.id;
|
||||||
const [type, setType] = useState<any>(fixedType ?? null);
|
const [type, setType] = useState<any>(fixedType ?? null);
|
||||||
const [page, setPage] = useState(SITE_WIDE);
|
const [page, setPage] = useState(SITE_WIDE);
|
||||||
|
|
@ -312,7 +309,7 @@ export default function FeedbackForm({ fixedType }: { fixedType?: string } = {})
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status === "sent") {
|
if (status === "sent") {
|
||||||
const where = describeLocation(page, section, sectionsOf);
|
const where = describeLocation(page, section);
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
aria-live="polite"
|
aria-live="polite"
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,7 @@
|
||||||
import { useEffect, useMemo, useRef, useState, type ReactNode } from 'react'
|
import { useEffect, useMemo, useRef, useState, type ReactNode } from 'react'
|
||||||
|
|
||||||
import QrCode, { QR_DOVE, QR_INK, QR_PAPER, type QrCenter } from '../../components/QrCode.tsx'
|
import QrCode, { QR_DOVE, QR_INK, QR_PAPER, type QrCenter } from '../../components/QrCode.tsx'
|
||||||
import { NAV_ACTIONS, PAGE_LINKS } from '../../navConfig.ts'
|
import { NAV_ACTIONS, PAGE_LINKS, PAGE_SECTIONS } from '../../navConfig.ts'
|
||||||
import { useNavSections } from '../../lib/navSections.ts'
|
|
||||||
import { awardHref, blogHref, eventHref, orgHref, personHref, teamHref } from '../../lib/hrefs.ts'
|
import { awardHref, blogHref, eventHref, orgHref, personHref, teamHref } from '../../lib/hrefs.ts'
|
||||||
import { siteUrl } from '../../lib/site.ts'
|
import { siteUrl } from '../../lib/site.ts'
|
||||||
import { useDirectory, type Directory } from '../../lib/useContent.ts'
|
import { useDirectory, type Directory } from '../../lib/useContent.ts'
|
||||||
|
|
@ -253,7 +252,6 @@ function downloadPng(svg: SVGSVGElement, stem: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function QrCodeMaker() {
|
export default function QrCodeMaker() {
|
||||||
const sectionsOf = useNavSections();
|
|
||||||
const { data: directory, loading, error } = useDirectory()
|
const { data: directory, loading, error } = useDirectory()
|
||||||
|
|
||||||
const [kind, setKind] = useState<Kind>('pages')
|
const [kind, setKind] = useState<Kind>('pages')
|
||||||
|
|
@ -279,7 +277,7 @@ export default function QrCodeMaker() {
|
||||||
}
|
}
|
||||||
}, [choices, path])
|
}, [choices, path])
|
||||||
|
|
||||||
const sections = kind === 'pages' ? sectionsOf(path) : []
|
const sections = kind === 'pages' ? (PAGE_SECTIONS[path] ?? []) : []
|
||||||
const selected = choices.find((c) => c.path === path) ?? null
|
const selected = choices.find((c) => c.path === path) ?? null
|
||||||
const typed = kind === 'custom' ? typedUrl(custom) : null
|
const typed = kind === 'custom' ? typedUrl(custom) : null
|
||||||
const target = kind === 'custom' ? typed : selected ? `${selected.path}${section}` : null
|
const target = kind === 'custom' ? typed : selected ? `${selected.path}${section}` : null
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
are cells of the same block.
|
are cells of the same block.
|
||||||
═══════════════════════════════════════════════════════════════ */
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
||||||
import { ArrowRight, ArrowUpRight, BookOpen, Dot, CalendarBlank, ChatCircle, Compass, GraduationCap, HandHeart, Heart, House, MapPin, MusicNotes, Sparkle, Star, Tent, UsersThree, type Icon } from '@phosphor-icons/react'
|
import { ArrowRight, ArrowUpRight, BookOpen, CalendarBlank, ChatCircle, Compass, GraduationCap, HandHeart, Heart, House, MapPin, MusicNotes, Sparkle, Star, Tent, UsersThree, type Icon } from '@phosphor-icons/react'
|
||||||
import { useId, useRef, useState, type CSSProperties, type KeyboardEvent } from 'react'
|
import { useId, useRef, useState, type CSSProperties, type KeyboardEvent } from 'react'
|
||||||
|
|
||||||
import HomeLink, { isExternal } from './HomeLink.tsx'
|
import HomeLink, { isExternal } from './HomeLink.tsx'
|
||||||
|
|
@ -38,7 +38,8 @@ type PathfinderProps = {
|
||||||
/* One accent per position, cycling. Paths are data; color is
|
/* One accent per position, cycling. Paths are data; color is
|
||||||
presentation, so it's assigned here rather than stored. */
|
presentation, so it's assigned here rather than stored. */
|
||||||
/* A path's icon: a key from src/data/pathIcons.ts, drawn from
|
/* A path's icon: a key from src/data/pathIcons.ts, drawn from
|
||||||
Phosphor. Nothing set (or a key no longer on the list) is a dot. */
|
Phosphor. A path saved before the list existed may hold an emoji;
|
||||||
|
that shows as it is. Nothing set is a dot. */
|
||||||
const ICONS: Record<string, Icon> = {
|
const ICONS: Record<string, Icon> = {
|
||||||
heart: Heart,
|
heart: Heart,
|
||||||
hands: HandHeart,
|
hands: HandHeart,
|
||||||
|
|
@ -59,7 +60,7 @@ const ICONS: Record<string, Icon> = {
|
||||||
function PathIcon({ value }: { value?: string | null }) {
|
function PathIcon({ value }: { value?: string | null }) {
|
||||||
const Glyph = value ? ICONS[value] : null
|
const Glyph = value ? ICONS[value] : null
|
||||||
if (Glyph) return <Glyph size={26} weight="bold" />
|
if (Glyph) return <Glyph size={26} weight="bold" />
|
||||||
return <Dot size={26} weight="bold" />
|
return <>{value || '•'}</>
|
||||||
}
|
}
|
||||||
|
|
||||||
// The site's accent family, in turn (color.ts).
|
// The site's accent family, in turn (color.ts).
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue