create-pmos 0.325.0 → 0.327.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 +1 -1
- package/payload/KIT-VERSION +1 -1
- 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/workspace/guide/briefing-premium.md +10 -3
- package/workspace/lib/engine/boards.js +28 -1
- package/workspace/lib/routes-boards.js +2 -2
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-vw-backlog-test.js +127 -0
- package/workspace/premium-vw-doc-test.js +3 -1
- package/workspace/premium-vw-meet-test.js +4 -1
- package/workspace/premium-vw-rec-test.js +209 -0
- package/workspace/public/pm/premium-board.js +10 -0
- package/workspace/public/pm/premium-meeting.js +28 -5
- package/workspace/public/pm/premium-shell.js +8 -2
- package/workspace/public/pm/premium-vw-backlog.css +30 -0
- package/workspace/public/pm/premium-vw-backlog.js +91 -0
- package/workspace/public/pm/premium-vw-doc-model.js +3 -2
- package/workspace/public/pm/premium-vw-doc.css +1 -0
- package/workspace/public/pm/premium-vw-doc.js +7 -4
- package/workspace/public/pm/premium-vw-jira.js +3 -1
- package/workspace/public/pm/premium-vw-meet.css +4 -0
- package/workspace/public/pm/premium-vw-meet.js +29 -4
- package/workspace/public/pm/premium-vw-rec.css +75 -0
- package/workspace/public/pm/premium-vw-rec.js +257 -0
- package/workspace/test-files.json +2 -0
- package/workspace/test-lists/premium-viewer.json +4 -2
- package/workspace/test-lists/premium-vw-backlog.json +13 -0
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* Reads GET /api/jira/tickets and GET /api/boards/sprints only; the model is pm/premium-vw-jira-model.js. Read-only: Jira owns status, sprint and
|
|
7
7
|
* assignee (D88), so nothing here moves a ticket. With no Jira data a view says what is missing. */
|
|
8
8
|
import { vwOpen, vwStyle } from './premium-viewer.js';
|
|
9
|
+
import { openBacklog } from './premium-vw-backlog.js';
|
|
9
10
|
import { mdRender } from './markdown.js';
|
|
10
11
|
import { esc, toast } from './premium-shell.js';
|
|
11
12
|
import { ticketModel, sprintModel, readLine } from './premium-vw-jira-model.js';
|
|
@@ -86,7 +87,7 @@ function sprintHtml(m) {
|
|
|
86
87
|
return `<div class="jv">${bar(m.name, m)}${pick}
|
|
87
88
|
<div class="jsh"><div><h3>${esc(m.name)}${m.dates ? ` · ${esc(m.dates)}` : ''}</h3><p>${[m.goal ? 'Goal: ' + m.goal : 'No sprint goal on record', m.left || m.state].filter(Boolean).map(esc).join(' · ')}</p></div><span class="gap"></span>${pts}</div>
|
|
88
89
|
<div class="jbrd">${m.cols.map((c) => `<section class="jcol" aria-label="${esc(c.label)}, ${c.cards.length}"><div class="jcolh"><span>${esc(c.label)}</span><span>${c.cards.length}</span></div>${c.cards.map(card).join('') || '<p class="jnone">None</p>'}</section>`).join('')}</div>
|
|
89
|
-
<p class="jnote">Read-only: Jira owns each ticket's status and sprint, so move a ticket in Jira.${m.other ? ` ${m.other} ${m.other === 1 ? 'ticket is' : 'tickets are'} in this sprint but on no initiative of this board, so ${m.other === 1 ? 'it has' : 'they have'} no ticket here.` : ''} Tickets with no sprint are
|
|
90
|
+
<p class="jnote">Read-only: Jira owns each ticket's status and sprint, so move a ticket in Jira.${m.other ? ` ${m.other} ${m.other === 1 ? 'ticket is' : 'tickets are'} in this sprint but on no initiative of this board, so ${m.other === 1 ? 'it has' : 'they have'} no ticket here.` : ''} Tickets with no sprint are in the backlog. <button type="button" class="jbtn" data-jbl>Open the backlog</button></p></div>`;
|
|
90
91
|
}
|
|
91
92
|
|
|
92
93
|
/** The board's sprints as a board by status in one tab; name picks a sprint (default: the active one). */
|
|
@@ -101,6 +102,7 @@ export async function openSprint(o) {
|
|
|
101
102
|
el.innerHTML = sprintHtml(m); bars(el);
|
|
102
103
|
el.querySelectorAll('[data-sp]').forEach((b) => { b.onclick = () => { name = b.dataset.sp; draw(el); }; });
|
|
103
104
|
el.querySelectorAll('.jcrd[data-k]').forEach((b) => { b.onclick = () => openTicket({ ws, board, initiative: b.dataset.ini, ref: b.dataset.k }); });
|
|
105
|
+
const bl = el.querySelector('[data-jbl]'); if (bl) bl.onclick = () => openBacklog({ ws, board }); // the tickets in no sprint (premium-viewer R9)
|
|
104
106
|
const re = el.querySelector('[data-jre]'); if (re) re.onclick = async () => { await draw(el); toast('Read the cached Jira reading again. A Jira check reads Jira itself.'); };
|
|
105
107
|
};
|
|
106
108
|
return vwOpen({ id: 'sprint:' + (board || ''), title: 'Sprint', icon: 'list', render: (el) => { draw(el); } });
|
|
@@ -85,3 +85,7 @@
|
|
|
85
85
|
.vm .vm-tb td{border:0;padding:0}
|
|
86
86
|
.vm .vm-tb td:first-child,.vm .vm-tb td.w{grid-column:1/-1}
|
|
87
87
|
}
|
|
88
|
+
.vm .vm-bl{list-style:none;margin:0 0 8px;padding:0;display:grid;gap:6px}
|
|
89
|
+
.vm .vm-bi{display:flex;flex-wrap:wrap;align-items:baseline;gap:8px;color:var(--ink-2)}
|
|
90
|
+
.vm .vm-bi small{font-size:var(--fs-2);color:var(--ink-3)}
|
|
91
|
+
.vm .vm-tg.warn{color:var(--ember-ink)}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/* pm/premium-vw-meet.js — the meeting detail laid out as the console's note sheet (initiative premium-viewer, R3, slice S3).
|
|
2
2
|
* The meeting dialog (premium-meeting.js detailHtml) draws its first tab with these parts: a head with Before, During and After,
|
|
3
3
|
* the linked calendar event and what it is about, the series line (the meeting before and after, "N of M"), then
|
|
4
|
-
* Before the meeting
|
|
5
|
-
*
|
|
4
|
+
* Before the meeting prep the console's Calendar card shows (GET /api/meeting-focus brief: In short, What matters today,
|
|
5
|
+
* Since the last one, To be ready, links; prepHtml), the meeting context the note kept (agenda, heard or not; what it is
|
|
6
|
+
* for; to be ready; read first; people) and what was still open coming in from the meeting before (carried in)
|
|
6
7
|
* During the transcript the note holds
|
|
7
8
|
* After Since the last one (each next step of the meeting before: Done, Raised again or Not mentioned, then the new ones),
|
|
8
9
|
* the summary, Decision and Why, Next step with owner, due and Make task, open questions, the screenshots of the
|
|
@@ -113,7 +114,7 @@ export const PHASES = [['before', 'Before'], ['during', 'During'], ['after', 'Af
|
|
|
113
114
|
* note tab); a part may leave out wire. The meeting dialog draws its own calendar sections (Prepared for you, Material, Previous
|
|
114
115
|
* meetings, Topics) after the Before stage, and its replay-answer notes when there is no note. */
|
|
115
116
|
const STAGES = {
|
|
116
|
-
before: { html: (S, x) => beforeHtml(S, x.esc) },
|
|
117
|
+
before: { html: (S, x) => prepHtml(x.brief, S, x.esc) + beforeHtml(S, x.esc) },
|
|
117
118
|
during: { html: (S, x) => duringHtml(S, x.esc) },
|
|
118
119
|
after: { html: (S, x) => (S ? sinceHtml(S, x.esc) + notesHtml(S, x.esc, { tasked: x.tasked, replayBtn: x.replayBtn }) : '') },
|
|
119
120
|
};
|
|
@@ -126,7 +127,7 @@ export function wireStage(k, el, S, ctx) { const w = STAGES[k] && STAGES[k].wire
|
|
|
126
127
|
|
|
127
128
|
/* ── html, pure: each builder takes the sheet and esc ──────────────────────────────────────────────────────────────── */
|
|
128
129
|
|
|
129
|
-
const ICP = { cal: '<rect x="4" y="5" width="16" height="15" rx="3"/><path d="M4 10h16M9 3v4M15 3v4"/>', lay: '<rect x="4" y="4" width="16" height="16" rx="3"/><path d="M4 10h16M10 10v10"/>', notes: '<path d="M7 3h7l4 4v14H7zM14 3v4h4M10 12h5M10 16h4"/>', prev: '<path d="M15 6l-6 6 6 6"/>', next: '<path d="M9 6l6 6-6 6"/>', check: '<path d="M5 12.5l4.5 4.5L19 7.5"/>', plus: '<path d="M12 5v14M5 12h14"/>', todo: '<circle cx="12" cy="12" r="8"/>' };
|
|
130
|
+
const ICP = { cal: '<rect x="4" y="5" width="16" height="15" rx="3"/><path d="M4 10h16M9 3v4M15 3v4"/>', lay: '<rect x="4" y="4" width="16" height="16" rx="3"/><path d="M4 10h16M10 10v10"/>', notes: '<path d="M7 3h7l4 4v14H7zM14 3v4h4M10 12h5M10 16h4"/>', prev: '<path d="M15 6l-6 6 6 6"/>', next: '<path d="M9 6l6 6-6 6"/>', check: '<path d="M5 12.5l4.5 4.5L19 7.5"/>', spark: '<path d="M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z"/>', plus: '<path d="M12 5v14M5 12h14"/>', todo: '<circle cx="12" cy="12" r="8"/>' };
|
|
130
131
|
const ic = (k) => `<svg class="i" viewBox="0 0 24 24">${ICP[k]}</svg>`;
|
|
131
132
|
|
|
132
133
|
/** The Before, During and After switch. */
|
|
@@ -143,6 +144,30 @@ export function seriesHtml(S, esc) {
|
|
|
143
144
|
return '';
|
|
144
145
|
}
|
|
145
146
|
|
|
147
|
+
/** Before, the meeting prep: the brief GET /api/meeting-focus answers (lib/calendar-layers.js briefOf, the console Calendar card's brief).
|
|
148
|
+
* In short, What matters today (To settle in planning for a planning meeting), Since the last one with its decisions and From last
|
|
149
|
+
* time steps, To be ready, and the meeting's links. `B` is that brief, or null (the note tab, or a read that failed): then nothing.
|
|
150
|
+
* When the note already carries in the meeting before (beforeHtml), Since the last one is left to it; when the note's context has
|
|
151
|
+
* To be ready, it is not repeated. */
|
|
152
|
+
export function prepHtml(B, S, esc) {
|
|
153
|
+
if (!B) return '';
|
|
154
|
+
const h = [], li = (tag, text, meta, tone) => `<li class="vm-bi"><span class="vm-tg${tone ? ' ' + tone : ''}">${esc(tag)}</span><span>${esc(text)}</span>${meta ? `<small>${esc(meta)}</small>` : ''}</li>`;
|
|
155
|
+
if (B.gist && B.gist.length) h.push(`<h5>In short</h5><p>${esc(B.gist.join(' '))}</p>`);
|
|
156
|
+
if (B.matters && B.matters.length) h.push(`<h5>${B.planning ? 'To settle in planning' : 'What matters today'}</h5><ul class="vm-bl">${B.matters.map((x) => li(x.tag || 'Item', x.text, x.meta, x.tone === 'bad' || x.tone === 'warn' ? 'warn' : '')).join('')}</ul>`);
|
|
157
|
+
const L = B.last;
|
|
158
|
+
if (L && !(S && S.carriedIn)) {
|
|
159
|
+
const day = dayLabel(L.at);
|
|
160
|
+
const body = L.private ? `<p class="note">That note is private, so only its title shows: ${esc(L.title || 'Untitled note')}.</p>`
|
|
161
|
+
: (L.overview ? `<p>${esc(L.overview)}</p>` : '<p class="note">That note has no summary yet.</p>')
|
|
162
|
+
+ ((L.decisions || []).length || (L.actions || []).length ? `<ul class="vm-bl">${(L.decisions || []).map((t) => li('Decision', t)).join('')}${(L.actions || []).map((a) => li('From last time', a.text, [a.owner, a.due && 'due ' + a.due].filter(Boolean).join(' · '), 'warn')).join('')}</ul>` : '');
|
|
163
|
+
h.push(`<h5>Since the last one${day ? ` <small>${esc(day)}</small>` : ''}</h5>${body}${B.earlier > 1 ? `<p class="note">${B.earlier} earlier notes of this meeting.</p>` : ''}`);
|
|
164
|
+
}
|
|
165
|
+
if (B.prep && !(S && S.context && S.context.prep)) h.push(`<h5>To be ready</h5><p>${esc(B.prep)}</p>`);
|
|
166
|
+
const links = [...(B.links || []).filter((l) => l && /^https?:\/\//i.test(l.url)).map((l) => ({ label: l.label, url: l.url })), ...(B.refs || []).map((r) => ({ label: r.label + (r.source ? ' · ' + r.source : ''), url: /^https?:\/\//i.test(r.link || '') ? r.link : '' }))];
|
|
167
|
+
if (links.length) h.push(`<h5>Links</h5><div class="vm-row">${links.map((x) => x.url ? `<a class="vm-pill" href="${esc(x.url)}" target="_blank" rel="noopener noreferrer">${esc(x.label)}</a>` : `<span class="vm-pill">${esc(x.label)}</span>`).join('')}</div>`);
|
|
168
|
+
return h.length ? `<section class="vm-bx vm-prep" data-vm-prep>${'<div class="vm-cap">' + ic('spark') + 'Prepared for this meeting</div>'}${h.join('')}</section>` : '';
|
|
169
|
+
}
|
|
170
|
+
|
|
146
171
|
/** Before, from the note: the meeting context it kept and what was carried in from the meeting before. */
|
|
147
172
|
export function beforeHtml(S, esc) {
|
|
148
173
|
if (!S) return '';
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
:root{--fs-1:11px;--fs-2:12px;--fs-3:14px;--fs-4:16px;--fs-5:20px;--fs-6:28px}
|
|
2
|
+
/* pm/premium-vw-rec.css — note recording in the premium viewer (premium-viewer S4): the Record control, the Live notes tab and the Focus tab. Loaded by vwStyle('rec'). */
|
|
3
|
+
.recctl{position:relative;display:inline-flex;align-items:stretch;border-radius:8px;background:var(--solid);color:var(--on-solid);flex:none}
|
|
4
|
+
.recctl[hidden]{display:none}
|
|
5
|
+
.recb{display:inline-flex;align-items:center;gap:7px;min-height:44px;padding:0 14px;font-size:var(--fs-2);font-weight:600;color:inherit;border-radius:6px}
|
|
6
|
+
.recb .i{width:16px;height:16px}
|
|
7
|
+
.recb.arr{padding:0 10px;border-left:1px solid var(--hair)}
|
|
8
|
+
.recb:focus-visible{outline:2px solid var(--ink);outline-offset:2px}
|
|
9
|
+
.recm{position:absolute;right:0;top:calc(100% + 8px);z-index:40;width:min(320px,calc(100vw - 32px));padding:8px;border:1px solid var(--hair);border-radius:8px;background:var(--card-solid);box-shadow:var(--card-shadow);color:var(--ink)}
|
|
10
|
+
.recm[hidden]{display:none}
|
|
11
|
+
.recm .label{display:block;margin:4px 8px 6px}
|
|
12
|
+
.recm [role="menuitem"]{display:flex;align-items:center;gap:8px;width:100%;min-height:44px;padding:6px 10px;border-radius:6px;text-align:left;font-size:var(--fs-2);font-weight:500}
|
|
13
|
+
.recm [role="menuitem"] b{font-weight:600;flex:1 1 auto;min-width:0;overflow-wrap:anywhere}
|
|
14
|
+
.recm [role="menuitem"] small{color:var(--ink-3);font-size:var(--fs-1);white-space:nowrap}
|
|
15
|
+
.recm [role="menuitem"]:focus-visible{background:var(--well)}
|
|
16
|
+
@media (hover:hover){.recm [role="menuitem"]:hover{background:var(--well)}}
|
|
17
|
+
.recm [role="menuitem"][disabled]{opacity:.55}
|
|
18
|
+
.recm [role="menuitem"] .i{width:16px;height:16px}
|
|
19
|
+
.recm .note{margin:4px 8px 8px}
|
|
20
|
+
.recask{padding:6px}
|
|
21
|
+
.recask p{margin:0 0 8px;font-size:var(--fs-2)}
|
|
22
|
+
.recask div,.rvask div{display:flex;flex-wrap:wrap;gap:8px}
|
|
23
|
+
|
|
24
|
+
.rvw .rvt{margin:0 0 10px;font-size:var(--fs-4);font-weight:600}
|
|
25
|
+
.rvh{display:flex;align-items:center;flex-wrap:wrap;gap:8px;padding:10px 12px;border:1px solid var(--hair);border-radius:8px;background:var(--card-solid);box-shadow:var(--card-shadow)}
|
|
26
|
+
.rvh b{font-size:var(--fs-3);font-weight:600}
|
|
27
|
+
.rvsp{flex:1 1 auto}
|
|
28
|
+
.rvclk{font-family:var(--mono);font-size:var(--fs-2);color:var(--ink-2)}
|
|
29
|
+
.rvdot{width:9px;height:9px;border-radius:50%;background:var(--bad);animation:br 1.6s ease-in-out infinite}
|
|
30
|
+
.rvdot.paused{background:var(--ember);animation:none}
|
|
31
|
+
.rvb{display:inline-flex;align-items:center;gap:6px;min-height:44px;padding:0 13px;border-radius:6px;background:var(--well);font-size:var(--fs-2);font-weight:600;color:var(--ink)}
|
|
32
|
+
.rvb .i{width:15px;height:15px}
|
|
33
|
+
.rvb.cta{background:var(--solid);color:var(--on-solid)}
|
|
34
|
+
.rvb[aria-pressed="true"]{background:var(--solid);color:var(--on-solid)}
|
|
35
|
+
.rvb:disabled{opacity:.55}
|
|
36
|
+
.rvb:focus-visible{outline:2px solid var(--ink);outline-offset:2px}
|
|
37
|
+
.rvask{margin:10px 0 0;padding:12px 14px;border:1px solid var(--hair);border-radius:8px;background:var(--card-solid)}
|
|
38
|
+
.rvask p{margin:0 0 10px;font-size:var(--fs-2)}
|
|
39
|
+
.rvopts{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin:10px 0 0}
|
|
40
|
+
.rvsec{margin:16px 0 0}
|
|
41
|
+
.rvsec>.label{display:block;margin:0 0 6px}
|
|
42
|
+
.rvta{width:100%;box-sizing:border-box;min-height:96px;padding:10px 12px;border:1px solid var(--hair);border-radius:6px;background:var(--card-solid);color:var(--ink);font:inherit;font-size:var(--fs-3);resize:vertical}
|
|
43
|
+
.rvta:focus-visible{outline:2px solid var(--ink);outline-offset:1px}
|
|
44
|
+
.rvhl{list-style:none;margin:0;padding:0;display:grid;gap:6px}
|
|
45
|
+
.rvhl li{display:flex;gap:10px;align-items:baseline;padding:8px 10px;border-radius:8px;background:var(--well);font-size:var(--fs-2)}
|
|
46
|
+
.rvhl time,.rvtr time{font-family:var(--mono);font-size:var(--fs-1);color:var(--ink-3);flex:none}
|
|
47
|
+
.rvhl em{margin-left:auto;font-style:normal;font-size:var(--fs-1);color:var(--ink-3)}
|
|
48
|
+
.rvtr{max-height:340px;overflow-y:auto;display:grid;gap:6px;padding:2px}
|
|
49
|
+
.rvtr p{display:flex;gap:8px;align-items:baseline;margin:0;font-size:var(--fs-2);color:var(--ink-2)}
|
|
50
|
+
.rvtr p b{font-weight:600;color:var(--ink);flex:none}
|
|
51
|
+
.rvtr p.cur{color:var(--ink)}
|
|
52
|
+
|
|
53
|
+
.fvh{display:flex;align-items:baseline;flex-wrap:wrap;gap:10px;margin:0 0 12px}
|
|
54
|
+
.fvh b{font-size:var(--fs-4);font-weight:600}
|
|
55
|
+
.fvbar{display:flex;gap:3px;height:28px;margin:0 0 12px}
|
|
56
|
+
.fvbar span{flex:var(--fc-flex,1);display:grid;place-items:center;min-width:18px;border-radius:6px;background:var(--well);font-size:var(--fs-1);font-weight:600;color:var(--ink-2)}
|
|
57
|
+
.fvbar span.on{background:var(--solid);color:var(--on-solid)}
|
|
58
|
+
.fvnow{padding:12px 14px;border:1px solid var(--hair);border-radius:8px;background:var(--card-solid);box-shadow:var(--card-shadow)}
|
|
59
|
+
.fvnow b{display:block;font-size:var(--fs-4);font-weight:600}
|
|
60
|
+
.fvnow p{margin:6px 0 0;font-size:var(--fs-3);color:var(--ink-2)}
|
|
61
|
+
.fvg{display:grid;grid-template-columns:1fr 1fr;gap:16px}
|
|
62
|
+
.fvtp{margin:0;padding-left:20px;display:grid;gap:4px;font-size:var(--fs-2)}
|
|
63
|
+
.fvtp li{color:var(--ink-2)}
|
|
64
|
+
.fvtp li.now{color:var(--ink);font-weight:600}
|
|
65
|
+
.fvtp small{margin-left:6px;color:var(--ink-3);font-size:var(--fs-1)}
|
|
66
|
+
.fvcap{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
|
|
67
|
+
.fvcap div{padding:8px 10px;border-radius:8px;background:var(--well)}
|
|
68
|
+
.fvcap b{display:block;font-size:var(--fs-4);font-weight:600}
|
|
69
|
+
.fvcap span{font-size:var(--fs-1);color:var(--ink-3)}
|
|
70
|
+
.fvst{list-style:none;margin:0;padding:0;display:grid;gap:8px}
|
|
71
|
+
.fvst li{display:flex;align-items:center;flex-wrap:wrap;gap:8px;padding:8px 10px;border:1px solid var(--hair);border-radius:8px}
|
|
72
|
+
.fvst li>span{flex:1 1 12em;min-width:0}
|
|
73
|
+
.fvst b{display:block;font-weight:600;font-size:var(--fs-2);overflow-wrap:anywhere}
|
|
74
|
+
.fvst small{font-size:var(--fs-1);color:var(--ink-3)}
|
|
75
|
+
@media (max-width:700px){.fvg{grid-template-columns:1fr}.recb span{display:none}}
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
/* pm/premium-vw-rec.js — note recording in the premium viewer (initiative premium-viewer, S4; the prototype Wawan approved on 2026-10-19).
|
|
2
|
+
* The Briefing holds the recorder (PR 826), so the Record control is on the Briefing only: Record starts an untitled note at once, the arrow lists today's meetings
|
|
3
|
+
* (of today, not ended more than 10 minutes ago). While a note records, the chip has Highlight, Pause, Focus and Stop; other pages show its state with Open and Stop.
|
|
4
|
+
* The note being recorded opens as a viewer tab beside the dialog's detail: the During capture (state, Highlight, Pause or Resume, Stop, Private, your notes, the
|
|
5
|
+
* highlights and the transcript). Focus opens as a second tab: the meeting as it is now, with Present and Audience view on a deck or Google Slides in its material.
|
|
6
|
+
* renderDuring(el, id, d) → draws the During capture of note `id` into `el` and reads it again every 3 s while `el` is shown. The notes view calls it.
|
|
7
|
+
* openLive(id, d) · openFocus(id, d) · mountRecord(here, d) d = { openDlg, toast, pmGet, pmPost } from premium-shell.js
|
|
8
|
+
* Reads GET /api/notes/one, GET /api/meeting-focus. Writes through window.__premiumRec (premium-meeting.js: the console's recorder) and POST /api/notes/save,
|
|
9
|
+
* /api/notes/private. The pure half (menuView, duringView, chipActs, focusPath) takes the routes' answers, so a test reads it without a DOM. */
|
|
10
|
+
import { vwOpen, vwStyle, vwConfirm, vwState } from './premium-viewer.js';
|
|
11
|
+
import { recordable, focusView, mmss, CONSENT_LINE, STOP_LINE, RECORD_LINE, FOCUS_LINE } from './premium-meeting.js';
|
|
12
|
+
|
|
13
|
+
const clip = (s, n) => { const t = String(s == null ? '' : s).replace(/\s+/g, ' ').trim(); return t.length > n ? t.slice(0, n - 1).trimEnd() + '…' : t; };
|
|
14
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"]/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"' }[c]));
|
|
15
|
+
const hhmm = (s) => (typeof s === 'string' && /T\d{2}:\d{2}/.test(s) ? s.slice(11, 16) : '');
|
|
16
|
+
const SPEAKER = { mic: 'You', system: 'Them', tab: 'Them' };
|
|
17
|
+
export const NEW_LINE = 'Starts an untitled note now and listens to your microphone and the meeting’s sound. The audio and the notes stay on this machine.';
|
|
18
|
+
export const PRIVATE_LINE = 'A private note keeps only what you type. Its audio, transcript and screen shots are deleted now and none are kept while it stays private.';
|
|
19
|
+
export const HL_LINE = 'Keeps the last 30 seconds and the next ones as a highlight, written from the transcript when the window closes.';
|
|
20
|
+
|
|
21
|
+
/* ── the pure half ─────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
22
|
+
|
|
23
|
+
/** The Record menu: today's meetings that can still be recorded, each with the mark its note has. `busy` when a note records, so nothing new can start. */
|
|
24
|
+
export function menuView(rows, notes, now = Date.now()) {
|
|
25
|
+
const live = (Array.isArray(notes) ? notes : []).filter((n) => n && (n.state === 'recording' || n.state === 'paused'));
|
|
26
|
+
const items = (Array.isArray(rows) ? rows : []).filter((r) => r && recordable(r, now)).map((r, i) => {
|
|
27
|
+
const n = live.find((x) => x.meeting && x.meeting.kind === 'event' && ((x.meeting.event_id && x.meeting.event_id === r.id) || (Date.parse(x.meeting.start) === Date.parse(r.at) && clip(x.meeting.title, 120).toLowerCase() === clip(r.title, 120).toLowerCase())));
|
|
28
|
+
const at = Date.parse(r.at), end = Date.parse(r.end);
|
|
29
|
+
return { i, title: clip(r.title, 80), time: hhmm(r.at) + (hhmm(r.end) ? '–' + hhmm(r.end) : ''), mark: n ? (n.state === 'recording' ? 'Recording' : 'Paused') : now >= at && (!Number.isFinite(end) || now <= end) ? 'Now' : '' };
|
|
30
|
+
});
|
|
31
|
+
return { items, busy: live.some((n) => n.state === 'recording') };
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** The During capture from GET /api/notes/one (or its error). `held` is true when this page's recorder listens to the note. Nothing is invented: a part the note does not hold is empty. */
|
|
35
|
+
export function duringView(r, { held = false } = {}) {
|
|
36
|
+
if (!r || r.ok !== true || !r.note) return { state: 'error', reason: clip((r && r.error) || 'The note could not be read.', 160) };
|
|
37
|
+
const n = r.note, st = n.state;
|
|
38
|
+
const mode = st === 'recording' ? (held ? 'recording' : 'stale') : st === 'paused' ? 'paused' : st === 'ended' ? 'ended' : 'idle';
|
|
39
|
+
const who = (src) => clip((n.speakers && n.speakers[src]) || SPEAKER[src] || 'You', 40);
|
|
40
|
+
const lines = (Array.isArray(n.transcript) ? n.transcript : []).filter((x) => x && !x.dropped && x.text).slice(-40).map((x) => ({ who: who(x.source), t: Number(x.t) || 0, time: mmss(x.t), text: clip(x.text, 400) }));
|
|
41
|
+
const highlights = (Array.isArray(n.highlights) ? n.highlights : []).filter((h) => h && h.text).map((h) => ({ id: h.id, text: clip(h.text, 300), time: mmss(h.from), cat: h.cat || '' }));
|
|
42
|
+
const shots = r.screen && Array.isArray(r.screen.frames) ? r.screen.frames.length : 0;
|
|
43
|
+
return { state: 'ok', id: n.id, title: clip(n.title || (n.meeting && n.meeting.title) || 'Untitled note', 120), mode, private: !!n.private, body: String(n.body || ''), lines, highlights, shots,
|
|
44
|
+
until: hhmm(n.resume_until), event: !!(n.meeting && n.meeting.kind === 'event' && n.meeting.event_id) };
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** The presses the chip shows. `v` is recChipView's answer; `here` is the page ('brief' holds the recorder). Other pages say what records with Open and Stop. */
|
|
48
|
+
export function chipActs(v, here) {
|
|
49
|
+
if (!v) return [];
|
|
50
|
+
if (here !== 'brief') return ['open', 'stop'];
|
|
51
|
+
if (v.mode === 'recording' && v.held) return ['hl', 'pause', 'fv', 'open', 'stop'];
|
|
52
|
+
return ['open', ...(v.canResume ? ['resume'] : []), 'stop'];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** The Focus read of a note: its calendar event and day. null when the note is not linked to an event, because Focus reads a meeting. */
|
|
56
|
+
export function focusPath(note) {
|
|
57
|
+
const m = note && note.meeting;
|
|
58
|
+
if (!m || m.kind !== 'event' || !m.event_id || !/T\d{2}:\d{2}/.test(String(m.start || ''))) return null;
|
|
59
|
+
return '/api/meeting-focus?event=' + encodeURIComponent(m.event_id) + '&date=' + String(m.start).slice(0, 10);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** The material Focus can put on the stage: a PMOS deck (Present, Audience view) or Google Slides (Present); a link opens in a new tab. */
|
|
63
|
+
export function stageOf(material) {
|
|
64
|
+
return (Array.isArray(material) ? material : []).map((m, i) => ({ i, title: clip(m.title || m.ref || m.url, 100), kind: m.kind || '', topic: clip(m.topic, 60),
|
|
65
|
+
present: m.kind === 'pmos-deck' || m.kind === 'slides', audience: m.kind === 'pmos-deck', url: /^https:\/\//.test(String(m.url || '')) ? m.url : '' })).filter((x) => x.title);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/* ── the DOM half ──────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
69
|
+
const $ = (s, r = document) => r.querySelector(s);
|
|
70
|
+
const REC = () => (typeof window !== 'undefined' && window.__premiumRec) || null;
|
|
71
|
+
const holding = () => (typeof window !== 'undefined' && window.__premiumHolding && window.__premiumHolding.id) || null;
|
|
72
|
+
const ICO = {
|
|
73
|
+
mic: '<rect x="9" y="3" width="6" height="11" rx="3"/><path d="M5 11a7 7 0 0 0 14 0M12 18v3"/>', chev: '<path d="m6 9 6 6 6-6"/>', flag: '<path d="M5 21V4h11l-1.5 4L16 12H5"/>',
|
|
74
|
+
pause: '<path d="M8 5v14M16 5v14"/>', stop: '<rect x="6" y="6" width="12" height="12" rx="2"/>', play: '<path d="M7 5v14l11-7z"/>', lock: '<rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V8a4 4 0 0 1 8 0v3"/>',
|
|
75
|
+
focus: '<path d="M4 8V4h4M16 4h4v4M20 16v4h-4M8 20H4v-4"/><circle cx="12" cy="12" r="3"/>', plus: '<path d="M12 5v14M5 12h14"/>',
|
|
76
|
+
};
|
|
77
|
+
const ic = (k) => `<svg class="i" viewBox="0 0 24 24" aria-hidden="true">${ICO[k]}</svg>`;
|
|
78
|
+
const fail = (d, res, what) => d.toast((res && res.error) || what);
|
|
79
|
+
|
|
80
|
+
/** The dialog the tabs sit in: the open one, else the meeting's dialog on the Briefing, else a dialog of the note's own. */
|
|
81
|
+
async function ensureDialog(id, d) {
|
|
82
|
+
if ($('#dlg') && $('#dlg').classList.contains('on')) return true;
|
|
83
|
+
const rec = REC(), n = rec ? rec.note(id) : null;
|
|
84
|
+
if (rec && n && n.meeting && n.meeting.kind === 'event') { await rec.open(id); if ($('#dlg').classList.contains('on')) return true; }
|
|
85
|
+
if (!d.openDlg) return false;
|
|
86
|
+
d.openDlg({ eye: 'Note', title: clip((n && n.title) || 'Untitled note', 120), label: 'Note',
|
|
87
|
+
say: 'This note is not linked to a meeting in this week’s calendar. What it holds shows in the Live notes tab.', html: '<p class="note">The note has no meeting. Its live notes are in the next tab.</p>' });
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export async function openLive(id, d) {
|
|
92
|
+
if (!id || !(await ensureDialog(id, d))) return null;
|
|
93
|
+
vwStyle('rec');
|
|
94
|
+
return vwOpen({ id: 'rec:' + id, title: 'Live notes', icon: 'mic', render: (el) => renderDuring(el, id, d) });
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** The During capture of one note. The notes view (thread "Viewer: notes") calls this for its During part; openLive puts it in a tab of its own. */
|
|
98
|
+
export function renderDuring(el, id, d) {
|
|
99
|
+
vwStyle('rec');
|
|
100
|
+
const ui = { v: null, ask: '', draft: null, saving: false };
|
|
101
|
+
let timer = null;
|
|
102
|
+
const read = async () => {
|
|
103
|
+
const r = await d.pmGet('/api/notes/one?id=' + encodeURIComponent(id));
|
|
104
|
+
ui.v = duringView(r, { held: holding() === id });
|
|
105
|
+
};
|
|
106
|
+
const clock = () => { const rec = REC(), t = rec && holding() === id ? rec.started() : null; return Number.isFinite(t) ? mmss(Date.now() - t) : ''; };
|
|
107
|
+
const draw = () => {
|
|
108
|
+
const v = ui.v;
|
|
109
|
+
if (!v) { el.innerHTML = '<article class="paper doc rvw"><p class="note" role="status">Reading the note.</p></article>'; return; }
|
|
110
|
+
if (v.state === 'error') { el.innerHTML = `<article class="paper doc rvw"><p class="note" role="status">The note could not be read: ${esc(v.reason)}</p></article>`; return; }
|
|
111
|
+
const b = (a, label, icon, cls) => `<button type="button" class="rvb${cls ? ' ' + cls : ''}" data-rv="${a}">${icon ? ic(icon) : ''}${label}</button>`;
|
|
112
|
+
const hl = REC() && REC().highlighting ? REC().highlighting() : null;
|
|
113
|
+
let head = '';
|
|
114
|
+
if (v.mode === 'recording') head = `<div class="rvh"><span class="rvdot" aria-hidden="true"></span><b>Recording</b><span class="rvclk" data-rv-clock>${esc(clock())}</span><span class="rvsp"></span>${b('hl', hl && hl.state === 'listening' ? 'Highlighting' : 'Highlight', 'flag')}${b('pause', 'Pause', 'pause')}${b('stop', 'Stop', 'stop', 'cta')}</div>`;
|
|
115
|
+
else if (v.mode === 'paused') head = `<div class="rvh"><span class="rvdot paused" aria-hidden="true"></span><b>Paused</b>${v.until ? `<span class="note">Open until ${esc(v.until)}</span>` : ''}<span class="rvsp"></span>${b('resume', 'Resume', 'play')}${b('stop', 'Stop', 'stop', 'cta')}</div>`;
|
|
116
|
+
else if (v.mode === 'stale') head = `<div class="rvh"><b>Marked recording</b><span class="rvsp"></span>${b('resume', 'Resume', 'play')}${b('stop', 'Stop', 'stop', 'cta')}</div><p class="note">The server holds this note as recording, but this page is not capturing audio. Resume starts listening again.</p>`;
|
|
117
|
+
else if (v.mode === 'ended') head = '<div class="rvh"><b>Ended</b></div><p class="note">The recording has ended. A stopped meeting cannot be recorded again. Its notes are in the meeting’s After part.</p>';
|
|
118
|
+
else head = '<div class="rvh"><b>Not recording</b></div>';
|
|
119
|
+
const ask = ui.ask === 'stop' ? `<div class="rvask" role="alert"><p><b>Stop “${esc(clip(v.title, 60))}” for good?</b> ${esc(STOP_LINE)}</p><div>${b('stopno', 'Cancel')}${v.mode === 'recording' ? b('pause', 'Pause instead') : ''}${b('stopgo', 'Stop for good', '', 'cta')}</div></div>` : '';
|
|
120
|
+
const opts = v.mode === 'ended' ? '' : `<div class="rvopts">${v.event ? b('fv', 'Focus', 'focus') : ''}<button type="button" class="rvb" data-rv="private" aria-pressed="${v.private}" title="${esc(PRIVATE_LINE)}">${ic('lock')}Private</button>${v.shots ? `<span class="note">${v.shots} screen ${v.shots === 1 ? 'shot' : 'shots'} kept</span>` : ''}</div>`;
|
|
121
|
+
const body = ui.draft == null ? v.body : ui.draft;
|
|
122
|
+
const mine = `<section class="rvsec"><label class="label" for="rvMine">Your notes</label><textarea id="rvMine" class="rvta" rows="4" placeholder="Type a line. Each line keeps the time it was written." data-rv-mine>${esc(body)}</textarea><p class="note" data-rv-saved>${ui.saving ? 'Saving.' : 'Saved on this machine when you leave the box.'}</p></section>`;
|
|
123
|
+
const hls = v.highlights.length ? `<section class="rvsec"><span class="label">Highlights</span><ul class="rvhl">${v.highlights.map((h) => `<li><time>${esc(h.time)}</time><span>${esc(h.text)}</span>${h.cat ? `<em>${esc(h.cat)}</em>` : ''}</li>`).join('')}</ul></section>` : '';
|
|
124
|
+
const tr = v.private ? '<p class="note">This note is private, so it keeps no transcript.</p>' : v.lines.length ? `<div class="rvtr" data-rv-tr>${v.lines.map((l, i) => `<p${i === v.lines.length - 1 ? ' class="cur"' : ''}><time>${esc(l.time)}</time><b>${esc(l.who)}</b><span>${esc(l.text)}</span></p>`).join('')}</div>` : `<p class="note">${v.mode === 'recording' ? 'Nothing has been heard yet.' : 'The transcript starts when the note records.'}</p>`;
|
|
125
|
+
const keep = el.querySelector('[data-rv-mine]') === document.activeElement;
|
|
126
|
+
el.innerHTML = `<article class="paper doc rvw"><h3 class="rvt">${esc(v.title)}</h3>${head}${ask}${opts}${mine}${hls}<section class="rvsec"><span class="label">${v.mode === 'recording' ? 'Live transcript' : 'Transcript'}</span>${tr}</section></article>`;
|
|
127
|
+
if (keep) { const t = el.querySelector('[data-rv-mine]'); t.focus(); t.setSelectionRange(t.value.length, t.value.length); }
|
|
128
|
+
const t = el.querySelector('[data-rv-tr]'); if (t) t.scrollTop = t.scrollHeight;
|
|
129
|
+
};
|
|
130
|
+
const loop = async () => {
|
|
131
|
+
clearTimeout(timer);
|
|
132
|
+
if (!el.isConnected) return;
|
|
133
|
+
if (!el.hidden) { await read(); if (!el.isConnected) return; if (el.querySelector('[data-rv-mine]') !== document.activeElement || !el.querySelector('.rvh')) draw(); }
|
|
134
|
+
timer = setTimeout(loop, 3000);
|
|
135
|
+
};
|
|
136
|
+
const tick = setInterval(() => { if (!el.isConnected) { clearInterval(tick); return; } const c = el.querySelector('[data-rv-clock]'); if (c) c.textContent = clock(); }, 1000);
|
|
137
|
+
const save = async () => {
|
|
138
|
+
if (ui.draft == null || !ui.v || ui.v.state !== 'ok' || ui.draft === ui.v.body) { ui.draft = null; return; }
|
|
139
|
+
ui.saving = true; const res = await d.pmPost('/api/notes/save', { id, body: ui.draft }); ui.saving = false;
|
|
140
|
+
if (!res || res.ok !== true) { fail(d, res, 'Your notes were not saved.'); return; }
|
|
141
|
+
ui.draft = null; await read(); draw();
|
|
142
|
+
};
|
|
143
|
+
el.addEventListener('input', (e) => { if (e.target.matches('[data-rv-mine]')) ui.draft = e.target.value; });
|
|
144
|
+
el.addEventListener('focusout', (e) => { if (e.target.matches('[data-rv-mine]')) save(); });
|
|
145
|
+
el.onclick = async (e) => { // delegated to the presses of the capture
|
|
146
|
+
const t = e.target.closest('[data-rv]'); if (!t) return;
|
|
147
|
+
const rec = REC(), a = t.dataset.rv; let res = null;
|
|
148
|
+
if (a === 'stop') { ui.ask = 'stop'; draw(); const g = el.querySelector('[data-rv="stopno"]'); if (g) g.focus(); return; }
|
|
149
|
+
if (a === 'stopno') { ui.ask = ''; draw(); return; }
|
|
150
|
+
if (a === 'fv') { openFocus(id, d); return; }
|
|
151
|
+
if (!rec) { d.toast('Recording is held by the Briefing. Open it there.'); return; }
|
|
152
|
+
t.disabled = true;
|
|
153
|
+
if (a === 'hl') { res = await rec.highlight(); if (res.ok) d.toast('Highlighting. ' + HL_LINE); }
|
|
154
|
+
else if (a === 'pause') { ui.ask = ''; res = await rec.pause(); if (res.ok) d.toast('Paused. You can resume within 1 hour.'); }
|
|
155
|
+
else if (a === 'resume') { res = await rec.resume(id); if (res.ok) d.toast('Resumed. Let people know.'); }
|
|
156
|
+
else if (a === 'stopgo') { ui.ask = ''; res = await rec.stop(id); if (res.ok) d.toast(res.discarded ? 'Nothing was recorded, so the note was deleted.' : 'Stopped for good. The final notes are written now.'); }
|
|
157
|
+
else if (a === 'private') {
|
|
158
|
+
const on = !(ui.v && ui.v.private);
|
|
159
|
+
if (on && !(await vwConfirm(el, { text: PRIVATE_LINE, yes: 'Make it private', no: 'Cancel' }))) { t.disabled = false; return; }
|
|
160
|
+
res = await d.pmPost('/api/notes/private', { id, private: on });
|
|
161
|
+
}
|
|
162
|
+
if (res && res.ok !== true) fail(d, res, 'That did not work.');
|
|
163
|
+
await read(); draw();
|
|
164
|
+
};
|
|
165
|
+
draw(); loop();
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/** Focus: the meeting as it is now, read every 3 s while its tab is shown (GET /api/meeting-focus), with the material on a stage. */
|
|
169
|
+
export async function openFocus(id, d) {
|
|
170
|
+
if (!id || !(await ensureDialog(id, d))) return null;
|
|
171
|
+
vwStyle('rec');
|
|
172
|
+
if (!vwState().ids.includes('rec:' + id)) vwOpen({ id: 'rec:' + id, title: 'Live notes', icon: 'mic', render: (el) => renderDuring(el, id, d) }); // Focus sits beside the note's live notes
|
|
173
|
+
return vwOpen({ id: 'focus:' + id, title: 'Focus', icon: 'list', render: (el) => renderFocus(el, id, d) });
|
|
174
|
+
}
|
|
175
|
+
function renderFocus(el, id, d) {
|
|
176
|
+
let F = null, stage = [], timer = null, path = null, note = null;
|
|
177
|
+
const draw = () => {
|
|
178
|
+
const head = `<div class="fvh"><b>${esc(clip((note && note.title) || 'Focus', 80))}</b><span class="note">${esc(F && F.state === 'ok' ? F.status : path ? 'Reading the meeting' : '')}</span></div>`;
|
|
179
|
+
if (!path) { el.innerHTML = `<article class="paper doc rvw">${head}<p class="note">Focus reads a meeting from the calendar. This note is not linked to a calendar event.</p></article>`; return; }
|
|
180
|
+
if (!F) { el.innerHTML = `<article class="paper doc rvw">${head}<p class="note">${esc(FOCUS_LINE)}</p></article>`; return; }
|
|
181
|
+
if (F.state === 'error') { el.innerHTML = `<article class="paper doc rvw">${head}<p class="note" role="status">Focus could not read this meeting: ${esc(F.reason)}</p></article>`; return; }
|
|
182
|
+
const nowT = F.phase === 'before' ? F.topics[0] : F.current;
|
|
183
|
+
let h = head;
|
|
184
|
+
if (F.stretches.length) h += `<div class="fvbar" role="img" aria-label="What the room talked about, in order. Numbers match the topic list.">${F.stretches.map((x) => `<span class="${x.on ? 'on' : ''}" data-flex="${x.flex}" title="${esc(x.text)}">${x.n}</span>`).join('')}</div>`;
|
|
185
|
+
h += `<div class="fvnow"><span class="label">${F.phase === 'before' ? 'First up' : 'Now'}</span><b>${esc(nowT ? nowT.text : 'No topic is current yet')}</b>${F.gist ? `<p>${esc(F.gist)}</p>` : ''}</div>`;
|
|
186
|
+
h += `<div class="fvg"><section class="rvsec"><span class="label">Topics</span>${F.topics.length ? `<ol class="fvtp">${F.topics.map((t) => `<li class="${t.state}"><span>${esc(t.text)}</span><small>${t.state === 'now' ? 'now' : t.state === 'done' ? (t.minutes ? t.minutes + ' min' : 'done') : t.state === 'parked' ? 'parked' : 'planned'}</small></li>`).join('')}</ol>` : '<p class="note">The meeting has no topics yet.</p>'}</section>`;
|
|
187
|
+
h += `<section class="rvsec"><span class="label">Captured so far</span>${F.rec || F.paused || F.phase === 'done' ? `<div class="fvcap"><div><b>${F.captured.decisions}</b><span>Decisions</span></div><div><b>${F.captured.actions}</b><span>Next steps</span></div><div><b>${F.captured.questions}</b><span>Questions</span></div></div>` : '<p class="note">Counts start when the note records.</p>'}</section></div>`;
|
|
188
|
+
h += `<section class="rvsec"><span class="label">${F.rec ? 'What is being said' : 'Transcript'}</span>${F.tail.length ? `<div class="rvtr">${F.tail.map((l, i) => `<p${i === F.tail.length - 1 ? ' class="cur"' : ''}><b>${esc(l.who)}</b><span>${esc(l.text)}</span></p>`).join('')}</div>` : `<p class="note">${F.rec ? 'Nothing has been said yet.' : 'The transcript starts when you record.'}</p>`}</section>`;
|
|
189
|
+
h += `<section class="rvsec"><span class="label">Material</span>${stage.length ? `<ul class="fvst">${stage.map((m) => `<li><span><b>${esc(m.title)}</b><small>${esc([m.kind, m.topic ? 'on ' + m.topic : ''].filter(Boolean).join(' · '))}</small></span>${m.present ? `<button type="button" class="rvb cta" data-fv="present" data-i="${m.i}">${ic('play')}Present</button>` : ''}${m.audience ? `<button type="button" class="rvb" data-fv="aud" data-i="${m.i}">Audience view</button>` : ''}${!m.present && m.url ? `<button type="button" class="rvb" data-fv="open" data-i="${m.i}">Open</button>` : ''}</li>`).join('')}</ul>` : '<p class="note">No material linked. Add some from the meeting.</p>'}</section>`;
|
|
190
|
+
if (F.companion) h += `<p class="note">${esc(F.companion)}</p>`;
|
|
191
|
+
el.innerHTML = `<article class="paper doc rvw">${h}</article>`;
|
|
192
|
+
el.querySelectorAll('.fvbar [data-flex]').forEach((x) => x.style.setProperty('--fc-flex', x.dataset.flex)); // run-time geometry: each stretch is as long as its talk
|
|
193
|
+
};
|
|
194
|
+
const loop = async () => {
|
|
195
|
+
clearTimeout(timer);
|
|
196
|
+
if (!el.isConnected) return;
|
|
197
|
+
if (!el.hidden) {
|
|
198
|
+
if (!note) { const one = await d.pmGet('/api/notes/one?id=' + encodeURIComponent(id)); note = one && one.ok ? one.note : null; path = focusPath(note); }
|
|
199
|
+
if (path) { const r = await d.pmGet(path); F = focusView(r); stage = stageOf(r && r.ok ? r.material : []); }
|
|
200
|
+
if (!el.isConnected) return;
|
|
201
|
+
draw();
|
|
202
|
+
if (!path) return;
|
|
203
|
+
}
|
|
204
|
+
timer = setTimeout(loop, 3000);
|
|
205
|
+
};
|
|
206
|
+
el.onclick = async (e) => { // delegated to Present, Audience view and Open
|
|
207
|
+
const t = e.target.closest('[data-fv]'); if (!t) return;
|
|
208
|
+
const r = F && F.state === 'ok' ? await d.pmGet(path) : null, raw = r && r.ok && Array.isArray(r.material) ? r.material[+t.dataset.i] : null, m = stage[+t.dataset.i];
|
|
209
|
+
if (!m) return;
|
|
210
|
+
if (t.dataset.fv === 'open') { window.open(m.url, '_blank', 'noopener'); return; }
|
|
211
|
+
const C = await import('./c3-material.js'); // the console's presenter: a PMOS deck in the presenter view, Google Slides in present mode
|
|
212
|
+
if (t.dataset.fv === 'present') C.presentItem(raw); else C.audienceItem(raw);
|
|
213
|
+
};
|
|
214
|
+
draw(); loop();
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/** The Record control on the Briefing's top bar: Record (a new note now) and an arrow with today's meetings. Each start asks "Tell everyone first" once. */
|
|
218
|
+
export function mountRecord(here, d) {
|
|
219
|
+
if (here !== 'brief' || $('#recCtl')) return;
|
|
220
|
+
const at = $('.tools-top'); if (!at) return;
|
|
221
|
+
vwStyle('rec');
|
|
222
|
+
const w = document.createElement('div'); w.id = 'recCtl'; w.className = 'recctl';
|
|
223
|
+
w.innerHTML = `<button type="button" class="recb" data-rc="new" aria-label="Record a new note" title="${esc(NEW_LINE)}">${ic('mic')}<span>Record</span></button><button type="button" class="recb arr" data-rc="menu" aria-haspopup="menu" aria-expanded="false" aria-label="Record a meeting of today">${ic('chev')}</button><div class="recm" role="menu" hidden></div>`;
|
|
224
|
+
at.prepend(w);
|
|
225
|
+
const menu = $('.recm', w), arr = $('[data-rc="menu"]', w);
|
|
226
|
+
let rows = [], told = false, pend = null;
|
|
227
|
+
const close = () => { menu.hidden = true; arr.setAttribute('aria-expanded', 'false'); };
|
|
228
|
+
const consent = (what) => { pend = what; menu.innerHTML = `<div class="recask" role="alert"><p><b>Tell everyone first.</b> ${esc(CONSENT_LINE.replace('Tell everyone first. ', ''))}</p><p class="note">${esc(what === 'new' ? NEW_LINE : RECORD_LINE)}</p><div><button type="button" class="rvb cta" data-rc="go">I told them, start</button><button type="button" class="rvb" data-rc="no">Not yet</button></div></div>`; menu.hidden = false; arr.setAttribute('aria-expanded', 'true'); const g = $('[data-rc="go"]', menu); if (g) g.focus(); };
|
|
229
|
+
const start = async (what) => {
|
|
230
|
+
const rec = REC(); if (!rec) { d.toast('The recorder is not ready yet.'); return; }
|
|
231
|
+
close();
|
|
232
|
+
const res = what === 'new' ? await rec.fresh() : await rec.record(rows[what]);
|
|
233
|
+
if (!res || res.ok !== true) { fail(d, res, 'The recording did not start.'); return; }
|
|
234
|
+
d.toast('Recording. Notes are being taken on this machine. Let people know.');
|
|
235
|
+
const id = res.id || holding(); if (id) openLive(id, d);
|
|
236
|
+
};
|
|
237
|
+
const ask = (what) => { if (told) start(what); else consent(what); };
|
|
238
|
+
const list = async () => {
|
|
239
|
+
const rec = REC(); rows = rec ? await rec.today() : [];
|
|
240
|
+
const v = menuView(rows, rec ? rec.notes() : []);
|
|
241
|
+
menu.innerHTML = `<p class="label">Today’s meetings</p>${v.items.length ? v.items.map((x) => `<button type="button" role="menuitem" data-rc="ev" data-i="${x.i}"${x.mark === 'Recording' || x.mark === 'Paused' ? ' disabled' : ''}><b>${esc(x.title)}</b><small>${esc(x.time)}${x.mark ? ' · ' + esc(x.mark) : ''}</small></button>`).join('') : '<p class="note">No meeting of today can be recorded now.</p>'}<button type="button" role="menuitem" data-rc="new">${ic('plus')}New note</button>`;
|
|
242
|
+
menu.hidden = false; arr.setAttribute('aria-expanded', 'true'); const f = $('[role="menuitem"]:not([disabled])', menu); if (f) f.focus();
|
|
243
|
+
};
|
|
244
|
+
const draw = () => { const rec = REC(), live = rec ? rec.notes().some((n) => n.state === 'recording') || !!holding() : false; w.hidden = live; if (live) close(); };
|
|
245
|
+
w.onclick = (e) => { // delegated to the control's presses
|
|
246
|
+
const t = e.target.closest('[data-rc]'); if (!t) return; e.stopPropagation();
|
|
247
|
+
const a = t.dataset.rc;
|
|
248
|
+
if (a === 'menu') { if (menu.hidden) list(); else close(); return; }
|
|
249
|
+
if (a === 'new') { ask('new'); return; }
|
|
250
|
+
if (a === 'ev') { ask(+t.dataset.i); return; }
|
|
251
|
+
if (a === 'go') { told = true; start(pend); return; }
|
|
252
|
+
if (a === 'no') { close(); arr.focus(); }
|
|
253
|
+
};
|
|
254
|
+
w.addEventListener('keydown', (e) => { if (e.key === 'Escape' && !menu.hidden) { close(); arr.focus(); } });
|
|
255
|
+
document.addEventListener('click', (e) => { if (!e.target.closest('#recCtl')) close(); });
|
|
256
|
+
addEventListener('premium-rec', draw); draw();
|
|
257
|
+
}
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"briefing-premium-calendar.test.js",
|
|
49
49
|
"briefing-premium-calendar-2.test.js",
|
|
50
50
|
"briefing-premium-calendar-3.test.js",
|
|
51
|
+
"premium-vw-rec.test.js",
|
|
51
52
|
"briefing-premium-products.test.js",
|
|
52
53
|
"briefing-premium-sources.test.js",
|
|
53
54
|
"briefing-premium-drafts.test.js",
|
|
@@ -219,6 +220,7 @@
|
|
|
219
220
|
"briefing-premium-calendar.test.js": 1,
|
|
220
221
|
"briefing-premium-calendar-2.test.js": 1,
|
|
221
222
|
"briefing-premium-calendar-3.test.js": 1,
|
|
223
|
+
"premium-vw-rec.test.js": 1,
|
|
222
224
|
"briefing-premium-products.test.js": 1,
|
|
223
225
|
"briefing-premium-sources.test.js": 1,
|
|
224
226
|
"briefing-premium-drafts.test.js": 1,
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
"_comment": "Initiative premium-viewer: the premium dialog's right pane as a viewer with tabs (S1, the frame the view slices build on).",
|
|
3
3
|
"panels": [
|
|
4
4
|
"premium-viewer-test.js",
|
|
5
|
-
"premium-vw-slides-test.js"
|
|
5
|
+
"premium-vw-slides-test.js",
|
|
6
|
+
"premium-vw-rec-test.js"
|
|
6
7
|
],
|
|
7
8
|
"seconds": {
|
|
8
9
|
"premium-viewer-test.js": 60,
|
|
9
10
|
"premium-vw-slides.test.js": 1,
|
|
10
|
-
"premium-vw-slides-test.js": 60
|
|
11
|
+
"premium-vw-slides-test.js": 60,
|
|
12
|
+
"premium-vw-rec-test.js": 120
|
|
11
13
|
},
|
|
12
14
|
"modules": [
|
|
13
15
|
"premium-vw-slides.test.js"
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "Initiative premium-viewer, R9: the Jira backlog of a board as a viewer tab, opened from the Board's sprint dialog.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"premium-vw-backlog.test.js"
|
|
5
|
+
],
|
|
6
|
+
"panels": [
|
|
7
|
+
"premium-vw-backlog-test.js"
|
|
8
|
+
],
|
|
9
|
+
"seconds": {
|
|
10
|
+
"premium-vw-backlog.test.js": 2,
|
|
11
|
+
"premium-vw-backlog-test.js": 45
|
|
12
|
+
}
|
|
13
|
+
}
|