create-pmos 0.433.0 → 0.435.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/briefing-premium-insights-test.js +63 -58
- package/workspace/changelog.json +24 -0
- package/workspace/fixtures/ready-reports.js +145 -0
- package/workspace/guide/index.md +2 -0
- package/workspace/guide/metric-drafts.md +21 -1
- package/workspace/guide/ready-made-dashboards.md +62 -0
- package/workspace/guide/your-impact.md +58 -0
- package/workspace/impact-screens-test.js +149 -0
- package/workspace/intel-report-ui-test.js +1 -1
- package/workspace/intelligence-gaps-ui-test.js +13 -9
- package/workspace/lib/board-premium.js +1 -1
- package/workspace/lib/engine/outbox.js +1 -1
- package/workspace/lib/engine/records/index.js +11 -3
- package/workspace/lib/goal-status.js +199 -0
- package/workspace/lib/goal-watch.js +71 -0
- package/workspace/lib/headless.js +24 -2
- package/workspace/lib/impact-cli.js +72 -0
- package/workspace/lib/impact-runs.js +114 -0
- package/workspace/lib/impact.js +195 -0
- package/workspace/lib/insights-premium.js +43 -4
- package/workspace/lib/intel-report.js +36 -5
- package/workspace/lib/metric-draft-runs.js +33 -10
- package/workspace/lib/metric-drafts.js +118 -15
- package/workspace/lib/metric-read-runs.js +132 -0
- package/workspace/lib/metric-reads.js +129 -0
- package/workspace/lib/metrics-cli.js +100 -5
- package/workspace/lib/pmos-verbs.js +4 -1
- 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 +4 -0
- package/workspace/lib/routes-board-premium.js +5 -0
- package/workspace/lib/routes-boards.js +1 -1
- package/workspace/lib/routes-goal-status.js +111 -0
- package/workspace/lib/routes-impact-views.js +58 -0
- package/workspace/lib/routes-impact.js +91 -0
- package/workspace/lib/routes-insights-premium.js +20 -0
- package/workspace/lib/routes-metric-drafts.js +55 -4
- package/workspace/lib/routes-ready-reports.js +455 -0
- package/workspace/lib/routes-records.js +2 -0
- package/workspace/lib/routes-report-setups.js +4 -3
- package/workspace/lib/settings-store.js +3 -0
- package/workspace/okr-goals-ui-test.js +175 -0
- 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 +33 -8
- package/workspace/public/pm/bd-prog-panel.js +58 -10
- package/workspace/public/pm/cozy-adler.css +5 -0
- package/workspace/public/pm/cozy-adler.js +17 -9
- package/workspace/public/pm/cozy-insights.css +84 -0
- package/workspace/public/pm/cozy-settings.js +11 -1
- 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 +87 -8
- package/workspace/public/pm/home-data.js +3 -2
- package/workspace/public/pm/home-impact.css +16 -0
- package/workspace/public/pm/home-impact.js +72 -0
- package/workspace/public/pm/home-ini.js +19 -1
- package/workspace/public/pm/home-today.js +4 -2
- package/workspace/public/pm/impact.css +37 -0
- package/workspace/public/pm/impact.js +201 -0
- package/workspace/public/pm/okr-list.js +249 -0
- package/workspace/public/pm/premium-insights.js +232 -240
- package/workspace/public/pm/premium-report-read.js +36 -5
- package/workspace/public/pm/premium-vw-mtg.js +4 -1
- package/workspace/public/pm/ready-lib.css +29 -0
- package/workspace/public/pm/ready-lib.js +62 -0
- package/workspace/public/premium-intelligence.html +3 -2
- package/workspace/public/premium.html +1 -0
- package/workspace/ready-dash-ui-test.js +227 -0
- package/workspace/server.js +58 -2
- package/workspace/skills/impact-detect.skill +46 -0
- package/workspace/skills/metric-read.skill +32 -0
- package/workspace/test-lists/batch17-ready-reports.json +9 -0
- package/workspace/test-lists/goal-watch.json +9 -0
- package/workspace/test-lists/impact-screens.json +5 -0
- package/workspace/test-lists/impact-ui.json +9 -0
- package/workspace/test-lists/impact.json +9 -0
- package/workspace/test-lists/okr-goals-ui.json +5 -0
- package/workspace/test-lists/ready-reports-ui.json +6 -0
|
@@ -684,3 +684,87 @@ body.ins-trv #goalTbl { border: 0; background: none; border-radius: 0; overflow:
|
|
|
684
684
|
.ins-menu#moreMenu [role="menuitem"] { flex-direction: row; align-items: center; gap: 10px; }
|
|
685
685
|
.ins-menu#moreMenu [role="menuitem"] > span:not(.k) { flex: 1; min-width: 0; }
|
|
686
686
|
.ins-strip .sp.ad svg { width: 40px; height: 40px; fill: initial; stroke: none; } /* Adler in Claude’s line (batch 16 item 2, AdH3) */
|
|
687
|
+
|
|
688
|
+
/* ── Claude runs the OKRs (batch 16 item 6, 6-B; frames GsM1–M5, GsViewer, GsMetrics, GsMetricsTree, GsProduct): one goal list on every width.
|
|
689
|
+
* A row is a dot, the outcome with its reading and age, and the owner; its drafts sit under it with ✕ / ✎ / ✓. ── */
|
|
690
|
+
#goalTbl.okr-list { display: block !important; background: none; border: 0; box-shadow: none; padding: 0; overflow: visible; }
|
|
691
|
+
#goalCards:empty { display: none; }
|
|
692
|
+
.okr-sec { display: flex; align-items: baseline; gap: 10px; padding: 14px 4px 8px; }
|
|
693
|
+
.okr-h { margin: 0; font-size: var(--fs-1); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--cz-ink3); flex: 1; }
|
|
694
|
+
.okr-sec .note { font-size: var(--fs-2); }
|
|
695
|
+
.okr-card { background: var(--cz-card); border: 1px solid var(--cz-hair); border-radius: 20px; overflow: hidden; }
|
|
696
|
+
.okr-card > * + *, .okr-row + .okr-row, .okr-obj + .okr-row { border-top: 1px solid var(--cz-hair); }
|
|
697
|
+
.okr-obj { margin: 0; padding: 10px 16px 0; font-size: var(--fs-2); font-weight: 700; color: var(--cz-ink3); }
|
|
698
|
+
.okr-row.sel { background: var(--cz-bluebg); }
|
|
699
|
+
.okr-main { display: flex; align-items: flex-start; gap: 12px; padding: 12px 12px 12px 16px; cursor: pointer; min-height: 48px; box-sizing: border-box; border-radius: 16px; }
|
|
700
|
+
.okr-main:hover { background: var(--cz-well); }
|
|
701
|
+
.okr-main:focus-visible { outline: 2px solid var(--cz-blueink); outline-offset: -2px; }
|
|
702
|
+
.okr-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
|
|
703
|
+
.okr-t b { font-size: var(--fs-4); font-weight: 700; line-height: 1.3; color: var(--cz-ink); }
|
|
704
|
+
.okr-t .note { font-size: var(--fs-2); color: var(--cz-ink3); }
|
|
705
|
+
.okr-none { margin: 0; padding: 14px 16px; color: var(--cz-ink3); font-size: var(--fs-3); }
|
|
706
|
+
.okr-dot { width: 10px; height: 10px; margin-top: 6px; }
|
|
707
|
+
.cz-dot.hollow { background: transparent; box-shadow: inset 0 0 0 1.5px var(--cz-ink3); }
|
|
708
|
+
.okr-av { width: 32px; height: 32px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center; font-size: var(--fs-1); font-weight: 800; background: var(--cz-well); color: var(--cz-ink); }
|
|
709
|
+
.okr-av.none { background: transparent; border: 2px dashed var(--cz-ink3); box-sizing: border-box; }
|
|
710
|
+
.okr-row.drafted .okr-t b { color: var(--cz-ink2); }
|
|
711
|
+
/* a draft under its row (GsM1, GsM3, GsM4, GsM5): its icon, Was …, what it does, why, and the icon presses */
|
|
712
|
+
.okr-dr { display: flex; align-items: flex-start; gap: 10px; margin: 0 12px 12px 38px; padding: 10px 10px 10px 12px; border-radius: 16px; border: 1px dashed rgba(47, 95, 179, .45); background: var(--cz-bluebg); }
|
|
713
|
+
.okr-dr .k { color: var(--cz-blueink); display: inline-flex; margin-top: 2px; }
|
|
714
|
+
.okr-dr .k svg, .okr-why .sp svg, .okr-mbar svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
|
|
715
|
+
.okr-dr .tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; font-size: var(--fs-3); }
|
|
716
|
+
.okr-dr .tx b { font-weight: 700; color: var(--cz-ink); }
|
|
717
|
+
.okr-dr .tx .note { font-size: var(--fs-2); }
|
|
718
|
+
.okr-old { font-size: var(--fs-2); color: var(--cz-ink3); text-decoration: line-through; }
|
|
719
|
+
.okr-dr .acts { display: flex; gap: 4px; flex: none; align-items: center; }
|
|
720
|
+
.okr-dr.made { border-style: solid; border-color: var(--cz-hair); background: var(--cz-well); }
|
|
721
|
+
.okr-dr.made .tx b { color: var(--cz-ink2); }
|
|
722
|
+
.okr-ed .tx { gap: 6px; }
|
|
723
|
+
.okr-ed .ins-dri { width: 100%; box-sizing: border-box; }
|
|
724
|
+
.okr-row > .okr-dr:first-of-type { margin-top: 0; }
|
|
725
|
+
.okr-row.crit .okr-main b { color: var(--cz-ink); }
|
|
726
|
+
.ins-dr .okr-card { background: none; border: 0; }
|
|
727
|
+
.ins-dr .okr-dr { margin: 6px 0; }
|
|
728
|
+
/* the ✦ line: red only when a limit breaks (GsM4Break) */
|
|
729
|
+
.ins-strip.crit { box-shadow: inset 0 0 0 1.5px var(--cz-dot-red); }
|
|
730
|
+
.ins-strip.crit .sp { color: var(--cz-dot-red); }
|
|
731
|
+
.ins-strip.crit .sp svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }
|
|
732
|
+
/* the North Star as the first card */
|
|
733
|
+
.ins-ns.okr-ns { display: block; background: none; border-radius: 0; padding: 0; font-size: inherit; font-weight: inherit; color: inherit; white-space: normal; }
|
|
734
|
+
/* the goal Viewer (GsViewer) */
|
|
735
|
+
.okr-vh { display: flex; align-items: center; gap: 10px; padding: 4px 2px 8px; flex-wrap: wrap; }
|
|
736
|
+
.okr-vh .okr-dot { margin-top: 0; }
|
|
737
|
+
.okr-vh b { font-size: var(--fs-4); font-weight: 800; }
|
|
738
|
+
.okr-vh .okr-sp { flex: 1; }
|
|
739
|
+
.okr-why { display: flex; gap: 12px; align-items: flex-start; background: var(--cz-well); border-radius: 16px; padding: 14px; margin: 8px 0; }
|
|
740
|
+
.okr-why .sp { color: var(--cz-blueink); display: inline-flex; }
|
|
741
|
+
.okr-why .sp svg { width: 20px; height: 20px; }
|
|
742
|
+
.okr-why p { margin: 0; font-size: var(--fs-3); line-height: 1.45; }
|
|
743
|
+
.okr-why .ins-mvl { margin-top: 8px; }
|
|
744
|
+
/* ⋯ › Metrics */
|
|
745
|
+
.okr-mbar { display: flex; gap: 2px; justify-content: flex-end; padding-bottom: 4px; }
|
|
746
|
+
.okr-mbar .cz-ib.on { background: var(--cz-well); }
|
|
747
|
+
.okr-mbar svg { width: 18px; height: 18px; }
|
|
748
|
+
.okr-sh { margin: 14px 4px 8px; font-size: var(--fs-1); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--cz-ink3); }
|
|
749
|
+
.okr-mrow { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 12px 10px 14px; background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; }
|
|
750
|
+
.okr-mrow + .okr-mrow { border-top: 1px solid var(--cz-hair); }
|
|
751
|
+
.okr-mrow:hover { background: var(--cz-well); }
|
|
752
|
+
.okr-mrow .okr-dot { margin-top: 0; }
|
|
753
|
+
.okr-tag { font-size: var(--fs-1); font-weight: 700; color: var(--cz-ink3); border: 1px solid var(--cz-hair); border-radius: 10px; padding: 1px 7px; }
|
|
754
|
+
.okr-tree { display: flex; flex-direction: column; align-items: center; }
|
|
755
|
+
.okr-tr0 { display: flex; justify-content: center; width: 100%; }
|
|
756
|
+
.okr-trk { width: 2px; height: 18px; background: var(--cz-hair); }
|
|
757
|
+
.okr-tr1 { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; width: 100%; padding-top: 10px; border-top: 2px solid var(--cz-hair); border-radius: 8px 8px 0 0; }
|
|
758
|
+
.okr-tr1.one { border-top: 0; padding-top: 0; }
|
|
759
|
+
.okr-tr1.loose, .okr-sh + .okr-tr1 { border-top: 0; padding-top: 0; justify-content: flex-start; }
|
|
760
|
+
.okr-node { display: flex; align-items: flex-start; gap: 8px; width: 170px; padding: 10px 12px; border-radius: 16px; border: 1px solid var(--cz-hair); background: var(--cz-card); color: inherit; font: inherit; text-align: left; cursor: pointer; }
|
|
761
|
+
.okr-node.ns { width: min(260px, 100%); }
|
|
762
|
+
.okr-node .okr-t b { font-size: var(--fs-3); }
|
|
763
|
+
.okr-node .okr-dot { margin-top: 5px; }
|
|
764
|
+
/* the product page's Goals line (GsProduct) */
|
|
765
|
+
.okr-pl { display: flex; align-items: center; gap: 10px; min-width: 0; }
|
|
766
|
+
.okr-plt { flex: 1; min-width: 0; }
|
|
767
|
+
.okr-pld { display: inline-flex; gap: 4px; flex: none; }
|
|
768
|
+
.okr-pld .okr-dot { margin-top: 0; width: 8px; height: 8px; }
|
|
769
|
+
@media (prefers-reduced-motion: reduce) { .okr-dot.m-crit::after { animation: none; } }
|
|
770
|
+
textarea.ins-dri { height: auto; padding: 6px 8px; font-weight: 500; resize: vertical; }
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/* pm/cozy-settings.js — Settings (initiative premium-uncovered-features, E3; canvas EvSettings). A dialog over the page, its sections on the left:
|
|
2
2
|
* General Theme (this device; the place menu's Theme row moved here, feedback batch 16 item 5), Viewer opens as a column or a popup
|
|
3
3
|
* (this device), Product (which products Home reads: the Products card), Your day (when the end-of-day card shows:
|
|
4
|
-
* time.workEnd, POST /api/settings),
|
|
4
|
+
* time.workEnd, POST /api/settings), Your impact (impact.on, POST /api/settings; canvas GmP1Switch, batch 16 item 7: the one switch
|
|
5
|
+
* for Adler's leaf, the impact log and the weekly check; the page hears `pmos:impact`), Agents write to Jira (fixed: only after Commit)
|
|
5
6
|
* Adler how much of Claude's face shows, Motion, Celebrations, Quiet after (adler.*, POST /api/settings; canvas AdM5, batch 16 item 2)
|
|
6
7
|
* Connectors each source's last read (GET /api/sources; was the Sources card, feedback batch 16 item 5, canvas FmA3Settings): the amber dot
|
|
7
8
|
* and ↻ Read again on a stale or failed one (POST /api/sources/refresh), ↻ in the header reads every source
|
|
@@ -57,9 +58,12 @@ function general() {
|
|
|
57
58
|
+ trow('Viewer opens as', 'A column beside the chat, or a popup over it', seg('Viewer opens as', 'viewer', vw, [['column', 'Column'], ['popup', 'Popup']]))
|
|
58
59
|
+ trow('Product', 'Which products Home, Board and Intelligence read', `<button type="button" class="ev-pick" data-ev-products aria-haspopup="menu">${esc(pname)} ${svg(ICON.down, 14)}</button>`)
|
|
59
60
|
+ trow('Your day', 'When the end-of-day card shows', `<label class="ev-vh" for="evDay">Your day ends at</label><select id="evDay" class="ev-inp" data-ev-day>${hours.map((h) => `<option value="${h}"${h === end ? ' selected' : ''}>${pad(h)}:00</option>`).join('')}</select>`)
|
|
61
|
+
+ trow('Your impact', 'Adler’s sprout and your impact log. Only you see it. Nothing leaves PMOS.', sw(impactOn(), 'data-ev-impact', 'Your impact'))
|
|
60
62
|
+ trow('Agents write to Jira', 'Only after you press Commit. Never on their own.', '<span class="ev-pill ok">Fixed</span>')
|
|
61
63
|
+ upd;
|
|
62
64
|
}
|
|
65
|
+
/* Your impact (GmP1Switch): on by default; off hides every impact surface and stops Claude's daily read */
|
|
66
|
+
function impactOn() { const x = T.set && Array.isArray(T.set.settings) ? T.set.settings.find((y) => y.key === 'impact.on') : null; return x ? x.value !== false : true; }
|
|
63
67
|
/* Settings > Adler (AdM5): four choices, each saved for this computer the moment it is pressed */
|
|
64
68
|
function adlerSec() {
|
|
65
69
|
const P = AD.prefs();
|
|
@@ -167,6 +171,12 @@ async function press(e) {
|
|
|
167
171
|
if (t.dataset.evGo) { T.sec = t.dataset.evGo; draw(); return; }
|
|
168
172
|
if (t.dataset.evSeg === 'theme') { const M = await import('./cozy-nav.js'); M.setTheme(t.dataset.v); draw(); return; }
|
|
169
173
|
if (t.dataset.evSeg && t.dataset.evSeg.startsWith('adler.')) { const r = await AD.savePref(pmPost, t.dataset.evSeg, t.dataset.v); T.msg = r && r.ok ? 'Saved.' : (r && r.error) || 'Not saved.'; draw(); return; }
|
|
174
|
+
if ('evImpact' in t.dataset) {
|
|
175
|
+
const on = !impactOn(), r = await pmPost('/api/settings', { key: 'impact.on', value: on });
|
|
176
|
+
if (r && r.ok) { const x = T.set && Array.isArray(T.set.settings) ? T.set.settings.find((y) => y.key === 'impact.on') : null; if (x) x.value = on; window.dispatchEvent(new CustomEvent('pmos:impact', { detail: { on } })); }
|
|
177
|
+
T.msg = r && r.ok ? (on ? 'Your impact is on.' : 'Your impact is off. The leaf, the log and the weekly check are hidden.') : (r && r.error) || 'Not saved.';
|
|
178
|
+
draw(); return;
|
|
179
|
+
}
|
|
170
180
|
if (t.dataset.evSeg === 'viewer') { store.set(VIEWER_KEY, t.dataset.v); document.body.classList.toggle('ev-vw-popup', t.dataset.v === 'popup'); draw(); return; }
|
|
171
181
|
// the one product pick (batch 12 item 5): the same list as the chip on Home, Board and Insights, under this row
|
|
172
182
|
if ('evProducts' in t.dataset) {
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
* sub one quiet line under the title: what the item is when the title is its parent's name (a program's "Charter", canvas MsBCharter)
|
|
37
37
|
* chip { n, label, on(button) }: the blue ✦ with its count right after the title (what Claude proposes on an initiative, batch 12
|
|
38
38
|
* items 2, 3 and 4, canvas In development PiA0/TpA1). Hidden at zero. setChip(id, chip) changes it while the item is shown.
|
|
39
|
-
* presses [{ act, label, icon, text?, solid? }]: the item's own presses before ⋯ (a program's charter icon, canvas MsB0Entry; the
|
|
39
|
+
* presses [{ act, label, icon, text?, solid?, pressed? }]: the item's own presses before ⋯ (a program's charter icon, canvas MsB0Entry; the
|
|
40
40
|
* charter's Save, MsBCharter). text draws the word beside the icon (not on a phone); solid is the one dark primary.
|
|
41
41
|
* onPress(act, button) runs them. setPresses(id, list) changes them while the item is shown (Save shows only after a change).
|
|
42
42
|
* guard (go, anchor) → true when the item holds unsaved changes and asks first: Close, ←, Escape and another open() call it, and
|
|
@@ -135,7 +135,7 @@ export function headHtml(it) {
|
|
|
135
135
|
const add = o.add && o.add.label && !phone ? ib('add', o.add.label, P.add) : '';
|
|
136
136
|
const own = (o.presses || []).filter((x) => x && x.act && x.label).map((x) => x.solid
|
|
137
137
|
? `<button type="button" class="cz-vw-pri${x.text && !phone ? '' : ' i'}" data-cz-vw="press" data-cz-vw-p="${esc(x.act)}" aria-label="${esc(x.label)}" title="${esc(x.label)}">${svg(path(x.icon), 15, 2.2)}${x.text && !phone ? `<span>${esc(x.text)}</span>` : ''}</button>`
|
|
138
|
-
: `<button type="button" class="cz-vw-ib" data-cz-vw="press" data-cz-vw-p="${esc(x.act)}" aria-label="${esc(x.label)}" title="${esc(x.label)}">${svg(path(x.icon), 18)}</button>`).join('');
|
|
138
|
+
: `<button type="button" class="cz-vw-ib" data-cz-vw="press" data-cz-vw-p="${esc(x.act)}" aria-label="${esc(x.label)}" title="${esc(x.label)}"${x.pressed != null ? ` aria-pressed="${x.pressed ? 'true' : 'false'}"` : ''}>${svg(path(x.icon), 18)}</button>`).join('');
|
|
139
139
|
const sub = o.sub ? `<p class="cz-vw-sub">${esc(o.sub)}</p>` : '';
|
|
140
140
|
const chip = o.chip && (o.chip.n > 0 || o.chip.looking) ? `<button type="button" class="cz-vw-chip${o.chip.looking ? ' live' : ''}" data-cz-vw="chip" aria-haspopup="dialog" aria-label="${esc(o.chip.label || 'Claude proposes ' + o.chip.n + '. Open')}" title="${esc(o.chip.label || 'Claude proposes')}">${svg(ICONS.spark, 13, 2)}${o.chip.n > 0 ? `<b>${esc(o.chip.n)}</b>` : ''}</button>` : '';
|
|
141
141
|
return (o.canBack || phone ? ib('back', o.canBack ? (o.backTo ? 'Back to ' + o.backTo : 'Back') : 'Close the viewer', P.back) : '')
|
|
@@ -213,3 +213,16 @@ button.rp-cy:hover { background: var(--cz-well); }
|
|
|
213
213
|
.vz-dk .czs-secs { margin: 0; }
|
|
214
214
|
.vz-dkp { border-radius: 16px; background: var(--cz-card); box-shadow: inset 0 0 0 1px var(--cz-hair); padding: 20px 22px; display: flex; flex-direction: column; gap: 10px; }
|
|
215
215
|
.vz-dkp h2 { margin: 0; font-size: var(--fs-5); font-weight: 800; }
|
|
216
|
+
/* the two cuts of a ready-made report (batch 17 item 1, PbG5): the switch, then which sections the sponsors read */
|
|
217
|
+
.vz-cut { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 10px; }
|
|
218
|
+
.vz-cuts { flex: none; align-self: flex-start; }
|
|
219
|
+
.vz-cuts button { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; }
|
|
220
|
+
.vz-cuts svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
|
|
221
|
+
.vz-cutl { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
|
|
222
|
+
.vz-cutl li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--cz-hair); font-size: var(--fs-3); }
|
|
223
|
+
.vz-cutl li:first-child { border-top: 0; }
|
|
224
|
+
.vz-cutl li span:last-child { display: flex; flex-direction: column; gap: 1px; }
|
|
225
|
+
.vz-cutl small { font-size: var(--fs-2); color: var(--cz-ink3); }
|
|
226
|
+
.vz-cb { flex: none; width: 18px; height: 18px; border-radius: 5px; border: 2px solid var(--cz-ink3); box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; }
|
|
227
|
+
.vz-cutl li.on .vz-cb { background: var(--cz-blue); border-color: var(--cz-blue); color: var(--cz-onsolid); }
|
|
228
|
+
.vz-cb svg { fill: none; stroke: currentColor; stroke-width: 3; }
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/* pm/dash-view.css — the ready-made Dashboard view (pm/dash-view.js; canvas In development, band "Ready-made dashboards and reports": PbA1–PbA3,
|
|
2
|
+
* PbA5, PbA7, PbS1, PbS2, PbG2, PbG3, PbG6–PbG10). dash-view.js loads it once, so it works wherever the program panel, the initiative view or the
|
|
3
|
+
* product page opens (Board, Home). Token vars only, over pm/cozy.css; the type scale is --fs-1..--fs-6. Every class starts with db-.
|
|
4
|
+
* The body is a size container: 720 px or wider lays the blocks in two columns, each block its own card (PbA7). */
|
|
5
|
+
|
|
6
|
+
.db { container-type: inline-size; display: flex; flex-direction: column; gap: 14px; padding: 2px 0 18px; color: var(--cz-ink); font-family: var(--cz-sans); }
|
|
7
|
+
.db-wait, .db-note { margin: 0; font-size: var(--fs-2); line-height: 1.5; color: var(--cz-ink3); }
|
|
8
|
+
.db-grid { display: flex; flex-direction: column; gap: 14px; }
|
|
9
|
+
.db-b { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
|
|
10
|
+
.db-h { margin: 0; font-size: var(--fs-4); font-weight: 800; }
|
|
11
|
+
.db-card { background: var(--cz-card); border: 1px solid var(--cz-hair); border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
|
|
12
|
+
.db-list { gap: 0; padding-top: 4px; padding-bottom: 4px; }
|
|
13
|
+
|
|
14
|
+
/* the ✦ line: what Claude handled, with the M face; a warning is the honest face on a warm edge */
|
|
15
|
+
.db-hd { display: flex; align-items: flex-start; gap: 12px; border-radius: 16px; padding: 12px 14px; background: var(--cz-bluebg); border: 1px solid color-mix(in srgb, var(--cz-blueink) 18%, transparent); }
|
|
16
|
+
.db-hd.warn { background: var(--cz-latebg); border-color: color-mix(in srgb, var(--cz-late) 55%, transparent); }
|
|
17
|
+
.db-hd p { margin: 0; flex: 1; min-width: 0; font-size: var(--fs-4); line-height: 1.45; color: var(--cz-ink2); }
|
|
18
|
+
.db-hd b { color: var(--cz-ink); font-weight: 800; }
|
|
19
|
+
.db-face { flex: none; width: 36px; height: 36px; display: inline-flex; }
|
|
20
|
+
.db-face svg { width: 36px; height: 36px; }
|
|
21
|
+
|
|
22
|
+
/* rows: a dot, the words, the owner */
|
|
23
|
+
.db-row, .db-rep, .db-sum, .db-fold { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 10px; padding: 9px 0; min-width: 0; width: 100%; }
|
|
24
|
+
button.db-row, button.db-rep, .db-sum, .db-fold { cursor: pointer; }
|
|
25
|
+
.db-list > .db-row + .db-row, .db-list > .db-row + .db-fold, .db-reps > * + * { border-top: 1px solid var(--cz-hair); }
|
|
26
|
+
.db-rt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
|
|
27
|
+
.db-rt b { font-size: var(--fs-4); font-weight: 800; line-height: 1.3; }
|
|
28
|
+
.db-rt small, .db-r { font-size: var(--fs-2); line-height: 1.4; color: var(--cz-ink3); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
|
|
29
|
+
.db-r { flex: none; text-align: right; }
|
|
30
|
+
.db-fold .db-rt b { font-size: var(--fs-3); }
|
|
31
|
+
.db-fold > svg, .db-rep > svg:last-child, .db-sum > svg:last-child { flex: none; color: var(--cz-ink3); }
|
|
32
|
+
.db-fold[aria-expanded="true"] > svg { transform: rotate(180deg); }
|
|
33
|
+
.db-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--cz-dot-q); }
|
|
34
|
+
.db-dot.ok { background: var(--cz-dot-ok); } .db-dot.risk { background: var(--cz-dot-risk); } .db-dot.late { background: var(--cz-dot-late); }
|
|
35
|
+
.db-dot.q { background: transparent; border: 2px solid var(--cz-ink3); box-sizing: border-box; }
|
|
36
|
+
.db-dots { display: inline-flex; gap: 4px; flex: none; }
|
|
37
|
+
.db-who { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--cz-well); color: var(--cz-ink2); font-size: var(--fs-1); font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
|
|
38
|
+
.db-tag { flex: none; display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 18px; padding: 0 4px; border-radius: 5px; background: var(--cz-bluebg); color: var(--cz-blueink); font-size: var(--fs-1); font-weight: 800; }
|
|
39
|
+
.db-none { margin: 0; display: flex; align-items: center; gap: 8px; font-size: var(--fs-3); color: var(--cz-ink3); }
|
|
40
|
+
.db-meta, .db-more, .db-p { margin: 0; font-size: var(--fs-2); line-height: 1.5; color: var(--cz-ink3); }
|
|
41
|
+
.db-p { font-size: var(--fs-3); color: var(--cz-ink2); }
|
|
42
|
+
.db-top { display: flex; align-items: center; gap: 10px; }
|
|
43
|
+
.db-top > small { margin-left: auto; font-size: var(--fs-2); color: var(--cz-ink3); text-align: right; }
|
|
44
|
+
.db-big { font-size: var(--fs-5); font-weight: 800; }
|
|
45
|
+
|
|
46
|
+
/* the stages of Ships: done green, now blue, next grey */
|
|
47
|
+
.db-steps { display: flex; align-items: flex-start; }
|
|
48
|
+
.db-st { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; min-width: 0; }
|
|
49
|
+
.db-st::before { content: ''; position: absolute; top: 6px; left: -50%; right: 50%; height: 2px; background: var(--cz-hair); }
|
|
50
|
+
.db-st:first-child::before { display: none; }
|
|
51
|
+
.db-st.done::before, .db-st.now::before { background: var(--cz-dot-ok); }
|
|
52
|
+
.db-st i { width: 12px; height: 12px; transform: rotate(45deg); border-radius: 3px; background: var(--cz-well2, var(--cz-hair)); position: relative; }
|
|
53
|
+
.db-st.done i { background: var(--cz-dot-ok); } .db-st.now i { background: var(--cz-blue); }
|
|
54
|
+
.db-st small { font-size: var(--fs-1); color: var(--cz-ink3); text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
|
|
55
|
+
|
|
56
|
+
/* milestones: the track, then one row each */
|
|
57
|
+
.db-trk { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px; background: linear-gradient(var(--cz-hair), var(--cz-hair)) center / 100% 2px no-repeat; }
|
|
58
|
+
.db-trk i { width: 12px; height: 12px; transform: rotate(45deg); border-radius: 3px; background: var(--cz-dot-q); }
|
|
59
|
+
.db-trk i.ok, .db-trk i.done { background: var(--cz-dot-ok); } .db-trk i.risk { background: var(--cz-dot-risk); } .db-trk i.late { background: var(--cz-dot-late); }
|
|
60
|
+
.db-ms { display: flex; align-items: center; gap: 10px; padding: 4px 0; font-size: var(--fs-3); }
|
|
61
|
+
.db-ms .db-rt { font-weight: 600; }
|
|
62
|
+
.db-gh { display: flex; align-items: center; gap: 4px; }
|
|
63
|
+
.db-gh > .db-sum { flex: 1; }
|
|
64
|
+
.db-hr { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -10px 0; }
|
|
65
|
+
|
|
66
|
+
/* the window of Did it work? */
|
|
67
|
+
.db-win { height: 4px; border-radius: 99px; background: var(--cz-hair); overflow: hidden; }
|
|
68
|
+
.db-win i { display: block; height: 100%; background: var(--cz-dot-ok); }
|
|
69
|
+
|
|
70
|
+
/* Ready for build: the checklist */
|
|
71
|
+
.db-cks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
|
|
72
|
+
.db-ck { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: var(--fs-3); }
|
|
73
|
+
.db-box { flex: none; width: 18px; height: 18px; border-radius: 5px; border: 2px solid var(--cz-ink3); box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; }
|
|
74
|
+
.db-ck.on .db-box { background: var(--cz-blue); border-color: var(--cz-blue); color: var(--cz-onsolid); }
|
|
75
|
+
|
|
76
|
+
/* Needs you, drafts, held and late reports: the presses sit at the card's end */
|
|
77
|
+
.db-need { background: var(--cz-bluebg); border-color: color-mix(in srgb, var(--cz-blueink) 18%, transparent); }
|
|
78
|
+
.db-nq { display: flex; gap: 10px; align-items: flex-start; }
|
|
79
|
+
.db-nq > svg { flex: none; margin-top: 2px; color: var(--cz-blueink); }
|
|
80
|
+
.db-pick { font-size: var(--fs-2); font-weight: 800; color: var(--cz-blueink); margin-top: 4px; }
|
|
81
|
+
.db-acts { display: flex; justify-content: flex-end; align-items: center; gap: 4px; }
|
|
82
|
+
.db-ib { all: unset; box-sizing: border-box; cursor: pointer; width: 40px; height: 40px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; color: var(--cz-ink2); flex: none; }
|
|
83
|
+
.db-ib.solid { width: 44px; height: 44px; background: var(--cz-blue); color: var(--cz-onsolid); }
|
|
84
|
+
.db-ib[disabled] { opacity: .45; cursor: default; }
|
|
85
|
+
@media (hover: hover) { .db-ib:not([disabled]):not(.solid):hover { background: var(--cz-well); color: var(--cz-ink); } .db-ib.solid:not([disabled]):hover { filter: brightness(1.1); } button.db-row:hover .db-rt b, button.db-rep:hover .db-rt b { text-decoration: underline; text-underline-offset: 3px; } }
|
|
86
|
+
.db-ib:focus-visible, .db-row:focus-visible, .db-rep:focus-visible, .db-fold:focus-visible, .db-sum:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 2px; border-radius: 10px; }
|
|
87
|
+
.db-draft, .db-held { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--cz-well); }
|
|
88
|
+
.db-held { background: var(--cz-bluebg); }
|
|
89
|
+
.db-draft > .db-acts, .db-held > .db-acts { flex-basis: 100%; }
|
|
90
|
+
.db-dic { flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--cz-well); color: var(--cz-ink2); display: inline-flex; align-items: center; justify-content: center; }
|
|
91
|
+
.db-draft .db-dic { width: auto; height: auto; background: none; margin-top: 2px; }
|
|
92
|
+
.db-held .db-dic { width: auto; height: auto; background: none; color: var(--cz-blueink); margin-top: 2px; }
|
|
93
|
+
.db-late { display: flex; flex-direction: column; }
|
|
94
|
+
.db-hu { gap: 10px; }
|
|
95
|
+
.db-hut { font-size: var(--fs-5); font-weight: 800; line-height: 1.35; }
|
|
96
|
+
.db-chips { display: flex; flex-wrap: wrap; gap: 6px; }
|
|
97
|
+
.db-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: var(--cz-well); font-size: var(--fs-2); font-weight: 700; color: var(--cz-ink2); }
|
|
98
|
+
.db-trust .db-acts { margin-top: -6px; }
|
|
99
|
+
.db-done { padding-top: 2px; padding-bottom: 2px; }
|
|
100
|
+
|
|
101
|
+
/* two columns at 720 px and wider (PbA7): each block is its own card, its heading inside */
|
|
102
|
+
@container (min-width: 720px) {
|
|
103
|
+
.db-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: stretch; }
|
|
104
|
+
.db-grid > .db-b { background: var(--cz-card); border: 1px solid var(--cz-hair); border-radius: 16px; padding: 14px 16px; }
|
|
105
|
+
.db-grid > .db-b > .db-card { border: 0; padding: 0; background: none; }
|
|
106
|
+
.db-grid > .db-b > .db-card.db-need { background: var(--cz-bluebg); padding: 12px 14px; }
|
|
107
|
+
.db-grid > .db-b > .db-h, .db-grid > .db-b > .db-hr { padding-bottom: 6px; border-bottom: 1px solid var(--cz-hair); }
|
|
108
|
+
.db-grid > .db-b > .db-hr { margin: -6px 0 0; }
|
|
109
|
+
}
|
|
110
|
+
@media (prefers-reduced-motion: no-preference) { .db-hd, .db-b { animation: db-in .24s ease-out both; } }
|
|
111
|
+
@keyframes db-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
|
|
@@ -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
|
+
}
|