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:
Waters Church
2026-09-14 15:35:47 -04:00
co-authored by Claude Fable 5.1
parent 7a44b25d4b
commit 0c4828eb26
4 changed files with 123 additions and 13 deletions
+15 -4
View File
@@ -4,7 +4,9 @@
ProPresenter module's live item; this tile only renders the plan it is
streamed. What is shown is this tile's own choice (gear menu →
moduleApi.instanceSettings: show/hide checklist, top-bar template,
colors, text size); /admin only holds the connection settings. */
colors, item-note categories); the text size is the title bar's A− / A+
(saved with the tile, 14 px until someone presses one); /admin only holds
the connection settings. */
const REFRESH_SVG = '<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12a9 9 0 1 1-2.64-6.36"/><path d="M21 3v6h-6"/></svg>';
@@ -121,10 +123,19 @@ export default function create({ root, moduleApi }) {
});
}
/**
* Which note categories this tile shows. Unset (never chosen in the gear
* window) means every category, including ones Planning Center gains
* later; an array is exactly those, by name. A layout saved before the
* categories were a list holds a comma-separated string — read as that
* list, blank as unset.
*/
function noteFilter() {
const raw = String(cfg().noteCategories || '');
const wanted = raw.split(',').map((s) => s.trim().toLowerCase()).filter(Boolean);
return wanted.length ? (note) => wanted.includes(String(note.category || '').toLowerCase()) : () => true;
const raw = cfg().noteCategories;
const names = Array.isArray(raw) ? raw : String(raw ?? '').split(',');
const wanted = new Set(names.map((s) => String(s).trim().toLowerCase()).filter(Boolean));
if (!Array.isArray(raw) && !wanted.size) return () => true;
return (note) => wanted.has(String(note.category || '').trim().toLowerCase());
}
/* ── status dot ─────────────────────────────────────────────────── */