create-pmos 0.434.0 → 0.436.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +25 -25
- package/payload/KIT-VERSION +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/changelog.json +24 -0
- package/workspace/fixtures/ready-reports.js +145 -0
- package/workspace/guide/home.md +1 -1
- package/workspace/guide/index.md +1 -0
- package/workspace/guide/initiative-boards.md +1 -1
- package/workspace/guide/ready-made-dashboards.md +62 -0
- package/workspace/lib/board-premium.js +1 -1
- package/workspace/lib/engine/boards.js +1 -1
- package/workspace/lib/intel-report.js +36 -5
- package/workspace/lib/ready-reports.js +616 -0
- package/workspace/lib/report-dashboards.js +5 -0
- package/workspace/lib/report-setups.js +16 -7
- package/workspace/lib/route-modules.js +1 -0
- package/workspace/lib/routes-board-premium.js +5 -0
- package/workspace/lib/routes-boards.js +3 -2
- package/workspace/lib/routes-ready-reports.js +455 -0
- package/workspace/lib/routes-report-setups.js +4 -3
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/program-charter-test.js +11 -7
- package/workspace/program-panel-test.js +1 -1
- package/workspace/public/pm/bd-ini-panel.js +23 -6
- package/workspace/public/pm/bd-prog-panel.js +58 -10
- package/workspace/public/pm/cozy-viewer.js +2 -2
- package/workspace/public/pm/cozy-vw-rp.css +13 -0
- package/workspace/public/pm/dash-view.css +111 -0
- package/workspace/public/pm/dash-view.js +261 -0
- package/workspace/public/pm/home-app.js +26 -0
- package/workspace/public/pm/home-data.js +3 -2
- package/workspace/public/pm/home-ini.js +19 -1
- package/workspace/public/pm/home-task.js +4 -2
- package/workspace/public/pm/ini-tasks.js +34 -6
- package/workspace/public/pm/ini-view.css +4 -0
- package/workspace/public/pm/premium-insights.js +10 -2
- package/workspace/public/pm/premium-report-read.js +36 -5
- package/workspace/public/pm/premium-vw-item.js +2 -0
- package/workspace/public/pm/ready-lib.css +29 -0
- package/workspace/public/pm/ready-lib.js +62 -0
- package/workspace/public/pm/task-card.css +1 -0
- package/workspace/public/pm/task-card.js +8 -3
- package/workspace/ready-dash-ui-test.js +227 -0
- package/workspace/server.js +2 -0
- package/workspace/task-delete-test.js +31 -0
- package/workspace/task-views-test.js +16 -0
- package/workspace/test-lists/batch17-ready-reports.json +9 -0
- package/workspace/test-lists/ready-reports-ui.json +6 -0
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
/* pm/dash-view.js — the ready-made Dashboard view of a program, a product or an initiative (batch 17 item 1, design A+; canvas In development,
|
|
2
|
+
* band "Ready-made dashboards and reports": PbH1Header, PbA1–PbA3, PbA5, PbA7, PbS1, PbS2, PbG2, PbG3, PbG6–PbG10).
|
|
3
|
+
*
|
|
4
|
+
* The program panel (bd-prog-panel.js), the initiative view (bd-ini-panel.js on the Board, home-ini.js on Home) and the product page (home-app.js)
|
|
5
|
+
* draw the same markup in the Viewer's shell. The model is the server's: GET /api/ready-reports/dashboard?ws&scope&from (lib/ready-reports.js).
|
|
6
|
+
* This file only draws it and wires its presses; it reads nothing on its own except that one route (readDash).
|
|
7
|
+
*
|
|
8
|
+
* readDash(ws, scope, from) → the dashboard, or null when it could not be read (the host then shows Work and offers no toggle)
|
|
9
|
+
* viewOf(page, opens) 'dash' | 'work': the PM's last choice on this page wins; else the server's opening view (read → Dashboard, act → Work)
|
|
10
|
+
* keepView(page, v) remembers the PM's choice per page, in this browser
|
|
11
|
+
* togglePress(v) the one header icon (PbH1): a gauge from Work, a list from Dashboard, aria-pressed
|
|
12
|
+
* dashHtml(d, o) the body: ✦ line · Goal(s) · the stage block · Guardrails · Needs you · Reports · Done. Zero is silence: an empty
|
|
13
|
+
* block is not drawn. o: { mdHtml (the goal Claude drafted, pm/metric-drafts.js, for "No goal yet"), talk (the
|
|
14
|
+
* phone's "Message Claude about …" line) }. A body 720 px or wider lays the blocks in two columns (PbA7).
|
|
15
|
+
* wireDash(body, h) the presses, once per body. h: { ws, scope, toast(text), reload(), openReport(row), editNeeds(n), milestones(),
|
|
16
|
+
* mdPress(btn) }. Every write is one press, then the dashboard is read again (h.reload).
|
|
17
|
+
*
|
|
18
|
+
* Adler: the M face leads the ✦ line in the mood the line already has (handled, or honest when it warns); one Adler per screen, never inside
|
|
19
|
+
* a row. Icon-only presses carry their words in aria-label and title. */
|
|
20
|
+
import { pmPost } from './http.js';
|
|
21
|
+
import { adler } from './cozy-adler.js';
|
|
22
|
+
|
|
23
|
+
const CSS = new URL('./dash-view.css', import.meta.url).href;
|
|
24
|
+
if (typeof document !== 'undefined' && document.head && !document.querySelector(`link[href="${CSS}"]`)) {
|
|
25
|
+
const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = CSS; document.head.appendChild(l);
|
|
26
|
+
}
|
|
27
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
28
|
+
const SV = (d, w = 18, sw = 1.8) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${sw}" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
|
|
29
|
+
export const I = {
|
|
30
|
+
gauge: 'M4.5 17a8 8 0 1 1 15 0M12 13l3.5-4M12 13h.01',
|
|
31
|
+
list: 'M9 6h11M9 12h11M9 18h11M4.5 6h.01M4.5 12h.01M4.5 18h.01',
|
|
32
|
+
spark: 'M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z', warn: 'M12 4l9 16H3zM12 10v4M12 17h.01',
|
|
33
|
+
rep: 'M6 3h9l4 4v14H6zM14 3v5h5M9 18v-3M12 18v-6M15 18v-4', dia: 'M12 4l8 8-8 8-8-8z', chk: 'M5 12l5 5 9-10', lock: 'M6 11h12v9H6zM8.5 11V8a3.5 3.5 0 0 1 7 0v3',
|
|
34
|
+
chart: 'M4 18l5-6 4 3 7-8', next: 'M10 7l5 5-5 5', down: 'M7 10l5 5 5-5', x: 'M6 6l12 12M18 6L6 18', pen: 'M4 20h4L19 9l-4-4L4 16zM13.5 6.5l4 4',
|
|
35
|
+
send: 'M4 12l16-8-6 16-3-7z', flag: 'M5 21V4h11l-2 4 2 4H5', pause: 'M9 6v12M15 6v12', clock: 'M12 7v5l3 2M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0-18',
|
|
36
|
+
again: 'M4 12a8 8 0 0 1 14-5.3L20 9M20 4v5h-5M20 12a8 8 0 0 1-14 5.3L4 15M4 20v-5h5', plug: 'M9 3v5M15 3v5M7 8h10v4a5 5 0 0 1-10 0zM12 17v4',
|
|
37
|
+
cal: 'M4 5h16v15H4zM8 3v4M16 3v4M4 10h16', target: 'M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0-18M12 7a5 5 0 1 0 0 10a5 5 0 1 0 0-10M12 11a1 1 0 1 0 0 2a1 1 0 1 0 0-2',
|
|
38
|
+
people: 'M9 11a3.5 3.5 0 1 0 0-7a3.5 3.5 0 1 0 0 7M2.5 20a6.5 6.5 0 0 1 13 0M16 4.5a3.5 3.5 0 0 1 0 6.5M18 14a6 6 0 0 1 3.5 6',
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/* ── which view opens ── */
|
|
42
|
+
const PREF = 'pmos.dash.view:';
|
|
43
|
+
const get = (k) => { try { return localStorage.getItem(k); } catch { return null; } };
|
|
44
|
+
const set = (k, v) => { try { localStorage.setItem(k, v); } catch { /* a private window */ } };
|
|
45
|
+
/** The PM's last choice on this page (a program, an initiative) wins; with none, the server's opening view: Dashboard when the PM came to
|
|
46
|
+
* read (Intelligence, a report, a notification), Work when they came to act (a Board row, a Home task). */
|
|
47
|
+
export function viewOf(page, opens) { const v = get(PREF + page); return v === 'dash' || v === 'work' ? v : opens === 'dashboard' ? 'dash' : 'work'; }
|
|
48
|
+
export const keepView = (page, v) => set(PREF + page, v === 'dash' ? 'dash' : 'work');
|
|
49
|
+
/** The one toggle icon in the charter's old place (PbH1): it shows where it takes you; pressed while the Dashboard is shown. */
|
|
50
|
+
export const togglePress = (v) => ({ act: 'dash', label: v === 'dash' ? 'Show the work' : 'Show the dashboard', icon: v === 'dash' ? I.list : I.gauge, pressed: v === 'dash' });
|
|
51
|
+
|
|
52
|
+
/** GET /api/ready-reports/dashboard. null when the route is missing or refused, so the host never draws a toggle to nothing. */
|
|
53
|
+
export async function readDash(ws, scope, from) {
|
|
54
|
+
const u = '/api/ready-reports/dashboard?' + new URLSearchParams(Object.entries({ ws: ws || '', scope, from: from || '' }).filter(([, v]) => v)).toString();
|
|
55
|
+
try { const r = await fetch(u, { credentials: 'same-origin' }); if (r.status !== 200) return null; const j = await r.json(); return j && j.ok !== false && (j.dashboard || j.scope) ? (j.dashboard || j) : null; } catch { return null; }
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* ── the parts ── */
|
|
59
|
+
const DOT = { ahead: 'ok', on: 'ok', ok: 'ok', done: 'ok', behind: 'risk', risk: 'risk', late: 'late', off: 'late', none: 'q', first: 'q', q: 'q' };
|
|
60
|
+
const dot = (d, label) => `<span class="db-dot ${DOT[d] || 'q'}"${label ? ` role="img" aria-label="${esc(label)}"` : ' aria-hidden="true"'}></span>`;
|
|
61
|
+
const who = (o) => { const n = String((o && (o.name || o)) || '').trim(); if (!n) return ''; const w = n.split(/\s+/); return `<span class="db-who" title="${esc(n)}" aria-label="${esc('Owner ' + n)}">${esc((w.length > 1 ? w[0][0] + w[1][0] : n[0]).toUpperCase())}</span>`; };
|
|
62
|
+
const tag = (p) => (p && p.tag ? `<span class="db-tag" title="${esc(p.name || p.tag)}">${esc(p.tag)}</span>` : '');
|
|
63
|
+
const ib = (act, label, icon, o = {}) => `<button type="button" class="db-ib${o.solid ? ' solid' : ''}" data-db="${esc(act)}"${o.k ? ` data-k="${esc(o.k)}"` : ''} aria-label="${esc(label)}" title="${esc(label)}"${o.off ? ' disabled' : ''}>${SV(icon, 17, o.solid ? 2.2 : 1.8)}</button>`;
|
|
64
|
+
const sec = (title, inner, cls = '', tail = '') => `<section class="db-b${cls ? ' ' + cls : ''}" aria-label="${esc(title)}">${tail ? `<div class="db-hr"><h4 class="db-h">${esc(title)}</h4>${tail}</div>` : `<h4 class="db-h">${esc(title)}</h4>`}${inner}</section>`;
|
|
65
|
+
const STATE_DOT = { ahead: 'ahead', on: 'on', behind: 'behind', late: 'late' };
|
|
66
|
+
|
|
67
|
+
/** The ✦ line (PbA1 top): what Claude handled, the lead in bold and the rest quiet. A warning (a stale source, a heads-up) is the honest face. */
|
|
68
|
+
function handledHtml(h) {
|
|
69
|
+
if (!h || !(h.lead || h.rest)) return '';
|
|
70
|
+
const warn = h.tone === 'warn';
|
|
71
|
+
return `<div class="db-hd${warn ? ' warn' : ''}" role="status"><span class="db-face">${adler(warn ? 'honest' : 'handled', 36, { label: false, id: 'db' })}</span>`
|
|
72
|
+
+ `<p><b>${esc(h.lead || '')}</b>${h.rest ? ' ' + esc(h.rest) : ''}</p>${h.act ? ib('handled', h.act.label || 'Keep both', I.chk, { solid: true, k: h.act.act || 'keep' }) : ''}</div>`;
|
|
73
|
+
}
|
|
74
|
+
/** Goal(s): the Claude-runs-the-OKRs goal row (a press opens the goal's Viewer); never a second goal list. The product page folds them to one
|
|
75
|
+
* summary row of dots (PbA3). With no goal yet, the goal Claude drafted (pm/metric-drafts.js) under a hollow "No goal yet". */
|
|
76
|
+
function goalsHtml(d, o) {
|
|
77
|
+
const G = d.goals || [];
|
|
78
|
+
// the product page keeps its way into the metrics review (o.metrics): one icon at the Goals block's head
|
|
79
|
+
const mx = d.level === 'product' && o.metrics ? `<button type="button" class="db-ib" data-db="metrics" aria-label="Open the metrics review" title="Metrics review">${SV(I.chart, 18)}</button>` : '';
|
|
80
|
+
if (!G.length && mx) return `<section class="db-b" aria-label="Goals"><div class="db-card"><div class="db-gh"><span class="db-rt"><b>Goals</b><small>No goal yet</small></span>${mx}</div>${d.drafts && d.drafts.goal && o.mdHtml ? o.mdHtml : ''}</div></section>`;
|
|
81
|
+
if (!G.length) return d.drafts && d.drafts.goal && o.mdHtml ? sec('Goal', `<div class="db-card"><p class="db-none">${dot('none')}No goal yet</p>${o.mdHtml}</div>`) : '';
|
|
82
|
+
const row = (g) => `<button type="button" class="db-row" data-db="goal" data-k="${esc(g.id)}"${g.ws || (g.product && g.product.ws) ? ` data-ws="${esc(g.ws || g.product.ws)}"` : ''}>${dot(g.dot, g.dot === 'none' ? 'No reading yet' : g.dot === 'behind' ? 'Behind its line' : g.dot === 'ahead' ? 'Ahead of its line' : 'On its line')}`
|
|
83
|
+
+ `<span class="db-rt"><b>${esc(g.title)}</b>${g.sub || g.product ? `<small>${tag(g.product)}${esc(g.sub || '')}</small>` : ''}</span>${who(g.owner)}</button>`;
|
|
84
|
+
if (d.level === 'product') {
|
|
85
|
+
const behind = G.filter((g) => DOT[g.dot] === 'risk' || DOT[g.dot] === 'late'), on = G.length - behind.length;
|
|
86
|
+
const line = [on ? on + ' on ' + (on === 1 ? 'its' : 'their') + ' line' : '', behind.length ? behind.map((g) => g.short || g.title).slice(0, 2).join(behind.length > 2 ? ', ' : ' and ') + (behind.length > 2 ? ' and ' + (behind.length - 2) + ' more' : '') + (behind.length === 1 ? ' is behind' : ' are behind') : ''].filter(Boolean).join(' · ');
|
|
87
|
+
const open = !!(o.open && o.open.has('goals'));
|
|
88
|
+
return `<section class="db-b" aria-label="Goals"><div class="db-card"><div class="db-gh"><button type="button" class="db-sum" data-db="fold" data-k="goals" aria-expanded="${open}"><span class="db-rt"><b>Goals</b><small>${esc(line)}</small></span>`
|
|
89
|
+
+ `<span class="db-dots" aria-hidden="true">${G.slice(0, 6).map((g) => dot(g.dot)).join('')}</span>${SV(open ? I.down : I.next, 16)}</button>${mx}</div>${open ? `<div class="db-list">${G.map(row).join('')}</div>` : ''}</div></section>`;
|
|
90
|
+
}
|
|
91
|
+
return sec(G.length === 1 ? 'Goal' : 'Goals', `<div class="db-card db-list">${G.map(row).join('')}</div>`);
|
|
92
|
+
}
|
|
93
|
+
/** The promise date Claude drafted from the usual stage times, marked a guess (PbA5): ✕ ✎ ✓. */
|
|
94
|
+
function promiseHtml(p) {
|
|
95
|
+
return `<div class="db-draft"><span class="db-dic">${SV(I.cal, 16)}</span><span class="db-rt"><b>Promise ${esc(p.date || '')}</b>${p.sub ? `<small>${esc(p.sub)}</small>` : ''}</span>`
|
|
96
|
+
+ `<div class="db-acts">${ib('promise', 'Not now', I.x, { k: 'drop' })}${ib('promise-edit', 'Change the date', I.pen)}${ib('promise', 'Keep this promise date', I.chk, { solid: true, k: 'keep' })}</div></div>`;
|
|
97
|
+
}
|
|
98
|
+
/** The stage block, by where the work is in its lifecycle. */
|
|
99
|
+
function stageHtml(d, o = {}) {
|
|
100
|
+
const S = d.stage, stale = d.heldBy && /jira/i.test(d.heldBy.source || '');
|
|
101
|
+
if (!S) return d.drafts && d.drafts.promise ? sec('Ships', `<div class="db-card"><p class="db-none">${dot('none')}No promise date yet</p>${promiseHtml(d.drafts.promise)}</div>`) : '';
|
|
102
|
+
if (S.kind === 'ready') { // PbS1: the exit checklist of the stage, who owes what, the day against the usual
|
|
103
|
+
const L = S.items || [], open = L.filter((x) => !x.done), done = L.filter((x) => x.done);
|
|
104
|
+
const shown = [...done.slice(-2), ...open], early = done.length - Math.min(2, done.length);
|
|
105
|
+
const item = (x) => `<li class="db-ck${x.done ? ' on' : ''}"><span class="db-box" aria-hidden="true">${x.done ? SV(I.chk, 13, 3) : ''}</span><span class="db-rt">${esc(x.text)}</span>${x.who || x.when ? `<small class="db-r">${esc([x.who, x.when].filter(Boolean).join(' · '))}</small>` : ''}</li>`;
|
|
106
|
+
return sec('Ready for build', `<div class="db-card"><div class="db-top"><b class="db-big">${esc(S.done)} of ${esc(S.total)}</b>${S.day ? `<small>day ${esc(S.day)}${S.usual ? ' · ' + esc(S.stage || 'this stage') + ' usually takes ' + esc(S.usual) : ''}</small>` : ''}</div>`
|
|
107
|
+
+ `<ul class="db-cks" aria-label="${esc(S.done + ' of ' + S.total + ' done')}">${shown.map(item).join('')}</ul>${early > 0 ? `<p class="db-more">${early} done earlier</p>` : ''}</div>`);
|
|
108
|
+
}
|
|
109
|
+
if (S.kind === 'ships') { // PbA1: the forecast range against the promise, the stages, Jira; PbG9 one date, no range before 3 weeks of tickets
|
|
110
|
+
const range = S.lo && S.hi && S.lo !== S.hi ? S.lo + ' to ' + S.hi : S.lo || S.promised || '';
|
|
111
|
+
const right = stale ? 'as of ' + (d.heldBy.since || '') : S.promised && range !== S.promised ? 'promised ' + S.promised : S.promised ? 'on its promise' : '';
|
|
112
|
+
const steps = (S.steps || []).length ? `<div class="db-steps" role="img" aria-label="${esc((S.steps || []).map((x) => x.name + ' ' + (x.state || '')).join(', '))}">${S.steps.map((x) => `<span class="db-st ${esc(x.state || 'next')}"><i></i><small>${esc(x.name)}${x.state === 'now' && S.today ? ' · ' + esc(S.today) : ''}</small></span>`).join('')}</div>` : '';
|
|
113
|
+
const j = S.jira ? [S.jira.total ? 'Jira · ' + S.jira.done + ' of ' + S.jira.total + ' tickets done' : '', S.jira.at ? 'read ' + S.jira.at : '', S.note || ''].filter(Boolean).join(' · ') : S.note || '';
|
|
114
|
+
const why = stale ? `<p class="db-meta">${esc(d.heldBy.why || 'The source could not be read.')}</p><div class="db-acts">${ib('reread', 'Read it again', I.again, { k: d.heldBy.source })}${ib('reconnect', 'Connect again', I.plug, { solid: true, k: d.heldBy.source })}</div>` : '';
|
|
115
|
+
return sec('Ships', `<div class="db-card"><div class="db-top">${dot(stale ? 'none' : S.dot)}<b class="db-big">${esc(range)}</b>${right ? `<small>${esc(right)}</small>` : ''}</div>${stale ? '' : steps}${!stale && j ? `<p class="db-meta">${esc(j)}</p>` : ''}${why}</div>`);
|
|
116
|
+
}
|
|
117
|
+
if (S.kind === 'milestones') { // PbA2, PbG10: the track, then one row per milestone with its product's tile
|
|
118
|
+
const M = S.items || [];
|
|
119
|
+
const track = M.length > 1 && !M.some((m) => m.product) ? `<div class="db-trk" aria-hidden="true">${M.map((m) => `<i class="${esc(DOT[m.dot] || 'q')}${m.done ? ' done' : ''}"></i>`).join('')}</div>` : '';
|
|
120
|
+
const row = (m) => `<div class="db-ms">${m.product ? tag(m.product) : dot(m.done ? 'done' : m.dot)}<span class="db-rt">${esc(m.name)}</span><small class="db-r">${esc(m.when || '')}</small></div>`;
|
|
121
|
+
return sec('Milestones', `<div class="db-card">${track}${M.map(row).join('')}${S.note ? `<p class="db-meta">${esc(S.note)}</p>` : ''}</div>`, '', ib('milestones', 'Edit the milestones in the charter', I.pen));
|
|
122
|
+
}
|
|
123
|
+
if (S.kind === 'did-it-work') { // PbS2: the reading against the promise, day N of the window; PbG7 a closed program lists each goal's landing
|
|
124
|
+
if (Array.isArray(S.items)) return sec('Did it work?', `<div class="db-card db-list">${S.items.map((g) => `<div class="db-row">${dot(g.dot)}<span class="db-rt"><b>${esc(g.title)}</b>${g.sub ? `<small>${esc(g.sub)}</small>` : ''}</span>${who(g.owner)}</div>`).join('')}</div>`);
|
|
125
|
+
const pct = S.day && S.window ? Math.max(0, Math.min(100, Math.round(S.day / S.window * 100))) : null;
|
|
126
|
+
return sec('Did it work?', `<div class="db-card"><div class="db-top">${dot(S.dot)}<b class="db-big">${esc(S.head || '')}</b>${S.day && S.window ? `<small>day ${esc(S.day)} of ${esc(S.window)}</small>` : ''}</div>`
|
|
127
|
+
+ (pct !== null ? `<div class="db-win" role="img" aria-label="${esc('Day ' + S.day + ' of ' + S.window)}"><i style="width:${pct}%"></i></div>` : '')
|
|
128
|
+
+ `${S.promise ? `<p class="db-meta">${esc(S.promise)}</p>` : ''}${S.note ? `<p class="db-p">${esc(S.note)}</p>` : ''}</div>`);
|
|
129
|
+
}
|
|
130
|
+
if (S.kind === 'ships-next') { // PbA3: the product's initiatives, late first, the next 2, the rest folded
|
|
131
|
+
const L = S.items || [], open = !!(o.open && o.open.has('ships'));
|
|
132
|
+
const row = (x) => `<div class="db-row">${dot(x.dot)}<span class="db-rt"><b>${esc(x.name)}</b><small>${esc([x.lo && x.hi && x.lo !== x.hi ? x.lo + '–' + x.hi : x.when || x.lo || '', x.promised && x.promised !== x.when ? 'promised ' + x.promised : x.promised ? 'on its date' : ''].filter(Boolean).join(' · '))}</small></span>${who(x.owner)}</div>`;
|
|
133
|
+
// "3 more" folds the rest; the server's words lead ("3 more, all on their dates"); with no rows to show it is one quiet line, never a dead fold
|
|
134
|
+
const mr = S.more && S.more.count ? S.more.items || S.more.rows || [] : [], mt = S.more ? S.more.text || S.more.count + ' more' : '';
|
|
135
|
+
const more = !S.more || !S.more.count ? '' : !mr.length ? `<p class="db-more">${esc(mt)}</p>`
|
|
136
|
+
: `<button type="button" class="db-fold" data-db="fold" data-k="ships" aria-expanded="${open}"><span class="db-rt"><b>${esc(mt)}</b>${S.more.sub ? `<small>${esc(S.more.sub)}</small>` : ''}</span>${SV(I.down, 16)}</button>${open ? mr.map(row).join('') : ''}`;
|
|
137
|
+
return L.length ? sec('Ships next', `<div class="db-card db-list">${L.map(row).join('')}${more}</div>`) : '';
|
|
138
|
+
}
|
|
139
|
+
if (S.kind === 'on-hold') return sec('On hold', `<div class="db-card"><p class="db-none">${SV(I.pause, 15)}On hold${S.since ? ' since ' + esc(S.since) : ''}. Its reports are paused.</p></div>`);
|
|
140
|
+
return '';
|
|
141
|
+
}
|
|
142
|
+
const guardHtml = (d) => ((d.guardrails || []).length ? sec('Guardrails', `<div class="db-card db-list">${d.guardrails.map((g) => `<div class="db-row">${dot(g.dot)}<span class="db-rt"><b>${esc(g.title)}</b>${g.sub ? `<small>${esc(g.sub)}</small>` : ''}</span>${who(g.owner)}</div>`).join('')}</div>`) : '');
|
|
143
|
+
/** Needs you: one decision with Claude's pick (PbA1): ✕ drops it, ✎ opens it to change, ✓ keeps the pick. */
|
|
144
|
+
function needsHtml(d) {
|
|
145
|
+
const n = d.needs; if (!n || !n.q) return '';
|
|
146
|
+
return sec('Needs you', `<div class="db-card db-need"><div class="db-nq">${SV(I.flag, 16)}<span class="db-rt"><b>${esc(n.q)}</b>${n.sub ? `<small>${esc(n.sub)}</small>` : ''}${n.pick ? `<span class="db-pick">✦ My pick: ${esc(n.pick)}</span>` : ''}</span></div>`
|
|
147
|
+
+ `<div class="db-acts">${ib('needs', 'Not now', I.x, { k: 'drop', off: !n.drop })}${ib('needs-edit', 'Change it first', I.pen)}${ib('needs', 'Keep my pick' + (n.pick ? ': ' + n.pick : ''), I.chk, { solid: true, k: 'keep', off: !n.keep })}</div></div>`);
|
|
148
|
+
}
|
|
149
|
+
/* ── Reports ── */
|
|
150
|
+
const KIND_ICON = { weekly: I.rep, checkpoint: I.dia, 'did-it-work': I.chk, 'heads-up': I.warn, frozen: I.lock, metrics: I.chart };
|
|
151
|
+
const iconOf = (r) => (r.state === 'frozen' ? I.lock : KIND_ICON[r.kind] || I.rep);
|
|
152
|
+
const rid = (r) => r.id || r.kind;
|
|
153
|
+
/** One report row: drafted ones open the one report Viewer; a held one (PbG2) and a late one (PbG8) carry their own presses. */
|
|
154
|
+
function repRow(r) {
|
|
155
|
+
if (r.state === 'held') return `<div class="db-held" data-rk="${esc(rid(r))}"><span class="db-dic q">${SV(I.pause, 16)}</span><span class="db-rt"><b>${esc(r.name)} held</b>${r.sub ? `<small>${esc(r.sub)}</small>` : ''}</span>`
|
|
156
|
+
+ `<div class="db-acts">${ib('hold', 'Skip this one', I.x, { k: rid(r) + '|skip' })}${ib('hold', 'Send it now with a note', I.send, { k: rid(r) + '|send-note' })}${ib('hold', 'Wait until it reads again', I.clock, { solid: true, k: rid(r) + '|wait' })}</div></div>`;
|
|
157
|
+
const open = r.path ? ` data-db="report" data-k="${esc(rid(r))}"` : '';
|
|
158
|
+
const head = `<${r.path ? 'button type="button"' : 'div'} class="db-rep"${open}><span class="db-dic">${SV(iconOf(r), 16)}</span><span class="db-rt"><b>${esc(r.name)}</b>${r.sub ? `<small>${esc(r.sub)}</small>` : ''}</span>${r.path ? SV(I.next, 16) : ''}</${r.path ? 'button' : 'div'}>`;
|
|
159
|
+
if (r.state === 'late') return `<div class="db-late">${head}<div class="db-acts">${ib('hold', 'Skip this week', I.x, { k: rid(r) + '|skip' })}${ib('send', 'Send it now', I.send, { solid: true, k: rid(r) })}</div></div>`;
|
|
160
|
+
return head;
|
|
161
|
+
}
|
|
162
|
+
/** The heads-up Claude drafts at once when a health budget breaks or a date slips badly (PbG3): its title, what it says, to whom, ✕ ✎ ➤. */
|
|
163
|
+
function headsUpHtml(r) {
|
|
164
|
+
return sec('Heads-up · draft', `<div class="db-card db-hu"><b class="db-hut">${esc(r.title || r.name)}</b>${r.sub ? `<p class="db-meta">${esc(r.sub)}</p>` : ''}`
|
|
165
|
+
+ `<div class="db-chips">${r.audience ? `<span class="db-chip">${SV(I.people, 14)}${esc(r.audience)}</span>` : ''}${r.channel ? `<span class="db-chip">${SV(I.send, 14)}${esc(r.channel)}</span>` : ''}</div>`
|
|
166
|
+
+ `<div class="db-acts">${ib('hold', 'Not now', I.x, { k: rid(r) + '|skip' })}${r.path ? ib('report', 'Change it first', I.pen, { k: rid(r) }) : ''}${ib('send', 'Send the heads-up', I.send, { solid: true, k: rid(r) })}</div></div>`);
|
|
167
|
+
}
|
|
168
|
+
function reportsHtml(d, o) {
|
|
169
|
+
const L = (d.reports || []).filter((r) => r.kind !== 'heads-up');
|
|
170
|
+
const hu = (d.reports || []).filter((r) => r.kind === 'heads-up' && r.state !== 'sent').map(headsUpHtml).join('');
|
|
171
|
+
if (!L.length) return hu;
|
|
172
|
+
const first = L.filter((r) => /^(held|late|drafted)$/.test(r.state));
|
|
173
|
+
const lead = first.length ? first : L.slice(0, 1), rest = L.filter((r) => !lead.includes(r));
|
|
174
|
+
const open = !!(o.open && o.open.has('reports'));
|
|
175
|
+
const more = rest.length ? `<button type="button" class="db-fold" data-db="fold" data-k="reports" aria-expanded="${open}"><span class="db-rt"><b>${rest.length} more</b><small>${esc(rest.map((r) => [r.name, r.sub].filter(Boolean).join(' · ')).join(' · '))}</small></span>${SV(I.down, 16)}</button>${open ? rest.map(repRow).join('') : ''}` : '';
|
|
176
|
+
return hu + sec(d.level === 'product' ? 'This week' : 'Reports', `<div class="db-card db-reps">${lead.map(repRow).join('')}${more}</div>`);
|
|
177
|
+
}
|
|
178
|
+
/** Send by itself (PbG6): offered after 4 issues sent unchanged; calm weeks only. Off by default. */
|
|
179
|
+
function trustHtml(d) {
|
|
180
|
+
const t = d.trust; if (!t) return '';
|
|
181
|
+
return `<div class="db-card db-trust"><div class="db-top"><span class="db-rt"><b>Send by itself</b><small>Only weeks where everything is on its line</small></span></div>`
|
|
182
|
+
+ `<div class="db-acts">${ib('trust', 'Not now', I.x, { k: 'off' })}${ib('trust', 'Send it by itself in calm weeks', I.chk, { solid: true, k: 'on' })}</div></div>`;
|
|
183
|
+
}
|
|
184
|
+
const doneHtml = (d, o) => { const x = d.done; if (!x || !x.text) return ''; const open = !!(o.open && o.open.has('done')); return `<div class="db-card db-done"><button type="button" class="db-fold" data-db="fold" data-k="done" aria-expanded="${open}"><span class="db-rt"><b>${esc(x.title || 'Done this week')}</b><small>${esc(x.text)}</small></span>${SV(I.down, 16)}</button>${open && x.more ? `<p class="db-p">${esc(x.more)}</p>` : ''}</div>`; };
|
|
185
|
+
|
|
186
|
+
/** The whole Dashboard body. Blocks in the design's order; each draws only when it has something. */
|
|
187
|
+
export function dashHtml(d, o = {}) {
|
|
188
|
+
if (!d) return '<p class="db-wait" role="status">Reading the dashboard.</p>';
|
|
189
|
+
const grid = [goalsHtml(d, o), stageHtml(d, o), guardHtml(d), needsHtml(d), reportsHtml(d, o)].filter(Boolean);
|
|
190
|
+
const note = d.note ? `<p class="db-note">${esc(d.note)}</p>` : '';
|
|
191
|
+
return `<div class="db" data-level="${esc(d.level || '')}">${handledHtml(d.handled)}${trustHtml(d)}<div class="db-grid">${grid.join('')}</div>${doneHtml(d, o)}${note}${o.talk || ''}</div>`;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/* ── the presses ── */
|
|
195
|
+
const post = (u, b) => Promise.resolve(pmPost(u, b)).catch(() => null);
|
|
196
|
+
/** Wires one body. The host keeps h.d() the dashboard on screen, h.open the folds (a Set), and redraws through h.redraw(). */
|
|
197
|
+
export function wireDash(body, h) {
|
|
198
|
+
body.addEventListener('click', async (e) => {
|
|
199
|
+
const b = e.target.closest('[data-db]'); if (!b || b.disabled || !body.contains(b)) return;
|
|
200
|
+
const d = h.d && h.d(); if (!d) return;
|
|
201
|
+
const a = b.dataset.db, k = b.dataset.k || '', base = { ws: h.ws || undefined, scope: d.scope };
|
|
202
|
+
const done = async (r, ok) => { if (!r || r.ok === false) { b.disabled = false; h.toast((r && r.error) || 'Nothing was changed. The server did not say why.'); return; } if (ok) h.toast(ok); await h.reload(); };
|
|
203
|
+
if (a === 'fold') { if (h.open.has(k)) h.open.delete(k); else h.open.add(k); h.redraw(); return; }
|
|
204
|
+
// the goal's own Viewer: Intelligence's goal detail (?goal=), until the one goal Viewer of "Claude runs the OKRs" lands
|
|
205
|
+
if (a === 'goal') { if (h.goal) h.goal(k, b); else location.assign('/premium-intelligence.html?' + new URLSearchParams({ ...(b.dataset.ws || h.ws ? { ws: b.dataset.ws || h.ws } : {}), goal: k }).toString()); return; }
|
|
206
|
+
if (a === 'milestones') { if (h.milestones) h.milestones(); return; }
|
|
207
|
+
if (a === 'metrics') { if (h.metrics) h.metrics(); return; }
|
|
208
|
+
if (a === 'needs-edit') { if (h.editNeeds) h.editNeeds(d.needs, b); return; }
|
|
209
|
+
if (a === 'promise-edit') { if (h.editPromise) h.editPromise(d.drafts && d.drafts.promise, b); return; }
|
|
210
|
+
const row = (id) => (d.reports || []).find((r) => rid(r) === id);
|
|
211
|
+
if (a === 'report') { const r = row(k); if (r && h.openReport) h.openReport(r, d); return; }
|
|
212
|
+
b.disabled = true;
|
|
213
|
+
if (a === 'needs') {
|
|
214
|
+
const n = d.needs || {}, w = { ws: h.ws || undefined, board: h.board || undefined, initiative: n.ini || undefined };
|
|
215
|
+
if (k === 'keep') return done(await post('/api/proposals/keep', { ...w, ids: (n.keep && n.keep.ids) || [] }), 'Kept your pick.');
|
|
216
|
+
return done(await post('/api/proposals/drop', { ...w, sig: n.drop && n.drop.sig }), 'Not now. It stays in Claude proposes.');
|
|
217
|
+
}
|
|
218
|
+
if (a === 'promise') { const p = (d.drafts && d.drafts.promise) || {}; return done(await post('/api/ready-reports/promise', { ...base, act: k, date: p.date }), k === 'keep' ? 'Kept. Reports say it is a guess until Jira has tickets.' : 'Not now.'); }
|
|
219
|
+
if (a === 'hold') { const [id, act] = k.split('|'), r = row(id) || {}; return done(await post('/api/ready-reports/hold', { ...base, kind: r.kind, act }), act === 'wait' ? 'It waits. It goes by itself once the source reads, if nothing changed.' : act === 'send-note' ? 'Sent, with the date of the last reading written on it.' : 'Skipped. The next issue covers both weeks.'); }
|
|
220
|
+
// ➤ is the report's Issue press (POST /api/report/issue): PMOS never sends outward; issuing freezes the bytes the PM sends from their mail
|
|
221
|
+
if (a === 'send') { const r = row(k) || {}; if (!r.cadence || !r.slot || !r.sha) { b.disabled = false; if (h.openReport && (r.path || r.desk)) h.openReport(r, d); return; } return done(await post('/api/report/issue', { ws: h.ws || undefined, cadence: r.cadence, slot: r.slot, sha: r.sha }), 'Issued. It is frozen as sent.'); }
|
|
222
|
+
if (a === 'trust') { const r = (d.reports || []).find((x) => x.id === (d.trust && d.trust.reportId)) || (d.reports || [])[0] || {}; return done(await post('/api/ready-reports/trust', { ...base, kind: r.kind || 'weekly', on: k === 'on' }), k === 'on' ? 'Calm weeks get ready by themselves. You still issue each one, and a miss or a decision waits for you.' : 'Not now. Each week waits for you to approve it.'); }
|
|
223
|
+
if (a === 'reread') return done(await post('/api/sources/refresh', { ws: h.ws || undefined, source: k || 'jira' }), 'Reading it again. The dashboard shows it when the read lands.');
|
|
224
|
+
// Connect again: Sources in the Viewer (pm/cozy-sources.js), where a source that is off or failing is connected; ← comes back
|
|
225
|
+
if (a === 'reconnect') { b.disabled = false; if (h.reconnect) { h.reconnect(k); return; } const V = await import('./cozy-viewer.js'); V.drill(); (await import('./cozy-sources.js')).openSources(); return; }
|
|
226
|
+
if (a === 'handled') return done(await post('/api/ready-reports/picks', { ws: h.ws || undefined, scope: d.scope }), 'Kept.');
|
|
227
|
+
b.disabled = false;
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/** One host's Dashboard state, for a view that already draws its work in the Viewer (the initiative view on the Board and on Home).
|
|
232
|
+
* o: { page ('initiative:<id>'), scope, ws, board (each a value or a function), vid (the Viewer item's id), VW, redraw(), toast(t), openReport(row), editNeeds(n), mdHtml() }
|
|
233
|
+
* → { presses(), shows(), html(work), read(via), toggle(), wire(body) } */
|
|
234
|
+
export function dashHost(o) {
|
|
235
|
+
const x = { view: 'work', d: null, read: false, open: new Set() };
|
|
236
|
+
const W = () => (typeof o.ws === 'function' ? o.ws() : o.ws) || '', B = () => (typeof o.board === 'function' ? o.board() : o.board) || '';
|
|
237
|
+
const presses = () => (x.d ? [togglePress(x.view)] : []);
|
|
238
|
+
const shows = () => x.view === 'dash' && !!x.d;
|
|
239
|
+
// the body is drawn again only when it shows the dashboard, before or after: a read that lands on the Work view only adds the header icon,
|
|
240
|
+
// so the focus (a stage picker, a task being typed) stays where the PM left it
|
|
241
|
+
const sync = (drew) => { const c = o.VW.current && o.VW.current(); if (c && c.id === o.vid) { o.VW.setPresses(o.vid, presses()); if (drew || shows()) o.redraw(); } };
|
|
242
|
+
async function read(via) {
|
|
243
|
+
const was = shows();
|
|
244
|
+
const d = await readDash(W(), o.scope, via);
|
|
245
|
+
if (!d) { x.d = null; if (x.view === 'dash') x.view = 'work'; } else { const first = !x.read; x.d = d; if (first) x.view = viewOf(o.page, d.opens); }
|
|
246
|
+
x.read = true; sync(was);
|
|
247
|
+
}
|
|
248
|
+
function toggle() {
|
|
249
|
+
if (!x.d) return;
|
|
250
|
+
x.view = x.view === 'dash' ? 'work' : 'dash'; keepView(o.page, x.view); sync(true);
|
|
251
|
+
const t = document.querySelector('#czViewer [data-cz-vw-p="dash"]'); if (t) t.focus();
|
|
252
|
+
}
|
|
253
|
+
const html = (work) => (shows() ? dashHtml(x.d, { open: x.open, mdHtml: o.mdHtml ? o.mdHtml() : '' }) : work());
|
|
254
|
+
function wire(body) {
|
|
255
|
+
if (body.dataset.dbWired === o.page) return; body.dataset.dbWired = o.page;
|
|
256
|
+
// ✎ on Needs you: the work shows (this once, not kept as the PM's choice) and Claude proposes opens on the decision (pm/ini-props.js)
|
|
257
|
+
const editNeeds = o.editNeeds || (() => { x.view = 'work'; sync(); setTimeout(() => { const c = document.querySelector('#czViewer [data-cz-vw="chip"]'); if (c) c.click(); }, 0); });
|
|
258
|
+
wireDash(body, { d: () => { const c = o.VW.current && o.VW.current(); return shows() && c && c.id === o.vid ? x.d : null; }, open: x.open, get ws() { return W(); }, get board() { return B(); }, toast: o.toast, redraw: o.redraw, reload: () => read(), openReport: o.openReport, editNeeds });
|
|
259
|
+
}
|
|
260
|
+
return { presses, shows, html, read, toggle, wire, state: x };
|
|
261
|
+
}
|
|
@@ -52,6 +52,7 @@ import * as PO from './prog-order.js'; // a program's order on Home: the grip,
|
|
|
52
52
|
import * as IMP from './home-impact.js'; // Your impact: the weekly check in Home's own chat (batch 16 item 7, GmP1Ledger)
|
|
53
53
|
import * as LPV from './loose-props.js'; // Claude's clean-up of "Not in an initiative": the ✦ on its header and the Viewer (batch 13 item 3)
|
|
54
54
|
import * as IM from './impact.js'; // Your impact (batch 16 item 7): Adler's sprout on the greeting, the week in the Viewer, the Friday chapter
|
|
55
|
+
import * as DB from './dash-view.js'; // the product page is the product's Dashboard (batch 17 item 1, canvas PbA3, PbG6, PbG8)
|
|
55
56
|
import { initiativeRename, taskRename } from './rename-press.js'; // tap the title to rename (canvas RnATask, RnASaved) // the pinned recording row above it (XvARecHome)
|
|
56
57
|
|
|
57
58
|
const $ = (s, r = document) => r.querySelector(s);
|
|
@@ -830,6 +831,7 @@ function openProductPage() {
|
|
|
830
831
|
+ `<section class="hi-pg" aria-label="This week"><div class="hi-pgh"><b>This week</b></div>${row('update', I.doc, 'Weekly update', sent ? 'Sent this week' : 'Ready to send')}${row('metrics', I.chart, 'Metrics review', 'With Strategist')}</section>`
|
|
831
832
|
+ (isPhone() ? `<button type="button" class="hi-talk" data-hp="talk">Message Claude about ${esc(name)}</button>` : '') + '</div>';
|
|
832
833
|
fillGoals(b, boardWs());
|
|
834
|
+
productDash(b, boardWs() || '', 'product', name);
|
|
833
835
|
b.onclick = (e) => {
|
|
834
836
|
const t = e.target.closest('[data-hp]'); if (!t) return;
|
|
835
837
|
if (t.dataset.hp === 'update') { VW.drill(); openTarget(updateTarget()); openUpdateViewer(); }
|
|
@@ -838,6 +840,29 @@ function openProductPage() {
|
|
|
838
840
|
};
|
|
839
841
|
} });
|
|
840
842
|
}
|
|
843
|
+
/** The product page as the product's Dashboard (batch 17 item 1, PbA3): the ✦ line, Goals folded to their dots, Ships next, This week's
|
|
844
|
+
* reports. It has no toggle: the page already is the dashboard. Until GET /api/ready-reports/dashboard answers (or when it cannot), the page
|
|
845
|
+
* keeps the Goals and This week it drew before. */
|
|
846
|
+
const PDASH = new Map(); // ws → { d, open }
|
|
847
|
+
function productDash(b, ws, vid, name) {
|
|
848
|
+
const x = PDASH.get(ws) || { d: null, open: new Set() }; PDASH.set(ws, x);
|
|
849
|
+
const paint = () => {
|
|
850
|
+
const c = VW.current(); if (!x.d || !b.isConnected || !c || c.id !== vid) return;
|
|
851
|
+
b.innerHTML = DB.dashHtml(x.d, { open: x.open, metrics: true, talk: isPhone() ? `<button type="button" class="hi-talk" data-hp="talk">Message Claude about ${esc(name)}</button>` : '' });
|
|
852
|
+
};
|
|
853
|
+
if (b.dataset.dbWired !== ws) {
|
|
854
|
+
b.dataset.dbWired = ws;
|
|
855
|
+
DB.wireDash(b, { d: () => x.d, open: x.open, ws, toast, redraw: paint,
|
|
856
|
+
// the metrics review, as the page offered before it was the dashboard: here for the board's product, in its own Home for another
|
|
857
|
+
metrics: () => { if (vid === 'product') { VW.drill(); openMetrics(); } else window.open('/premium.html?ws=' + encodeURIComponent(ws) + '&ini=product&view=metrics', '_blank', 'noopener'); }, reload: async () => { const d = await DB.readDash(ws, 'product', 'read'); if (d) x.d = d; paint(); },
|
|
858
|
+
openReport: async (row) => {
|
|
859
|
+
// Home's own weekly update (desk: true, 1-A) opens its update flow, not a document
|
|
860
|
+
if (row.desk) { if (vid === 'product') { VW.drill(); openTarget(updateTarget()); openUpdateViewer(); } else window.open('/premium.html?ws=' + encodeURIComponent(ws) + '&ini=product', '_blank', 'noopener'); return; }
|
|
861
|
+
if (!row.path) return; VW.drill(); (await import('./premium-report-read.js')).openReportView(row.path, { ws, name: row.name, cuts: true }); } });
|
|
862
|
+
}
|
|
863
|
+
paint();
|
|
864
|
+
DB.readDash(ws, 'product', 'read').then((d) => { if (d) { x.d = d; paint(); } });
|
|
865
|
+
}
|
|
841
866
|
/** A phone: the page's "Message Claude about …" closes the sheet and opens the chat full screen; its ← goes back to the list (HbCPhone). */
|
|
842
867
|
function talk() { S.phoneChat = true; VW.close(); drawList(); chat.focus(); }
|
|
843
868
|
/** "Overview with Claude" on the initiative's card: the ask is typed into the chat box, for the PM to send or change. */
|
|
@@ -983,6 +1008,7 @@ function goOtherProduct(g) {
|
|
|
983
1008
|
b.innerHTML = `<div class="hi-v hi-page">${goalsBlock(ws)}`
|
|
984
1009
|
+ `<section class="hi-pg" aria-label="This week"><div class="hi-pgh"><b>This week</b></div><div class="hm-r hi-r"><a class="hm-rm" href="${esc(own)}" target="_blank" rel="noopener"><span class="hm-tile">${SVG(I.doc, 14)}</span><span class="hm-rt"><b>Weekly update and metrics review</b><em class="q">In ${esc(name)}'s own Home, in a new tab</em></span></a></div></section>`
|
|
985
1010
|
+ (isPhone() ? `<button type="button" class="hi-talk" data-hp="talk">Message Claude about ${esc(name)}</button>` : '') + '</div>';
|
|
1011
|
+
productDash(b, ws, 'product:' + ws, name);
|
|
986
1012
|
// a phone has no chat beside the page: its own chat is one press away, as on the board's own product (Wawan, 2026-10-25)
|
|
987
1013
|
fillGoals(b, ws);
|
|
988
1014
|
b.onclick = (e) => { const t = e.target.closest('[data-hp="talk"]'); if (t) talk(); };
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* homeLists(D) the Home list: Needs you (top 3 + "N more"), Initiatives (the product first) and Loose, each row with its kids
|
|
6
6
|
* iniLayout(D, id) one initiative as a layout of Home: its card's groups (Needs you, Sessions, Stakeholders, Meetings, Routines, Files,
|
|
7
7
|
* Finished sessions) and the Elsewhere line
|
|
8
|
-
* productCard(D) the product's card: "This week", the KRs and the budget on track or at risk, Then, the next routine, the CTA
|
|
8
|
+
* productCard(D) the product's card (every anchor from D.board.anchorRows when sent): "This week", the KRs and the budget on track or at risk, Then, the next routine, the CTA
|
|
9
9
|
* weeklyUpdate(D) the weekly update the Viewer shows and Send turns into a mail draft: On track, At risk, Needs a decision
|
|
10
10
|
* streamOf(conv, o) the chat's stream: day dividers, "New since you left", "N earlier messages", messages, Worked-for folds
|
|
11
11
|
* meetLineOf(P) the meeting line: the current or next meeting, +N for the rest of the day
|
|
@@ -153,7 +153,8 @@ export function productName(D) {
|
|
|
153
153
|
}
|
|
154
154
|
/** The product's KRs and budgets this week: one item per anchor, on track when none of its initiatives is late or at risk. */
|
|
155
155
|
export function productCard(D, now = Date.now()) {
|
|
156
|
-
|
|
156
|
+
// every open initiative's anchor when the board sends them (anchorRows, batch 17), so the count matches the product's dashboard; else the rows listed
|
|
157
|
+
const rows = D.board && Array.isArray(D.board.anchorRows) ? D.board.anchorRows : boardRows(D).filter(OPEN);
|
|
157
158
|
const by = new Map();
|
|
158
159
|
for (const r of rows) { const a = anchorOf(r); if (!by.has(a)) by.set(a, []); by.get(a).push(r); }
|
|
159
160
|
const items = [...by.entries()].filter(([a]) => a !== 'No anchor').map(([a, L]) => {
|
|
@@ -32,6 +32,7 @@ import { iniMore, iniText, pageHref, stagePick, deleteSaid, DELETE_MS } from './
|
|
|
32
32
|
import * as SC from './home-stage-card.js';
|
|
33
33
|
import { viewHtml, wireView } from './ini-view.js'; // the one initiative view, the Board's panel's own renderer
|
|
34
34
|
import { ensureCss as ensureStepsCss } from './cozy-steps.js'; // stage card D: the card's last node and the move sheet's words // D99: the initiative's own workflow (Change picker, switch, Won't do, Archive)
|
|
35
|
+
import * as DB from './dash-view.js'; // the ready-made Dashboard view (batch 17 item 1)
|
|
35
36
|
|
|
36
37
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
37
38
|
const SVG = (d, w = 16, sw = 1.8) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${sw}" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
|
|
@@ -47,6 +48,18 @@ const X = { ctx: null, L: new Map(), reading: new Set(), tried: new Set(), view:
|
|
|
47
48
|
const curM = () => { const S = X.ctx && X.ctx.S; return S && S.ini && S.ini !== 'product' && S.IMid === S.ini ? S.IM : null; };
|
|
48
49
|
const wsOf = (M) => (M && M.board && M.board.ws) || undefined;
|
|
49
50
|
const bw = (M) => ({ ws: M.board.ws, board: M.board.id });
|
|
51
|
+
/* ── the Dashboard view (batch 17 item 1, pm/dash-view.js; canvas PbH1Header): one header icon on the page switches Work and Dashboard ── */
|
|
52
|
+
const DASH = new Map(); // initiative id → its Dashboard host
|
|
53
|
+
function dashFor(id) {
|
|
54
|
+
if (!id || id === 'product' || !X.ctx) return null;
|
|
55
|
+
if (!DASH.has(id)) {
|
|
56
|
+
const wsOf = () => { const M = curM(); return (M && M.board.ws) || (rowOf(id) || {}).ws || ''; };
|
|
57
|
+
DASH.set(id, DB.dashHost({ page: 'initiative:' + id, scope: 'initiative:' + id, ws: wsOf, board: () => { const M = curM(); return (M && M.board.id) || (rowOf(id) || {}).boardId || ''; },
|
|
58
|
+
vid: 'ov:' + id, VW: X.ctx.VW, redraw: () => { if (BODY) BODY.__pg = null; redrawView(); }, toast: (t) => X.ctx.toast(t),
|
|
59
|
+
openReport: async (row) => { if (!row.path) return; X.ctx.VW.drill(); (await import('./premium-report-read.js')).openReportView(row.path, { ws: wsOf(), name: row.name, cuts: true }); } }));
|
|
60
|
+
}
|
|
61
|
+
return DASH.get(id);
|
|
62
|
+
}
|
|
50
63
|
async function readL(id, M, force) {
|
|
51
64
|
if (!force && (X.L.has(id) || X.reading.has(id))) return;
|
|
52
65
|
X.reading.add(id);
|
|
@@ -426,9 +439,13 @@ export function iniPage() {
|
|
|
426
439
|
const VW = X.ctx.VW;
|
|
427
440
|
let rename = X.ctx.renameIni ? X.ctx.renameIni(id, '') : null;
|
|
428
441
|
if (rename) rename = { ...rename, value: X.ctx.iniTitle(id) };
|
|
442
|
+
const dh = dashFor(id);
|
|
429
443
|
BODY = VW.open({ id: 'ov:' + id, kind: X.ctx.kindOf(id), title: X.ctx.iniTitle(id), icon: 'goal', more: () => pageMore(id), rename,
|
|
430
444
|
discuss: () => X.ctx.newIn(id), discussHome: true, // the one view (OvViewers): Discuss starts a new session about it, where + New session was
|
|
431
|
-
|
|
445
|
+
presses: dh ? dh.presses() : null, onPress: (a) => { if (a === 'dash' && dh) dh.toggle(); },
|
|
446
|
+
render: (b) => { X.view = 'page'; BODY = b; ADDING = null; draw(b); wire(b, id); wirePage(b, id); if (dh) dh.wire(b); } });
|
|
447
|
+
// came to read (?view=dashboard: a report, Intelligence, a notification) or to act (a Home task): which view opens first
|
|
448
|
+
if (dh) dh.read(new URLSearchParams(location.search).get('view') === 'dashboard' ? 'read' : 'act');
|
|
432
449
|
WF.pmosNotice(wfUi(), id); // WfTriage: "Set to Tender from the BRD · Undo", once
|
|
433
450
|
if (!curM()) { X.failed = null; X.ctx.loadIni().then(() => { if (S.ini !== id) return; if (!curM()) X.failed = id; redrawView(); }); }
|
|
434
451
|
return true;
|
|
@@ -497,6 +514,7 @@ function draw(b) {
|
|
|
497
514
|
if (!M) { b.__pg = null; b.innerHTML = `<div class="hi-v"><p class="hi-small" role="status">${X.failed === id ? 'The initiative could not be read.' : 'Reading the initiative.'}</p></div>`; return; }
|
|
498
515
|
const v = X.view;
|
|
499
516
|
if (v !== 'page') b.__pg = null;
|
|
517
|
+
if (v === 'page' && dashFor(id) && dashFor(id).shows()) { b.__pg = null; b.innerHTML = dashFor(id).html(() => ''); return; }
|
|
500
518
|
if (v === 'page') { const h = pageHtml(id, M); if (b.__pg !== h || !b.firstChild) { b.__pg = h; b.innerHTML = h; } return; }
|
|
501
519
|
// Documents is shell A (XvADocs): no tabs, the summary card and folding groups straight in the body
|
|
502
520
|
if (v === 'docs') { b.innerHTML = docsView(id, M) + '<p class="hi-small" role="status" id="ovMsg"></p>'; return; }
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* status, the dates, the owner and the notes, and its move icon the section, the group or the initiative. Every write is the board's own route and is the PM's press; each says so
|
|
7
7
|
* in a toast with Undo, and a refusal shows the route's reason and changes nothing. Talk it through in chat is under ⋯ (the chat is beside
|
|
8
8
|
* the Viewer on Home). The PM's own items (a note, a mention made into a task) open in My work's item view (home-work.js). */
|
|
9
|
-
import { taskOf, checkOf, mountCard, boardSaver, cardStyle, placeOf, historyFor } from './task-card.js';
|
|
9
|
+
import { taskOf, checkOf, mountCard, boardSaver, cardStyle, placeOf, historyFor, deleteEntry } from './task-card.js';
|
|
10
10
|
|
|
11
11
|
/** h: { VW, pmPost, toast, toastUndo?, now, ws, board, iniTitle(id), openIni(id), askInChat(task), onChange(), rename?(task),
|
|
12
12
|
* owners?() → [names], inis?() → [{ id, title }] } */
|
|
@@ -24,11 +24,12 @@ export function openTask(task, h) {
|
|
|
24
24
|
clearTimeout(changed.t); changed.t = setTimeout(() => { if (h.onChange) h.onChange(); }, 400);
|
|
25
25
|
};
|
|
26
26
|
const toast = (msg, undo) => (h.toastUndo && undo ? h.toastUndo(msg, undo) : h.toast(msg));
|
|
27
|
+
// Delete (batch 7 item 5; batch 17 item 2): the trash at the end of the Status row and the last entry of ⋯, one write with Undo
|
|
28
|
+
const del = deleteEntry({ ws, board, t, post: (p, b) => h.pmPost(p, b), toast, done: () => { if (h.VW.close) h.VW.close(); if (h.onChange) h.onChange(); } });
|
|
27
29
|
const body = h.VW.open({
|
|
28
30
|
id, kind: 'Task', title: t.title, icon: 'task', check: checkOf(t),
|
|
29
31
|
rename: t.jira ? null : h.rename ? h.rename(raw) : null,
|
|
30
32
|
more: () => {
|
|
31
|
-
const del = deleteEntry({ ws, board, t, post: (p, b) => h.pmPost(p, b), toast, done: () => { if (h.VW.close) h.VW.close(); if (h.onChange) h.onChange(); } });
|
|
32
33
|
return [{ label: 'Talk it through in chat', on: () => h.askInChat(raw) }, ...(del ? [{ sep: true }, del] : [])]; // Delete: batch 7 item 5
|
|
33
34
|
},
|
|
34
35
|
onPress: (act) => { if (act === 'check' && card) card.setStatus(t.status === 'Done' ? 'To do' : 'Done'); },
|
|
@@ -42,6 +43,7 @@ export function openTask(task, h) {
|
|
|
42
43
|
groups: () => (layout ? layout.names || [] : null),
|
|
43
44
|
sections: () => sections,
|
|
44
45
|
history: historyFor({ ws, board, t, post: (p, b) => h.pmPost(p, b) }), // what Claude changed with your ✓ (batch 12, TpA6)
|
|
46
|
+
...(del ? { remove: del.on } : {}),
|
|
45
47
|
});
|
|
46
48
|
},
|
|
47
49
|
});
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* viewMode() / setViewMode(m) 'list' | 'timeline' | 'kanban': the last view, remembered for the PM across initiatives; first time List
|
|
7
7
|
* switchHtml(m) the icon-only segment List / Timeline / Kanban (Kanban is the Board's "By stage" icon)
|
|
8
|
-
* headExtraHtml(v, m) what the view adds to the header: Timeline's Weeks/Months/
|
|
8
|
+
* headExtraHtml(v, m) what the view adds to the header: Timeline's Weeks/Months/Quarter/Year/2 years/5 years picker, Kanban's stage picker
|
|
9
9
|
* timelineHtml(v, o, isOpen) the stage groups of the List (the same folds), bars by start → due, a circle for a due day only, a dashed
|
|
10
10
|
* date press at today for a task with no dates, the Today line and the legend under it
|
|
11
11
|
* kanbanHtml(v, o, isOpen) one stage at a time; columns To do, In progress, Done; Won't do a folded strip; phone: one column a screen
|
|
@@ -24,6 +24,7 @@ export const P = {
|
|
|
24
24
|
list: 'M9 6h11M9 12h11M9 18h11M4.5 6h.01M4.5 12h.01M4.5 18h.01', time: 'M4 6h9M8 12h11M6 18h7', kanban: 'M4 4h4v16H4zM10 4h4v10h-4zM16 4h4v13h-4z',
|
|
25
25
|
down: 'M7 10l5 5 5-5', right: 'M10 7l5 5-5 5', cal: 'M4 5h16v15H4zM8 3v4M16 3v4M4 10h16', jira: 'M12 3l9 9-9 9-9-9z', check: 'M5 12l5 5 9-10',
|
|
26
26
|
dia: 'M12 4l8 8-8 8-8-8z', skip: 'M6 7l5 5-5 5M13 7l5 5-5 5', bin: 'M5 7h14M10 7V4h4v3M7 7l1 13h8l1-13',
|
|
27
|
+
full: 'M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5', unfull: 'M9 4v5H4M15 4v5h5M9 20v-5H4M15 20v-5h5',
|
|
27
28
|
};
|
|
28
29
|
/** The small grey ◇ after a milestone task's title (batch 11 item 3), on every task row: List, Kanban, Timeline. The Jira mark is another
|
|
29
30
|
* shape (blue, nested) and stays as it is. */
|
|
@@ -32,7 +33,8 @@ export const msGlyph = (x) => (x && x.ms ? `<span class="iv-ms${x.done ? ' dn' :
|
|
|
32
33
|
export const msNoDate = (x) => !!(x && x.ms && !x.end && !x.closed);
|
|
33
34
|
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
34
35
|
const VIEWS = [['list', 'List', P.list], ['timeline', 'Timeline', P.time], ['kanban', 'Kanban', P.kanban]];
|
|
35
|
-
|
|
36
|
+
// [key, label, px a day, the days the axis shows ahead at least]: Year, 2 years and 5 years (batch 17 item 3) read like the Board's spans
|
|
37
|
+
const ZOOMS = [['week', 'Weeks', 14, 42], ['month', 'Months', 4, 42], ['quarter', 'Quarter', 1.6, 92], ['year', 'Year', 0.8, 365], ['y2', '2 years', 0.4, 730], ['y5', '5 years', 0.16, 1826]];
|
|
36
38
|
const COLS = [['To do', 'To do'], ['In progress', 'In progress'], ['Done', 'Done']];
|
|
37
39
|
|
|
38
40
|
/* ── what the PM picked: the view and the zoom for the PM (this browser), the Kanban stage per initiative for the session ── */
|
|
@@ -42,6 +44,27 @@ const STAGE = new Map(); // initiative → the Kanban's stage key ('all' | a
|
|
|
42
44
|
const SCROLL = new Map(); // initiative|zoom → the Timeline's scroll, so a redraw keeps the PM's place
|
|
43
45
|
export function viewMode() { if (!VIEW) { const v = store.get('pmos.tasks.view'); VIEW = v === 'timeline' || v === 'kanban' ? v : 'list'; } return VIEW; }
|
|
44
46
|
export function setViewMode(m) { VIEW = m === 'timeline' || m === 'kanban' ? m : 'list'; store.set('pmos.tasks.view', VIEW); }
|
|
47
|
+
/* Full width (batch 17 item 3): the Timeline takes the whole window, as the Board's does. The choice holds while the Viewer shows a Timeline
|
|
48
|
+
* (body.ivt-full; the css applies only to a Viewer that holds one), so List and Kanban stay in the panel; Escape or the same icon goes back. */
|
|
49
|
+
const PHONE = () => typeof matchMedia === 'function' && matchMedia('(max-width: 720px)').matches;
|
|
50
|
+
const fullOn = () => typeof document !== 'undefined' && document.body.classList.contains('ivt-full');
|
|
51
|
+
function setFull(on) {
|
|
52
|
+
document.body.classList.toggle('ivt-full', !!on);
|
|
53
|
+
const b = document.querySelector('#czViewer [data-iv-full]'), l = on ? 'Back to the panel' : 'Full width';
|
|
54
|
+
if (b) { b.setAttribute('aria-pressed', String(!!on)); b.setAttribute('aria-label', l); b.title = l; b.innerHTML = SVG(on ? P.unfull : P.full, 18); }
|
|
55
|
+
// Escape goes back to the panel first: the Viewer leaves Escape to a [data-esc-layer] (pm/cozy-viewer.js), so the Viewer carries the mark
|
|
56
|
+
// while full; an open zoom menu closes on its own Escape before this one; a Viewer that left the Timeline closes as usual
|
|
57
|
+
const vw = document.getElementById('czViewer'); if (vw) vw.toggleAttribute('data-esc-layer', !!on);
|
|
58
|
+
if (on && !setFull.esc) {
|
|
59
|
+
setFull.esc = true;
|
|
60
|
+
addEventListener('keydown', (e) => {
|
|
61
|
+
if (e.key !== 'Escape' || !fullOn() || POP) return;
|
|
62
|
+
e.preventDefault(); e.stopImmediatePropagation();
|
|
63
|
+
const tl = !!document.querySelector('#czViewer .ivt'); setFull(false);
|
|
64
|
+
if (!tl && window.czViewer && window.czViewer.isOpen()) window.czViewer.close();
|
|
65
|
+
}, true);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
45
68
|
const zoomOf = () => { if (!ZOOM) { const z = store.get('pmos.tasks.zoom'); ZOOM = ZOOMS.some((x) => x[0] === z) ? z : 'week'; } return ZOOM; };
|
|
46
69
|
/** For the tests: forget the PM's picks. */
|
|
47
70
|
export const resetViews = () => { VIEW = null; ZOOM = null; STAGE.clear(); SCROLL.clear(); };
|
|
@@ -83,7 +106,9 @@ const stageKeyOf = (v) => { const L = stagesOf(v), k = STAGE.get(v.id || v.key);
|
|
|
83
106
|
export function headExtraHtml(v, m) {
|
|
84
107
|
if (m === 'timeline') {
|
|
85
108
|
const z = ZOOMS.find((x) => x[0] === zoomOf());
|
|
86
|
-
|
|
109
|
+
const f = fullOn(), fl = f ? 'Back to the panel' : 'Full width';
|
|
110
|
+
return `<button type="button" class="ivx-pick" data-iv-zoom aria-haspopup="menu" aria-label="Zoom: ${esc(z[1].toLowerCase())}. Change">${esc(z[1])}${SVG(P.down, 14, 2)}</button>`
|
|
111
|
+
+ (PHONE() ? '' : `<button type="button" class="iv-ib" data-iv-full aria-pressed="${f}" aria-label="${fl}" title="${fl}">${SVG(f ? P.unfull : P.full, 18)}</button>`);
|
|
87
112
|
}
|
|
88
113
|
if (m === 'kanban') {
|
|
89
114
|
const L = stagesOf(v), k = stageKeyOf(v), x = L.find((y) => y.key === k);
|
|
@@ -142,16 +167,18 @@ export function timelineHtml(v, o, isOpen) {
|
|
|
142
167
|
// the range: the open tasks around today, a little air each side; never more than a few years
|
|
143
168
|
const ns = [];
|
|
144
169
|
for (const s of S) { for (const x of flat(s).concat(flatDone(s))) { const a = dn(x.start), b = dn(x.end); if (a != null) ns.push(a); if (b != null) ns.push(b); if (x.cmp) { const c = dn(x.cmp.start), d = dn(x.cmp.due); if (c != null) ns.push(c); if (d != null) ns.push(d); } } for (const k of jiraOf(s)) { const b = dn(k.due); if (b != null) ns.push(b); } }
|
|
145
|
-
const lo = Math.max(today - 730, Math.min(today - 14, ...ns) - 4), hi = Math.min(today + 1095, Math.max(today +
|
|
170
|
+
const lo = Math.max(today - 730, Math.min(today - 14, ...ns) - 4), hi = Math.min(today + Math.max(1095, z[3]), Math.max(today + z[3], ...ns) + 10);
|
|
146
171
|
const O = lo - ((new Date(lo * 864e5).getUTCDay() + 6) % 7); // start on a Monday
|
|
147
172
|
const W = Math.ceil((hi - O + 1) * px), X = (n) => Math.round((n - O) * px);
|
|
148
|
-
// the axis: Mondays (Weeks), the 1st (Months), the quarter's first day (
|
|
173
|
+
// the axis: Mondays (Weeks), the 1st (Months), the quarter's first day (Quarter, Year, 2 years), the year's first day (5 years)
|
|
149
174
|
const ticks = [];
|
|
150
175
|
for (let n = O; n <= hi; n++) {
|
|
151
176
|
const d = new Date(n * 864e5), m = d.getUTCMonth(), y = d.getUTCFullYear();
|
|
152
177
|
if (z[0] === 'week' && d.getUTCDay() === 1) ticks.push({ x: X(n), t: md(n), b: d.getUTCDate() <= 7 });
|
|
153
178
|
if (z[0] === 'month' && d.getUTCDate() === 1) ticks.push({ x: X(n), t: MON[m] + (m === 0 ? ' ' + y : ''), b: m === 0 });
|
|
154
|
-
if (z[0] === 'quarter' && d.getUTCDate() === 1 && m % 3 === 0) ticks.push({ x: X(n), t: 'Q' + (m / 3 + 1) + ' ' + y, b: m === 0 });
|
|
179
|
+
if ((z[0] === 'quarter' || z[0] === 'year') && d.getUTCDate() === 1 && m % 3 === 0) ticks.push({ x: X(n), t: 'Q' + (m / 3 + 1) + ' ' + y, b: m === 0 });
|
|
180
|
+
if (z[0] === 'y2' && d.getUTCDate() === 1 && m % 3 === 0) ticks.push({ x: X(n), t: m === 0 ? String(y) : 'Q' + (m / 3 + 1), b: m === 0 });
|
|
181
|
+
if (z[0] === 'y5' && d.getUTCDate() === 1 && m === 0) ticks.push({ x: X(n), t: String(y), b: true });
|
|
155
182
|
}
|
|
156
183
|
const drag = o.quick ? ' data-ivt-drag="1"' : '';
|
|
157
184
|
// the compared version's days: a thin dark line with end caps under the bar, only where they differ; a dropped task keeps only its line
|
|
@@ -364,6 +391,7 @@ export function press(b, d, root, H, e) {
|
|
|
364
391
|
if (hidden && d.ivView === viewMode()) { menuPop(b, 'Tasks view', VIEWS.map(([k, l]) => ({ k, label: l, on: k === viewMode() })), (x) => { setViewMode(x.k); if (H.redraw) H.redraw(); }); return true; }
|
|
365
392
|
setViewMode(d.ivView); closePop(); if (H.redraw) H.redraw(); return true;
|
|
366
393
|
}
|
|
394
|
+
if ('ivFull' in d) { setFull(!fullOn()); return true; }
|
|
367
395
|
if ('ivZoom' in d) { menuPop(b, 'Zoom', ZOOMS.map(([k, l]) => ({ k, label: l, on: k === zoomOf() })), (x) => { ZOOM = x.k; store.set('pmos.tasks.zoom', x.k); if (H.redraw) H.redraw(); }); return true; }
|
|
368
396
|
if ('ivKstage' in d) {
|
|
369
397
|
const v = H.__v; if (!v) return true;
|
|
@@ -675,3 +675,7 @@ button.lk-mt:hover { color: var(--cz-ink) !important; }
|
|
|
675
675
|
.iv-stc, .iv-dtc { min-height: 36px; }
|
|
676
676
|
.iv-addp { width: 30px !important; height: 30px; }
|
|
677
677
|
}
|
|
678
|
+
/* the Tasks Timeline in full width (batch 17 item 3): the Viewer that holds it takes the window, as the Board's timeline does */
|
|
679
|
+
@media (min-width: 721px) {
|
|
680
|
+
body.ivt-full #czViewer:has(.ivt) { position: fixed !important; inset: 12px; width: auto !important; max-width: none !important; flex-basis: auto !important; z-index: 90; border-radius: 16px; }
|
|
681
|
+
}
|
|
@@ -36,6 +36,7 @@ import { mountNav } from './cozy-nav.js';
|
|
|
36
36
|
import { mountLivePill } from './cozy-live-pill.js';
|
|
37
37
|
import * as IM from './impact.js'; // Your impact's ✦ line (batch 16 item 7): a key result your work moved
|
|
38
38
|
import * as AD from './cozy-adler.js'; // Adler in Claude's ✦ line only, never in a chart (batch 16 item 2, canvas AdH3, AdM3)
|
|
39
|
+
import * as RL from './ready-lib.js'; // the ready-made reports of every program, product and initiative (batch 17 item 1, PbA6, PbG4)
|
|
39
40
|
import * as RI from './premium-report-intel.js'; // a report made from Intelligence (batch 15 item 4): the header icon, the ✦ proposals, the draft panel
|
|
40
41
|
import * as OK from './okr-list.js'; // Claude runs the OKRs (batch 16 item 6, 6-B): the goal list, its drafts, the ✦ line, ⋯ › Metrics, the notify choice
|
|
41
42
|
|
|
@@ -570,6 +571,7 @@ document.addEventListener('keydown', (e) => {
|
|
|
570
571
|
let libBack = null;
|
|
571
572
|
function openLib() {
|
|
572
573
|
if (!$('#side').hidden) closeSide();
|
|
574
|
+
LIB.read = false;
|
|
573
575
|
libBack = document.activeElement; $('#libSide').hidden = false; document.body.classList.add('ins-sideon'); drawList(); $('#libSide').focus({ preventScroll: true });
|
|
574
576
|
}
|
|
575
577
|
function closeLib(focus) {
|
|
@@ -1455,8 +1457,14 @@ function drawList() {
|
|
|
1455
1457
|
const table = nRep ? `<div class="ins-rtbl" id="repAsks"><div class="ins-rl ins-rlh" role="presentation"><span>Report</span><span>Next</span><span>Status</span></div><div role="list">${reps.map(repRowHtml).join('')}${asks.map(askRowHtml).join('')}</div></div>`
|
|
1456
1458
|
: !empty ? '<div class="ins-empty"><b>No report is set up and no report file is on record.</b> Reports are made in Home.</div>' : '';
|
|
1457
1459
|
const dashBlock = `<div class="ins-sec"><h3>Dashboards</h3><span class="q">${dashes.length} · a dashboard is a saved view of Goals</span></div><div class="ins-dgrid" role="list">${dashes.map(dashCard).join('')}</div>`;
|
|
1458
|
-
$('#repBody').innerHTML = `${oneNote()}<div id="listRows" aria-label="Dashboards and reports">${fbox}${empty}${table}${dashBlock}</div>`;
|
|
1459
|
-
}
|
|
1460
|
+
$('#repBody').innerHTML = `${oneNote()}<div id="readyLib">${RL.libHtml(LIB.L, { open: LIB.open, yours: true })}</div><div id="listRows" aria-label="Dashboards and reports">${fbox}${empty}${table}${dashBlock}</div>`;
|
|
1461
|
+
if (!LIB.read && M.board && M.board.ws) { LIB.read = true; RL.readLib(M.board.ws).then((L) => { LIB.L = L; if (!$('#libSide').hidden) drawLib(); }); }
|
|
1462
|
+
}
|
|
1463
|
+
/* the ready-made group before Yours (batch 17 item 1, PbA6): read once per open of the panel, again after a switch */
|
|
1464
|
+
const LIB = { L: null, read: false, open: new Set() };
|
|
1465
|
+
const drawLib = () => { const el = $('#readyLib'); if (el) el.innerHTML = RL.libHtml(LIB.L, { open: LIB.open, yours: true }); };
|
|
1466
|
+
RL.wireLib($('#repBody'), { get ws() { return M && M.board ? M.board.ws : ''; }, open: LIB.open, toast: (t) => toast(t), redraw: drawLib,
|
|
1467
|
+
reload: async () => { LIB.L = await RL.readLib(M.board.ws); drawLib(); } });
|
|
1460
1468
|
$('#repBody').addEventListener('click', async (e) => {
|
|
1461
1469
|
const d = e.target.closest('[data-d]'); if (d) { setView(d.dataset.d); return; }
|
|
1462
1470
|
const fx = e.target.closest('[data-fx]');
|