Page updates: v1.10.3 to v1.10.6 #20
14 changed files with 308 additions and 127 deletions
|
|
@ -38,16 +38,6 @@ 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
|
||||
|
|
|
|||
10
index.html
10
index.html
|
|
@ -13,16 +13,6 @@
|
|||
and the accessibility choices, for the same reason. -->
|
||||
<script>
|
||||
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");
|
||||
document.documentElement.dataset.theme =
|
||||
t === "dark" || t === "light" ? t : matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ import { timeline } from "./admin-schema/timeline.js";
|
|||
import { frontPage } from "./admin-schema/frontPage.js";
|
||||
import { blogPosts, communityPage } from "./admin-schema/blog.js";
|
||||
import { siteSettings } from "./admin-schema/siteSettings.js";
|
||||
import { organizationPage } from "./admin-schema/organizationPage.js";
|
||||
|
||||
export const ENTITIES = {
|
||||
organizations,
|
||||
|
|
@ -62,6 +63,7 @@ export const ENTITIES = {
|
|||
front_page: frontPage,
|
||||
blog_posts: blogPosts,
|
||||
community_page: communityPage,
|
||||
organization_page: organizationPage,
|
||||
site_settings: siteSettings,
|
||||
};
|
||||
|
||||
|
|
|
|||
43
server/src/admin-schema/organizationPage.js
Normal file
43
server/src/admin-schema/organizationPage.js
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
/* 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,6 +26,7 @@ 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 organizationPage from "./routes/organizationPage.js";
|
||||
import pages from "./routes/pages.js";
|
||||
import feedback from "./routes/feedback.js";
|
||||
import requests from "./routes/requests.js";
|
||||
|
|
@ -38,7 +39,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, sortIntoFolders, writeMissingThumbs } from "./media.js";
|
||||
import { UPLOADS_DIR, writeMissingThumbs } from "./media.js";
|
||||
import { logSafe, startSessionSweeper } from "./auth.js";
|
||||
import { syncDescriptorsWithSchema } from "./admin-schema-sync.js";
|
||||
import { startGroupSync } from "./accessGroups.js";
|
||||
|
|
@ -57,9 +58,6 @@ 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`))
|
||||
|
|
@ -172,6 +170,7 @@ app.route("/api", history);
|
|||
app.route("/api", home);
|
||||
app.route("/api", directory);
|
||||
app.route("/api", blog);
|
||||
app.route("/api", organizationPage);
|
||||
|
||||
// Tighter limit on the write path than anything else gets.
|
||||
app.use("/api/feedback", rateLimit({ windowMs: 60_000, max: 5 }));
|
||||
|
|
|
|||
|
|
@ -36,8 +36,7 @@
|
|||
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
|
||||
and files from before folders keep a bare name in the root.
|
||||
sortIntoFolders() moves those older images once, at boot.
|
||||
keep a bare name in the root.
|
||||
|
||||
── Files copied in by hand ──
|
||||
A file put straight into UPLOADS_DIR has no media row, so the
|
||||
|
|
@ -51,7 +50,6 @@
|
|||
|
||||
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";
|
||||
|
||||
|
|
@ -373,83 +371,4 @@ 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
134
server/src/migrations/055_organization_page.sql
Normal file
134
server/src/migrations/055_organization_page.sql
Normal file
|
|
@ -0,0 +1,134 @@
|
|||
-- ═══════════════════════════════════════════════════════════════
|
||||
-- 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;
|
||||
43
server/src/routes/organizationPage.js
Normal file
43
server/src/routes/organizationPage.js
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
/* ═══════════════════════════════════════════════════════════════
|
||||
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,9 +21,6 @@
|
|||
the app's own not-found page with a 404 status, so search engines
|
||||
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),
|
||||
the page is still served, as built, and the cause is logged once:
|
||||
a preview is never worth a page that won't load.
|
||||
|
|
@ -92,23 +89,12 @@ pages.get("/sitemap.xml", (c) => {
|
|||
});
|
||||
});
|
||||
|
||||
/* Pages that have moved: old path → new, query string kept. */
|
||||
const MOVED = {
|
||||
"/leadership": "/organization",
|
||||
};
|
||||
|
||||
pages.get("*", (c, next) => {
|
||||
const pathname = c.req.path;
|
||||
// The API's own paths, and an upload that isn't there, stay plain
|
||||
// 404s rather than becoming a page.
|
||||
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;
|
||||
try {
|
||||
html = indexHtml();
|
||||
|
|
|
|||
|
|
@ -5,9 +5,7 @@
|
|||
Connect Nav → Icon), as [key, label]. The admin's dropdown lists
|
||||
the labels; Pathfinder.tsx draws the Phosphor icon for each key.
|
||||
Adding one is a line here and one in ICONS in Pathfinder.tsx.
|
||||
|
||||
A path saved before this list existed may hold an emoji instead
|
||||
of a key; Pathfinder shows that as it is.
|
||||
A path with none set shows a dot.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
export const PATH_ICONS: [string, string][] = [
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import { timeline } from "./adminSchema/timeline.ts";
|
|||
import { frontPage } from "./adminSchema/frontPage.ts";
|
||||
import { blogPosts, communityPage } from "./adminSchema/blog.ts";
|
||||
import { siteSettings } from "./adminSchema/siteSettings.ts";
|
||||
import { organizationPage } from "./adminSchema/organizationPage.ts";
|
||||
|
||||
export const ADMIN_ENTITIES: Record<string, any> = {
|
||||
organizations,
|
||||
|
|
@ -38,6 +39,7 @@ export const ADMIN_ENTITIES: Record<string, any> = {
|
|||
front_page: frontPage,
|
||||
blog_posts: blogPosts,
|
||||
community_page: communityPage,
|
||||
organization_page: organizationPage,
|
||||
site_settings: siteSettings,
|
||||
};
|
||||
|
||||
|
|
|
|||
71
src/lib/adminSchema/organizationPage.ts
Normal file
71
src/lib/adminSchema/organizationPage.ts
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
/* 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" },
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
|
@ -105,6 +105,11 @@ export const PAGES_NAV = {
|
|||
label: "Community blog section",
|
||||
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.",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
are cells of the same block.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
import { ArrowRight, ArrowUpRight, BookOpen, CalendarBlank, ChatCircle, Compass, GraduationCap, HandHeart, Heart, House, MapPin, MusicNotes, Sparkle, Star, Tent, UsersThree, type Icon } from '@phosphor-icons/react'
|
||||
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 { useId, useRef, useState, type CSSProperties, type KeyboardEvent } from 'react'
|
||||
|
||||
import HomeLink, { isExternal } from './HomeLink.tsx'
|
||||
|
|
@ -38,8 +38,7 @@ type PathfinderProps = {
|
|||
/* One accent per position, cycling. Paths are data; color is
|
||||
presentation, so it's assigned here rather than stored. */
|
||||
/* A path's icon: a key from src/data/pathIcons.ts, drawn from
|
||||
Phosphor. A path saved before the list existed may hold an emoji;
|
||||
that shows as it is. Nothing set is a dot. */
|
||||
Phosphor. Nothing set (or a key no longer on the list) is a dot. */
|
||||
const ICONS: Record<string, Icon> = {
|
||||
heart: Heart,
|
||||
hands: HandHeart,
|
||||
|
|
@ -60,7 +59,7 @@ const ICONS: Record<string, Icon> = {
|
|||
function PathIcon({ value }: { value?: string | null }) {
|
||||
const Glyph = value ? ICONS[value] : null
|
||||
if (Glyph) return <Glyph size={26} weight="bold" />
|
||||
return <>{value || '•'}</>
|
||||
return <Dot size={26} weight="bold" />
|
||||
}
|
||||
|
||||
// The site's accent family, in turn (color.ts).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue