create-pmos 0.323.0 → 0.325.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/briefing-premium-calendar-2-test.js +8 -6
- package/workspace/briefing-premium-calendar-3-test.js +7 -4
- package/workspace/briefing-premium-calendar-test.js +4 -2
- package/workspace/guide/briefing-premium.md +15 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-vw-item-test.js +128 -0
- package/workspace/premium-vw-meet-test.js +210 -0
- package/workspace/premium-vw-notes-test.js +161 -0
- package/workspace/premium-vw-slides-test.js +269 -0
- package/workspace/public/pm/premium-board.js +3 -1
- package/workspace/public/pm/premium-deck.js +218 -0
- package/workspace/public/pm/premium-initiative.js +7 -2
- package/workspace/public/pm/premium-meeting.js +84 -31
- package/workspace/public/pm/premium-report-read.js +11 -3
- package/workspace/public/pm/premium-shell.js +1 -0
- package/workspace/public/pm/premium-vw-item-model.js +58 -0
- package/workspace/public/pm/premium-vw-item.css +25 -0
- package/workspace/public/pm/premium-vw-item.js +66 -0
- package/workspace/public/pm/premium-vw-meet.css +87 -0
- package/workspace/public/pm/premium-vw-meet.js +322 -0
- package/workspace/public/pm/premium-vw-notes.css +43 -0
- package/workspace/public/pm/premium-vw-notes.js +188 -0
- package/workspace/public/pm/premium-vw-slides.css +163 -0
- package/workspace/public/pm/premium-vw-slides.js +472 -0
- package/workspace/public/pm/premium.js +2 -0
- package/workspace/test-lists/premium-viewer.json +9 -3
- package/workspace/test-lists/premium-vw-item.json +13 -0
- package/workspace/test-lists/premium-vw-meet.json +13 -0
- package/workspace/test-lists/premium-vw-notes.json +13 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/* pm/premium-vw-item-model.js — the pure half of the work item view (initiative premium-viewer, S7; planning/prd/premium-viewer-prd.md R9).
|
|
2
|
+
* No DOM, no request: it turns the answer of GET /api/initiative-premium (lib/initiative-premium.js build()) into the HTML of an initiative tab
|
|
3
|
+
* or a task tab, so a node test loads it with import(). Every line is a field of that model; a part the model does not hold is left out,
|
|
4
|
+
* and an answer that is still reading or failed is said as such. Every value is escaped here. */
|
|
5
|
+
|
|
6
|
+
export const esc = (s) => String(s == null ? '' : s).replace(/[&<>"]/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"' }[c]));
|
|
7
|
+
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
8
|
+
export const when = (iso) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); return m ? +m[3] + ' ' + MON[+m[2] - 1] : ''; };
|
|
9
|
+
const kv = (rows) => { const r = rows.filter((x) => x && x[1]); return r.length ? `<div class="kv2">${r.map(([k, v]) => `<span>${esc(k)}</span><span>${esc(v)}</span>`).join('')}</div>` : ''; };
|
|
10
|
+
const sec = (title, body) => (body ? `<section class="vwi-s"><p class="label">${esc(title)}</p>${body}</section>` : '');
|
|
11
|
+
const CHECK_TONE = { done: 'ok', blocked: 'bad', pending: 'warn' };
|
|
12
|
+
export const SHOW_TASKS = 8;
|
|
13
|
+
|
|
14
|
+
/** The view ids: the same item opened twice refills one tab. */
|
|
15
|
+
export const iniId = (id) => 'item:ini:' + id;
|
|
16
|
+
export const taskId = (ini, key) => 'item:task:' + ini + ':' + key;
|
|
17
|
+
|
|
18
|
+
/** A task row of the model by its key ('task:<uid>' or 'req:<id>'), or null. */
|
|
19
|
+
export const findTask = (m, key) => (m && m.tasks && Array.isArray(m.tasks.rows) ? m.tasks.rows.find((t) => t.key === key) || null : null);
|
|
20
|
+
|
|
21
|
+
/** The state of an answer: 'ready' with a model, 'reading' while the routes derive, or 'error' with the route's words. */
|
|
22
|
+
export function stateOf(res) {
|
|
23
|
+
if (res && res.ok && res.state === 'ready' && res.model) return { state: 'ready', model: res.model };
|
|
24
|
+
if (res && res.state === 'reading') return { state: 'reading' };
|
|
25
|
+
return { state: 'error', error: (res && res.error) || 'The route did not answer.' };
|
|
26
|
+
}
|
|
27
|
+
export const readingHtml = (what) => `<article class="paper doc vwi"><p class="vwi-wait" role="status">Reading ${esc(what)} from the board. The board derives it from its records, so this can take a moment.</p></article>`;
|
|
28
|
+
export const errorHtml = (what, error) => `<article class="paper doc vwi"><p class="vwi-wait" role="alert">${esc(what)} could not be read: ${esc(error)}</p></article>`;
|
|
29
|
+
|
|
30
|
+
/** The initiative tab. `pageHref` is the initiative page's address for the same board. */
|
|
31
|
+
export function iniHtml(m, pageHref) {
|
|
32
|
+
const h = m.head || {}, rec = (m.files || []).find((f) => /record/i.test(f.label || ''));
|
|
33
|
+
const facts = (m.rows && m.rows[0] && m.rows[0].dialog && m.rows[0].dialog.facts) || [];
|
|
34
|
+
const top = `${rec ? `<p class="dpath">${esc(rec.path)}</p>` : ''}<div class="vwi-head">${h.statusLabel ? `<span class="chp ${esc(h.tone || 'mut')}"><i></i>${esc(h.statusLabel)}</span>` : ''}<b>${esc(m.title)}</b></div>${m.desc ? `<p class="vwi-desc">${esc(m.desc)}</p>` : ''}`;
|
|
35
|
+
const o = m.overview || {};
|
|
36
|
+
const next = o.h ? `<p class="vwi-next"><b>${esc(o.h)}</b>${o.who ? ` · ${esc(o.who)}` : ''}</p>${o.p ? `<p class="vwi-p">${esc(o.p)}</p>` : ''}` : o.why ? `<p class="vwi-p">${esc(o.why)}</p>` : '';
|
|
37
|
+
const watch = [].concat(m.health || [], m.warnings || []);
|
|
38
|
+
const checks = (m.checks || []).length ? `<ul class="vwi-l">${m.checks.map((c) => `<li><span class="chp ${CHECK_TONE[c.state] || 'mut'}"><i></i>${esc(c.stateLabel)}</span><span class="vwi-t"><b>${esc(c.label)}</b>${c.owed ? `<small>${esc(c.owed)}</small>` : ''}</span></li>`).join('')}</ul>` : '';
|
|
39
|
+
const T = m.tasks || { rows: [] }, rows = T.rows || [];
|
|
40
|
+
const tasks = rows.length ? `<ul class="vwi-l">${rows.slice(0, SHOW_TASKS).map((t) => `<li><button type="button" class="vwi-r" data-vwtask="${esc(t.key)}"><span class="vwi-t"><b>${esc(t.title)}</b><small>${esc([t.ref, t.src, t.state].filter(Boolean).join(' · '))}</small></span></button></li>`).join('')}</ul>${rows.length > SHOW_TASKS ? `<p class="vwi-p">${rows.length - SHOW_TASKS} more on the <a href="${esc(pageHref)}">initiative page</a>.</p>` : ''}` : T.note ? `<p class="vwi-p">${esc(T.note)}</p>` : '';
|
|
41
|
+
const docs = ((m.docs && m.docs.rows) || []).filter((d) => d.path && !(m.files || []).some((f) => f.path === d.path));
|
|
42
|
+
const links = (m.files || []).map((f) => [f.label, f.path]).concat(docs.map((d) => [d.title + (d.state ? ' · ' + d.state : ''), d.path]));
|
|
43
|
+
const linkHtml = links.length ? `<ul class="vwi-l">${links.map(([a, b]) => `<li><span class="vwi-t"><b>${esc(a)}</b><small class="vwi-path">${esc(b)}</small></span></li>`).join('')}</ul>` : '';
|
|
44
|
+
const miss = m.header && m.header.missing && m.header.missing.length ? `<p class="vwi-p">Not read: ${esc(m.header.missing.join(', '))}.</p>` : '';
|
|
45
|
+
return `<article class="paper doc vwi">${top}${kv(facts)}${sec('Next', next)}${sec('Watch', watch.length ? `<ul class="vwi-w">${watch.map((w) => `<li>${esc(w)}</li>`).join('')}</ul>` : '')}${sec('Checks', checks)}${sec('Tasks', tasks)}${sec('Links', linkHtml)}${miss}<p class="vwi-foot"><a class="vwi-go" href="${esc(pageHref)}">Open the initiative page</a></p></article>`;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** The task tab. A task the model no longer holds says so. */
|
|
49
|
+
export function taskHtml(m, key) {
|
|
50
|
+
const t = findTask(m, key);
|
|
51
|
+
if (!t) return `<article class="paper doc vwi"><p class="vwi-wait" role="status">This task is no longer on ${esc(m.title)}. It may have moved to another initiative or been removed.</p>${iniLink(m)}</article>`;
|
|
52
|
+
const req = t.src === 'PRD requirement';
|
|
53
|
+
const rows = [['Type', t.kind || (req ? 'PRD requirement' : 'Task')], ['Reference', t.ref], ['Source', t.src], ['Owner', t.owner], ['Starts', when(t.start)], ['Due', when(t.end)], ['Status', t.state || (req ? 'No result recorded' : '')], ['Blocked', t.blocked ? 'Yes' : '']];
|
|
54
|
+
const note = req ? 'Read from the initiative’s PRD' + (m.tasks && m.tasks.basis && m.tasks.basis.source ? ' (' + m.tasks.basis.source + ')' : '') + '. The repository records no result for one requirement.'
|
|
55
|
+
: t.pmos ? 'A PMOS task, kept on the board. Change its status from its own dialog on the initiative page.' : 'Read from the board. Jira owns its status and dates.';
|
|
56
|
+
return `<article class="paper doc vwi"><div class="vwi-head"><b>${esc(t.title)}</b></div>${kv(rows)}<p class="vwi-p">${esc(note)}</p>${iniLink(m)}</article>`;
|
|
57
|
+
}
|
|
58
|
+
const iniLink = (m) => `<section class="vwi-s"><p class="label">Initiative</p><ul class="vwi-l"><li><button type="button" class="vwi-r" data-vwini="${esc(m.id)}"><span class="vwi-t"><b>${esc(m.title)}</b><small>${esc([m.head && m.head.statusLabel, m.lane, m.board && m.board.name].filter(Boolean).join(' · '))}</small></span></button></li></ul></section>`;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
:root{--fs-1:11px;--fs-2:12px;--fs-3:14px;--fs-4:16px;--fs-5:20px;--fs-6:28px}
|
|
2
|
+
/* pm/premium-vw-item.css — the work item view of the premium viewer (initiative premium-viewer, S7). Loaded by vwStyle('item'). Console type sizes only. */
|
|
3
|
+
.vwi .vwi-head{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:0 0 8px}
|
|
4
|
+
.vwi .vwi-head b{font-size:var(--fs-4);font-weight:600;color:var(--ink);overflow-wrap:anywhere}
|
|
5
|
+
.vwi .vwi-desc,.vwi .vwi-p{font-size:var(--fs-3);color:var(--ink-2);margin:6px 0;line-height:1.5}
|
|
6
|
+
.vwi .vwi-next{font-size:var(--fs-3);color:var(--ink);margin:4px 0}
|
|
7
|
+
.vwi .vwi-wait{font-size:var(--fs-3);color:var(--ink-2);margin:0}
|
|
8
|
+
.vwi .vwi-s{margin:18px 0 0}
|
|
9
|
+
.vwi .vwi-s>.label{margin:0 0 8px}
|
|
10
|
+
.vwi .vwi-l{list-style:none;margin:0;padding:0;border:1px solid var(--hair);border-radius:8px;background:var(--card-solid);box-shadow:var(--card-shadow)}
|
|
11
|
+
.vwi .vwi-l>li{display:flex;align-items:center;gap:10px;min-height:44px;padding:8px 12px;border-top:1px solid var(--hair)}
|
|
12
|
+
.vwi .vwi-l>li:first-child{border-top:0}
|
|
13
|
+
.vwi .vwi-l>li:has(>.vwi-r){padding:0}
|
|
14
|
+
.vwi .vwi-r{display:flex;align-items:center;gap:10px;width:100%;min-height:44px;padding:8px 12px;text-align:left;background:none;border:0;color:inherit;font:inherit;cursor:pointer;border-radius:6px}
|
|
15
|
+
@media (hover:hover){.vwi .vwi-r:hover{background:var(--well)}}
|
|
16
|
+
.vwi .vwi-r:focus-visible{outline:2px solid var(--ember);outline-offset:-2px}
|
|
17
|
+
.vwi .vwi-t{display:flex;flex-direction:column;gap:2px;min-width:0}
|
|
18
|
+
.vwi .vwi-t b{font-size:var(--fs-3);font-weight:500;color:var(--ink);overflow-wrap:anywhere}
|
|
19
|
+
.vwi .vwi-t small{font-size:var(--fs-2);color:var(--ink-3);overflow-wrap:anywhere}
|
|
20
|
+
.vwi .vwi-path{font-family:var(--mono)}
|
|
21
|
+
.vwi .vwi-w{margin:0;padding-left:18px;font-size:var(--fs-3);color:var(--ink-2)}
|
|
22
|
+
.vwi .vwi-foot{margin:18px 0 0;font-size:var(--fs-3)}
|
|
23
|
+
.vwi .vwi-go,.vwi .vwi-p a{color:var(--ink);font-weight:500;text-decoration:underline;text-underline-offset:3px;display:inline-flex;align-items:center;min-height:44px}
|
|
24
|
+
.vwi-open{margin:14px 0 0}
|
|
25
|
+
.vwi-open .dmcta{min-height:44px}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/* pm/premium-vw-item.js — an initiative or one of its tasks as a tab of the premium dialog's viewer (initiative premium-viewer, S7; PRD R9).
|
|
2
|
+
* openWorkItem({ kind: 'initiative', id, ws?, board? }) the record, the next step, the checks, the tasks and the links
|
|
3
|
+
* openWorkItem({ kind: 'task', ini, key, ws?, board? }) one task (key 'task:<uid>' or 'req:<id>') with a link back to its initiative
|
|
4
|
+
* Both read GET /api/initiative-premium, the route the initiative page reads; the HTML comes from premium-vw-item-model.js. The route answers
|
|
5
|
+
* 'reading' while the board derives, and the tab asks again. Inside a tab a task opens its own tab and the initiative link opens the initiative's. */
|
|
6
|
+
import { vwOpen, vwStyle } from './premium-viewer.js';
|
|
7
|
+
import { esc, iniId, taskId, stateOf, readingHtml, errorHtml, iniHtml, taskHtml, findTask } from './premium-vw-item-model.js';
|
|
8
|
+
|
|
9
|
+
const TRIES = 20, WAIT = 1500, KEEP = 30000;
|
|
10
|
+
const cache = new Map(); // query → { at, p }: two tabs of one initiative read once
|
|
11
|
+
const qOf = (o) => ['id=' + encodeURIComponent(o.id), o.ws ? 'ws=' + encodeURIComponent(o.ws) : '', o.board ? 'board=' + encodeURIComponent(o.board) : ''].filter(Boolean).join('&');
|
|
12
|
+
const pageHref = (o) => '/premium-initiative.html?' + qOf(o);
|
|
13
|
+
|
|
14
|
+
async function read(o) {
|
|
15
|
+
const q = qOf(o), c = cache.get(q);
|
|
16
|
+
if (c && Date.now() - c.at < KEEP) return c.p;
|
|
17
|
+
const p = (async () => {
|
|
18
|
+
for (let i = 0; i < TRIES; i++) {
|
|
19
|
+
let r = null;
|
|
20
|
+
try { r = await (await fetch('/api/initiative-premium?' + q, { credentials: 'same-origin' })).json(); } catch { r = null; }
|
|
21
|
+
const s = stateOf(r);
|
|
22
|
+
if (s.state !== 'reading') return s;
|
|
23
|
+
await new Promise((ok) => setTimeout(ok, WAIT));
|
|
24
|
+
}
|
|
25
|
+
return { state: 'reading' };
|
|
26
|
+
})();
|
|
27
|
+
cache.set(q, { at: Date.now(), p });
|
|
28
|
+
p.then((s) => { if (s.state !== 'ready') cache.delete(q); });
|
|
29
|
+
return p;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function openWorkItem(o) {
|
|
33
|
+
if (!o) return null;
|
|
34
|
+
vwStyle('item');
|
|
35
|
+
const ctx = { id: o.kind === 'task' ? o.ini : o.id, ws: o.ws || '', board: o.board || '' };
|
|
36
|
+
if (!ctx.id) return null;
|
|
37
|
+
const isTask = o.kind === 'task';
|
|
38
|
+
return vwOpen({
|
|
39
|
+
id: isTask ? taskId(ctx.id, o.key) : iniId(ctx.id),
|
|
40
|
+
title: o.title || (isTask ? 'Task' : 'Initiative'),
|
|
41
|
+
icon: isTask ? 'tk' : 'list',
|
|
42
|
+
render(el) {
|
|
43
|
+
el.innerHTML = readingHtml(isTask ? 'the task' : 'the initiative');
|
|
44
|
+
read(ctx).then((s) => {
|
|
45
|
+
if (!el.isConnected) return;
|
|
46
|
+
if (s.state === 'reading') { el.innerHTML = readingHtml(isTask ? 'the task' : 'the initiative'); return; }
|
|
47
|
+
if (s.state === 'error') { el.innerHTML = errorHtml(isTask ? 'The task' : 'The initiative', s.error); return; }
|
|
48
|
+
el.innerHTML = isTask ? taskHtml(s.model, o.key) : iniHtml(s.model, pageHref(ctx));
|
|
49
|
+
el._vwi = s.model;
|
|
50
|
+
});
|
|
51
|
+
},
|
|
52
|
+
wire(el) {
|
|
53
|
+
el.onclick = (e) => { // delegated on the tab's own pane
|
|
54
|
+
const m = el._vwi; if (!m) return;
|
|
55
|
+
const t = e.target.closest('[data-vwtask]');
|
|
56
|
+
if (t) { const row = findTask(m, t.dataset.vwtask); openWorkItem({ kind: 'task', ini: ctx.id, key: t.dataset.vwtask, title: row ? row.title : '', ws: ctx.ws, board: ctx.board }); return; }
|
|
57
|
+
if (e.target.closest('[data-vwini]')) openWorkItem({ kind: 'initiative', id: ctx.id, title: m.title, ws: ctx.ws, board: ctx.board });
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** The press a dialog's pane carries to open the initiative's full record as a tab. */
|
|
64
|
+
export const recordPress = (label) => `<p class="vwi-open"><button type="button" class="dmcta alt" data-vwopen="1">${esc(label || 'Open the full record')}</button></p>`;
|
|
65
|
+
|
|
66
|
+
if (typeof window !== 'undefined') window.__premiumWorkItem = { openWorkItem };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
@font-face{font-family:"Space Grotesk";src:url(/vendor/space-grotesk-var.woff2) format("woff2");font-weight:300 700;font-display:swap}
|
|
2
|
+
@font-face{font-family:"IBM Plex Mono";src:url(/vendor/ibm-plex-mono-400.woff2) format("woff2");font-weight:400;font-display:swap}
|
|
3
|
+
@font-face{font-family:"IBM Plex Mono";src:url(/vendor/ibm-plex-mono-500.woff2) format("woff2");font-weight:500;font-display:swap}
|
|
4
|
+
@font-face{font-family:"IBM Plex Mono";src:url(/vendor/ibm-plex-mono-700.woff2) format("woff2");font-weight:600 700;font-display:swap}
|
|
5
|
+
:root{--fs-1:11px;--fs-2:12px;--fs-3:14px;--fs-4:16px;--fs-5:20px;--fs-6:28px}
|
|
6
|
+
/* pm/premium-vw-meet.css — the meeting detail as the console's note sheet (initiative premium-viewer, S3; premium-vw-meet.js).
|
|
7
|
+
* Loaded once by vmStyle(). Sizes are only var(--fs-1..6), weights 400/500/600 (premium-console-type.test.js). */
|
|
8
|
+
.vm .vm-ln{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin:8px 0 0;font-size:var(--fs-3);color:var(--ink-2)}
|
|
9
|
+
.vm .vm-ln .i{width:16px;height:16px;flex:none;color:var(--ink-3)}
|
|
10
|
+
.vm .vm-ln b{color:var(--ink);font-weight:600}
|
|
11
|
+
.vm .mtg-link{margin:8px 0 4px}
|
|
12
|
+
.vm .vm-about[hidden]{display:none}
|
|
13
|
+
.vm .vm-ser{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin:10px 0 0;font:500 var(--fs-2) var(--mono);color:var(--ink-2)}
|
|
14
|
+
.vm .vm-ser>span{display:inline-flex;align-items:center;gap:6px}
|
|
15
|
+
.vm .vm-ser .i{width:14px;height:14px}
|
|
16
|
+
.vm .vm-ib{width:36px;height:36px;border-radius:6px;display:inline-grid;place-items:center;background:var(--well);color:var(--ink)}
|
|
17
|
+
.vm .vm-ib:disabled{opacity:.4}
|
|
18
|
+
.vm .vm-ib .i{width:16px;height:16px}
|
|
19
|
+
.vm .vm-lk{min-height:36px;padding:0 8px;border-radius:6px;font-size:var(--fs-2);font-weight:500;color:var(--ink-3);text-decoration:underline;text-underline-offset:3px}
|
|
20
|
+
@media (hover:hover){.vm .vm-lk:hover{color:var(--ink)}}
|
|
21
|
+
.vm .vm-ph{display:flex;gap:6px;flex-wrap:wrap;margin:18px 0 14px;padding:4px;border-radius:6px;background:var(--well);width:max-content;max-width:100%}
|
|
22
|
+
.vm .vm-ph button{min-height:36px;padding:0 16px;border-radius:6px;font-size:var(--fs-2);font-weight:600;color:var(--ink-2)}
|
|
23
|
+
.vm .vm-ph button[aria-pressed="true"]{background:var(--solid);color:var(--on-solid)}
|
|
24
|
+
.vm .vm-ph button:focus-visible,.vm .vm-ib:focus-visible,.vm .vm-lk:focus-visible{outline:2px solid var(--ember);outline-offset:2px}
|
|
25
|
+
.vm .vm-body[hidden]{display:none}
|
|
26
|
+
.vm .vm-bx{background:var(--card-solid,var(--card));border:1px solid var(--hair);border-radius:8px;box-shadow:var(--card-shadow);padding:14px 18px;margin:0 0 12px;font-size:var(--fs-3);line-height:1.5}
|
|
27
|
+
.vm .vm-cap{display:flex;align-items:center;gap:8px;font:600 var(--fs-1) var(--mono);letter-spacing:.08em;text-transform:uppercase;color:var(--ink-3);padding:0 0 10px;margin:0 0 6px;border-bottom:1px solid var(--hair)}
|
|
28
|
+
.vm .vm-cap .i{width:14px;height:14px}
|
|
29
|
+
.vm .vm-bx p{margin:0 0 8px;color:var(--ink-2)}
|
|
30
|
+
.vm h5{margin:16px 0 6px;font-size:var(--fs-3);font-weight:600;color:var(--ink)}
|
|
31
|
+
.vm h5 small{font-weight:500;font-size:var(--fs-2);color:var(--ink-3);margin-left:6px}
|
|
32
|
+
.vm .vm-ul{margin:0;padding-left:20px;color:var(--ink-2)}
|
|
33
|
+
.vm .vm-ul em{font-style:normal;font-size:var(--fs-2);color:var(--ink-3)}
|
|
34
|
+
.vm .vm-agl>div{display:flex;align-items:center;gap:8px;padding:4px 0}
|
|
35
|
+
.vm .vm-agl i{width:14px;height:14px;border-radius:6px;box-shadow:inset 0 0 0 1.5px var(--ink-3);flex:none;margin:0 1px}
|
|
36
|
+
.vm .vm-agl .i{width:16px;height:16px;color:var(--ok);flex:none}
|
|
37
|
+
.vm .vm-agl small{margin-left:auto;font-size:var(--fs-2);color:var(--ink-3)}
|
|
38
|
+
.vm .vm-row{display:flex;gap:8px;flex-wrap:wrap}
|
|
39
|
+
.vm .vm-pill{display:inline-flex;align-items:center;min-height:36px;padding:0 14px;border-radius:6px;background:var(--well);font-size:var(--fs-2);font-weight:500;color:var(--ink)}
|
|
40
|
+
@media (hover:hover){.vm a.vm-pill:hover{background:var(--b3,var(--well))}}
|
|
41
|
+
.vm .vm-none{padding:12px 16px;border-radius:8px;background:var(--well)}
|
|
42
|
+
.vm .vm-trn>div{display:grid;grid-template-columns:52px minmax(0,1fr);gap:8px;align-items:start;padding:5px 0}
|
|
43
|
+
.vm .vm-trn p{margin:0;color:var(--ink-2)}
|
|
44
|
+
.vm .vm-trn b{color:var(--ink);font-weight:600}
|
|
45
|
+
.vm .vm-t{font:500 var(--fs-2) var(--mono);color:var(--ink-3);padding-top:1px}
|
|
46
|
+
.vm .vm-sl{list-style:none;margin:0;padding:0}
|
|
47
|
+
.vm .vm-si{display:grid;grid-template-columns:28px minmax(0,1fr);gap:10px;align-items:start;padding:8px 0;border-top:1px solid var(--hair)}
|
|
48
|
+
.vm .vm-si:first-child{border-top:0}
|
|
49
|
+
.vm .vm-si b{display:block;font-weight:500;color:var(--ink)}
|
|
50
|
+
.vm .vm-si small{display:flex;gap:8px;align-items:center;font-size:var(--fs-2);color:var(--ink-3);margin-top:2px}
|
|
51
|
+
.vm .vm-k{width:28px;height:28px;border-radius:6px;display:grid;place-items:center;background:var(--well);color:var(--ink-3)}
|
|
52
|
+
.vm .vm-k .i{width:14px;height:14px}
|
|
53
|
+
.vm .vm-k.ok{color:var(--ok)}
|
|
54
|
+
.vm .vm-k.new{color:var(--ember-ink)}
|
|
55
|
+
.vm .vm-st{font:600 var(--fs-1) var(--mono);letter-spacing:.06em;text-transform:uppercase}
|
|
56
|
+
.vm .vm-st.ok{color:var(--ok)}
|
|
57
|
+
.vm .vm-st.warn,.vm .vm-st.new{color:var(--ember-ink)}
|
|
58
|
+
.vm .vm-mrow{display:flex;align-items:baseline;gap:10px;flex-wrap:wrap;margin:6px 0}
|
|
59
|
+
.vm .vm-mrow b{font-weight:600}
|
|
60
|
+
.vm .vm-rp{display:flex;align-items:center;gap:10px;margin:10px 0 6px}
|
|
61
|
+
.vm .vm-rp b{font-weight:600}
|
|
62
|
+
.vm .vm-aud{width:100%;max-width:100%;margin:2px 0 4px}
|
|
63
|
+
.vm .vm-sum{margin:12px 0 8px;line-height:1.6;color:var(--ink)}
|
|
64
|
+
.vm .vm-tb{width:100%;border-collapse:collapse;margin:10px 0 6px;font-size:var(--fs-3)}
|
|
65
|
+
.vm .vm-tb th{text-align:left;font:500 var(--fs-1) var(--mono);letter-spacing:.06em;text-transform:uppercase;color:var(--ink-3);padding:6px 10px 6px 0;border-bottom:1px solid var(--hair)}
|
|
66
|
+
.vm .vm-tb td{padding:8px 10px 8px 0;border-bottom:1px solid var(--hair);vertical-align:middle}
|
|
67
|
+
.vm .vm-tb td.w{color:var(--ink-2)}
|
|
68
|
+
.vm .vm-tb td.o{white-space:nowrap;color:var(--ink-2)}
|
|
69
|
+
.vm .vm-tb .mut{font-size:var(--fs-2)}
|
|
70
|
+
.vm .vh{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
|
|
71
|
+
.vm .vm-q{display:flex;gap:10px;align-items:baseline;padding:6px 0;color:var(--ink-2)}
|
|
72
|
+
.vm .vm-tg{font:600 var(--fs-1) var(--mono);letter-spacing:.06em;text-transform:uppercase;color:var(--ink-3);flex:none}
|
|
73
|
+
.vm .vm-shots{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:10px}
|
|
74
|
+
.vm .vm-shots figure{margin:0}
|
|
75
|
+
.vm .vm-shots img{display:block;width:100%;aspect-ratio:16/10;object-fit:cover;border-radius:6px;border:1px solid var(--hair);background:var(--well)}
|
|
76
|
+
.vm .vm-shots figcaption{font:500 var(--fs-1) var(--mono);color:var(--ink-3);margin-top:4px}
|
|
77
|
+
.vm .vm-fold{margin-top:14px;border-top:1px solid var(--hair);padding-top:10px}
|
|
78
|
+
.vm .vm-fold summary{cursor:pointer;min-height:36px;display:flex;align-items:center;font-size:var(--fs-2);font-weight:600;color:var(--ink-2)}
|
|
79
|
+
@media (max-width:700px){
|
|
80
|
+
.vm .vm-ph button,.vm .vm-ib,.vm .vm-lk,.vm .vm-pill,.vm .vm-fold summary{min-height:44px}
|
|
81
|
+
.vm .vm-ib{width:44px;height:44px}
|
|
82
|
+
.vm .vm-ph{width:100%}.vm .vm-ph button{flex:1}
|
|
83
|
+
.vm .vm-tb thead{display:none}
|
|
84
|
+
.vm .vm-tb tr{display:grid;grid-template-columns:1fr auto;gap:2px 10px;padding:8px 0;border-bottom:1px solid var(--hair)}
|
|
85
|
+
.vm .vm-tb td{border:0;padding:0}
|
|
86
|
+
.vm .vm-tb td:first-child,.vm .vm-tb td.w{grid-column:1/-1}
|
|
87
|
+
}
|
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
/* pm/premium-vw-meet.js — the meeting detail laid out as the console's note sheet (initiative premium-viewer, R3, slice S3).
|
|
2
|
+
* The meeting dialog (premium-meeting.js detailHtml) draws its first tab with these parts: a head with Before, During and After,
|
|
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 context the note kept (agenda, heard or not; what it is for; to be ready; read first; people) and what
|
|
5
|
+
* was still open coming in from the meeting before (carried in)
|
|
6
|
+
* During the transcript the note holds
|
|
7
|
+
* After Since the last one (each next step of the meeting before: Done, Raised again or Not mentioned, then the new ones),
|
|
8
|
+
* the summary, Decision and Why, Next step with owner, due and Make task, open questions, the screenshots of the
|
|
9
|
+
* shared screen and the folded transcript.
|
|
10
|
+
* An earlier or later meeting of the series opens as a viewer tab (openNoteTab), with the same sheet.
|
|
11
|
+
*
|
|
12
|
+
* WHERE EACH PART COMES FROM. GET /api/notes/one?id= answers { note, recording, screen: { frames }, place } (lib/routes-notes.js).
|
|
13
|
+
* The parts are read as the console reads them (dest-notes.js partsOf, c3-notes.js): the final notes after Stop, else what was
|
|
14
|
+
* caught live; `place` is lib/notes-series.js placeOf. Nothing is invented: a part the answer does not hold is left out or says so.
|
|
15
|
+
* Not drawn, because no record or route backs them here: re-linking the note to another calendar event (the console's own
|
|
16
|
+
* meeting picker), and Make task on a Since the last one row (the console has none either). */
|
|
17
|
+
import { agendaHeard, peopleOf } from './notes-context.js';
|
|
18
|
+
import { vwOpen, vwStyle } from './premium-viewer.js';
|
|
19
|
+
|
|
20
|
+
const clip = (s, n) => { const t = String(s == null ? '' : s).replace(/\s+/g, ' ').trim(); return t.length > n ? t.slice(0, n - 1) + '…' : t; };
|
|
21
|
+
const pad = (n) => String(n).padStart(2, '0');
|
|
22
|
+
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
23
|
+
const WD = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
|
24
|
+
/** "Tue 6 Oct", or '' for a date that does not parse. */
|
|
25
|
+
export const dayLabel = (iso) => { const t = new Date(iso); return Number.isFinite(t.getTime()) ? WD[t.getDay()] + ' ' + t.getDate() + ' ' + MON[t.getMonth()] : ''; };
|
|
26
|
+
const hm = (iso) => { const t = new Date(iso); return Number.isFinite(t.getTime()) ? pad(t.getHours()) + ':' + pad(t.getMinutes()) : ''; };
|
|
27
|
+
/** Meeting time as the console writes it: 03:07, or 1:02:03. */
|
|
28
|
+
export const clock = (ms) => { if (ms == null || !Number.isFinite(+ms)) return ''; const s = Math.floor(+ms / 1000), h = Math.floor(s / 3600), m = Math.floor((s % 3600) / 60); return (h ? h + ':' + pad(m) : pad(m)) + ':' + pad(s % 60); };
|
|
29
|
+
const SPEAKER = { mic: 'You', meeting: 'Meeting', speech: 'You' };
|
|
30
|
+
const speakerOf = (n, who) => (who ? (n.speakers && n.speakers[who]) || SPEAKER[who] || String(who) : '');
|
|
31
|
+
|
|
32
|
+
/** The lines of the note, as the console reads them (c3-notes.js transcriptOf): the final segments after Stop, else the live lines. */
|
|
33
|
+
export function transcriptOf(n) {
|
|
34
|
+
if (!n) return [];
|
|
35
|
+
if (n.final && Array.isArray(n.final.segments) && n.final.segments.length) return n.final.segments.map((g) => ({ t: g.t, text: String(g.text || ''), who: speakerOf(n, g.spk) }));
|
|
36
|
+
return (n.transcript || []).filter((x) => x && x.text && !x.dropped).map((x) => ({ t: x.t, text: String(x.text), who: speakerOf(n, x.source) }));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** What was caught live, as view-notes.js caughtItems reads it: the agent's minute bullets, else the labelled lines. */
|
|
40
|
+
function caughtOf(n) {
|
|
41
|
+
const out = { decision: [], action: [], question: [] };
|
|
42
|
+
const bs = (n.bullets || []).filter((b) => b && b.text && !b.dropped && !b.open);
|
|
43
|
+
if (bs.length) { bs.forEach((b) => { if (out[b.cat]) out[b.cat].push(b); }); return out; }
|
|
44
|
+
(n.transcript || []).forEach((x) => { if (x && x.text && !x.dropped && out[x.cat]) out[x.cat].push(x); });
|
|
45
|
+
return out;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** The note's parts, as dest-notes.js partsOf reads them: the final notes when there are some, else what was caught live. */
|
|
49
|
+
export function partsOf(n) {
|
|
50
|
+
const f = n && n.final_notes;
|
|
51
|
+
if (f) return { from: 'final', overview: String(f.overview || f.purpose || ''), decisions: f.decisions || [], actions: f.actions || [], questions: f.questions || [] };
|
|
52
|
+
const c = caughtOf(n || {});
|
|
53
|
+
let overview = '';
|
|
54
|
+
if (n && n.agent && n.agent.markdown) overview = String(n.agent.markdown).split(/\r?\n/).map((l) => l.replace(/^\s*(?:#+|[-*]|\d+[.)])\s*/, '').replace(/\*\*|__|`/g, '').trim()).filter((l) => l && !/^(summary|overview)$/i.test(l)).join(' ');
|
|
55
|
+
else { const ov = n && n.summary && n.summary.sections && n.summary.sections.overview; if (Array.isArray(ov)) overview = ov.map((x) => String((x && x.text) || '')).filter(Boolean).join(' '); }
|
|
56
|
+
if (n && n.overview_pm) overview = n.overview_pm;
|
|
57
|
+
return { from: 'live', overview, decisions: c.decision, actions: c.action, questions: c.question };
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const startOf = (n) => (n.meeting && n.meeting.start) || n.recorded_from || n.created_at || n.updated_at;
|
|
61
|
+
const lenOf = (n) => n.meeting_ms || Math.max(0, ...(n.transcript || []).map((x) => (x && x.t) || 0));
|
|
62
|
+
|
|
63
|
+
/** The sheet of one note, from the answer of GET /api/notes/one. Null when the answer holds no note. Every field is a field of the answer. */
|
|
64
|
+
export function noteSheet(one) {
|
|
65
|
+
if (!one || one.ok !== true || !one.note || !one.note.id) return null;
|
|
66
|
+
const n = one.note, p = partsOf(n), fin = p.from === 'final', priv = !!n.private;
|
|
67
|
+
const ev = n.meeting && n.meeting.kind === 'event' ? n.meeting : null;
|
|
68
|
+
const c = ev && ev.context ? ev.context : null;
|
|
69
|
+
const lines = priv ? [] : transcriptOf(n);
|
|
70
|
+
const heard = c ? agendaHeard(c, lines) : [];
|
|
71
|
+
const ini = n.initiative && n.initiative.id ? n.initiative : null, board = n.board && n.board.id ? n.board : null;
|
|
72
|
+
const about = ini ? [board && (board.title || board.id), ini.title || ini.id].filter(Boolean).join(' › ') : board ? board.title || board.id : n.portfolio ? 'Portfolio' : '';
|
|
73
|
+
const pl = one.place && one.place.key && !priv ? one.place : null;
|
|
74
|
+
const ms = lenOf(n);
|
|
75
|
+
return {
|
|
76
|
+
id: n.id, title: clip(n.title || 'Untitled note', 120), state: n.state || 'idle', private: priv, from: p.from,
|
|
77
|
+
day: dayLabel(startOf(n)), minutes: ms >= 60000 ? Math.round(ms / 60000) : 0,
|
|
78
|
+
event: ev ? { title: clip(ev.title || n.title, 120), when: [dayLabel(ev.start), hm(ev.start) + (ev.end ? ' to ' + hm(ev.end) : '')].filter(Boolean).join(' ') } : null,
|
|
79
|
+
adhoc: !!(n.meeting && n.meeting.kind === 'adhoc'),
|
|
80
|
+
about, initiative: ini ? { id: ini.id, ws: ini.ws || (board && board.ws) || '', name: clip(ini.title || ini.id, 70) } : null,
|
|
81
|
+
context: c ? {
|
|
82
|
+
agenda: (c.agenda || []).map((a, i) => ({ text: clip(a, 140), heard: heard[i] !== null && heard[i] !== undefined })),
|
|
83
|
+
purpose: clip(c.purpose, 240), prep: clip(c.prep, 240),
|
|
84
|
+
read: [...(c.links || []).map((l) => ({ label: clip(l.label, 60), url: l.url })), ...(c.refs || []).map((x) => ({ label: clip(x.label, 120), url: x.link || '' }))],
|
|
85
|
+
people: peopleOf(c), attendees: Number.isInteger(c.attendees) ? c.attendees : null,
|
|
86
|
+
} : null,
|
|
87
|
+
overview: priv ? '' : clip(p.overview, 2000),
|
|
88
|
+
whyCol: fin,
|
|
89
|
+
decisions: priv ? [] : p.decisions.map((x) => ({ text: clip(x.text, 240), why: fin ? clip(x.why, 240) : '' })).filter((x) => x.text),
|
|
90
|
+
actions: priv ? [] : p.actions.map((x) => ({ text: clip(x.text, 240), owner: clip(x.owner, 60), due: /^\d{4}-\d{2}-\d{2}$/.test(String(x.due || '')) ? x.due : clip(x.due, 30) })).filter((x) => x.text),
|
|
91
|
+
questions: priv ? [] : p.questions.map((x) => ({ text: clip(x.text, 240) })).filter((x) => x.text),
|
|
92
|
+
shots: priv ? [] : ((one.screen && one.screen.frames) || []).filter((f) => f && Number.isFinite(+f.t)).slice(0, 12).map((f) => ({ t: +f.t, why: clip(f.why, 120) })),
|
|
93
|
+
audio: !priv && one.recording && one.recording.bytes ? '/api/notes/recording?id=' + encodeURIComponent(n.id) + '&b=' + one.recording.bytes + (one.recording.cleaned ? '&c=1' : '') : '',
|
|
94
|
+
lines,
|
|
95
|
+
series: pl ? { key: pl.key, title: clip(pl.title, 120), pos: pl.pos, count: pl.count, prev: pl.prev ? { id: pl.prev.id, day: dayLabel(pl.prev.at) } : null, next: pl.next ? { id: pl.next.id, day: dayLabel(pl.next.at) } : null } : null,
|
|
96
|
+
seriesOff: n.series_pm === 'off',
|
|
97
|
+
since: pl && pl.since ? { day: dayLabel(pl.since.at), items: (pl.since.items || []).map((x) => ({ text: clip(x.text, 240), owner: clip(x.owner, 60), state: x.state })), fresh: (pl.since.fresh || []).map((x) => ({ text: clip(x.text, 240), owner: clip(x.owner, 60) })) } : null,
|
|
98
|
+
carriedIn: pl && pl.prev ? { day: dayLabel(pl.prev.at), overview: clip(pl.prev.overview, 300), items: (pl.carried_in || []).map((x) => ({ text: clip(x.text, 240), owner: clip(x.owner, 60) })) } : null,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** The phase the head opens on: During while the note records or is paused, After once the meeting has notes, else Before. */
|
|
103
|
+
export function phaseOf({ noteState, hasNotes }) {
|
|
104
|
+
if (noteState === 'recording' || noteState === 'paused') return 'during';
|
|
105
|
+
return hasNotes ? 'after' : 'before';
|
|
106
|
+
}
|
|
107
|
+
export const PHASES = [['before', 'Before'], ['during', 'During'], ['after', 'After']];
|
|
108
|
+
|
|
109
|
+
/* ── the stages: one interface the threads that own Before (meeting prep), During (recording) and After plug into ──────
|
|
110
|
+
* A stage is { html(S, ctx) → string, wire?(el, S, ctx) }. S is noteSheet(one), or null for a meeting with no note yet. ctx is
|
|
111
|
+
* { esc, tasked, replayBtn, where: 'meeting' | 'tab', id, reread() }. html is drawn inside the stage's .vm-body; wire runs after each
|
|
112
|
+
* draw with that .vm-body and binds on it only. setStage(k, part) replaces a stage on every sheet (the meeting dialog and the
|
|
113
|
+
* note tab); a part may leave out wire. The meeting dialog draws its own calendar sections (Prepared for you, Material, Previous
|
|
114
|
+
* meetings, Topics) after the Before stage, and its replay-answer notes when there is no note. */
|
|
115
|
+
const STAGES = {
|
|
116
|
+
before: { html: (S, x) => beforeHtml(S, x.esc) },
|
|
117
|
+
during: { html: (S, x) => duringHtml(S, x.esc) },
|
|
118
|
+
after: { html: (S, x) => (S ? sinceHtml(S, x.esc) + notesHtml(S, x.esc, { tasked: x.tasked, replayBtn: x.replayBtn }) : '') },
|
|
119
|
+
};
|
|
120
|
+
export function setStage(k, part) {
|
|
121
|
+
if (!STAGES[k] || !part || typeof part.html !== 'function') throw new Error('setStage: a stage is before, during or after, with html(S, ctx)');
|
|
122
|
+
STAGES[k] = { html: part.html, wire: typeof part.wire === 'function' ? part.wire : null };
|
|
123
|
+
}
|
|
124
|
+
export const stageHtml = (k, S, ctx) => STAGES[k].html(S, ctx);
|
|
125
|
+
export function wireStage(k, el, S, ctx) { const w = STAGES[k] && STAGES[k].wire; if (w && el) w(el, S, ctx); }
|
|
126
|
+
|
|
127
|
+
/* ── html, pure: each builder takes the sheet and esc ──────────────────────────────────────────────────────────────── */
|
|
128
|
+
|
|
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 ic = (k) => `<svg class="i" viewBox="0 0 24 24">${ICP[k]}</svg>`;
|
|
131
|
+
|
|
132
|
+
/** The Before, During and After switch. */
|
|
133
|
+
export const phaseHtml = (on, esc) => `<div class="vm-ph" role="group" aria-label="Meeting stage">${PHASES.map(([k, l]) => `<button type="button" data-ph="${k}" aria-pressed="${on === k}">${esc(l)}</button>`).join('')}</div>`;
|
|
134
|
+
|
|
135
|
+
/** The series line: the meeting before, "Title · N of M", the meeting after, and Not part of this series. */
|
|
136
|
+
export function seriesHtml(S, esc) {
|
|
137
|
+
if (!S) return '';
|
|
138
|
+
if (S.series) {
|
|
139
|
+
const s = S.series, go = (x, k, label) => `<button type="button" class="vm-ib" data-vm="${k}"${x ? ` data-id="${esc(x.id)}" title="${esc(label + ', ' + x.day)}"` : ' disabled'} aria-label="${esc(label)}">${ic(k)}</button>`;
|
|
140
|
+
return `<div class="vm-ser">${go(s.prev, 'prev', 'The meeting before')}<span>${ic('notes')}${esc(s.title)} · ${s.pos} of ${s.count}</span>${go(s.next, 'next', 'The meeting after')}<button type="button" class="vm-lk" data-vm="serout">Not part of this series</button></div>`;
|
|
141
|
+
}
|
|
142
|
+
if (S.seriesOff) return `<div class="vm-ser"><span>${ic('notes')}Taken out of its series</span><button type="button" class="vm-lk" data-vm="serback">Put it back</button></div>`;
|
|
143
|
+
return '';
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/** Before, from the note: the meeting context it kept and what was carried in from the meeting before. */
|
|
147
|
+
export function beforeHtml(S, esc) {
|
|
148
|
+
if (!S) return '';
|
|
149
|
+
const out = [];
|
|
150
|
+
if (S.carriedIn) out.push(`<section class="vm-bx"><div class="vm-cap">${ic('notes')}Carried in from ${esc(S.carriedIn.day)}</div>${S.carriedIn.overview ? `<p>${esc(S.carriedIn.overview)}</p>` : ''}${S.carriedIn.items.length ? `<ul class="vm-ul">${S.carriedIn.items.map((x) => `<li>${esc(x.text)}${x.owner ? ` <em>${esc(x.owner)}</em>` : ''}</li>`).join('')}</ul>` : '<p class="note">Nothing from the meeting before is still open.</p>'}</section>`);
|
|
151
|
+
const c = S.context;
|
|
152
|
+
if (!c) { out.push(`<p class="mut vm-none">${S.event ? 'The calendar gave no more about this meeting.' : 'This note is not linked to a calendar event, so nothing was prepared for it.'}</p>`); return out.join(''); }
|
|
153
|
+
const h = [];
|
|
154
|
+
if (c.agenda.length) h.push(`<h5>Agenda${c.agenda.some((a) => a.heard) ? ` <small>${c.agenda.filter((a) => a.heard).length} of ${c.agenda.length} heard</small>` : ''}</h5><div class="vm-agl">${c.agenda.map((a) => `<div class="vm-ag${a.heard ? ' vm-heard' : ''}">${a.heard ? ic('check') : '<i></i>'}<span>${esc(a.text)}</span>${a.heard ? '<small>Heard in the transcript</small>' : ''}</div>`).join('')}</div>`);
|
|
155
|
+
if (c.purpose) h.push(`<h5>What it is for</h5><p>${esc(c.purpose)}</p>`);
|
|
156
|
+
if (c.prep) h.push(`<h5>To be ready</h5><p>${esc(c.prep)}</p>`);
|
|
157
|
+
if (c.read.length) h.push(`<h5>Read first</h5><div class="vm-row">${c.read.map((x) => /^https?:\/\//i.test(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>`);
|
|
158
|
+
if (c.people.length) h.push(`<h5>People</h5><div class="vm-row">${c.people.map((p) => `<span class="pp"><i class="av2">${esc(String(p).charAt(0).toUpperCase())}</i>${esc(clip(p, 40))}</span>`).join('')}</div>`);
|
|
159
|
+
else if (c.attendees) h.push(`<h5>People</h5><p>${c.attendees} attendees. Names are not kept while calendar names are off.</p>`);
|
|
160
|
+
out.push(`<section class="vm-bx"><div class="vm-cap">${ic('cal')}From the note's meeting</div>${h.join('') || '<p class="note">The calendar gave no more about this meeting.</p>'}</section>`);
|
|
161
|
+
return out.join('');
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const trHtml = (L, esc) => `<div class="vm-trn">${L.map((l) => `<div><span class="vm-t">${esc(clock(l.t))}</span><p>${l.who ? `<b>${esc(l.who)}</b> ` : ''}${esc(l.text)}</p></div>`).join('')}</div>`;
|
|
165
|
+
/** During: the transcript the note holds. */
|
|
166
|
+
export function duringHtml(S, esc) {
|
|
167
|
+
if (!S || !S.lines.length) return `<p class="mut vm-none">${S && S.private ? 'This note is private, so its transcript is not shown.' : 'Nothing was transcribed for this meeting yet. Record it, and the lines show here.'}</p>`;
|
|
168
|
+
return `<section class="vm-bx"><div class="vm-cap">Transcript · ${S.lines.length} ${S.lines.length === 1 ? 'line' : 'lines'}</div>${trHtml(S.lines, esc)}<p class="note">Transcribed on this machine.</p></section>`;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/** After: Since the last one. Each next step of the meeting before, then this note's new ones. */
|
|
172
|
+
export function sinceHtml(S, esc) {
|
|
173
|
+
if (!S || !S.since) return '';
|
|
174
|
+
const st = { done: ['ok', 'Done', 'check'], again: ['warn', 'Raised again', 'todo'], quiet: ['', 'Not mentioned', 'todo'] };
|
|
175
|
+
const row = (x, s) => `<li class="vm-si" data-since="${s[1] === 'New' ? 'new' : x.state}"><span class="vm-k ${s[0]}">${ic(s[2])}</span><div><b>${esc(x.text)}</b><small><span class="vm-st ${s[0]}">${esc(s[1])}</span>${x.owner ? esc(x.owner) : ''}</small></div></li>`;
|
|
176
|
+
const rows = [...S.since.items.map((x) => row(x, st[x.state] || st.quiet)), ...S.since.fresh.map((x) => row(x, ['new', 'New', 'plus']))];
|
|
177
|
+
return `<section class="vm-bx vm-since"><div class="vm-cap">${ic('notes')}Since the last one, ${esc(S.since.day)}</div>${rows.length ? `<ul class="vm-sl">${rows.join('')}</ul>` : '<p class="note">The meeting before had no next steps, and this one has none.</p>'}</section>`;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/** The notes table rows for Decision and Why, and Next step with owner, due and Make task. `N` is { decisions, actions, questions, whyCol }; `tasked` the made steps. */
|
|
181
|
+
export function notesTablesHtml(N, esc, tasked) {
|
|
182
|
+
const h = [];
|
|
183
|
+
if (N.decisions.length) h.push(`<table class="vm-tb" data-vm-t="decisions"><thead><tr><th>Decision</th>${N.whyCol ? '<th>Why</th>' : ''}</tr></thead><tbody>${N.decisions.map((d) => `<tr><td>${esc(d.text)}</td>${N.whyCol ? `<td class="w">${d.why ? esc(d.why) : '<span class="mut">No why given</span>'}</td>` : ''}</tr>`).join('')}</tbody></table>`);
|
|
184
|
+
if (N.actions.length) h.push(`<table class="vm-tb" data-vm-t="actions"><thead><tr><th>Next step</th><th>Owner</th><th>Due</th><th><span class="vh">Make task</span></th></tr></thead><tbody>${N.actions.map((a, i) => `<tr><td>${esc(a.text)}</td><td class="o">${a.owner ? esc(a.owner) : '<span class="mut">No owner</span>'}</td><td class="o">${a.due ? esc(a.due) : '<span class="mut">No date</span>'}</td><td class="o"><button type="button" class="mtg-b mtg-task" data-task="${i}"${tasked && tasked.has(i) ? ' disabled' : ''}>${tasked && tasked.has(i) ? 'Task made' : 'Make task'}</button></td></tr>`).join('')}</tbody></table>`);
|
|
185
|
+
if (N.questions.length) h.push(`<h5>Open questions</h5>${N.questions.map((q) => `<div class="vm-q"><span class="vm-tg">Question</span>${esc(q.text)}</div>`).join('')}`);
|
|
186
|
+
return h.join('');
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/** After, from the note: the summary, the tables, the screenshots and the folded transcript. `opts` = { tasked, replayBtn } */
|
|
190
|
+
export function notesHtml(S, esc, opts = {}) {
|
|
191
|
+
if (!S) return '';
|
|
192
|
+
if (S.private) return '<p class="mut vm-none">This note is private, so its notes are not shown.</p>';
|
|
193
|
+
const h = [`<div class="vm-mrow"><b>${esc(S.title)}</b><span class="note">${esc([S.day, S.minutes ? S.minutes + ' min' : ''].filter(Boolean).join(' · '))}</span></div>`];
|
|
194
|
+
if (S.audio || opts.replayBtn) h.push(`<div class="vm-rp"><b>Replay</b>${opts.replayBtn ? '<button type="button" class="mtg-b" data-m3="replay">Replay</button>' : ''}</div>${S.audio ? `<audio class="vm-aud" controls preload="metadata" src="${esc(S.audio)}"></audio>` : ''}<p class="note">Kept on this machine.</p>`);
|
|
195
|
+
h.push(S.overview ? `<p class="vm-sum">${esc(S.overview)}</p>` : `<p class="mut">${S.state === 'recording' || S.state === 'paused' ? 'The summary is written when you stop recording.' : 'The note holds no summary.'}</p>`);
|
|
196
|
+
h.push(notesTablesHtml(S, esc, opts.tasked));
|
|
197
|
+
if (!S.decisions.length && !S.actions.length && !S.questions.length) h.push('<p class="mut">The note holds no decisions, next steps or questions yet.</p>');
|
|
198
|
+
if (S.shots.length) h.push(`<h5>Screen · ${S.shots.length} ${S.shots.length === 1 ? 'shot' : 'shots'}</h5><div class="vm-shots">${S.shots.map((f) => `<figure><img src="/api/notes/screen?id=${encodeURIComponent(S.id)}&t=${f.t}" alt="${esc(f.why || 'The shared screen at ' + clock(f.t))}" loading="lazy"><figcaption>${esc(clock(f.t))}${f.why ? ' · ' + esc(f.why) : ''}</figcaption></figure>`).join('')}</div>`);
|
|
199
|
+
if (S.lines.length) h.push(`<details class="vm-fold"><summary>Transcript · ${S.lines.length} ${S.lines.length === 1 ? 'line' : 'lines'}</summary>${trHtml(S.lines, esc)}</details>`);
|
|
200
|
+
return `<section class="vm-bx vm-notes"><div class="vm-cap">${ic('notes')}Notes</div>${h.join('')}</section>`;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/** The head lines of a note opened on its own: its calendar event and what it is about. `opts.change` adds Change for what it is about. */
|
|
204
|
+
export function linksHtml(S, esc, opts = {}) {
|
|
205
|
+
const chg = opts.change ? `<button type="button" class="vm-lk" data-vm="nabout" aria-expanded="${!!opts.open}">${S.about ? 'Change' : 'Choose what it is about'}</button>` : '';
|
|
206
|
+
return `<div class="vm-ln">${ic('cal')}${S.event ? `<b>${esc(S.event.title)}</b><span>· ${esc(S.event.when)}</span>` : `<span class="mut">${S.adhoc ? 'A meeting that is not on the calendar' : 'No meeting'}</span>`}</div>`
|
|
207
|
+
+ `<div class="vm-ln">${ic('lay')}${S.about ? `<b>${esc(S.about)}</b>` : '<span class="mut">Not linked to the Portfolio, a board or an initiative</span>'}${chg}</div>`;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/* ── what a note is about: the console's one picker (c3-notes.js aboutMenu), as a select ────────────────────────────── */
|
|
211
|
+
|
|
212
|
+
/** The choices, from GET /api/boards with each board's initiatives (GET /api/boards/backlog rows): Portfolio, each board, its initiatives. */
|
|
213
|
+
export function aboutChoices(boards) {
|
|
214
|
+
const out = [{ v: 'p', label: 'Portfolio', body: { portfolio: true } }];
|
|
215
|
+
for (const b of boards || []) {
|
|
216
|
+
if (!b || !b.id) continue;
|
|
217
|
+
const board = { id: b.id, ws: b.ws || null, title: b.name || b.title || b.id };
|
|
218
|
+
out.push({ v: 'b:' + (board.ws || '') + '/' + board.id, label: 'Board: ' + board.title, body: { board, initiative: null } });
|
|
219
|
+
for (const i of b.inis || []) if (i && i.id) out.push({ v: 'i:' + (board.ws || '') + '/' + i.id, label: 'Initiative: ' + clip(i.title || i.id, 70), body: { board, initiative: { id: i.id, ws: board.ws, title: i.title || i.id } } });
|
|
220
|
+
}
|
|
221
|
+
return out;
|
|
222
|
+
}
|
|
223
|
+
/** The value of the note's current link among the choices, or ''. */
|
|
224
|
+
export function aboutNow(note) {
|
|
225
|
+
if (!note) return '';
|
|
226
|
+
if (note.initiative && note.initiative.id) return 'i:' + (note.initiative.ws || (note.board && note.board.ws) || '') + '/' + note.initiative.id;
|
|
227
|
+
if (note.board && note.board.id) return 'b:' + (note.board.ws || '') + '/' + note.board.id;
|
|
228
|
+
return note.portfolio ? 'p' : '';
|
|
229
|
+
}
|
|
230
|
+
/** The body of POST /api/notes/link for a choice; 'none' removes the link. Null for an unknown value. */
|
|
231
|
+
export function aboutBody(id, v, choices) {
|
|
232
|
+
if (v === 'none') return { id, portfolio: false, board: null, initiative: null };
|
|
233
|
+
const c = (choices || []).find((x) => x.v === v);
|
|
234
|
+
return c ? { id, ...c.body } : null;
|
|
235
|
+
}
|
|
236
|
+
const aboutPickHtml = (choices, cur, esc) => choices ? `<div class="mtg-link vm-nabout"><select aria-label="What this note is about">${[['', 'Choose what it is about'], ...choices.map((c) => [c.v, c.label]), ...(cur ? [['none', 'Not linked']] : [])].map(([v, l]) => `<option value="${esc(v)}"${v && v === cur ? ' selected' : ''}>${esc(l)}</option>`).join('')}</select><button type="button" class="addb pri" data-vm="nsave">Save</button></div>` : '<p class="note vm-nabout" role="status">Reading the boards.</p>';
|
|
237
|
+
|
|
238
|
+
/* ── the viewer tab: a meeting of the series, opened beside the dialog's own meeting ─────────────────────────────── */
|
|
239
|
+
|
|
240
|
+
/** Loads this view's stylesheet once (the frame keeps one link per view). */
|
|
241
|
+
export const vmStyle = () => { if (typeof document !== 'undefined') vwStyle('meet'); };
|
|
242
|
+
|
|
243
|
+
/** Opens a note in the viewer: one tab that pages through its series. The Notes list (premium-vw-notes.js) and the meeting dialog's
|
|
244
|
+
* series line open it. deps: { pmGet, pmPost, esc, toast, task(sheet, step) → Promise<{ ok, text }>, changed?() after a write } */
|
|
245
|
+
export async function openNoteTab(d, id) {
|
|
246
|
+
vmStyle();
|
|
247
|
+
const st = { id, note: null, sheet: null, error: '', phase: 'after', tasked: new Set(), say: '', about: false, choices: null };
|
|
248
|
+
const ctx = () => ({ esc: d.esc, tasked: st.tasked, replayBtn: false, where: 'tab', id: st.id, reread: () => read(st.id) });
|
|
249
|
+
const html = () => {
|
|
250
|
+
const S = st.sheet;
|
|
251
|
+
if (!S) return `<article class="paper doc mtg vm"><p class="note" role="status">${st.error ? 'The note could not be read: ' + d.esc(st.error) : 'Reading the note.'}</p></article>`;
|
|
252
|
+
const part = (k) => `<div class="vm-body" data-part="${k}"${st.phase === k ? '' : ' hidden'}>${stageHtml(k, S, ctx())}</div>`;
|
|
253
|
+
return `<article class="paper doc mtg vm"><p class="note mtg-status" role="status"${st.say ? '' : ' hidden'}>${d.esc(st.say)}</p><div class="mh2"><div><h3 class="d1">${d.esc(S.title)}</h3><p class="mt">${d.esc([S.day, S.minutes ? S.minutes + ' min' : ''].filter(Boolean).join(' · '))}</p></div></div>${linksHtml(S, d.esc, { change: true, open: st.about })}${st.about ? aboutPickHtml(st.choices, aboutNow(st.note), d.esc) : ''}${seriesHtml(S, d.esc)}${phaseHtml(st.phase, d.esc)}${PHASES.map(([k]) => part(k)).join('')}</article>`;
|
|
254
|
+
};
|
|
255
|
+
let el = null;
|
|
256
|
+
const wireParts = () => { if (!el || !st.sheet) return; for (const [k] of PHASES) wireStage(k, el.querySelector(`.vm-body[data-part="${k}"]`), st.sheet, ctx()); };
|
|
257
|
+
const paint = () => { if (el && el.isConnected) { el.innerHTML = html(); wireParts(); } };
|
|
258
|
+
async function read(noteId) {
|
|
259
|
+
const fresh = noteId !== st.id || !st.sheet;
|
|
260
|
+
st.id = noteId; if (fresh) { st.sheet = null; st.tasked = new Set(); st.about = false; } st.error = ''; st.say = ''; paint();
|
|
261
|
+
const one = await d.pmGet('/api/notes/one?id=' + encodeURIComponent(noteId));
|
|
262
|
+
if (st.id !== noteId) return;
|
|
263
|
+
const was = st.sheet;
|
|
264
|
+
st.sheet = noteSheet(one); st.note = st.sheet ? one.note : null; st.error = st.sheet ? '' : (one && one.error) || 'no answer';
|
|
265
|
+
if (st.sheet && (fresh || !was)) st.phase = phaseOf({ noteState: st.sheet.state, hasNotes: !!(st.sheet.overview || st.sheet.decisions.length || st.sheet.actions.length) });
|
|
266
|
+
el = vwOpen({ id: 'meet-note', title: st.sheet ? st.sheet.title : 'Meeting note', icon: 'notes', html: html(), wire });
|
|
267
|
+
wireParts();
|
|
268
|
+
}
|
|
269
|
+
async function boards() {
|
|
270
|
+
const r = await d.pmGet('/api/boards');
|
|
271
|
+
const list = r && r.ok && Array.isArray(r.boards) ? r.boards.filter((b) => b && b.id && !b.error) : [];
|
|
272
|
+
await Promise.all(list.map(async (b) => {
|
|
273
|
+
const x = await d.pmGet('/api/boards/backlog?ws=' + encodeURIComponent(b.ws || '') + '&board=' + encodeURIComponent(b.id) + '&limit=100');
|
|
274
|
+
b.inis = x && x.ok && Array.isArray(x.rows) ? x.rows : [];
|
|
275
|
+
}));
|
|
276
|
+
return aboutChoices(list);
|
|
277
|
+
}
|
|
278
|
+
function wire(pane) {
|
|
279
|
+
el = pane;
|
|
280
|
+
pane.onclick = async (e) => {
|
|
281
|
+
const b = e.target.closest('button'); if (!b || !st.sheet) return;
|
|
282
|
+
if (b.dataset.ph) {
|
|
283
|
+
st.phase = b.dataset.ph;
|
|
284
|
+
el.querySelectorAll('.vm-ph [data-ph]').forEach((x) => x.setAttribute('aria-pressed', String(x === b)));
|
|
285
|
+
el.querySelectorAll('.vm-body[data-part]').forEach((x) => { x.hidden = x.dataset.part !== st.phase; });
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
if ((b.dataset.vm === 'prev' || b.dataset.vm === 'next') && b.dataset.id) return read(b.dataset.id);
|
|
289
|
+
if (b.dataset.vm === 'nabout') {
|
|
290
|
+
st.about = !st.about; paint();
|
|
291
|
+
if (st.about && !st.choices) { st.choices = await boards(); if (st.about) paint(); }
|
|
292
|
+
const sel = el.querySelector('.vm-nabout select'); if (sel) sel.focus();
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
if (b.dataset.vm === 'nsave') {
|
|
296
|
+
const sel = el.querySelector('.vm-nabout select'), body = sel && aboutBody(st.sheet.id, sel.value, st.choices);
|
|
297
|
+
if (!body) { d.toast('Choose what the note is about first.'); return; }
|
|
298
|
+
b.disabled = true;
|
|
299
|
+
const r = await d.pmPost('/api/notes/link', body);
|
|
300
|
+
if (!r || !r.ok) { b.disabled = false; d.toast('Not saved' + (r && r.error ? ': ' + r.error : '.')); return; }
|
|
301
|
+
d.toast(sel.value === 'none' ? 'Not linked to the Portfolio, a board or an initiative.' : 'Saved. The note moved into its group.');
|
|
302
|
+
st.about = false; if (d.changed) d.changed();
|
|
303
|
+
return read(st.sheet.id);
|
|
304
|
+
}
|
|
305
|
+
if (b.dataset.vm === 'serout' || b.dataset.vm === 'serback') {
|
|
306
|
+
const r = await d.pmPost('/api/notes/series-member', { id: st.sheet.id, key: b.dataset.vm === 'serout' ? 'off' : null });
|
|
307
|
+
d.toast(r && r.ok ? (b.dataset.vm === 'serout' ? 'Taken out of the series.' : 'Back in its series.') : 'Not saved' + (r && r.error ? ': ' + r.error : '.'));
|
|
308
|
+
if (r && r.ok) { if (d.changed) d.changed(); read(st.sheet.id); }
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
if (b.dataset.task !== undefined) {
|
|
312
|
+
const i = +b.dataset.task, step = st.sheet.actions[i]; if (!step) return;
|
|
313
|
+
b.disabled = true;
|
|
314
|
+
const res = await d.task(st.sheet, step);
|
|
315
|
+
if (res.ok) st.tasked.add(i);
|
|
316
|
+
st.say = res.text; paint();
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
el = vwOpen({ id: 'meet-note', title: 'Meeting note', icon: 'notes', html: html(), wire });
|
|
321
|
+
await read(id);
|
|
322
|
+
}
|