pco-plan: note categories as switches, top-bar variables as chips, no text-size field
Item notes get their own gear group, after Colors, with the existing
showNotes switch as the group's on/off in its title row. Its categories
come from Planning Center (GET /note-categories → the service type's
item_note_categories, by name, cached 10 min, an empty list rather than
an error when unconfigured or unreachable) and render as switches, three
across, all on until someone flips one; the tile reads an unset value as
every category, an array as exactly those, and a layout's old
comma-separated string as that list (blank = all).
The top bar template is a `template` field: one chip per placeholder
({series} {part} {serviceType} {date} {shortDate} {time} {length}
{items}) to drag or click into the text, with the help down to the
joining rules. Rendering is unchanged.
Text size leaves the gear window: the title bar's A− / A+ already size
the text and save it with the tile; the client falls back to 14 px when
nothing is saved.
tools/pco-mock.js serves item_note_categories (the categories its notes
use plus "Stage", which none does yet) so the route can be exercised.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
7a44b25d4b
commit
0c4828eb26
@@ -11,6 +11,10 @@
|
||||
* GET /services/v2/service_types every service type, with its
|
||||
* parent folder relationship
|
||||
* GET /services/v2/service_types/{id}
|
||||
* GET /services/v2/service_types/{id}/item_note_categories
|
||||
* the note categories the
|
||||
* items below use, plus one
|
||||
* ("Stage") no note uses yet
|
||||
* GET /services/v2/service_types/{id}/plans ?filter=future|past, order,
|
||||
* per_page — today's plan,
|
||||
* next week's and last week's
|
||||
@@ -129,6 +133,22 @@ const ITEMS = [
|
||||
{ id: 'i13', type: 'media', title: 'Walk-out Loop', pos: 'post', length: 600, notes: [['Video', 'Announcements loop until the room clears']] },
|
||||
];
|
||||
|
||||
/**
|
||||
* Item note categories, per service type in Planning Center: every category
|
||||
* the items above use, in the order the mock account lists them, plus one no
|
||||
* note uses yet — a tile that has never chosen shows it on as well.
|
||||
*/
|
||||
const NOTE_CATEGORIES = ['Audio', 'Video', 'Lighting', 'ProPresenter', 'Stage'];
|
||||
|
||||
function noteCategoryRecord(name, index, stId) {
|
||||
return {
|
||||
type: 'ItemNoteCategory',
|
||||
id: `${stId}-nc${index + 1}`,
|
||||
attributes: { name, sequence: index + 1, frequently_used: index < 2, deleted_at: null },
|
||||
relationships: { service_type: { data: { type: 'ServiceType', id: stId } } },
|
||||
};
|
||||
}
|
||||
|
||||
function itemsDocument(planId, include) {
|
||||
const wants = new Set(String(include || '').split(',').map((s) => s.trim()).filter(Boolean));
|
||||
const data = [];
|
||||
@@ -246,6 +266,9 @@ const server = http.createServer((req, res) => {
|
||||
const st = SERVICE_TYPES.find((x) => x.id === parts[1]);
|
||||
if (!st) return notFound(res);
|
||||
if (parts.length === 2) return send(res, 200, { data: serviceTypeRecord(st) });
|
||||
if (parts[2] === 'item_note_categories' && parts.length === 3) {
|
||||
return collection(res, NOTE_CATEGORIES.map((name, i) => noteCategoryRecord(name, i, st.id)), url);
|
||||
}
|
||||
if (parts[2] !== 'plans') return notFound(res);
|
||||
const plans = plansFor(st.id);
|
||||
if (parts.length === 3) {
|
||||
|
||||
Reference in New Issue
Block a user