create-pmos 0.325.0 → 0.326.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 +9 -2
- 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-rec-test.js +209 -0
- package/workspace/public/pm/premium-board.js +10 -0
- package/workspace/public/pm/premium-meeting.js +22 -1
- 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-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
|
@@ -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
|
+
}
|