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: "Color", widget: "color" }, { path: "logo", label: "Logo", widget: "image", folder: "logos", 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, ], };