import { mediaUrl } from "../media.ts"; import { PUBLISHED_FIELD, LISTED_FIELD, AFFILIATION_ROLE_FIELDS, linksChild, blocksChild } from "./shared.ts"; /* ── People ──────────────────────────────────────────────────── */ export const people = { key: "people", label: "People", singular: "person", idLabel: "URL ID", slugFrom: "display_name", list: { columns: [ { key: "display_name", label: "Name", primary: true }, { key: "tagline", label: "Tagline" }, { key: "locality", label: "City" }, { key: "is_published", label: "Live", widget: "bool" }, { key: "is_listed", label: "Listed", widget: "bool" }, ], filters: [ { key: "is_published", label: "Published", options: [["1", "Live"], ["0", "Hidden"]] }, { key: "is_listed", label: "Listed", options: [["1", "Listed"], ["0", "Link only"]] }, ], }, groups: [ { legend: "Identity", fields: [ { path: "display_name", label: "Display name", required: true }, { path: "sort_name", label: "Sort name", help: "Doe, Jane" }, { path: "pronouns", label: "Pronouns" }, { path: "tagline", label: "Tagline", full: true }, { path: "specialty", label: "Specialty", full: true, help: "One line shown in directories, eg. Vocals, piano · Gospel, folk", }, { path: "photo", label: "Photo", widget: "image", crop: 1, resolve: mediaUrl, full: true }, { path: "primary_org_id", label: "Home organization", widget: "select", optionsFrom: "organizations", blankLabel: "Default: none", help: "Optional. Shown above their bio", }, { path: "bio", label: "Bio", widget: "textarea", full: true, help: "Leave a blank line between paragraphs", }, ], }, { legend: "Public contact", fields: [ { path: "public_email", label: "Email", help: "Printed on the site" }, { path: "public_phone", label: "Phone" }, { path: "locality", label: "City" }, { path: "state_code", label: "State" }, { path: "country", label: "Country" }, { path: "location_label", label: "Display location" }, ], }, { legend: "Private", note: "Never sent to the public site. Only admins see this.", fields: [ { path: "private.birth_date", label: "Birth date", widget: "date" }, { path: "private.private_email", label: "Email" }, { path: "private.private_phone", label: "Phone" }, { path: "private.address", label: "Address", full: true }, { path: "private.notes", label: "Notes", widget: "textarea", full: true }, ], }, { legend: "Publishing", note: "Unpublished people are invisible everywhere.", fields: [PUBLISHED_FIELD, LISTED_FIELD], }, { legend: "Hidden on the site", note: "Ticked parts stay here but don't show anywhere on the site. Someone with a profile account who has claimed this person sets these on their profile too (Data → Profile accounts).", fields: [ ["photo", "Photo"], ["pronouns", "Pronouns"], ["tagline", "Tagline"], ["bio", "Bio"], ["email", "Public email"], ["phone", "Public phone"], ["location", "Location"], ["links", "Links"], ].map(([key, label]) => ({ path: `hide_${key}`, label: `Hide ${label.toLowerCase()}`, widget: "checkbox" })), }, ], children: [ { key: "tags", label: "Directories", note: "Tags that list this person in a directory, eg. Musicians. Tags are made under Data → People tags.", addLabel: "Add tag", title: (row, options) => options?.person_tag_types?.find((t) => t.id === row.tag_id)?.label ?? "New tag", blank: { tag_id: "" }, fields: [ { path: "tag_id", label: "Tag", widget: "select", optionsFrom: "person_tag_types", required: true, }, ], }, { key: "affiliations", label: "Roles and organizations", addLabel: "Add role", note: "Where someone appears within a team is set on that team's page, " + "not by the order of this list.", title: (row, options) => [row.title, options?.organizations?.find((o) => o.id === row.org_id)?.label] .filter(Boolean) .join(" · ") || "New role", blank: { org_id: "", role: "member", is_public: 1, is_owner: 0 }, fields: [ { path: "org_id", label: "Organization", widget: "select", optionsFrom: "organizations", required: true, }, { path: "team_id", label: "Team", widget: "select", optionsFrom: "teams", blankLabel: "Default: none", // A team belongs to an org; offering one from another // org would fail the composite foreign key on save. filterBy: (option, row) => option.org_id === row.org_id, help: "Only teams of the chosen organization", }, ...AFFILIATION_ROLE_FIELDS, ], }, { key: "person_awards", label: "Awards", addLabel: "Add award", title: (row, options) => options?.awards?.find((a) => a.id === row.award_id)?.label ?? "New award", blank: { award_id: "", is_public: 1 }, fields: [ { path: "award_id", label: "Award", widget: "select", optionsFrom: "awards", required: true, help: "Labelled with the organization that gives it", }, { path: "event_id", label: "Presented at", widget: "select", optionsFrom: "events", blankLabel: "Default: none", }, { path: "awarded_on", label: "Date", widget: "date" }, { path: "citation", label: "Citation", widget: "textarea", full: true }, { path: "is_public", label: "Public", widget: "checkbox" }, ], }, linksChild, blocksChild, ], };