create-pmos 0.442.0 → 0.444.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-board-test.js +8 -2
- package/workspace/briefing-premium-insights-test.js +40 -38
- package/workspace/briefing-premium-test.js +2 -1
- package/workspace/changelog.json +24 -0
- package/workspace/goals-clear-ui-test.js +263 -0
- package/workspace/guide/home.md +12 -2
- package/workspace/guide/metric-drafts.md +8 -2
- package/workspace/home-railcard-test.js +193 -0
- package/workspace/intel-report-ui-test.js +1 -1
- package/workspace/intelligence-gaps-ui-test.js +16 -14
- package/workspace/lib/board-premium.js +1 -1
- package/workspace/lib/engine/boards.js +9 -2
- package/workspace/lib/engine/records/index.js +9 -2
- package/workspace/lib/initiative-layout.js +3 -1
- package/workspace/lib/insights-premium.js +22 -1
- package/workspace/lib/metric-drafts.js +37 -10
- package/workspace/lib/metric-read-runs.js +20 -13
- package/workspace/lib/metric-reads.js +208 -23
- package/workspace/lib/metrics-cli.js +62 -5
- package/workspace/lib/routes-boards.js +40 -1
- package/workspace/lib/routes-goal-status.js +89 -6
- package/workspace/lib/routes-insights-premium.js +1 -1
- package/workspace/lib/routes-metric-drafts.js +26 -3
- package/workspace/live-pill-round-test.js +178 -0
- package/workspace/metric-drafts-ui-test.js +5 -2
- package/workspace/okr-goals-ui-test.js +27 -23
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/panels-test.js +231 -0
- package/workspace/premium-board-actions-test.js +2 -2
- package/workspace/premium-rec-tab-test.js +2 -1
- package/workspace/premium-vw-item-test.js +10 -2
- package/workspace/premium-vw-jira-test.js +3 -0
- package/workspace/public/pm/bd-ini-panel.js +3 -2
- package/workspace/public/pm/cozy-adler.js +21 -0
- package/workspace/public/pm/cozy-divider.css +32 -0
- package/workspace/public/pm/cozy-divider.js +45 -0
- package/workspace/public/pm/cozy-insights.css +96 -0
- package/workspace/public/pm/cozy-live-pill.css +16 -17
- package/workspace/public/pm/cozy-live-pill.js +28 -17
- package/workspace/public/pm/cozy-panels.css +59 -0
- package/workspace/public/pm/cozy-panels.js +524 -0
- package/workspace/public/pm/cozy-today.css +15 -0
- package/workspace/public/pm/cozy-viewer.js +173 -69
- package/workspace/public/pm/cozy-vw-shell.css +4 -0
- package/workspace/public/pm/goals-clear.js +265 -0
- package/workspace/public/pm/home-app.js +73 -14
- package/workspace/public/pm/home-ini.js +9 -3
- package/workspace/public/pm/home-today.js +55 -12
- package/workspace/public/pm/ini-edit.js +401 -0
- package/workspace/public/pm/ini-groups.js +14 -8
- package/workspace/public/pm/ini-tasks.js +84 -26
- package/workspace/public/pm/ini-versions.js +18 -4
- package/workspace/public/pm/ini-view-model.js +45 -18
- package/workspace/public/pm/ini-view.css +117 -5
- package/workspace/public/pm/ini-view.js +51 -17
- package/workspace/public/pm/metric-drafts.js +4 -1
- package/workspace/public/pm/mission.js +11 -7
- package/workspace/public/pm/premium-board.js +8 -6
- package/workspace/public/pm/premium-insights.js +375 -59
- package/workspace/public/pm/task-card.css +2 -0
- package/workspace/public/pm/task-card.js +4 -1
- package/workspace/server.js +6 -2
- package/workspace/skills/metric-read.skill +7 -5
- package/workspace/stage-card-tasks-test.js +396 -0
- package/workspace/stage-card-test.js +12 -4
- package/workspace/task-delete-test.js +9 -1
- package/workspace/task-milestones-test.js +3 -3
- package/workspace/task-press-test.js +12 -4
- package/workspace/task-views-test.js +198 -5
- package/workspace/test-lists/batch18-live-pill-round.json +10 -0
- package/workspace/test-lists/batch18-panels.json +9 -0
- package/workspace/test-lists/goals-clear.json +15 -0
- package/workspace/test-lists/home-railcard.json +9 -0
- package/workspace/test-lists/stage-card-tasks.json +6 -0
- package/workspace/tk-tasks-test.js +2 -2
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
/* pm/goals-clear.js — goals made clear on Intelligence (feedback batch 18 item 11, build 11-B; main canvas In development, frames Gc*). PURE: each
|
|
2
|
+
* function takes a drafted row (GET /api/metric-drafts, through okr-list.js draftsOf) or a goal of the Intelligence model (GET /api/insights-premium,
|
|
3
|
+
* with the fields lib/goal-status.js and the goals reading engine add) and returns words or markup. No read, no write, no clock of its own.
|
|
4
|
+
*
|
|
5
|
+
* rhythmOf(x) { short: "Every Monday", long: "every Monday 07:00" } | null the server's rhythm, else said from the recipe
|
|
6
|
+
* keptSay(rows) the "Kept" toast: "Kept. I read it every Monday 07:00." with the goal's own rhythm (never "every morning")
|
|
7
|
+
* tableHtml(rows, o) GcJ1aTable: the drafts table. Proposed metric · How it is counted · Now (read hh:mm) · Target · From, how often · ✕ ✓
|
|
8
|
+
* checkHtml(r, st) GcJ1Drafts: the check panel of one drafted metric; GcS3Differs once the PM typed a number that differs
|
|
9
|
+
* needOf(x) "it needs a full week": why a weekly (or monthly) goal is not read more often, said after How often
|
|
10
|
+
* firstOf(g) { n, first, next } while a goal has fewer than 3 readings (GcJ2FirstMonday): no pace, no trend yet
|
|
11
|
+
* firstMeta(g) the row's second line then: "39.4k · Looker, Mon 2 Nov 07:02 · pace known after 3 readings"
|
|
12
|
+
* firstChart(g) the dashed box where the chart will be: "The line starts with the 2nd reading, Mon 9 Nov"
|
|
13
|
+
* krHtml(g, o) GcR3Goal, GcR4Failed, GcR5Held: the failed or held box, How it is counted, From … (said once), the checks, the query
|
|
14
|
+
* lineOf(goals, product) the ✦ line for a held reading, a failed read or the first readings; null when none of them is the news
|
|
15
|
+
*
|
|
16
|
+
* The rules of the frames: summary first; how often and the last read are said once, in "From, how often"; a held or failed reading never shows as
|
|
17
|
+
* progress (the row and the dot keep the last good reading); icon-only presses, with words in aria-label and title; Adler stays out of the table,
|
|
18
|
+
* the counts and the charts. Every field is optional: what the server did not send is not drawn (zero is silence). */
|
|
19
|
+
|
|
20
|
+
import { esc, SV, P, dotHtml } from './okr-list.js';
|
|
21
|
+
|
|
22
|
+
const WD = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
|
|
23
|
+
const WD3 = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
|
24
|
+
const DAYKEY = { sun: 0, mon: 1, tue: 2, wed: 3, thu: 4, fri: 5, sat: 6 };
|
|
25
|
+
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
26
|
+
const fin = (v) => typeof v === 'number' && Number.isFinite(v);
|
|
27
|
+
const when = (iso) => { const t = Date.parse(String(iso || '')); return Number.isFinite(t) ? new Date(t) : null; };
|
|
28
|
+
const pad = (n) => String(n).padStart(2, '0');
|
|
29
|
+
/** "07:02" in the PM's own time. A day with no time ("2026-11-02") has none. */
|
|
30
|
+
export const hm = (iso) => { const d = /T\d/.test(String(iso || '')) ? when(iso) : null; return d ? pad(d.getHours()) + ':' + pad(d.getMinutes()) : ''; };
|
|
31
|
+
/** "Mon 2 Nov" (a date) and "Mon 2 Nov, 07:02" (a date with its time). */
|
|
32
|
+
export const dayTxt = (iso) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); if (!m) return ''; const d = /T\d/.test(iso) ? when(iso) : new Date(+m[1], +m[2] - 1, +m[3]); return d ? WD3[d.getDay()] + ' ' + d.getDate() + ' ' + MON[d.getMonth()] : ''; };
|
|
33
|
+
export const atTxt = (iso) => [dayTxt(iso), hm(iso)].filter(Boolean).join(', ');
|
|
34
|
+
const big = (v) => (fin(v) ? (Math.abs(v) >= 1000 ? v.toLocaleString('en-US', { maximumFractionDigits: 0 }) : String(Math.round(v * 100) / 100)) : '');
|
|
35
|
+
const icon = (d, s = 16) => SV(d, s);
|
|
36
|
+
const I = Object.assign({}, P, { open: 'M14 4h6v6M20 4l-9 9M18 14v5H5V6h5', redo: 'M20 12a8 8 0 1 1-2.3-5.6M20 4v5h-5', warn: 'M12 4l9 16H3zM12 10v4M12 17v.5' });
|
|
37
|
+
const ib = (o) => `<button type="button" class="cz-ib sm${o.solid ? ' solid' : ''}" data-gc="${esc(o.act)}"${o.row ? ` data-row="${esc(o.row)}"` : ''} aria-label="${esc(o.label)}" title="${esc(o.title || o.label)}"${o.busy ? ' disabled' : ''}>${icon(o.icon, o.solid ? 18 : 16)}</button>`;
|
|
38
|
+
|
|
39
|
+
/* ── the rhythm ────────────────────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
40
|
+
/** How often a goal is read, in two lengths: the table's short one and the long one the panel and the toast say. The server's rhythm wins
|
|
41
|
+
* ({ txt, short }); else it is said from the recipe's cadence, at and day. null when the goal has no way to be read. */
|
|
42
|
+
export function rhythmOf(x) {
|
|
43
|
+
const R = (x && x.rhythm) || (x && x.raw && x.raw.rhythm), rc = (x && x.recipe) || (x && x.raw && x.raw.recipe) || null;
|
|
44
|
+
const rat = R && typeof R === 'object' ? (/^\d{1,2}:\d{2}$/.test(String(R.at || '')) ? String(R.at) : (/(\d{1,2}:\d{2})$/.exec(String(R.txt || '')) || [])[1] || '') : '';
|
|
45
|
+
if (R && typeof R === 'object' && R.cadence === 'daily' && rat) return { short: 'Every day, ' + rat.padStart(5, '0'), long: String(R.txt || 'every day ' + rat).replace(/^./, (c) => c.toLowerCase()) };
|
|
46
|
+
if (R && typeof R === 'object' && (R.txt || R.short)) { const long = String(R.txt || R.short); return { short: String(R.short || long.replace(/^./, (c) => c.toUpperCase()).replace(/ \d{2}:\d{2}$/, '')), long: long.replace(/^./, (c) => c.toLowerCase()) }; }
|
|
47
|
+
if (typeof R === 'string' && R) return { short: R.replace(/^./, (c) => c.toUpperCase()), long: R.replace(/^./, (c) => c.toLowerCase()) };
|
|
48
|
+
const c = rc && rc.cadence; if (!c) return null;
|
|
49
|
+
const at = /^\d{1,2}:\d{2}$/.test(String(rc.at || '')) ? String(rc.at).padStart(5, '0') : '';
|
|
50
|
+
if (c === 'hourly') return { short: 'Every hour', long: 'every hour' + (rc.hours ? ', ' + rc.hours : '') };
|
|
51
|
+
if (c === 'daily') return { short: 'Every day' + (at ? ', ' + at : ''), long: 'every day' + (at ? ' ' + at : '') };
|
|
52
|
+
if (c === 'weekly') { const d = DAYKEY[String(rc.day || 'mon').slice(0, 3).toLowerCase()]; const w = WD[d === undefined ? 1 : d]; return { short: 'Every ' + w, long: 'every ' + w + (at ? ' ' + at : '') }; }
|
|
53
|
+
if (c === 'monthly') return { short: 'Every month', long: 'every month, the 1st' + (at ? ' ' + at : '') };
|
|
54
|
+
return { short: String(c), long: String(c) };
|
|
55
|
+
}
|
|
56
|
+
/** Why a goal is read no more often than this (GcJ1Drafts): a weekly count needs the whole week in it, a monthly one the whole month. */
|
|
57
|
+
export function needOf(x) {
|
|
58
|
+
const R = (x && x.rhythm) || (x && x.raw && x.raw.rhythm), rc = (x && x.recipe) || (x && x.raw && x.raw.recipe) || null;
|
|
59
|
+
const c = (R && typeof R === 'object' && R.cadence) || (rc && rc.cadence) || '';
|
|
60
|
+
return c === 'weekly' ? 'it needs a full week' : c === 'monthly' ? 'it needs a full month' : '';
|
|
61
|
+
}
|
|
62
|
+
/** The "Kept" toast (AdM3Intel, now with the goal's own rhythm). rows: the drafts kept by this press. One rhythm for all: it says it; several:
|
|
63
|
+
* "each on its own rhythm". A server's said line (r.said) wins. */
|
|
64
|
+
export function keptSay(rows, said) {
|
|
65
|
+
if (said) return said;
|
|
66
|
+
const R = (rows || []).map(rhythmOf).filter(Boolean), longs = [...new Set(R.map((x) => x.long))];
|
|
67
|
+
if (!R.length) return 'Kept. I read it from now on.';
|
|
68
|
+
if (longs.length === 1) return 'Kept. I read ' + ((rows || []).length > 1 ? 'them ' : 'it ') + longs[0] + '.';
|
|
69
|
+
return 'Kept. I read each one on its own rhythm: the first reading within the hour.';
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/* ── the drafts table (GcJ1aTable) ─────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
73
|
+
const GROUP_SAY = { 'North Star': 'the moment people get value', Inputs: 'what moves the North Star', Guardrails: 'must not get worse', 'Key results': 'this quarter' };
|
|
74
|
+
const TYPE_SAY = { 'Stay within': 'Stay within', Percentage: 'Percentage', Count: 'Count', Amount: 'Amount', Duration: 'Duration', 'Done or not': 'Done or not' };
|
|
75
|
+
const liveOf = (r) => { const L = r && r.raw && r.raw.live; return L && typeof L === 'object' ? L : null; };
|
|
76
|
+
const countsOf = (x) => { const c = (x && x.counts) || (x && x.raw && x.raw.counts); return c && typeof c === 'object' ? c : null; };
|
|
77
|
+
/** What the row says in "How it is counted": the plain sentence, else the two counts as "a ÷ b", else nothing. */
|
|
78
|
+
export function countedOf(x) {
|
|
79
|
+
const c = countsOf(x); if (!c) return '';
|
|
80
|
+
if (c.what) return String(c.what);
|
|
81
|
+
return [c.num_label, c.den_label].filter(Boolean).join(' ÷ ');
|
|
82
|
+
}
|
|
83
|
+
/** The source and the rhythm as the table says them: the source with its dot (green: it read; amber: it could not), then the short rhythm. */
|
|
84
|
+
function fromHtml(r) {
|
|
85
|
+
const rc = (r.raw && r.raw.recipe) || null, L = liveOf(r), src = (rc && rc.connector) || r.source || '';
|
|
86
|
+
const R = rhythmOf(r);
|
|
87
|
+
if (!src && !R) return '<span class="note">Not set yet</span>';
|
|
88
|
+
const dot = L ? (L.ok === false ? 'risk' : 'ok') : 'q';
|
|
89
|
+
return `<span class="gc-src"><i class="cz-dot ${dot}" aria-hidden="true"></i><b>${esc(src || 'You type it in')}</b></span>${R ? `<span class="note">${esc(R.short)}</span>` : ''}`;
|
|
90
|
+
}
|
|
91
|
+
const nowOf = (r) => { const L = liveOf(r); if (L && L.ok !== false) return L.txt || big(L.value) || r.nowTxt || '—'; if (L && L.ok === false) return '—'; return r.nowTxt || '—'; };
|
|
92
|
+
/** rows: the open metric drafts (okr-list.js draftsOf, kind metric) in the product's groups. o: { busy: Set of row ids, sel: row id }.
|
|
93
|
+
* The header's "read hh:mm" is the time of the newest live read; with none it is "Now". */
|
|
94
|
+
export function tableHtml(rows, o = {}) {
|
|
95
|
+
const R = (rows || []).filter((r) => r && r.kind === 'metric' && r.state === 'open'); if (!R.length) return '';
|
|
96
|
+
const lives = R.map(liveOf).filter((L) => L && L.ok !== false && L.at).map((L) => L.at).sort();
|
|
97
|
+
const t = lives.length ? hm(lives[lives.length - 1]) : '';
|
|
98
|
+
const groups = ['North Star', 'Inputs', 'Guardrails', 'Key results'];
|
|
99
|
+
const by = groups.map((g) => [g, R.filter((r) => r.group === g)]).concat([['', R.filter((r) => !groups.includes(r.group))]]).filter(([, L]) => L.length);
|
|
100
|
+
const busy = o.busy || new Set();
|
|
101
|
+
const row = (r) => {
|
|
102
|
+
const type = (r.raw && TYPE_SAY[r.raw.type]) || '';
|
|
103
|
+
return `<div class="gc-tr${o.sel === r.id ? ' sel' : ''}" role="row" data-gc-row="${esc(r.id)}" tabindex="0" aria-label="${esc('Check ' + r.name)}">`
|
|
104
|
+
+ `<span class="gc-nm" role="cell"><b>${esc(r.name)}</b>${type ? `<span class="gc-type">${esc(type)}</span>` : ''}</span>`
|
|
105
|
+
+ `<span class="gc-hw" role="cell">${esc(countedOf(r)) || '<span class="note">Not written yet</span>'}</span>`
|
|
106
|
+
+ `<span class="gc-now" role="cell"><b>${esc(nowOf(r))}</b></span>`
|
|
107
|
+
+ `<span class="gc-tg" role="cell"><b>${esc(r.targetTxt || '—')}</b></span>`
|
|
108
|
+
+ `<span class="gc-from" role="cell">${fromHtml(r)}</span>`
|
|
109
|
+
+ `<span class="gc-acts" role="cell">${ib({ act: 'drop', row: r.id, icon: I.x, label: 'Not now: ' + r.name, title: 'Not now', busy: busy.has(r.id) })}${ib({ act: 'keep', row: r.id, icon: I.chk, label: 'Keep: ' + r.name, title: 'Keep', solid: false, busy: busy.has(r.id) })}</span></div>`;
|
|
110
|
+
};
|
|
111
|
+
return `<div class="gc-tbl" role="table" aria-label="Proposed metrics"><div class="gc-th" role="row"><span role="columnheader">Proposed metric</span><span role="columnheader">How it is counted</span>`
|
|
112
|
+
+ `<span role="columnheader">Now${t ? ` <span class="note">read ${esc(t)}</span>` : ''}</span><span role="columnheader">Target</span><span role="columnheader">From, how often</span><span role="columnheader"><span class="vh">Not now or keep</span></span></div>`
|
|
113
|
+
+ by.map(([g, L]) => (g ? `<div class="gc-grp" role="row"><span role="cell"><b>${esc(g)}</b> <span class="note">${esc(GROUP_SAY[g] || '')}</span></span></div>` : '') + L.map(row).join('')).join('') + '</div>';
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/* ── the check panel (GcJ1Drafts, GcS3Differs) ─────────────────────────────────────────────────────────────────────────────────── */
|
|
117
|
+
const checkRow = (c) => `<li class="${c.ok ? 'ok' : 'warn'}">${icon(c.ok ? I.chk : I.warn, 14)}<span>${esc(c.text)}</span></li>`;
|
|
118
|
+
const queryHtml = (rc, open) => (rc && rc.query ? `<details class="gc-q"${open ? ' open' : ''}><summary><b>The query</b> <span class="note">${esc([rc.connector, rc.where].filter(Boolean).join(' · '))}</span></summary><pre>${esc(rc.query)}</pre></details>` : '');
|
|
119
|
+
/** The counts as a fraction (GcR3Goal): "1,212 checkouts stopped at login" over "6,000 checkouts reached login", then "= 20.2%, week of 9 Nov".
|
|
120
|
+
* With a reading that failed, the counts are "?" and the result is "not known for this week". */
|
|
121
|
+
function fractionHtml(c, L, unknown) {
|
|
122
|
+
if (!c || !(c.num_label || c.den_label)) return '';
|
|
123
|
+
const n = unknown ? '?' : big(L && L.num), d = unknown ? '?' : big(L && L.den);
|
|
124
|
+
if (!unknown && !(n || d)) return '';
|
|
125
|
+
const res = unknown ? '= not known for this ' + (L && L.period && /^month/.test(L.period) ? 'month' : 'week') : '= ' + (L.txt || big(L.value)) + (L.period ? ', ' + L.period : '');
|
|
126
|
+
return `<div class="gc-frac">${c.num_label ? `<div class="n"><b>${esc(n)}</b><span>${esc(c.num_label)}</span></div>` : ''}${c.den_label ? `<div class="d"><b>${esc(d)}</b><span>${esc(c.den_label)}</span></div>` : ''}<div class="r">${esc(res)}</div></div>`;
|
|
127
|
+
}
|
|
128
|
+
/** st: { compare: the PM's number as typed, busy, msg }. The compare answer lives on the row (raw.compare) once the server has it. */
|
|
129
|
+
export function checkHtml(r, st = {}) {
|
|
130
|
+
const raw = r.raw || {}, L = liveOf(r), c = countsOf(r), rc = raw.recipe || null, R = rhythmOf(r), cmp = raw.compare && fin(raw.compare.value) ? raw.compare : null;
|
|
131
|
+
if (cmp && cmp.state !== 'picked' && !st.back) {
|
|
132
|
+
// GcS3Differs: mine beside yours, how far apart and why, then Claude's suggestion with ✕ / ✓
|
|
133
|
+
const sg = cmp.suggest || null, mine = cmp.oursTxt || (fin(cmp.ours) ? big(cmp.ours) : '') || (L && L.ok !== false ? (L.txt || big(L.value)) : r.nowTxt || '—');
|
|
134
|
+
const close = cmp.state === 'same' || (cmp.differs === false) || (cmp.differs === undefined && fin(cmp.pct) && Math.abs(cmp.pct) <= 2);
|
|
135
|
+
return `<div class="gc-two"><div class="gc-card"><span class="note">Mine</span><b>${esc(mine)}</b><span class="note">${esc(cmp.oursLabel || 'as I count it')}</span></div>`
|
|
136
|
+
+ `<div class="gc-card"><span class="note">${esc(cmp.label || 'Yours')}</span><b>${esc(cmp.txt || big(cmp.value))}</b><span class="note">you typed it</span></div></div>`
|
|
137
|
+
+ (close ? `<p class="gc-say"><b>Within 2%.</b> Your number and mine agree, so I keep counting it this way.</p>`
|
|
138
|
+
: `<p class="gc-say">${cmp.apart ? `<b>${esc(cmp.apart)} apart.</b> ` : ''}${cmp.why ? `<b>I found why:</b> ${esc(cmp.why)}` : 'I am looking for why. It shows here when I know.'}</p>`)
|
|
139
|
+
+ (sg && sg.text && !close ? `<div class="gc-sg"><span class="sp" aria-hidden="true">${icon(I.spark, 16)}</span><p>${esc(sg.text)} I write your pick into “How it is counted”.</p><span class="acts">${ib({ act: 'pick-other', row: r.id, icon: I.x, label: 'No, count it the other way', title: 'No', busy: st.busy })}${ib({ act: 'pick', row: r.id, icon: I.chk, label: 'Yes, count it as you suggest', title: 'Yes', solid: true, busy: st.busy })}</span></div>` : '')
|
|
140
|
+
+ `<p class="note gc-msg" role="status">${esc(st.msg || '')}</p>`;
|
|
141
|
+
}
|
|
142
|
+
const value = L && L.ok !== false ? (L.txt || big(L.value)) : '';
|
|
143
|
+
const head = L && L.ok === false
|
|
144
|
+
? `<div class="gc-warnbox"><b>${esc(atTxt(L.at) + ' · not read')}</b><p>${esc(L.error || 'The source did not answer.')} I did not guess a number.</p></div>`
|
|
145
|
+
: '';
|
|
146
|
+
const box = `<div class="gc-box"><span class="gc-k">How it is counted</span>${c && c.what ? `<p class="gc-what">${esc(c.what)}</p>` : '<p class="note">Not written yet. ✎ says it in your words.</p>'}`
|
|
147
|
+
+ (L && L.ok !== false && (L.num != null || L.den != null) ? fractionHtml(c, L) : '')
|
|
148
|
+
+ (value ? `<p class="gc-big"><b>${esc(value)}</b><span class="note">read ${esc(L.at && Date.now() - Date.parse(L.at) < 15 * 6e4 ? 'just now' : atTxt(L.at))}${L.period ? ', ' + esc(L.period) : ''}</span></p>`
|
|
149
|
+
: !L ? `<p class="note">Not read yet. ↻ reads it now, and nothing is kept until you keep it.</p>` : '') + '</div>';
|
|
150
|
+
const checks = (Array.isArray(raw.checks) ? raw.checks : []).filter((x) => x && x.text);
|
|
151
|
+
const cmpLine = { ok: false, text: 'No other number to compare yet: type yours' };
|
|
152
|
+
const list = checks.concat(cmp ? [] : [cmpLine]);
|
|
153
|
+
return head + box
|
|
154
|
+
+ `<div class="gc-sec"><b class="gc-k">My checks</b><ul class="gc-checks">${list.map(checkRow).join('')}</ul></div>`
|
|
155
|
+
+ `<form class="gc-cmp" data-gc-cmp><input name="v" inputmode="decimal" maxlength="24" autocomplete="off" placeholder="${esc('Your number for ' + (L && L.period ? L.period.replace(/^week of .*/, 'last week') : 'last week') + (value ? ', e.g. ' + value : ''))}" aria-label="Your number, to compare with mine" value="${esc(st.compare || '')}">`
|
|
156
|
+
+ `<button type="submit" class="cz-ib sm solid" aria-label="Compare with my number" title="Compare"${st.busy ? ' disabled' : ''}>${icon(I.chk, 18)}</button></form>`
|
|
157
|
+
+ (R ? `<p class="gc-line"><b>How often</b> ${esc([R.long, needOf(r)].filter(Boolean).join(' · '))}</p>` : '')
|
|
158
|
+
+ queryHtml(rc, true)
|
|
159
|
+
+ `<div class="gc-foot">${rc && rc.url ? `<a class="cz-ib sm" href="${esc(rc.url)}" target="_blank" rel="noopener noreferrer" aria-label="Open in ${esc(rc.connector || 'the source')}" title="Open in ${esc(rc.connector || 'the source')}">${icon(I.open)}</a>` : ''}`
|
|
160
|
+
+ ib({ act: 'edit', row: r.id, icon: I.pen, label: 'Edit how it is counted, the target or the source', title: 'Edit', busy: st.busy })
|
|
161
|
+
+ ib({ act: 'test', row: r.id, icon: I.redo, label: 'Read it now', title: 'Read now', busy: st.busy })
|
|
162
|
+
+ `<span class="gc-sp"></span>${ib({ act: 'keep', row: r.id, icon: I.chk, label: 'Keep', title: 'Keep', solid: true, busy: st.busy })}</div>`
|
|
163
|
+
+ `<p class="note gc-msg" role="status">${esc(st.msg || '')}</p>`;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/* ── first readings (GcJ2FirstMonday) ──────────────────────────────────────────────────────────────────────────────────────────── */
|
|
167
|
+
const SEEN_UNTIL = 3;
|
|
168
|
+
/** While a goal has fewer than 3 readings: how many, the first one (with its source and time) and when the next one comes. null from the 3rd. */
|
|
169
|
+
export function firstOf(g) {
|
|
170
|
+
const S = (g && g.series) || [], n = S.length;
|
|
171
|
+
// Only goals Claude reads on a rhythm; a goal read by hand keeps its line from the first reading.
|
|
172
|
+
if (!g || !n || n >= SEEN_UNTIL || !g.recipe) return null;
|
|
173
|
+
const last = g.lastRead || null, z = S[n - 1];
|
|
174
|
+
return { n, txt: (last && last.txt) || g.nowTxt || big(z.v), source: (last && last.source) || (g.recipe && g.recipe.connector) || '', at: (last && last.at) || z.at, next: g.nextRead || null };
|
|
175
|
+
}
|
|
176
|
+
/** The row's second line while the line is not drawn yet. */
|
|
177
|
+
export function firstMeta(g) {
|
|
178
|
+
const F = firstOf(g); if (!F) return '';
|
|
179
|
+
return [F.txt, [F.source, atTxt(F.at)].filter(Boolean).join(', '), 'pace known after 3 readings'].filter(Boolean).join(' · ');
|
|
180
|
+
}
|
|
181
|
+
/** Where the chart goes: "The line starts with the 2nd reading, Mon 9 Nov". */
|
|
182
|
+
export function firstChart(g) {
|
|
183
|
+
const F = firstOf(g); if (!F || F.n >= 2) return '';
|
|
184
|
+
return `<div class="gc-wait" role="note">The line starts with the 2nd reading${F.next ? ', ' + esc(dayTxt(F.next)) : ''}</div>`;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/* ── a key result's panel (GcR3Goal), and its failed (GcR4Failed) and held (GcR5Held) states ───────────────────────────────────────── */
|
|
188
|
+
/** "From Looker, chart “Checkout funnel”, every Monday 07:00. Last Mon 16 Nov, next Mon 23 Nov." The last read and the next one, said once. */
|
|
189
|
+
export function fromLine(g) {
|
|
190
|
+
const rc = g.recipe || null, R = rhythmOf(g), L = g.lastRead || null, F = g.failed || null, H = (g.held || [])[0] || null;
|
|
191
|
+
if (!rc || !rc.connector) return '';
|
|
192
|
+
const lastAt = [L && L.at, F && F.at, H && H.at].filter(Boolean).sort().pop() || (rc.last && rc.last.at) || null;
|
|
193
|
+
const last = lastAt ? 'Last ' + dayTxt(lastAt) + (H && H.at === lastAt ? ' (held)' : '') : '';
|
|
194
|
+
const next = g.nextRead ? 'next ' + dayTxt(g.nextRead) : '';
|
|
195
|
+
return `<p class="gc-fl">From <b>${esc(rc.connector)}</b>${rc.where ? ', ' + esc(rc.where) : ''}${R ? ', ' + esc(R.long) : ''}.${last || next ? ' ' + esc([last, next].filter(Boolean).join(', ')) + '.' : ''}</p>`;
|
|
196
|
+
}
|
|
197
|
+
/** The amber box of a read that failed: the time, the reason, and its one fix (reconnect the source, then Claude reads it at once). */
|
|
198
|
+
function failedHtml(g) {
|
|
199
|
+
const F = g.failed; if (!F) return '';
|
|
200
|
+
const fx = F.fix || {}, src = fx.connector || (g.recipe && g.recipe.connector) || 'the source';
|
|
201
|
+
return `<div class="gc-warnbox" data-gc-failed><b>${esc(atTxt(F.at) + ' · not read')}</b><p>${esc(F.why || 'The source did not answer.')} I did not guess a number.</p>`
|
|
202
|
+
+ `<div class="gc-fix"><b>Reconnect ${esc(src)}, then I read it at once</b>${ib({ act: 'reconnect', row: fx.row || '', icon: I.plug, label: 'Reconnect ' + src, title: 'Reconnect', solid: true })}</div></div>`;
|
|
203
|
+
}
|
|
204
|
+
/** The amber box of a held reading: the time, the value it read, why it was held, its checks, the drafted Jira ticket (✎, ✓ send it) and ✓✓ file it
|
|
205
|
+
* anyway. ticket: the drafted ticket row (okr-list.js draftsOf) when the goal's held reading names one. */
|
|
206
|
+
function heldHtml(g, ticket) {
|
|
207
|
+
const H = (g.held || [])[0]; if (!H) return '';
|
|
208
|
+
// say it once: a check whose words are already the why is not listed again
|
|
209
|
+
const checks = (H.checks || []).filter((c) => c && c.text && !String(H.why || '').includes(c.text));
|
|
210
|
+
const tk = ticket && ticket.state === 'open' ? `<div class="gc-fix"><b>I drafted a Jira ticket: “${esc((ticket.raw && ticket.raw.ticket && ticket.raw.ticket.title) || ticket.text)}”</b><span class="acts"><button type="button" class="cz-ib sm" data-okd="edit" data-row="${esc(ticket.id)}" aria-label="Edit the ticket" title="Edit">${icon(I.pen)}</button><button type="button" class="cz-ib sm solid" data-okd="keep" data-row="${esc(ticket.id)}" aria-label="Send the ticket to Jira" title="Send to Jira">${icon(I.chk, 18)}</button></span></div>` : '';
|
|
211
|
+
return `<div class="gc-warnbox" data-gc-held><b>${esc(dayTxt(H.at) + (H.txt || fin(H.value) ? ' · read ' + (H.txt || big(H.value)) : '') + ' · held')}</b>${H.why ? `<p>${esc(H.why)}</p>` : ''}`
|
|
212
|
+
+ (checks.length ? `<ul class="gc-checks">${checks.map(checkRow).join('')}</ul>` : '') + tk
|
|
213
|
+
+ `<div class="gc-file">${ib({ act: 'file-held', row: H.at, icon: I.checks, label: 'It is right: file it as a reading', title: 'File it' })}</div></div>`;
|
|
214
|
+
}
|
|
215
|
+
/** The key result's panel body above its chart: the failed or held box, How it is counted with its counts, From … (said once), Last read with its
|
|
216
|
+
* checks, and the query. o: { ticket: the held reading's drafted ticket row }. '' when the goal has none of these fields. */
|
|
217
|
+
export function krHtml(g, o = {}) {
|
|
218
|
+
const c = countsOf(g), L = g.lastRead || null, failed = !!g.failed;
|
|
219
|
+
const frac = fractionHtml(c, L || {}, failed);
|
|
220
|
+
const box = c && (c.what || frac) ? `<div class="gc-box"><span class="gc-k">How it is counted</span>${frac || `<p class="gc-what">${esc(c.what)}</p>`}${frac && c.what ? `<p class="note">${esc(c.what)}</p>` : ''}</div>` : '';
|
|
221
|
+
const checks = (g.checks || []).filter((x) => x && x.text);
|
|
222
|
+
// a goal read by hand says when in its head line already; the last read is said here only for a goal Claude reads
|
|
223
|
+
const last = L && g.recipe && !failed && !(g.held || []).length ? `<div class="gc-sec"><p class="gc-line"><b>Last read</b> ${esc(atTxt(L.at))}</p>${checks.length ? `<ul class="gc-checks">${checks.map(checkRow).join('')}</ul>` : ''}</div>` : '';
|
|
224
|
+
const out = failedHtml(g) + heldHtml(g, o.ticket) + box + fromLine(g) + last + (failed ? '' : queryHtml(g.recipe, true));
|
|
225
|
+
return out ? `<div class="gc-kr">${out}</div>` : '';
|
|
226
|
+
}
|
|
227
|
+
/** The big number of a goal whose last reading was not good: the last good one, and from when (GcR4Failed, GcR5Held). */
|
|
228
|
+
export function lastGoodSay(g) {
|
|
229
|
+
if (!(g.failed || (g.held || []).length)) return '';
|
|
230
|
+
const L = g.lastRead; return L && L.at ? (g.failed ? 'from ' + dayTxt(L.at) + ', the last good reading' : 'the last good reading, ' + dayTxt(L.at)) : '';
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/* ── the ✦ line ────────────────────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
234
|
+
/** The news a reading brings, before the ordinary line: a held reading, then a failed read, then the first readings. null when none applies. */
|
|
235
|
+
export function lineOf(goals, product) {
|
|
236
|
+
const G = (goals || []).filter(Boolean);
|
|
237
|
+
const held = G.filter((g) => (g.held || []).length);
|
|
238
|
+
if (held.length) {
|
|
239
|
+
const g = held[0], H = g.held[0], role = g.role === 'north-star' ? 'the North Star' : g.title;
|
|
240
|
+
return { head: 'I held back one reading of ' + role + '.', sub: (H.short || (H.why ? String(H.why).split('. ')[0] : 'It did not pass my checks')).replace(/\.?$/, '.') + ' Check it in the side panel.', tone: 'behind', goal: g.id };
|
|
241
|
+
}
|
|
242
|
+
const failed = G.filter((g) => g.failed);
|
|
243
|
+
if (failed.length) {
|
|
244
|
+
const g = failed[0], F = g.failed, src = (F.fix && F.fix.connector) || (g.recipe && g.recipe.connector) || 'The source';
|
|
245
|
+
const d = when(F.at);
|
|
246
|
+
return { head: 'I couldn’t read ' + g.title + (d ? ' on ' + WD[d.getDay()] : '') + '.', sub: String(F.short || F.why || src + ' did not answer').replace(/\.?$/, '.') + ' Reconnect it and I read it straight away.', tone: 'behind', goal: g.id };
|
|
247
|
+
}
|
|
248
|
+
const read = G.filter((g) => (g.series || []).length);
|
|
249
|
+
if (read.length && read.every((g) => g.series.length === 1)) {
|
|
250
|
+
const hourly = read.filter((g) => { const r = g.recipe; return r && r.cadence === 'hourly'; });
|
|
251
|
+
const next = read.map((g) => g.nextRead).filter(Boolean).sort().pop();
|
|
252
|
+
return { head: 'The first readings are in' + (read.length === G.length ? ', all ' + G.length + ' goals.' : ', ' + read.length + ' of ' + G.length + ' goals.'),
|
|
253
|
+
sub: 'One reading is a starting point, not a trend.' + (hourly.length ? ' ' + hourly[0].title + ' reads every hour, so its line starts today' + (next ? '; the others from ' + dayTxt(next) : '') + '.' : next ? ' The lines start with the 2nd reading, ' + dayTxt(next) + '.' : ''), tone: 'calm' };
|
|
254
|
+
}
|
|
255
|
+
return null;
|
|
256
|
+
}
|
|
257
|
+
/** A drafted-metrics ✦ line (GcJ1aTable): "I drafted a North Star, 3 inputs and 2 guardrails for pmos-idpf." */
|
|
258
|
+
export function draftsLine(rows, product) {
|
|
259
|
+
const R = (rows || []).filter((r) => r && r.kind === 'metric' && r.state === 'open'); if (!R.length) return null;
|
|
260
|
+
const n = (g) => R.filter((r) => r.group === g).length;
|
|
261
|
+
const parts = [n('North Star') ? 'a North Star' : '', n('Inputs') ? n('Inputs') + (n('Inputs') === 1 ? ' input' : ' inputs') : '', n('Guardrails') ? n('Guardrails') + (n('Guardrails') === 1 ? ' guardrail' : ' guardrails') : '', n('Key results') ? n('Key results') + (n('Key results') === 1 ? ' key result' : ' key results') : ''].filter(Boolean);
|
|
262
|
+
const list = parts.length > 1 ? parts.slice(0, -1).join(', ') + ' and ' + parts[parts.length - 1] : parts[0] || R.length + ' metrics';
|
|
263
|
+
return { head: 'I drafted ' + list + (product ? ' for ' + product : '') + '.', sub: 'Keep them and I read each one on its own rhythm, first reading within the hour. Tap a row to check it.', tone: 'drafts', keepAll: R.length > 1 ? R.length : 0 };
|
|
264
|
+
}
|
|
265
|
+
export { dotHtml };
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
* press (pmPost). Nothing here opens the old dialog or links to the console. */
|
|
17
17
|
import { mountNav } from './cozy-nav.js';
|
|
18
18
|
import { mountLivePill } from './cozy-live-pill.js';
|
|
19
|
+
import { mountPanels } from './cozy-panels.js';
|
|
19
20
|
import { ownTab, bring, tabUrl } from './rec-tab-core.js';
|
|
20
21
|
import * as VW from './cozy-viewer.js';
|
|
21
22
|
import * as SV from './small-vw.js'; // the small Viewers: a stakeholder, its form, a routine (batch 18 item 2-C)
|
|
@@ -304,8 +305,10 @@ function homeListHtml() {
|
|
|
304
305
|
const R = L.reviewModel(S.D, NOW());
|
|
305
306
|
// a group is open until the PM folds it; another product starts folded; "Not in an initiative" starts folded on a phone (HvAC, HvACDesk)
|
|
306
307
|
const pOpen = (g) => (g.key in S.pg ? !!S.pg[g.key] : g.kind === 'loose' ? !isPhone() : g.kind === 'program' || g.primary || M.products.length === 1);
|
|
308
|
+
const sel = S.sel || (S.ini && S.ini !== 'product' ? 'i:' + S.ini : null);
|
|
309
|
+
S.lo = { sel, ses: S.ses, restOpen: (k) => S.rest.has(k), pin: S.pin, phone: false }; // the folded rail's card draws Home's rows with these
|
|
307
310
|
return TD.listHtml(M, todayModel(), {
|
|
308
|
-
sel: S.
|
|
311
|
+
sel, selHead: S.head, ses: S.ses, pOpen, here: isPhone() ? null : TD.groupOfOpen(M, sel) || S.head, restOpen: (k) => S.rest.has(k), cap: S.cap, pin: S.pin, avHtml, ready: S.ready, err: S.D.err.length ? S.D.err[0] : '',
|
|
309
312
|
pick: S.D.pick, tones: pickTones(), review: R, mic: canDictate(), phone: isPhone(), day: S.day, news: S.news && S.news.ok ? S.news.count : 0, top: S.ready ? RECROW.html() + MEN.rowHtml(S.D, { sel: S.sel }) + (S.impact ? IMP.rowHtml(S.impact.c, { esc, sel: S.sel === 'impact' }) : '') : '',
|
|
310
313
|
imFace: IM.faceHtml(S.im, { joy: S.imJoy }),
|
|
311
314
|
});
|
|
@@ -467,7 +470,7 @@ function iniViewOf(id) {
|
|
|
467
470
|
const need = H.needsOf(S.D).find((r) => r.ini === id);
|
|
468
471
|
const p = programOf(S.D.programs || [], row.ws || (B.board || {}).ws || '', id);
|
|
469
472
|
return iniView(rowFor({ ...row, trail: t || row.trail || null }), { steps: B.steps || STEPS, today: B.today, usual: WFM.usualOf(S.D.trail, row),
|
|
470
|
-
ask: need ? { title: need.name, n: H.needsOf(S.D).filter((r) => r.ini === id).length } : null, program: p ? { id: p.id, title: p.title } : null,
|
|
473
|
+
ask: need ? { title: need.name, n: H.needsOf(S.D).filter((r) => r.ini === id).length } : null, program: p ? { id: p.id, title: p.title } : null, jiraReadAt: ((B.jira || {}).readAt) || '',
|
|
471
474
|
// the card (batch 18 item 1): Claude's line while a session works on it, the stakeholders
|
|
472
475
|
claude: (() => { const w = S.D.sessions.find((s) => H.iniOfSession(s) === id && s.shown === 'working'); return w ? 'I’m working on “' + H.nameOf(w) + '”. I’ll say here when it is ready.' : ''; })(),
|
|
473
476
|
people: (((S.D.desk && S.D.desk.stakeholders) || {})[id] || []) });
|
|
@@ -588,8 +591,41 @@ function drawList() {
|
|
|
588
591
|
if (PHC && PHC.el.parentNode === sc) PHC.el.remove();
|
|
589
592
|
document.body.classList.toggle('hm-folded', S.folded && !isPhone());
|
|
590
593
|
document.body.classList.toggle('hm-plist', isPhone() && !S.phoneChat); // a phone: the list is the page until a row opens its conversation (HmPhone)
|
|
594
|
+
drawRailCard();
|
|
591
595
|
drawRecTop();
|
|
592
596
|
}
|
|
597
|
+
/* ── the folded rail's card (batch 18 item 14, FlA1–FlA5) ──
|
|
598
|
+
* With the Viewer wide, Home's list folds to a rail of group tiles (cozy-viewer.js). A tile's press opens a card beside it with that group's
|
|
599
|
+
* rows, Home's own (iniHtml): a row opens as on Home and the card closes, the rail and the Viewer's width stay; the pill lists the sessions
|
|
600
|
+
* in place. A second press on the tile, ×, Escape or a press outside closes it. The card sits in the rail, inside #hmList, so the list's
|
|
601
|
+
* own presses work in it. S.rc: the group whose card is open. */
|
|
602
|
+
function drawRailCard() {
|
|
603
|
+
const bar = $('#hmList > .cz-vw-railbar');
|
|
604
|
+
if (!bar || isPhone() || !VW.railOn() || !S.M || !S.M.groups.some((g) => g.key === S.rc)) S.rc = null;
|
|
605
|
+
let card = bar && bar.querySelector(':scope > .hv-rc');
|
|
606
|
+
if (!S.rc) { if (card) card.remove(); VW.railSync(null); return; }
|
|
607
|
+
if (!card) { card = document.createElement('div'); card.className = 'hv-rc'; card.setAttribute('role', 'dialog'); card.setAttribute('data-esc-layer', ''); bar.append(card); }
|
|
608
|
+
const g = S.M.groups.find((x) => x.key === S.rc);
|
|
609
|
+
card.setAttribute('aria-label', g.name);
|
|
610
|
+
const html = TD.railCardHtml(S.M, S.rc, S.lo);
|
|
611
|
+
if (card.__h !== html) { card.__h = html; card.innerHTML = html; }
|
|
612
|
+
VW.railSync(S.rc);
|
|
613
|
+
// beside the tile, its top with the tile's, kept inside the window
|
|
614
|
+
const t = bar.querySelector(`[data-cz-vw-rail="${CSS.escape(S.rc)}"]`);
|
|
615
|
+
if (!t) return;
|
|
616
|
+
const r = t.getBoundingClientRect();
|
|
617
|
+
card.style.left = Math.round(r.right + 12) + 'px';
|
|
618
|
+
card.style.top = Math.round(Math.max(12, Math.min(r.top - 10, innerHeight - card.offsetHeight - 12))) + 'px';
|
|
619
|
+
}
|
|
620
|
+
function railCard(key, o = {}) {
|
|
621
|
+
const was = S.rc;
|
|
622
|
+
S.rc = key || null; S.ses = null;
|
|
623
|
+
drawList();
|
|
624
|
+
if (S.rc) { const f = $('#hmList .hv-rc .hv-rcb .hm-rm, #hmList .hv-rc .hv-rcb .hv-fold'); if (f && o.focus !== false) f.focus({ preventScroll: true }); return; }
|
|
625
|
+
const t = was && o.back && $(`#hmList [data-cz-vw-rail="${CSS.escape(was)}"]`); if (t) t.focus();
|
|
626
|
+
}
|
|
627
|
+
VW.railCard((key) => railCard(S.rc === key ? null : key, { back: true }));
|
|
628
|
+
document.addEventListener('cz:vw-rail', (e) => { if (!e.detail.on && S.rc) S.rc = null; });
|
|
593
629
|
/* A phone chat has no floating menu, so while a meeting records its pill sits in the top bar (XcbOptions B, case 7): a red dot and the
|
|
594
630
|
* clock (home-rec-row.js ticks every [data-hr-clock]); a press opens the live meeting in place. No recording: no pill. */
|
|
595
631
|
function drawRecTop() {
|
|
@@ -988,6 +1024,7 @@ async function goIni(id, o = {}) {
|
|
|
988
1024
|
openTarget(iniTarget(id));
|
|
989
1025
|
if (o.page !== false) { pushPage(); iniPage(); }
|
|
990
1026
|
syncUrl();
|
|
1027
|
+
if (window.czPanels) window.czPanels.scope(id); // the initiative reopens with its last panels and shares (batch 18 item 15)
|
|
991
1028
|
await loadIni();
|
|
992
1029
|
if (S.ini !== id) return;
|
|
993
1030
|
drawList(); openTarget(iniTarget(id));
|
|
@@ -1027,7 +1064,7 @@ function goProgram(id) {
|
|
|
1027
1064
|
pushPage();
|
|
1028
1065
|
programPanel().then(() => { if (S.head === 'g:' + id) document.dispatchEvent(new CustomEvent('bd:program', { detail: { id } })); }).catch(() => toast('The program could not open.'));
|
|
1029
1066
|
}
|
|
1030
|
-
function goHome() { S.ini = null; S.sel = null; S.IM = null; S.head = null; S.phoneChat = false; syncUrl(); drawList(); openTarget(homeTarget()); }
|
|
1067
|
+
function goHome() { S.ini = null; S.sel = null; S.IM = null; S.head = null; S.phoneChat = false; syncUrl(); drawList(); openTarget(homeTarget()); if (window.czPanels) window.czPanels.scope(null); }
|
|
1031
1068
|
/* The browser's Back closes the page a name opened (HbC). The Viewer keeps the one trail and its history entries (batch 14 item 7): Back
|
|
1032
1069
|
* at the trail's first item closes it, and Home is then as it was. Close (×, Escape) takes the entries off and keeps the initiative's chat. */
|
|
1033
1070
|
let paged = false;
|
|
@@ -1683,11 +1720,14 @@ $('#hmDesk').onclick = (e) => { if (S.sheet && e.target === $('#hmDesk')) sheet(
|
|
|
1683
1720
|
$('#hmList').onclick = (e) => { // delegated: every press on the list is a <button>
|
|
1684
1721
|
const b = e.target.closest('button'); if (!b) return;
|
|
1685
1722
|
const d = b.dataset;
|
|
1723
|
+
if ('hmRcx' in d) { railCard(null, { back: true }); return; } // × on the folded rail's card
|
|
1724
|
+
// a pick in the rail's card: the card closes, the rail stays folded and the Viewer as wide (FlA4After)
|
|
1725
|
+
if (S.rc && b.closest('.hv-rc') && (d.hmSel || d.hmProg || d.hmProdopen || d.hmSesnew)) { S.rc = null; S.ses = null; VW.keepWide(); }
|
|
1686
1726
|
if (d.hmSes) { sesPill(d.hmSes === S.ses ? null : d.hmSes); return; } // an initiative's pill: what sits in it, under it (a sheet on a phone)
|
|
1687
1727
|
if ('hmSesx' in d) { sesPill(null); return; }
|
|
1688
1728
|
if (d.hmSesnew) { sesPill(null, false); newIn(d.hmSesnew); return; }
|
|
1689
1729
|
if (d.hmCompact) { compact(d.hmCompact); return; } // ✓ on Claude's ✦ Compact (batch 13 item 8): the pill's list stays open
|
|
1690
|
-
if (S.ses && !b.closest('.hv-spp, .hv-sps')) sesPill(null, false); // a press anywhere else in the list closes it
|
|
1730
|
+
if (S.ses && !b.closest('.hv-spp, .hv-sps, .hv-rcs')) sesPill(null, false); // a press anywhere else in the list closes it
|
|
1691
1731
|
if (d.hmSel) { if (S.ses) sesPill(null, false); if (S.day) S.day = false; select(d.hmSel); return; }
|
|
1692
1732
|
if ('hrImpact' in d) { if (S.day) S.day = false; S.sel = 'impact'; if (isPhone()) S.phoneChat = true; openTarget(homeTarget()); drawList(); return; } // Your impact: Home's own chat, on the weekly check
|
|
1693
1733
|
if ('hrMentions' in d) { if (S.day) S.day = false; S.sel = 'mentions'; drawList(); MEN.openMentions(menCtx()); return; }
|
|
@@ -1716,7 +1756,9 @@ $('#hmList').onclick = (e) => { // delegated: every press on the list is a <bu
|
|
|
1716
1756
|
if (d.hmGroup) { if (S.shut.has(d.hmGroup)) S.shut.delete(d.hmGroup); else S.shut.add(d.hmGroup); store.set('pmos.home.shut', JSON.stringify([...S.shut])); drawList(); return; }
|
|
1717
1757
|
if ('hmAllneeds' in d) { S.allNeeds = !S.allNeeds; drawList(); return; }
|
|
1718
1758
|
if ('hmNew' in d) { menu(b, newItems(), 'New'); return; }
|
|
1719
|
-
|
|
1759
|
+
// the list header's fold (batch 18 item 15): with a Viewer open the list folds to the rail and the Viewer takes the room; with none, the
|
|
1760
|
+
// list folds away and the button at the top left brings it back
|
|
1761
|
+
if ('hmFold' in d) { if (VW.isOpen()) { VW.wide(true); return; } S.folded = true; store.set('pmos.home.fold', '1'); drawList(); return; }
|
|
1720
1762
|
if ('hmMeet' in d) { const m = H.meetLineOf(S.D.today); if (m) openMeeting(m.meeting); return; }
|
|
1721
1763
|
if ('hmCal' in d) { openCalendar(); return; }
|
|
1722
1764
|
if ('hmRec' in d) { MORE.openRecorder().then(() => drawList()); return; }
|
|
@@ -1737,13 +1779,23 @@ function sesPill(id, back = true) {
|
|
|
1737
1779
|
const was = S.ses;
|
|
1738
1780
|
S.ses = id || null;
|
|
1739
1781
|
drawList();
|
|
1740
|
-
const f = id ? $('#hmList .hv-spp .hm-rm, #hmList .hv-sps .hm-rm') : back && was ? $(`#hmList [data-hm-ses="${CSS.escape(was)}"]`) : null;
|
|
1782
|
+
const f = id ? $('#hmList .hv-spp .hm-rm, #hmList .hv-sps .hm-rm, #hmList .hv-rcs .hm-rm') : back && was ? $(`#hmList [data-hm-ses="${CSS.escape(was)}"]`) : null;
|
|
1741
1783
|
if (f) f.focus();
|
|
1742
1784
|
}
|
|
1743
1785
|
// Escape closes it wherever the focus is (a redraw of the list can drop the focus to the page); a press outside the list closes it too
|
|
1744
1786
|
window.addEventListener('keydown', (e) => { if (e.key === 'Escape' && S.ses && menuEl.hidden) { e.preventDefault(); e.stopPropagation(); sesPill(null); } }, true); // before the Viewer's own Escape
|
|
1745
1787
|
// a press outside the list (the chat, the Viewer) closes an open pill list too
|
|
1746
1788
|
document.addEventListener('pointerdown', (e) => { if (S.ses && !e.target.closest('#hmList')) sesPill(null, false); });
|
|
1789
|
+
// the rail's card: Escape closes it (after an open pill list) and gives the focus back to its tile; a press outside it closes it
|
|
1790
|
+
window.addEventListener('keydown', (e) => { if (e.key === 'Escape' && S.rc && !e.defaultPrevented && menuEl.hidden) { e.preventDefault(); e.stopPropagation(); railCard(null, { back: true }); } }, true);
|
|
1791
|
+
document.addEventListener('pointerdown', (e) => { if (S.rc && !e.target.closest('.hv-rc, .cz-vw-railtile')) railCard(null); });
|
|
1792
|
+
// arrows move between the card's rows
|
|
1793
|
+
$('#hmList').addEventListener('keydown', (e) => {
|
|
1794
|
+
if ((e.key !== 'ArrowDown' && e.key !== 'ArrowUp') || !e.target.closest('.hv-rc')) return;
|
|
1795
|
+
const all = [...document.querySelectorAll('#hmList .hv-rc .hv-rcb .hm-rm, #hmList .hv-rc .hv-rcb .hv-fold, #hmList .hv-rc .hv-rcb [data-hm-sesnew]')];
|
|
1796
|
+
const i = all.indexOf(e.target.closest('button')); if (!all.length) return;
|
|
1797
|
+
e.preventDefault(); all[Math.max(0, Math.min(all.length - 1, i < 0 ? 0 : i + (e.key === 'ArrowDown' ? 1 : -1)))].focus();
|
|
1798
|
+
});
|
|
1747
1799
|
$('#hmList').addEventListener('submit', async (e) => { // the capture box: Enter adds the task
|
|
1748
1800
|
if (e.target.id !== 'hmCapF') return;
|
|
1749
1801
|
e.preventDefault();
|
|
@@ -1825,14 +1877,21 @@ PO.mount({ programs: () => S.D.programs || [], stateOf: (p) => (((S.M && S.M.gro
|
|
|
1825
1877
|
SO.mount({ redraw: () => { S.D.order = SO.layout(); drawList(); }, say: (m, undo) => (undo ? toastUndo(m, undo) : toast(m)) });
|
|
1826
1878
|
mountNav('home', document, { here: () => { if (VW.isOpen()) VW.close(); goHome(); } });
|
|
1827
1879
|
// the Live pill (batch 6 item 2): on Home a row opens in place, the session's chat (with its Viewer page) or the meeting; the open one is tinted
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1880
|
+
const liveGo = (x) => {
|
|
1881
|
+
if (x.kind === 'rec') { const id = /[?&]meeting=([^&]+)/.exec(x.href || ''); if (!id) return false; openMeeting({ note: decodeURIComponent(id[1]) }); return true; }
|
|
1882
|
+
const s = x.sid && S.D.sessions.find((y) => y.id === x.sid); if (!s) return false;
|
|
1883
|
+
if (VW.isOpen() && isPhone()) VW.close();
|
|
1884
|
+
S.sel = 's:' + s.id; S.phoneChat = isPhone(); openTarget(sessionTarget(s)); followViewer(s); drawList(); syncUrl();
|
|
1885
|
+
return true;
|
|
1886
|
+
};
|
|
1887
|
+
mountLivePill(document, { open: () => (S.cur && S.cur.ses) || null, go: liveGo });
|
|
1888
|
+
/* The panels (batch 18 item 15, canvas TbT1Split…TbT9Divider): the chat and up to 3 Viewers side by side, the divider, open beside, ⧉, slide
|
|
1889
|
+
* over. A Live pill row opens in the chat (liveGo); a remembered Viewer of an initiative opens again here when Home has a view for it. */
|
|
1890
|
+
mountPanels({
|
|
1891
|
+
go: liveGo,
|
|
1892
|
+
reopen: (it) => {
|
|
1893
|
+
if (/^file:[\w./-]+\.\w+$/.test(it.id || '')) { openFile({ path: it.id.slice(5), name: it.title || '' }); return true; }
|
|
1894
|
+
return false;
|
|
1836
1895
|
},
|
|
1837
1896
|
});
|
|
1838
1897
|
PHC = mountPhoneCard({ pmGet, pmPost, toast, ws: () => WS || null, openMeeting: (m) => openMeeting(m), skip: ['meeting'] }); drawList();
|
|
@@ -282,13 +282,19 @@ function wirePage(b, id) {
|
|
|
282
282
|
addCancel: () => { ADDING = null; ADD_DATES = null; redrawView(); },
|
|
283
283
|
// the stage card's ⏸ or calendar on a hold (batch 11 item 21): what the hold says, and its return date set or changed here
|
|
284
284
|
hold: (i, btn) => holdPop(btn, id),
|
|
285
|
-
|
|
285
|
+
// opt (batch 18 item 16): the + on a stage: the task goes under that stage, with the dates its field picked; the toast offers Undo
|
|
286
|
+
addTask: async (title, inp, opt) => {
|
|
286
287
|
const M = curM(); if (!M) return;
|
|
287
288
|
inp.disabled = true;
|
|
288
|
-
const
|
|
289
|
+
const D = opt ? opt : ADD_DATES || {};
|
|
290
|
+
const r = await C.pmPost('/api/boards/tasks/add', { ...bw(M), initiative: id, title, ...(D.start ? { start: D.start } : {}), ...(D.due ? { due: D.due } : {}), ...(opt && opt.section != null ? { section: opt.section } : {}) });
|
|
289
291
|
inp.disabled = false;
|
|
290
292
|
if (!r || r.ok === false) { say((r && r.error) || 'The task was not added.'); return; }
|
|
291
|
-
|
|
293
|
+
const uid = r.item && r.item.uid;
|
|
294
|
+
if (opt && uid) undoToast('Added to ' + (opt.name || 'the stage') + '.', async () => { const u = await C.pmPost('/api/boards/tasks/delete', { ...bw(M), task: uid, why: 'undo of add' }); if (!u || u.ok === false) C.toast((u && u.error) || 'The undo did not land.'); await C.load(); redrawView(); });
|
|
295
|
+
else say('Task added.');
|
|
296
|
+
await C.load(); redrawView();
|
|
297
|
+
if (opt) return;
|
|
292
298
|
const n = BODY && BODY.querySelector('#ivAddTask'); if (n) { n.value = ''; n.focus(); }
|
|
293
299
|
},
|
|
294
300
|
next: (btn) => { const M = curM(); if (M) popNext(btn, id, M); },
|