Finish the audit leftovers
- One mediaUrl in media.ts instead of 12 identical aliases and a kind map; orgPath builds on hrefs.ts's orgHref - One Logo component (hides itself or shows a fallback when the file is missing) for event cards, org lists and chapter marks - useHistory is a thin wrapper over useRecord - adminSchema.ts split into adminSchema/, one file per entity plus shared.ts; the registry is unchanged (checked by loading both) - JS smooth scrolls respect reduced motion (lib/motion.ts) - Content-Security-Policy in Report-Only, with /api/csp-report logging what it would block Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
c74ad746f5
commit
e4a9c96f7e
42 changed files with 1968 additions and 2043 deletions
83
src/lib/adminSchema/teams.ts
Normal file
83
src/lib/adminSchema/teams.ts
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
import { mediaUrl } from "../media.ts";
|
||||
import { PUBLISH_FIELDS, AFFILIATION_ROLE_FIELDS, linksChild, blocksChild } from "./shared.ts";
|
||||
|
||||
/* ── Teams ───────────────────────────────────────────────────── */
|
||||
|
||||
export const teams = {
|
||||
key: "teams",
|
||||
label: "Teams",
|
||||
singular: "team",
|
||||
idLabel: "URL ID",
|
||||
// teams.id is a global primary key, not scoped to the org, so
|
||||
// 'board' can only exist once across the whole site. Composing
|
||||
// the slug from both fields is what keeps NGU's board and the
|
||||
// Northwest's board from colliding.
|
||||
slugFrom: ["org_id", "name"],
|
||||
|
||||
list: {
|
||||
columns: [
|
||||
{ key: "name", label: "Name", primary: true },
|
||||
{ key: "org_id", label: "Organization" },
|
||||
{ key: "tagline", label: "Tagline" },
|
||||
{ key: "is_published", label: "Live", widget: "bool" },
|
||||
{ key: "is_listed", label: "Listed", widget: "bool" },
|
||||
],
|
||||
filters: [
|
||||
{ key: "org_id", label: "Organization", optionsFrom: "organizations" },
|
||||
{ key: "is_published", label: "Published", options: [["1", "Live"], ["0", "Hidden"]] },
|
||||
{ key: "is_listed", label: "Listed", options: [["1", "Listed"], ["0", "Link only"]] },
|
||||
],
|
||||
},
|
||||
|
||||
groups: [
|
||||
{
|
||||
legend: "Identity",
|
||||
note:
|
||||
"Pick the organization first: the id is built from it, " +
|
||||
"and it can't be changed once anyone is filed under this team.",
|
||||
fields: [
|
||||
{
|
||||
path: "org_id",
|
||||
label: "Organization",
|
||||
widget: "select",
|
||||
optionsFrom: "organizations",
|
||||
required: true,
|
||||
help: "Who this team belongs to",
|
||||
},
|
||||
{ path: "name", label: "Name", required: true, help: "Board, Leadership Team" },
|
||||
{ path: "tagline", label: "Tagline", full: true },
|
||||
{ path: "color", label: "Colour", widget: "color" },
|
||||
{ path: "logo", label: "Logo", widget: "image", resolve: mediaUrl, full: true },
|
||||
],
|
||||
},
|
||||
{ legend: "Publishing", fields: PUBLISH_FIELDS },
|
||||
],
|
||||
|
||||
children: [
|
||||
{
|
||||
key: "members",
|
||||
label: "Members",
|
||||
addLabel: "Add member",
|
||||
note:
|
||||
"This order is the order they appear on the site. Owners are " +
|
||||
"still listed first, in this order among themselves.",
|
||||
title: (row, options) =>
|
||||
[options?.people?.find((p) => p.id === row.person_id)?.label, row.title]
|
||||
.filter(Boolean)
|
||||
.join(" · ") || "New member",
|
||||
blank: { person_id: "", role: "member", is_public: 1, is_owner: 0 },
|
||||
fields: [
|
||||
{
|
||||
path: "person_id",
|
||||
label: "Person",
|
||||
widget: "select",
|
||||
optionsFrom: "people",
|
||||
required: true,
|
||||
},
|
||||
...AFFILIATION_ROLE_FIELDS,
|
||||
],
|
||||
},
|
||||
linksChild,
|
||||
blocksChild,
|
||||
],
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue