create-pmos 0.414.0 → 0.416.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +25 -25
- package/payload/KIT-VERSION +2 -2
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/payload/state/log.md +1 -1
- package/workspace/bin/pmos.js +1 -1
- package/workspace/briefing-premium-adddoc-test.js +3 -3
- package/workspace/briefing-premium-board-test.js +72 -43
- package/workspace/briefing-premium-doc-edit-test.js +2 -2
- package/workspace/briefing-premium-initiative-test.js +19 -22
- package/workspace/briefing-premium-insights-test.js +28 -17
- package/workspace/changelog.json +24 -0
- package/workspace/core-docs-workflow-test.js +1 -1
- package/workspace/guide/workflows.md +6 -2
- package/workspace/ini-workflow-test.js +11 -11
- package/workspace/lib/board-premium.js +13 -0
- package/workspace/lib/board-trail.js +6 -1
- package/workspace/lib/engine/boards.js +12 -4
- package/workspace/lib/goal-chat.js +46 -15
- package/workspace/lib/initiative-chat.js +7 -5
- package/workspace/lib/initiative-premium.js +4 -2
- package/workspace/lib/insights-premium.js +9 -1
- package/workspace/lib/item-cli.js +2 -1
- package/workspace/lib/pmos-verbs.js +1 -1
- package/workspace/lib/route-modules.js +1 -0
- package/workspace/lib/routes-boards.js +149 -18
- package/workspace/lib/routes-briefing-premium.js +14 -1
- package/workspace/lib/routes-live.js +53 -0
- package/workspace/lib/task-cli.js +137 -25
- package/workspace/lib/task-items.js +88 -0
- package/workspace/lib/workflow-cli.js +1 -1
- package/workspace/milestone-suggest-test.js +2 -1
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-board-actions-test.js +3 -3
- package/workspace/premium-chat-report-tab-test.js +13 -5
- package/workspace/premium-core-doc-issue-test.js +1 -1
- package/workspace/premium-report-read-test.js +66 -51
- package/workspace/premium-vw-backlog-test.js +3 -3
- package/workspace/premium-vw-doc-test.js +3 -3
- package/workspace/premium-vw-item-test.js +4 -4
- package/workspace/premium-vw-jira-test.js +14 -13
- package/workspace/premium-vw-slides-test.js +7 -5
- package/workspace/program-panel-test.js +1 -1
- package/workspace/public/pm/bd-ini-panel.js +68 -210
- package/workspace/public/pm/cozy-insights.css +15 -0
- package/workspace/public/pm/cozy-live-pill.css +48 -0
- package/workspace/public/pm/cozy-live-pill.js +141 -0
- package/workspace/public/pm/cozy-viewer.js +4 -3
- package/workspace/public/pm/cozy-vw-rp.css +48 -0
- package/workspace/public/pm/home-app.js +45 -8
- package/workspace/public/pm/home-chat.js +5 -2
- package/workspace/public/pm/home-ini.js +57 -22
- package/workspace/public/pm/home-stage-card.js +3 -2
- package/workspace/public/pm/home-task.js +16 -5
- package/workspace/public/pm/ini-view-model.js +277 -0
- package/workspace/public/pm/ini-view.css +122 -0
- package/workspace/public/pm/ini-view.js +180 -0
- package/workspace/public/pm/live-model.js +104 -0
- package/workspace/public/pm/ov-view.css +44 -0
- package/workspace/public/pm/premium-board.js +23 -15
- package/workspace/public/pm/premium-initiative-head.js +12 -2
- package/workspace/public/pm/premium-insights.js +61 -35
- package/workspace/public/pm/premium-report-read.js +74 -50
- package/workspace/public/pm/premium-report-tab.js +36 -15
- package/workspace/public/pm/premium-shell.js +1 -1
- package/workspace/public/pm/premium-vw-item-model.js +6 -3
- package/workspace/public/pm/premium-vw-item.js +25 -6
- package/workspace/public/pm/premium-vw-jira.js +17 -15
- package/workspace/public/pm/rp-parts.js +75 -12
- package/workspace/public/pm/task-card.css +24 -49
- package/workspace/public/pm/task-card.js +90 -64
- package/workspace/public/pm/tk-view.css +21 -0
- package/workspace/public/pm/tk-view.js +216 -0
- package/workspace/public/pm/wf-page.js +2 -0
- package/workspace/server.js +24 -1
- package/workspace/stage-card-test.js +49 -41
- package/workspace/task-card-test.js +83 -38
- package/workspace/test-files.json +3 -1
- package/workspace/test-lists/bd-ini-panel.json +3 -3
- package/workspace/test-lists/one-task-list.json +5 -0
- package/workspace/tk-tasks-test.js +3 -3
- package/workspace/public/pm/bd-ini-model.js +0 -81
- package/workspace/public/pm/cozy-rec-pill.css +0 -12
- package/workspace/public/pm/cozy-rec-pill.js +0 -46
|
@@ -1,142 +1,39 @@
|
|
|
1
1
|
/* pm/bd-ini-panel.js — the Board's initiative and Jira ticket in the Viewer's shell A (initiative viewer-shell-a, V9; canvas XvABoard, XvOptAJira).
|
|
2
|
-
*
|
|
3
|
-
* views open the same item now. The shell floats at 560 px over the page's right edge, with its grip, and does not push the page.
|
|
2
|
+
* The shell floats at 560 px over the page's right edge, with its grip, and does not push the page.
|
|
4
3
|
*
|
|
5
|
-
* mount(o) once, from premium-board.js. o: { M() the model, statusOf(r), fmt(iso), md(date), ago(iso),
|
|
6
|
-
*
|
|
7
|
-
* actions popover, grillOpen(r, btn), onShow(key, from) / onHide() so the page
|
|
8
|
-
* programOf(r) the program it is in or null,
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* openTicket(r, k) the ticket as a drill-in: ← goes back to the initiative; the summary says what blocks it and what that delays
|
|
4
|
+
* mount(o) once, from premium-board.js. o: { M() the model, statusOf(r), fmt(iso), md(date), ago(iso), grill(id) the open first
|
|
5
|
+
* questions, usual(track) the usual days in the step, rowOf(key), pageHref(r), askHref(r, q), refreshJira(), send(r) the
|
|
6
|
+
* Send to Jira sheet, acts(r, btn) the row actions popover, grillOpen(r, btn), onShow(key, from) / onHide() so the page
|
|
7
|
+
* marks the row the item came from, programOf(r) the program it is in or null, openProgram(id, btn), turnProgram(r)
|
|
8
|
+
* "Turn into a program", setTask(r, uid, state) a task's state, addTask(r, title) a new task (POST /api/boards/tasks/add),
|
|
9
|
+
* viewDoc(path) }
|
|
10
|
+
* openIni(r, from) the initiative: the ONE view (pm/ini-view.js from pm/ini-view-model.js, feedback batch 6 item 1; canvas OvIniA), the
|
|
11
|
+
* same as Home's initiative page: the summary card, the stage card with its dates line (it replaced the Plan card, item 3),
|
|
12
|
+
* Tasks as the WBS, then Documents and Linked. What the Board adds under them: drafted tickets and the PRD drift.
|
|
13
|
+
* openTicket(r, k) the ticket as a drill-in, in the one ticket Viewer (tk-view.js): ← goes back to the initiative; the summary says what blocks it and what that delays
|
|
15
14
|
* refresh() draws the shown item again after a new read, in place · close() · shown() → the key of the initiative shown, or null
|
|
16
15
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* "Open in full" (the initiative page) is the shell's own ⋯ item. The Ask box is gone: Discuss in chat takes the question to Home. */
|
|
16
|
+
* What has no place on the view is under ⋯ in the shell's order: change it (move, hold, cancel or archive; the plan dates), look back (read
|
|
17
|
+
* Jira again), then link and copy. "Open in full" (the initiative page) is the shell's own ⋯ item. Discuss in chat takes the question to Home. */
|
|
20
18
|
import * as VW from './cozy-viewer.js';
|
|
21
19
|
import { esc } from './premium-shell.js';
|
|
22
|
-
import { lr,
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import
|
|
26
|
-
import { ladderOf, whyOf as whyOfSteps, planModel } from './bd-ini-model.js';
|
|
20
|
+
import { lr, copyText } from './cozy-xv.js';
|
|
21
|
+
import { iniView } from './ini-view-model.js';
|
|
22
|
+
import { viewHtml, wireView } from './ini-view.js';
|
|
23
|
+
import * as TV from './tk-view.js';
|
|
27
24
|
|
|
28
25
|
let O = null;
|
|
29
26
|
let cur = null; // { key, tk } the initiative shown, and its ticket while the drill-in is shown
|
|
30
|
-
|
|
27
|
+
let adding = null; // the key of the initiative whose inline Add a task is open
|
|
31
28
|
const TI = (r) => (r && r.trail) || null;
|
|
32
|
-
const DEP_ST = (d) => (!d.known ? 'not on this repository' : d.done ? 'done' : d.stage || 'open');
|
|
33
29
|
const tkState = (k) => (k.blocked ? 'Blocked' + (k.reason ? ' by ' + k.reason.replace(/^Waiting on /i, '') : '') : k.status || 'To do');
|
|
34
|
-
const isJiraStep = (t) => (t.key === 'build' || t.key === 'deliver') && (t.tickets || []).length > 0;
|
|
35
30
|
const jiraAt = () => { const J = (O.M() && O.M().jira) || {}; return J.readAt ? 'Jira · ' + O.ago(J.readAt) : ''; };
|
|
36
31
|
|
|
37
|
-
/* ── the initiative
|
|
38
|
-
/** The
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const t = r.track || {};
|
|
43
|
-
if (isJiraStep(t)) return jiraAt();
|
|
44
|
-
return r.progress != null && Number.isFinite(Number(r.progress)) ? Math.round(Number(r.progress)) + '% done · typed in by hand' : '';
|
|
45
|
-
}
|
|
46
|
-
/** The meta line: the owner's avatar and name, then the workflow's icon and name (each fact has one place on the panel). */
|
|
47
|
-
function whoHtml(r) {
|
|
48
|
-
const L = ladderOf(r, (O.M() && O.M().steps) || []), wf = L.wf;
|
|
49
|
-
const av = r.owner ? `<span class="xv-av" aria-hidden="true">${esc(String(r.owner).charAt(0).toUpperCase())}</span>${esc(r.owner)}` : 'No owner';
|
|
50
|
-
return `<p class="czs-meta xv-who">${av}<span aria-hidden="true">·</span>${wfIcon(wf, 16)}${esc(wf.name || 'Product feature')}</p>`;
|
|
51
|
-
}
|
|
52
|
-
/** The summary card: what waits on you leads, with its one primary; otherwise the status and the one sentence that says why. */
|
|
53
|
-
export function iniSummary(r) {
|
|
54
|
-
const t = r.track || {}, s = O.statusOf(r), it = TI(r), g = r.id && O.grill(r.id);
|
|
55
|
-
const L = ladderOf(r, (O.M() && O.M().steps) || []);
|
|
56
|
-
const meta = [r.owner || 'No owner', (L.wf && L.wf.name) || 'Product feature'].join(' · '), extra = whoHtml(r), right = progSource(r), why = whyOfSteps(r, (O.M() && O.M().steps) || [], nowOf());
|
|
57
|
-
if (t.you && t.youKind) {
|
|
58
|
-
const prd = t.youKind === 'drift' && it && it.links && it.links.prd;
|
|
59
|
-
return { line: t.you, tone: 'you', text: t.youWhy || why, meta: '', metaText: meta, extra, right, primary: prd ? { label: 'Open the PRD', act: 'doc:' + prd } : t.youKind === 'commit' && r.id ? { label: 'Send to Jira', act: 'commit' } : r.id ? { label: t.you, href: O.pageHref(r) } : null };
|
|
60
|
-
}
|
|
61
|
-
if (t.you) {
|
|
62
|
-
const rel = r.release ? r.release.name : t.output, open = (t.tickets || []).filter((k) => k.status !== 'Done').length;
|
|
63
|
-
return { line: 'Your sign-off' + (rel ? ' · ' + rel : ''), tone: 'you', meta: '', metaText: meta, extra, right,
|
|
64
|
-
text: open ? open + ' ' + plural(open, 'ticket is', 'tickets are') + ' still open, so the sign-off can wait until they close.' : 'Every release ticket is done. Release notes are not on record in PMOS.',
|
|
65
|
-
primary: r.id ? { label: 'Sign off ' + (rel || 'the release'), href: O.pageHref(r) } : null };
|
|
66
|
-
}
|
|
67
|
-
if (g && g.open) return { line: g.open + ' ' + plural(g.open, 'question', 'questions') + ' before the BRD', tone: 'you', meta: '', metaText: meta, extra, right, text: (g.later ? 'You chose to answer later. ' : '') + 'PMOS asks what the BRD needs that the Why does not say yet.', primary: { label: 'Answer the questions', act: 'grill' } };
|
|
68
|
-
const tone = s.tone === 'late' || s.tone === 'risk' || s.tone === 'red' ? 'warn' : '';
|
|
69
|
-
// say it once: when the sentence counts the days past the plan, the status line says only Late (the row's "N days over" is the list's)
|
|
70
|
-
return { line: s.tone === 'late' && /^The plan ended /.test(why) ? 'Late' : s.text, tone, meta: '', metaText: meta, extra, right, text: why };
|
|
71
|
-
}
|
|
72
|
-
/** The skipped steps, each with its reason (lib/board-trail.js), under the ladder. */
|
|
73
|
-
function skipText(r, L) {
|
|
74
|
-
const t = r.track || {};
|
|
75
|
-
if (L.own) {
|
|
76
|
-
const sk = L.skipped.map((j) => r.wfStages[j]).filter(Boolean);
|
|
77
|
-
return sk.map((s) => s.name + ' skipped' + (s.skipped && s.skipped.why ? '. ' + s.skipped.why : '.')).join(' ');
|
|
78
|
-
}
|
|
79
|
-
const sk = (t.skipped || []).map((j) => L.steps[j]).filter(Boolean);
|
|
80
|
-
if (!sk.length) return '';
|
|
81
|
-
const why = sk.map((s) => { const w = (t.skipWhy || []).find((x) => x.stage === s.key); return w && w.why ? s.label + ' skipped. ' + w.why : null; });
|
|
82
|
-
if (why.every(Boolean)) return why.join(' ');
|
|
83
|
-
return sk.map((s) => s.label).join(', ') + ' skipped: it was moved past ' + (sk.length === 1 ? 'that step' : 'those steps') + '. No reason is on record.';
|
|
84
|
-
}
|
|
85
|
-
const TK_SHOWN = 3;
|
|
86
|
-
const moreOpen = new Set(); // the initiatives whose open tickets are all shown (a press on "N more open")
|
|
87
|
-
/** Build and Deliver: the open tickets, blocked first, three shown, then "N more open" with the done count; Deliver's two parts. */
|
|
88
|
-
function ticketsHtml(r) {
|
|
89
|
-
const t = r.track || {};
|
|
90
|
-
const open = t.tickets.filter((k) => k.status !== 'Done').sort((a, b) => (b.blocked ? 1 : 0) - (a.blocked ? 1 : 0)), done = t.tickets.filter((k) => k.status === 'Done');
|
|
91
|
-
const all = moreOpen.has(r.key), shown = all ? open : open.slice(0, TK_SHOWN), more = open.length - shown.length;
|
|
92
|
-
const doneOf = done.length + ' of ' + t.tickets.length + ' ' + plural(t.tickets.length, 'ticket', 'tickets') + ' done';
|
|
93
|
-
let h = shown.map((k) => lr({ tk: k.key, mk: k.blocked ? 'warn' : '', title: `<em>${esc(k.key)}</em> ${esc(k.title)}`, sub: [tkState(k), k.assignee, k.age != null ? k.age + 'd' : ''].filter(Boolean).join(' · ') })).join('');
|
|
94
|
-
if (more > 0) h += `<button type="button" class="xv-lr go" data-xb="tkmore"><span class="xv-mk" aria-hidden="true"></span><span class="w"><b>${esc(more + ' more open')}</b><span>${esc(doneOf)}</span></span></button>`;
|
|
95
|
-
else if (done.length) h += lr({ mk: 'done', title: esc(doneOf), sub: done.slice(0, 3).map((k) => k.title.toLowerCase()).join(', ') + (done.length > 3 ? ', …' : '') });
|
|
96
|
-
if (t.key === 'deliver') h += lr({ title: 'Release notes', sub: 'not on record' }) + lr({ mk: t.you ? 'you' : '', title: 'Your sign-off', sub: t.you ? 'waiting' : 'after the tickets' });
|
|
97
|
-
return h;
|
|
98
|
-
}
|
|
99
|
-
/** The exit steps of the current stage, as the shared step list (stage card D): the stage's own To finish list and its output on another
|
|
100
|
-
* workflow; on Product feature the parts of the step's output that the records count. */
|
|
101
|
-
function exitSteps(r, L) {
|
|
102
|
-
const t = r.track || {};
|
|
103
|
-
if (L.own) {
|
|
104
|
-
const st = L.stage || {}, out = [];
|
|
105
|
-
for (const f of Array.isArray(st.finish) ? st.finish : []) if (f) out.push({ state: 'wait', label: f.charAt(0).toUpperCase() + f.slice(1) });
|
|
106
|
-
const o = st.output || {};
|
|
107
|
-
if (o.name && !out.some((x) => x.label.toLowerCase() === String(o.name).toLowerCase())) out.push(o.kind === 'signoff' ? { state: 'you', label: 'Your sign-off: ' + o.name } : { state: 'wait', label: o.name.charAt(0).toUpperCase() + o.name.slice(1) });
|
|
108
|
-
return out;
|
|
109
|
-
}
|
|
110
|
-
return (t.segs || []).filter((s) => s.name).map((s) => (s.cls === 'dn' ? { state: 'done', label: s.name } : s.cls === 'yo' ? { state: 'you', label: s.name, note: s.st || '' } : { state: 'wait', label: s.name, note: s.st && s.st !== 'to do' ? s.st : '' }));
|
|
111
|
-
}
|
|
112
|
-
const PLUS = '<svg aria-hidden="true" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 5v14M5 12h14"/></svg>';
|
|
113
|
-
/** The stage card (XipB; the Home stage card D look): the current stage of the initiative's own workflow, where it stands ("5 of 7 · day 0
|
|
114
|
-
* of ~14"), its ladder, then what finishes it: the tickets on Build and Deliver, else the exit steps, else "No exit steps on record" with
|
|
115
|
-
* the icon-only add; the last row is the next stage. */
|
|
116
|
-
export function stageCardHtml(r) {
|
|
117
|
-
const t = r.track || {}, L = ladderOf(r, (O.M() && O.M().steps) || []);
|
|
118
|
-
const u = O.usual ? O.usual(t) : null;
|
|
119
|
-
const where = [L.k >= 0 ? (L.k + 1) + ' of ' + L.steps.length : '', t.days != null ? 'day ' + t.days + (u && u.days != null ? ' of ~' + u.days : '') : ''].filter(Boolean).join(' · ');
|
|
120
|
-
const title = L.name || 'Stage not on record';
|
|
121
|
-
const nowTitle = O.dayTitle ? O.dayTitle({ ...t, label: title }) : title;
|
|
122
|
-
const sk = skipText(r, L);
|
|
123
|
-
let body = '';
|
|
124
|
-
const tail = L.next ? stepTail({ name: L.next.label, note: 'Next stage' }) : ''; // its node is the diamond (cozy-xv.css), so the name carries no second ◆
|
|
125
|
-
if (!L.own && isJiraStep(t)) body = ticketsHtml(r);
|
|
126
|
-
else if (!L.own && (t.key === 'build' || t.key === 'deliver')) body = '<p class="xv-q">No Jira ticket has been read for it yet.</p>' + (tail ? stepsHtml([], { cls: 'xv-sl', tail }) : '');
|
|
127
|
-
else {
|
|
128
|
-
const steps = exitSteps(r, L);
|
|
129
|
-
if (steps.length) body = stepsHtml(steps, { cls: 'xv-sl', label: 'To finish ' + title, tail });
|
|
130
|
-
else {
|
|
131
|
-
// nothing finishes this stage on record: say so, and the icon-only add opens the stage in the workflow editor (WfAStage, To finish)
|
|
132
|
-
const add = L.own && L.stage && L.stage.key ? `<a class="xv-add" href="${esc(editHref(L.wf) + '&stage=' + encodeURIComponent(L.stage.key) + (r.ws || (O.M() && O.M().board && O.M().board.ws) ? '&ws=' + encodeURIComponent(r.ws || O.M().board.ws) : ''))}" aria-label="Add an exit step" title="Add an exit step">${PLUS}</a>` : '';
|
|
133
|
-
const none = `<li class="cz-sli${add ? ' has-act' : ''}"><div class="cz-st wt xv-none">${nodeHtml('wait')}<span class="tx"><span class="lb">No exit steps on record</span><small>${esc(L.own ? 'Add the steps that finish ' + title + ', so PMOS can count them.' : 'Nothing is counted toward ' + title + ' yet.')}</small></span></div>${add}</li>`;
|
|
134
|
-
body = stepsHtml([], { cls: 'xv-sl', tail: none + tail });
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
const aria = L.k >= 0 ? L.steps.length + ' stages of ' + (L.wf.name || 'Product feature') + '. Stage ' + (L.k + 1) + ', ' + title : 'No stage on record';
|
|
138
|
-
return `<section class="xv-card xv-sc" aria-label="${esc('Stage · ' + title)}"><div class="xv-ch"><b>${esc(title)}</b>${where ? `<span class="r">${esc(where)}</span>` : ''}</div>`
|
|
139
|
-
+ stageBar(L.steps, L.k, L.skipped, nowTitle, aria) + (sk ? `<p class="xv-q xv-skip">${esc(sk)}</p>` : '') + body + '</section>';
|
|
32
|
+
/* ── the initiative: the one view ── */
|
|
33
|
+
/** The view's model for a row: the same function Home's page calls, with what only the Board's model holds (its eight steps, its day). */
|
|
34
|
+
export function viewOf(r) {
|
|
35
|
+
const M = O.M() || {}, p = O.programOf ? O.programOf(r) : null, u = O.usual ? O.usual(r.track || {}) : null;
|
|
36
|
+
return iniView(r, { steps: M.steps || [], today: M.today, usual: u, grill: r.id ? O.grill(r.id) : null, program: p ? { id: p.id, title: p.title } : null, jiraAt: jiraAt() });
|
|
140
37
|
}
|
|
141
38
|
function draftedHtml(d, g) {
|
|
142
39
|
return d.slice(0, 8).map((x) => lr({ mk: x.waiting ? 'you' : '', title: (x.id ? `<em>${esc(x.id)}</em> ` : '') + esc(x.summary || ''), sub: 'not in Jira' })).join('')
|
|
@@ -146,46 +43,13 @@ function draftedHtml(d, g) {
|
|
|
146
43
|
const driftQ = (keys) => 'What changed in the PRD after ' + keys.join(', ') + ' ' + (keys.length === 1 ? 'was' : 'were') + ' pushed?';
|
|
147
44
|
const driftHtml = (keys) => `<p>${esc(keys.join(', '))} ${keys.length === 1 ? 'was' : 'were'} pushed from an older PRD. Review ${keys.length === 1 ? 'it' : 'them'} before the next push.</p>`
|
|
148
45
|
+ `<div><button type="button" class="xv-mini" data-xb="drift" data-q="${esc(driftQ(keys))}">Discuss the change in chat</button></div>`;
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
const doc = (label, path) => (path ? [`<button type="button" class="xv-chip" data-doc="${esc(path)}" title="${esc(path)}">${esc(label)}</button>`] : []);
|
|
152
|
-
return [].concat(doc(L.prdVersion ? 'PRD v' + String(L.prdVersion).replace(/^v/i, '') : 'PRD', L.prd), doc('Rubric', L.rubric), doc('Evaluation', L.evaluation), doc('Release notes', L.notes),
|
|
153
|
-
D.map((d) => `<span class="xv-chip" title="${esc((d.title || d.id) + ': ' + DEP_ST(d))}">${esc('Waits on ' + (d.title || d.id))}</span>`),
|
|
154
|
-
epic ? [`<span class="xv-chip">${esc('Epic ' + epic)}</span>`] : []);
|
|
155
|
-
}
|
|
156
|
-
const CAL = '<svg aria-hidden="true" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M5 6h14v14H5zM5 10h14M9 3v4M15 3v4"/></svg>';
|
|
157
|
-
/** The Plan card: one drawn line, its legend naming only what is drawn, then what its dates wait on. */
|
|
158
|
-
function planHtml(r) {
|
|
159
|
-
const m = planModel(r, nowOf()), it = TI(r), D = (it && it.deps) || [];
|
|
160
|
-
if (!m && !D.length) return '';
|
|
161
|
-
const w = (a, b) => Math.max(0.5, b - a);
|
|
162
|
-
const pos = (x) => (x <= 8 ? '0' : x >= 92 ? '-100%' : '-50%');
|
|
163
|
-
const say = m ? [m.marks.find((x) => x.kind === 'start'), m.marks.find((x) => x.kind === 'end')].filter(Boolean).map((x) => (x.kind === 'start' ? 'Plan from ' : 'to ') + x.label).join(' ')
|
|
164
|
-
+ (m.over ? ', ' + m.overBar.days + ' days past the plan' : '') + (m.exp ? '. Jira’s pace ends it ' + m.marks.find((x) => x.kind === 'jira').label : '') + '.' : '';
|
|
165
|
-
let line = '';
|
|
166
|
-
if (m) {
|
|
167
|
-
line = `<div class="xv-pl" role="img" aria-label="${esc(say)}">`
|
|
168
|
-
+ (m.bar ? `<i class="bar" style="left:${m.bar.from}%;width:${w(m.bar.from, m.bar.to)}%"></i>` : '')
|
|
169
|
-
+ (m.overBar ? `<i class="over" style="left:${m.overBar.from}%;width:${w(m.overBar.from, m.overBar.to)}%"></i>` : '')
|
|
170
|
-
+ (m.expBar ? `<i class="exp" style="left:${m.expBar.from}%;width:${w(m.expBar.from, m.expBar.to)}%"></i>` : '')
|
|
171
|
-
+ m.marks.map((x) => `<i class="tk${x.kind === 'today' && x.warn ? ' am' : x.kind === 'jira' ? ' e' : ''}" style="left:${x.at}%"></i>`).join('')
|
|
172
|
-
+ m.marks.filter((x) => !x.hide).map((x) => `<span class="lb${x.kind === 'today' || x.kind === 'jira' ? ' tp' : ''}${x.kind === 'today' && x.warn ? ' w' : ''}${x.kind === 'jira' ? ' e' : ''}" data-pl="${x.kind}" style="left:${x.at}%;transform:translateX(${pos(x.at)})">`
|
|
173
|
-
+ (x.kind === 'start' ? esc(x.label) : `<b>${esc(x.label)}</b>${x.word ? ' ' + esc(x.word) : ''}`) + '</span>').join('')
|
|
174
|
-
+ '</div>'
|
|
175
|
-
+ `<div class="xv-lg" aria-hidden="true">${m.legend.map((x) => `<span><i class="${x.kind}"></i>${esc(x.text)}</span>`).join('')}</div>`;
|
|
176
|
-
}
|
|
177
|
-
const open = D.filter((d) => d.known && !d.done);
|
|
178
|
-
const deps = D.length ? `<p class="xv-q"><b>Waits on ${esc(D.map((d) => d.title || d.id).join(', '))}.</b> ${esc(D.map((d) => (d.title || d.id) + ': ' + DEP_ST(d)).join(' · '))}.${open.length ? ' Its own dates hold only once ' + (open.length === 1 ? 'that one is' : 'those are') + ' done.' : ''}</p>` : '';
|
|
179
|
-
return `<section class="xv-card xv-plan" aria-label="Plan"><div class="xv-ch">${CAL}<b>Plan</b></div>${line}${deps}</section>`;
|
|
180
|
-
}
|
|
181
|
-
function iniSections(r) {
|
|
46
|
+
/** What only the Board reads under the view: tickets drafted in PMOS and pushed tickets that differ from the PRD. */
|
|
47
|
+
function boardSections(r) {
|
|
182
48
|
const it = TI(r), S = [];
|
|
183
49
|
const d = ((it && it.drafted) || []).filter((x) => !x.key);
|
|
184
50
|
if (d.length) S.push({ id: 'drafted', title: 'Drafted in PMOS', count: d.length, render: () => draftedHtml(d, (it && it.gate) || {}) });
|
|
185
51
|
const dr = (it && it.drift) || [];
|
|
186
52
|
if (dr.length) S.push({ id: 'drift', title: 'Jira differs from the PRD', count: dr.length, render: () => driftHtml(dr) });
|
|
187
|
-
const L = linkedChips(r);
|
|
188
|
-
if (L.length) S.push({ id: 'linked', title: 'Linked', count: L.length, render: () => chips(L) });
|
|
189
53
|
return S;
|
|
190
54
|
}
|
|
191
55
|
/** ⋯ in the shell's order: change it, look back, then link and copy. Archive and cancel stay in the row actions, with their Undo. */
|
|
@@ -201,27 +65,44 @@ function iniMore(r) {
|
|
|
201
65
|
more.push({ label: 'Copy as text', on: () => copyText(iniText(r), 'Copied as text.') });
|
|
202
66
|
return more;
|
|
203
67
|
}
|
|
204
|
-
/** The initiative as plain text, for Copy as text: the summary, the
|
|
68
|
+
/** The initiative as plain text, for Copy as text: the summary, the stage and the open tasks. */
|
|
205
69
|
function iniText(r) {
|
|
206
|
-
const
|
|
207
|
-
const lines = [r.title, [s.line, s.metaText].filter(Boolean).join(' · ')];
|
|
70
|
+
const v = viewOf(r), s = v.summary, lines = [r.title, s.line + (s.right ? ' · ' + s.right : '')];
|
|
208
71
|
if (s.text) lines.push(s.text);
|
|
209
|
-
|
|
210
|
-
for (const
|
|
72
|
+
lines.push('', v.stage.name + (v.stage.n ? ' · ' + v.stage.n + ' of ' + v.stage.of : '') + (v.stage.doneOf ? ' · ' + v.stage.doneOf : ''));
|
|
73
|
+
for (const sec of v.tasks.sections) for (const x of sec.top || []) lines.push('- ' + x.title + (x.sub ? ' · ' + x.sub : ''));
|
|
74
|
+
for (const k of ((r.track && r.track.tickets) || []).filter((x) => x.status !== 'Done')) lines.push('- ' + k.key + ' ' + k.title + ' · ' + tkState(k) + (k.assignee ? ' · ' + k.assignee : ''));
|
|
211
75
|
return lines.join('\n');
|
|
212
76
|
}
|
|
213
|
-
|
|
214
|
-
|
|
77
|
+
function iniBody(r) {
|
|
78
|
+
return viewHtml(viewOf(r), { add: !!(r.id && O.addTask), adding: adding === r.key, openTask: false, tail: VW.czSections(boardSections(r), { key: 'board' }) });
|
|
79
|
+
}
|
|
80
|
+
/** Presses inside the shown item: the view's own (pm/ini-view.js), a ticket's drill-in, the PRD-change question. A [data-doc] goes to the page's handler. */
|
|
215
81
|
function wire(body, key) {
|
|
82
|
+
const redraw = () => { const r = O.rowOf(key); if (!r || (cur && cur.tk)) return; const top = body.scrollTop; body.innerHTML = iniBody(r); body.scrollTop = top; };
|
|
83
|
+
wireView(body, {
|
|
84
|
+
check: (uid, b) => { const r = O.rowOf(key), k = r && (r.tasks || []).find((x) => x.uid === uid); if (r && O.setTask) O.setTask(r, uid, k && k.status === 'Done' ? 'To do' : 'Done'); },
|
|
85
|
+
openTicket: (tk) => { const r = O.rowOf(key), k = r && ((r.track && r.track.tickets) || []).find((x) => x.key === tk); if (k) openTicket(r, k); },
|
|
86
|
+
add: () => { adding = key; redraw(); const f = body.querySelector('#ivAddTask'); if (f) f.focus(); },
|
|
87
|
+
addCancel: () => { adding = null; redraw(); },
|
|
88
|
+
addTask: async (title, inp) => { const r = O.rowOf(key); if (!r || !O.addTask) return; inp.disabled = true; const ok = await O.addTask(r, title); inp.disabled = false; if (ok) { inp.value = ''; inp.focus(); } },
|
|
89
|
+
primary: (act, b) => {
|
|
90
|
+
const r = O.rowOf(key); if (!r) return;
|
|
91
|
+
if (act === 'grill') O.grillOpen(r, b);
|
|
92
|
+
else if (act === 'commit') O.send(r); // the Commit of drafted tickets opens the Send sheet (tk-send.js), the one path to Jira
|
|
93
|
+
else if (act.startsWith('doc:')) O.viewDoc(act.slice(4));
|
|
94
|
+
else if (act === 'page' && r.id) location.assign(O.pageHref(r));
|
|
95
|
+
},
|
|
96
|
+
program: (id, b) => { if (O.openProgram) O.openProgram(id, b); },
|
|
97
|
+
doc: (path) => O.viewDoc(path),
|
|
98
|
+
redraw,
|
|
99
|
+
});
|
|
216
100
|
body.onclick = (e) => {
|
|
217
101
|
const r = O.rowOf(key); if (!r) return;
|
|
218
102
|
const tk = e.target.closest('[data-tk]'); if (tk) { const k = ((r.track && r.track.tickets) || []).find((x) => x.key === tk.dataset.tk); if (k) openTicket(r, k); return; }
|
|
219
103
|
const a = e.target.closest('[data-czs-act], [data-xb]'); if (!a) return;
|
|
220
104
|
const act = a.dataset.czsAct || a.dataset.xb;
|
|
221
|
-
if (act === '
|
|
222
|
-
if (act === 'grill') O.grillOpen(r, a);
|
|
223
|
-
else if (act === 'commit') O.send(r); // the Commit of drafted tickets opens the Send sheet (tk-send.js), the one path to Jira
|
|
224
|
-
else if (act === 'drift') location.assign(O.askHref(r, a.dataset.q || ''));
|
|
105
|
+
if (act === 'drift') location.assign(O.askHref(r, a.dataset.q || ''));
|
|
225
106
|
else if (act.startsWith('doc:')) O.viewDoc(act.slice(4));
|
|
226
107
|
};
|
|
227
108
|
}
|
|
@@ -229,6 +110,7 @@ function wire(body, key) {
|
|
|
229
110
|
export const vidOf = (r) => (r.id ? String(r.id) : 'bd:' + r.key);
|
|
230
111
|
export function openIni(r, from) {
|
|
231
112
|
if (!O || !r || !r.track) return;
|
|
113
|
+
adding = null;
|
|
232
114
|
// a row with no record id has no chat of its own: its question goes to the board's chat
|
|
233
115
|
VW.open({ kind: 'Initiative', title: r.title, icon: 'flag', id: vidOf(r), url: r.id ? O.pageHref(r) : '', full: true,
|
|
234
116
|
discuss: r.id ? true : () => location.assign(O.askHref(r, '')), more: iniMore(r), rename: O.rename ? O.rename(r) : null,
|
|
@@ -236,50 +118,26 @@ export function openIni(r, from) {
|
|
|
236
118
|
onClose: () => { if (cur && cur.key === r.key && !cur.tk) { cur = null; O.onHide(); } } });
|
|
237
119
|
}
|
|
238
120
|
|
|
239
|
-
/* ── the Jira ticket, as a drill-in (
|
|
121
|
+
/* ── the Jira ticket, as a drill-in, in the one ticket Viewer (tk-view.js; canvas OvViewers) ── */
|
|
240
122
|
/** The blocker's own summary, where its key (in the reason) is a ticket of a row on this board. */
|
|
241
123
|
function blockerTitle(key) {
|
|
242
124
|
for (const r of (O.M() && O.M().rows) || []) { const x = ((r.track && r.track.tickets) || []).find((y) => y.key === key); if (x && x.title && x.title !== x.key) return x.title; }
|
|
243
125
|
return '';
|
|
244
126
|
}
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
const right = jiraAt(), primary = k.url ? { label: k.blocked ? 'Comment in Jira' : 'Open in Jira', href: k.url, blank: true } : null;
|
|
248
|
-
if (!k.blocked) return { line: k.raw || k.status || 'To do', right, meta: [k.assignee, k.sprint, pts].filter(Boolean).join(' · '), primary };
|
|
249
|
-
const reason = k.reason || (x && x.reason) || 'Flagged as blocked in Jira', on = /\b([A-Z][A-Z0-9]+-\d+)\b/.exec(reason), bt = on ? blockerTitle(on[1]) : '';
|
|
250
|
-
const days = k.blockedDays != null ? ' ' + k.blockedDays + ' ' + plural(k.blockedDays, 'day', 'days') : '';
|
|
251
|
-
const slip = k.sprintEnd ? 'If it is not fixed by ' + O.fmt(k.sprintEnd) + ', the end of ' + (k.sprint || 'its sprint') + ', ' + (r.release ? r.release.name + ' on ' + O.fmt(r.release.iso) + ' slips.' : 'it carries into the next sprint.') : r.release ? 'It holds up ' + r.release.name + ' on ' + O.fmt(r.release.iso) + '.' : '';
|
|
252
|
-
const status = k.raw && !/block/i.test(k.raw) ? k.raw : '';
|
|
253
|
-
return { line: 'Blocked' + days + (on ? ' on ' + on[1] : ''), tone: 'warn', right, text: [reason.replace(/\.$/, '') + (bt ? ' (' + bt + ')' : '') + '.', slip].filter(Boolean).join(' '),
|
|
254
|
-
meta: [k.assignee, k.sprint, pts, status].filter(Boolean).join(' · '), primary };
|
|
255
|
-
}
|
|
256
|
-
function tkSections(r, k) {
|
|
257
|
-
const t = r.track || {}, it = TI(r), x = it && it.tickets ? it.tickets[k.key] : null, sub = x && x.subtasks, S = [];
|
|
258
|
-
if (((it && it.drift) || []).includes(k.key)) S.push({ id: 'tdrift', title: 'The PRD changed after the push', count: 1, open: true, render: () => driftHtml([k.key]) });
|
|
259
|
-
const items = sub && Array.isArray(sub.items) ? sub.items : null;
|
|
260
|
-
S.push({ id: 'sub', title: 'Subtasks', count: sub && sub.total ? sub.done + ' of ' + sub.total : '', render: () => (items && items.length
|
|
261
|
-
? items.map((y) => lr({ mk: y.done ? 'done' : '', title: esc(y.name || y.summary || ''), sub: y.done ? 'done' : 'open' })).join('')
|
|
262
|
-
: sub && sub.total ? [[sub.done, 'done', 'done'], [sub.total - sub.done, 'open', '']].filter(([n]) => n > 0).map(([n, w, c]) => lr({ mk: c, title: esc(n + ' ' + plural(n, 'subtask', 'subtasks')), sub: w })).join('')
|
|
263
|
-
: '<p class="xv-q">No subtasks are in the Jira reading.</p>') });
|
|
264
|
-
if (t.output) S.push({ id: 'counts', title: 'Counts toward', count: t.output, render: () => `<p>${esc(t.output)}${t.count ? ' · ' + esc(t.count) : ''}</p>` });
|
|
265
|
-
return S;
|
|
266
|
-
}
|
|
267
|
-
const tkBody = (r, k) => VW.czSummary(tkSummary(r, k)) + VW.czSections(tkSections(r, k), { key: 'board-ticket' }) + '<p class="xv-q">PMOS owns the ticket text. Status, sprint and assignee change only in Jira.</p>';
|
|
127
|
+
/** The stage a ticket sits in: the workflow's Build stage (where its tickets count), else the stage the initiative is in. */
|
|
128
|
+
const tkStage = (r) => { const L = (r && r.wfStages) || [], b = L.find((x) => /^build\b/i.test(x.name || '')); return (b && b.name) || (r && r.wfStage && r.wfStage.name) || ''; };
|
|
268
129
|
export function openTicket(r, k, from) {
|
|
269
130
|
if (!O || !r || !k) return;
|
|
270
131
|
const c = VW.current && VW.current(), back = !!(c && c.id === vidOf(r));
|
|
271
|
-
const
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
body.innerHTML = tkBody(x, kk); wire(body, x.key);
|
|
281
|
-
},
|
|
282
|
-
onClose: () => { if (cur && cur.tk === k.key) { cur = null; O.onHide(); } } });
|
|
132
|
+
const it = TI(r), tr = it && it.tickets ? it.tickets[k.key] || null : null, M = O.M() || {}, B = M.board || {};
|
|
133
|
+
O.onShow(r.key, back ? null : from);
|
|
134
|
+
cur = { key: r.key, tk: k.key };
|
|
135
|
+
TV.openTicketView({ ws: r.ws || B.ws || '', board: r.boardId || B.id || '', ini: r.id || '', iniTitle: r.title, ref: k.key, base: k, trail: tr, stage: tkStage(r), release: r.release || null,
|
|
136
|
+
readAt: (M.jira && M.jira.readAt) || '', back, blockerTitle, askHref: (q) => O.askHref(r, q),
|
|
137
|
+
refresh: M.jira ? () => O.refreshJira() : null,
|
|
138
|
+
openIni: () => openIni(O.rowOf(r.key) || r),
|
|
139
|
+
extra: () => (((it && it.drift) || []).includes(k.key) ? [{ id: 'tdrift', title: 'The PRD changed after the push', count: 1, open: true, render: () => driftHtml([k.key]) }] : []),
|
|
140
|
+
onHide: () => { if (cur && cur.tk === k.key) { cur = null; O.onHide(); } } });
|
|
283
141
|
}
|
|
284
142
|
|
|
285
143
|
/** The shown item drawn again from the new read, in place. A row that left the Board closes it. */
|
|
@@ -287,9 +145,9 @@ export function refresh() {
|
|
|
287
145
|
if (!cur || !VW.isOpen()) return;
|
|
288
146
|
const r = O.rowOf(cur.key); if (!r || !r.track) { close(); return; }
|
|
289
147
|
const b = VW.body(); if (!b || (document.activeElement && b.contains(document.activeElement))) return;
|
|
290
|
-
|
|
148
|
+
if (cur.tk) return; // the ticket Viewer reads its own records (tk-view.js); Read Jira again opens it fresh
|
|
291
149
|
const top = b.scrollTop;
|
|
292
|
-
b.innerHTML =
|
|
150
|
+
b.innerHTML = iniBody(r);
|
|
293
151
|
b.scrollTop = top;
|
|
294
152
|
}
|
|
295
153
|
export function close() { if (cur) { cur = null; VW.close(); } }
|
|
@@ -485,6 +485,21 @@ p.ins-fl { flex-direction: row; align-items: center; margin: 0 0 6px; flex-wrap:
|
|
|
485
485
|
.ins-etr { display: flex; align-items: center; gap: 10px; }
|
|
486
486
|
.ins-etr > span { flex: 1; }
|
|
487
487
|
.ins-mvl { display: flex; flex-direction: column; gap: 8px; }
|
|
488
|
+
/* the goal Viewer (canvas OvViewers "Goal"): the big number over the chart, the milestones, Moved by */
|
|
489
|
+
.ins-gbig { border-radius: 18px; box-shadow: inset 0 0 0 1px var(--cz-hair); background: var(--cz-card); padding: 14px 16px 10px; display: flex; flex-direction: column; gap: 6px; }
|
|
490
|
+
.ins-gnum { margin: 0; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
|
|
491
|
+
.ins-gnum b { font-size: 30px; font-weight: 800; letter-spacing: -.02em; color: var(--cz-ink); }
|
|
492
|
+
.ins-gnum span { font-size: 13px; font-weight: 700; color: var(--cz-ink3); }
|
|
493
|
+
.ins-gch .msr { stroke: var(--cz-ink3); stroke-width: 1; stroke-dasharray: 1.5 3; opacity: .8; }
|
|
494
|
+
.ins-gch .msd { fill: var(--cz-ink2); stroke: none; }
|
|
495
|
+
.ins-gch .msl { fill: var(--cz-ink2); font-size: 11px; font-weight: 700; }
|
|
496
|
+
.ins-mvb { display: flex; flex-direction: column; gap: 8px; }
|
|
497
|
+
.ins-mvh { margin: 4px 0 0; font-size: 14px; font-weight: 800; color: var(--cz-ink); }
|
|
498
|
+
.ins-mvh span { font-weight: 700; font-size: 12.5px; color: var(--cz-ink3); margin-left: 4px; }
|
|
499
|
+
a.ins-mvr { text-decoration: none; color: inherit; padding: 0; }
|
|
500
|
+
a.ins-mvr .go { min-height: 46px; }
|
|
501
|
+
a.ins-mvr:hover .go { background: var(--cz-well2); }
|
|
502
|
+
.ins-dia { display: inline-block; width: 7px; height: 7px; background: currentColor; transform: rotate(45deg); margin: 0 3px 0 1px; }
|
|
488
503
|
.ins-gd.ph .ins-vbar { background: transparent; padding: 0; }
|
|
489
504
|
.ins-gd.ph .ins-vtab.on { background: var(--cz-well); box-shadow: none; }
|
|
490
505
|
.ins-gd .ins-trow .ins-tog { margin-left: auto; }
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/* pm/cozy-live-pill.css — the Live pill beside the floating menu and its list (canvas XrrABoard, XrrAPhone, XrrAGrill), drawn by
|
|
2
|
+
* pm/cozy-live-pill.js inside #czNav, so it follows the menu button and hides with it. Token vars from cozy.css only. Motion: one info
|
|
3
|
+
* ripple when a mark changes while the list is open; the recording clock is the only other thing that changes. */
|
|
4
|
+
.cz-live { position: absolute; left: 68px; bottom: 8px; height: 40px; padding: 0 14px 0 12px; border-radius: 999px; border: 0; background: var(--cz-card); box-shadow: var(--cz-float); display: inline-flex; align-items: center; gap: 10px; font: 800 13px var(--cz-sans); color: var(--cz-ink); white-space: nowrap; cursor: pointer; z-index: 1; }
|
|
5
|
+
.cz-live[hidden] { display: none; }
|
|
6
|
+
.cz-live.open { box-shadow: var(--cz-float), 0 0 0 2px color-mix(in srgb, var(--cz-blue) 30%, var(--cz-card)); }
|
|
7
|
+
.cz-live.recp { box-shadow: var(--cz-float), 0 0 0 1.5px color-mix(in srgb, var(--cz-dot-red) 35%, var(--cz-card)); }
|
|
8
|
+
.cz-live:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 2px; }
|
|
9
|
+
.lv-row:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: -2px; }
|
|
10
|
+
.cz-live .lv-g { display: inline-flex; align-items: center; gap: 6px; }
|
|
11
|
+
.cz-live .lv-sp { width: 1px; height: 16px; background: var(--cz-hair); }
|
|
12
|
+
.cz-live .lv-ms { display: inline-flex; align-items: center; gap: 6px; }
|
|
13
|
+
|
|
14
|
+
/* one mark per item: blue asks you, ring running, amber stopped, check finished, red recording (grey while paused) */
|
|
15
|
+
.lv-m { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 9px; height: 9px; border-radius: 50%; box-sizing: border-box; flex: none; background: var(--cz-blue); }
|
|
16
|
+
.lv-m.run { background: transparent; border: 1.5px solid var(--cz-ink3); }
|
|
17
|
+
.lv-m.stop { background: var(--cz-dot-late); }
|
|
18
|
+
.lv-m.rec { background: var(--cz-dot-red); }
|
|
19
|
+
.lv-m.rec.paused { background: var(--cz-dot-q); }
|
|
20
|
+
.lv-m.done { width: 14px; height: 14px; border-radius: 0; background: none; color: var(--cz-dot-ok); }
|
|
21
|
+
.lv-m.done svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
|
|
22
|
+
.lv-m.once::after { content: ''; position: absolute; inset: 0; border-radius: 50%; background: var(--cz-blue); animation: cz-info 1.6s ease-out 1; }
|
|
23
|
+
@media (prefers-reduced-motion: reduce) { .lv-m.once::after { animation: none; } }
|
|
24
|
+
|
|
25
|
+
/* the list: one popover over the menu button, newest first, no headers */
|
|
26
|
+
.lv-tray { position: absolute; left: 0; bottom: 68px; width: 360px; box-sizing: border-box; padding: 6px; border-radius: 22px; background: var(--cz-card); border: 1px solid var(--cz-hair); box-shadow: var(--cz-sheet); display: flex; flex-direction: column; z-index: 2; }
|
|
27
|
+
.lv-tray[hidden], .lv-scrim[hidden] { display: none; }
|
|
28
|
+
.lv-row { position: relative; display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 4px 12px 4px 6px; border-radius: 14px; color: var(--cz-ink); text-decoration: none; }
|
|
29
|
+
.lv-row + .lv-row::before { content: ''; position: absolute; left: 38px; right: 12px; top: 0; height: 1px; background: var(--cz-hair); }
|
|
30
|
+
.lv-row:hover { background: var(--cz-well); }
|
|
31
|
+
.lv-row.cur { background: var(--cz-bluebg); }
|
|
32
|
+
.lv-mk { width: 24px; flex: none; display: inline-flex; justify-content: center; align-items: center; }
|
|
33
|
+
.lv-t { flex: 1; min-width: 0; font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
34
|
+
.lv-t small { display: block; font-size: 12.5px; font-weight: 600; color: var(--cz-ink3); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
35
|
+
.lv-tm { font-size: 12.5px; font-weight: 700; color: var(--cz-ink3); white-space: nowrap; font-variant-numeric: tabular-nums; flex: none; }
|
|
36
|
+
.cz-live .lv-tm { font-size: 13px; }
|
|
37
|
+
.lv-tm.rec { color: var(--cz-red); }
|
|
38
|
+
.lv-tm.stop { color: var(--cz-late); }
|
|
39
|
+
|
|
40
|
+
/* a phone: the menu button is bottom right, so the pill sits to its left, and the list is a short sheet */
|
|
41
|
+
@media (max-width: 760px) {
|
|
42
|
+
.cz-live { left: auto; right: 68px; }
|
|
43
|
+
.lv-scrim { position: fixed; inset: 0; background: rgba(42,46,53,.18); z-index: 0; }
|
|
44
|
+
.lv-tray.sheet { position: fixed; left: 0; right: 0; bottom: 0; width: auto; padding: 18px 8px 28px; border-radius: 26px 26px 0 0; border: 0; }
|
|
45
|
+
.lv-tray.sheet::before { content: ''; position: absolute; top: 8px; left: 50%; width: 40px; height: 5px; margin-left: -20px; border-radius: 3px; background: var(--cz-well2); }
|
|
46
|
+
}
|
|
47
|
+
/* the phone keyboard is up: no pill and no menu button over the chat box */
|
|
48
|
+
body.cz-kb .cz-fabw { display: none; }
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/* pm/cozy-live-pill.js — the Live pill beside the floating menu on every page (batch 6 item 2; canvas XrrABoard, XrrAHome, XrrAPhone,
|
|
2
|
+
* XrrAPhoneClosed, XrrAGrill). It replaces the recording pill (cozy-rec-pill.js): a recording is now its first row.
|
|
3
|
+
*
|
|
4
|
+
* Closed, it is one quiet pill with one mark per live item, in the list's order: a blue dot asks you, a ring is running, amber stopped,
|
|
5
|
+
* a check finished and not read yet; a recording leads with its red dot and clock (grey and still while paused). No counts and no words:
|
|
6
|
+
* its name says them (live-model.js pillLabel). A press, or Ctrl J (⌘J) on any page, opens one short list of the 5 or fewer things the
|
|
7
|
+
* PM touched last, newest first (a popover over the menu button on a desktop, a sheet on a phone). A row opens that chat on Home; on
|
|
8
|
+
* Home itself it opens in place (opts.go). While the list is open the rows keep their places: only a mark changes, with one info ripple.
|
|
9
|
+
* ↑ ↓ move, Enter opens, Esc closes, 1 to 5 open a row. Nothing live: no pill (zero is silence). On a phone it hides with the menu
|
|
10
|
+
* button while the keyboard is up.
|
|
11
|
+
*
|
|
12
|
+
* mountLivePill(doc = document, opts) once per page, after mountNav: the pill lives inside #czNav, so it hides whenever the menu hides
|
|
13
|
+
* opts.go(item) → true the page opens the item itself (Home: the session's chat, the meeting); else the row's link is followed
|
|
14
|
+
* opts.open() → id the session open on this page now: its row is tinted
|
|
15
|
+
* Reads GET /api/live every 10 s while the page is shown, and on the cz:live event (Home sends it after the PM opens or answers a
|
|
16
|
+
* session); the recording comes from pm/rec-state.js. Nothing is written. */
|
|
17
|
+
import { onRecording } from './rec-state.js';
|
|
18
|
+
import { liveItems, keepOrder, pillLabel, rowLabel, clock, elapsed } from './live-model.js';
|
|
19
|
+
|
|
20
|
+
const esc = (v) => String(v == null ? '' : v).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c]);
|
|
21
|
+
const SHEET = '/pm/cozy-live-pill.css';
|
|
22
|
+
const CHECK = '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg>';
|
|
23
|
+
const PHONE = '(max-width: 760px)';
|
|
24
|
+
const mac = () => { try { return /Mac|iPhone|iPad/.test(navigator.platform || navigator.userAgent || ''); } catch { return false; } };
|
|
25
|
+
const markHtml = (m, once) => (m === 'done' ? `<i class="lv-m done${once ? ' once' : ''}">${CHECK}</i>` : `<i class="lv-m ${m}${once ? ' once' : ''}"></i>`);
|
|
26
|
+
|
|
27
|
+
export function mountLivePill(doc = document, opts = {}) {
|
|
28
|
+
if (doc.getElementById('czLive')) return;
|
|
29
|
+
if (!doc.querySelector(`link[href="${SHEET}"]`)) { const l = doc.createElement('link'); l.rel = 'stylesheet'; l.href = SHEET; doc.head.appendChild(l); }
|
|
30
|
+
const L = { sessions: [], titles: {}, rec: null, open: false, shown: [], marks: new Map(), tick: null, tries: 0 };
|
|
31
|
+
let pill = null, tray = null, scrim = null;
|
|
32
|
+
const phone = () => typeof matchMedia === 'function' && matchMedia(PHONE).matches;
|
|
33
|
+
const place = () => {
|
|
34
|
+
const nav = doc.getElementById('czNav');
|
|
35
|
+
if (!nav) { if (L.tries++ < 50) setTimeout(place, 100); return false; }
|
|
36
|
+
pill = doc.createElement('button'); pill.type = 'button'; pill.id = 'czLive'; pill.className = 'cz-live'; pill.hidden = true;
|
|
37
|
+
pill.setAttribute('aria-expanded', 'false'); pill.setAttribute('aria-controls', 'czLiveList');
|
|
38
|
+
scrim = doc.createElement('div'); scrim.className = 'lv-scrim'; scrim.hidden = true;
|
|
39
|
+
tray = doc.createElement('div'); tray.id = 'czLiveList'; tray.className = 'lv-tray'; tray.hidden = true;
|
|
40
|
+
tray.setAttribute('role', 'dialog'); tray.setAttribute('aria-label', 'What you work on now');
|
|
41
|
+
nav.append(scrim, tray, pill);
|
|
42
|
+
pill.addEventListener('click', () => set(!L.open));
|
|
43
|
+
scrim.addEventListener('click', () => set(false));
|
|
44
|
+
tray.addEventListener('click', (e) => { const a = e.target.closest('a[data-lv]'); if (a) go(a, e); });
|
|
45
|
+
tray.addEventListener('keydown', keys);
|
|
46
|
+
draw();
|
|
47
|
+
return true;
|
|
48
|
+
};
|
|
49
|
+
const items = () => liveItems(L.sessions, { rec: L.rec, titles: L.titles, open: opts.open ? opts.open() : null });
|
|
50
|
+
function go(a, e) {
|
|
51
|
+
const x = L.shown.find((i) => i.id === a.dataset.lv);
|
|
52
|
+
if (x && opts.go && !(e && (e.metaKey || e.ctrlKey || e.shiftKey)) && opts.go(x)) { if (e) e.preventDefault(); set(false); return; }
|
|
53
|
+
set(false); // the link is followed
|
|
54
|
+
}
|
|
55
|
+
function rowsHtml(list) {
|
|
56
|
+
return list.map((x, i) => {
|
|
57
|
+
const was = L.marks.get(x.id), once = L.open && was && was !== x.mark;
|
|
58
|
+
return `<a class="lv-row${x.open ? ' cur' : ''}" href="${esc(x.href)}" data-lv="${esc(x.id)}" aria-label="${esc(rowLabel(x))}" aria-keyshortcuts="${i + 1}">`
|
|
59
|
+
+ `<span class="lv-mk">${x.kind === 'rec' ? `<i class="lv-m rec${x.paused ? ' paused' : ''}"></i>` : markHtml(x.mark, once)}</span>`
|
|
60
|
+
+ `<span class="lv-t">${esc(x.name)}<small>${esc(x.sub)}</small></span>`
|
|
61
|
+
+ `<span class="lv-tm${x.kind === 'rec' && !x.paused ? ' rec' : x.mark === 'stop' ? ' stop' : ''}">${esc(x.time)}</span></a>`;
|
|
62
|
+
}).join('');
|
|
63
|
+
}
|
|
64
|
+
function pillHtml(list) {
|
|
65
|
+
const r = list.find((x) => x.kind === 'rec'), rest = list.filter((x) => x.kind !== 'rec');
|
|
66
|
+
return (r ? `<span class="lv-g"><i class="lv-m rec${r.paused ? ' paused' : ''}"></i><span class="lv-tm${r.paused ? '' : ' rec'}">${esc(r.time)}</span></span>${rest.length ? '<span class="lv-sp"></span>' : ''}` : '')
|
|
67
|
+
+ (rest.length ? `<span class="lv-ms">${rest.map((x) => markHtml(x.mark, false)).join('')}</span>` : '');
|
|
68
|
+
}
|
|
69
|
+
function draw() {
|
|
70
|
+
if (!pill) return;
|
|
71
|
+
const now = items();
|
|
72
|
+
if (!now.length && !L.open) { pill.hidden = true; tray.hidden = true; scrim.hidden = true; return; }
|
|
73
|
+
const list = L.open ? keepOrder(L.shown, now) : now;
|
|
74
|
+
if (L.open && !list.length) { set(false); return; }
|
|
75
|
+
pill.hidden = !now.length && !L.open;
|
|
76
|
+
pill.classList.toggle('recp', now.some((x) => x.kind === 'rec' && !x.paused));
|
|
77
|
+
pill.setAttribute('aria-label', pillLabel(now, { mac: mac() }));
|
|
78
|
+
pill.title = 'Now ' + (mac() ? '⌘J' : 'Ctrl J');
|
|
79
|
+
pill.innerHTML = pillHtml(now);
|
|
80
|
+
if (L.open) {
|
|
81
|
+
const f = doc.activeElement && tray.contains(doc.activeElement) ? doc.activeElement.dataset.lv : null;
|
|
82
|
+
tray.innerHTML = rowsHtml(list);
|
|
83
|
+
if (f) { const a = [...tray.querySelectorAll('a[data-lv]')].find((n) => n.dataset.lv === f); if (a) a.focus(); }
|
|
84
|
+
L.shown = list;
|
|
85
|
+
}
|
|
86
|
+
L.marks = new Map(list.map((x) => [x.id, x.mark]));
|
|
87
|
+
tickRec(now);
|
|
88
|
+
}
|
|
89
|
+
function set(open) {
|
|
90
|
+
if (!pill) return;
|
|
91
|
+
if (open && !items().length) open = false;
|
|
92
|
+
L.open = open;
|
|
93
|
+
pill.setAttribute('aria-expanded', String(open)); pill.classList.toggle('open', open);
|
|
94
|
+
tray.classList.toggle('sheet', open && phone());
|
|
95
|
+
tray.hidden = !open; scrim.hidden = !(open && phone());
|
|
96
|
+
if (open) { L.shown = items(); L.marks = new Map(L.shown.map((x) => [x.id, x.mark])); tray.innerHTML = rowsHtml(L.shown); const a = tray.querySelector('a'); if (a) a.focus(); read(); }
|
|
97
|
+
else { L.shown = []; if (tray.contains(doc.activeElement)) pill.focus(); }
|
|
98
|
+
draw();
|
|
99
|
+
}
|
|
100
|
+
function keys(e) {
|
|
101
|
+
const rows = [...tray.querySelectorAll('a[data-lv]')], i = rows.indexOf(doc.activeElement);
|
|
102
|
+
const n = rows.length, down = e.key === 'ArrowDown';
|
|
103
|
+
if ((down || e.key === 'ArrowUp') && n) { e.preventDefault(); rows[i < 0 ? (down ? 0 : n - 1) : (i + (down ? 1 : n - 1)) % n].focus(); }
|
|
104
|
+
else if (/^[1-5]$/.test(e.key) && !e.ctrlKey && !e.metaKey && !e.altKey) { const a = rows[Number(e.key) - 1]; if (a) { e.preventDefault(); a.click(); } }
|
|
105
|
+
}
|
|
106
|
+
// the meeting clock ticks once a second while a recording runs; nothing else moves
|
|
107
|
+
function tickRec(list) {
|
|
108
|
+
const run = list.some((x) => x.kind === 'rec' && !x.paused);
|
|
109
|
+
if (run && !L.tick) L.tick = setInterval(() => { if (!doc.hidden) { const t = clock(elapsed(L.rec)); pill.querySelectorAll('.lv-g .lv-tm').forEach((n) => { n.textContent = t; }); const r = tray.querySelector('[data-lv^="rec:"] .lv-tm'); if (r) r.textContent = t; } }, 1000);
|
|
110
|
+
else if (!run && L.tick) { clearInterval(L.tick); L.tick = null; }
|
|
111
|
+
}
|
|
112
|
+
async function read() {
|
|
113
|
+
if (doc.hidden) return;
|
|
114
|
+
try {
|
|
115
|
+
const r = await fetch('/api/live', { credentials: 'same-origin' });
|
|
116
|
+
const j = r.ok ? await r.json() : null;
|
|
117
|
+
if (j && j.ok) { L.sessions = j.sessions || []; L.titles = j.titles || {}; draw(); }
|
|
118
|
+
} catch { /* the server is away: the pill keeps what it last read */ }
|
|
119
|
+
}
|
|
120
|
+
// Ctrl J (⌘J) opens and closes it from any page; Esc closes it. A terminal keeps its keys.
|
|
121
|
+
doc.addEventListener('keydown', (e) => {
|
|
122
|
+
if (e.key === 'Escape' && L.open) { e.preventDefault(); e.stopPropagation(); set(false); return; }
|
|
123
|
+
if (!((e.ctrlKey || e.metaKey) && !e.altKey && !e.shiftKey && (e.key === 'j' || e.key === 'J'))) return;
|
|
124
|
+
const t = e.target; if (t && t.closest && t.closest('.xterm')) return;
|
|
125
|
+
if (!pill || (pill.hidden && !L.open)) return;
|
|
126
|
+
e.preventDefault(); e.stopImmediatePropagation(); set(!L.open);
|
|
127
|
+
}, true);
|
|
128
|
+
doc.addEventListener('click', (e) => { if (L.open && e.target.isConnected && pill && !pill.contains(e.target) && !tray.contains(e.target)) set(false); });
|
|
129
|
+
// a phone: the pill hides with the menu button while the keyboard is up, so it never covers the chat box
|
|
130
|
+
const vv = typeof window !== 'undefined' ? window.visualViewport : null;
|
|
131
|
+
if (vv) {
|
|
132
|
+
const kb = () => { const a = doc.activeElement, typing = !!(a && a.matches && a.matches('input, textarea, [contenteditable="true"], [contenteditable=""]')); doc.body.classList.toggle('cz-kb', phone() && typing && window.innerHeight - vv.height > 150); };
|
|
133
|
+
vv.addEventListener('resize', kb); doc.addEventListener('focusin', kb); doc.addEventListener('focusout', () => setTimeout(kb, 50));
|
|
134
|
+
}
|
|
135
|
+
place();
|
|
136
|
+
onRecording((s) => { L.rec = s; draw(); });
|
|
137
|
+
read();
|
|
138
|
+
setInterval(read, 10000);
|
|
139
|
+
doc.addEventListener('visibilitychange', () => { if (!doc.hidden) read(); });
|
|
140
|
+
doc.addEventListener('cz:live', () => read());
|
|
141
|
+
}
|