create-pmos 0.402.0 → 0.404.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 -30
- package/payload/AGENTS.md +2 -0
- package/payload/KIT-VERSION +1 -1
- package/payload/mods/pmos-cockpit/hooks/lib/session-facts.mjs +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/board-programs-test.js +32 -5
- package/workspace/briefing-premium-adddoc-test.js +28 -22
- package/workspace/briefing-premium-board-test.js +91 -73
- package/workspace/briefing-premium-calendar-2-test.js +23 -10
- package/workspace/briefing-premium-calendar-3-test.js +23 -19
- package/workspace/briefing-premium-calendar-test.js +19 -17
- package/workspace/briefing-premium-initiative-test.js +25 -12
- package/workspace/briefing-premium-insights-test.js +31 -18
- package/workspace/briefing-premium-metrics-test.js +8 -8
- package/workspace/briefing-premium-test.js +4 -3
- package/workspace/changelog.json +24 -0
- package/workspace/fixtures/premium-viewer-fixtures.js +24 -2
- package/workspace/guide/jira.md +38 -6
- package/workspace/guide/programs.md +2 -0
- package/workspace/home-rows-test.js +184 -0
- package/workspace/lib/briefing-premium-agent.js +3 -0
- package/workspace/lib/calendar-layers.js +8 -4
- package/workspace/lib/initiative-layout.js +4 -3
- package/workspace/lib/jira-cli.js +17 -12
- package/workspace/lib/jira-status.js +1 -1
- package/workspace/lib/jira-tickets.js +126 -24
- package/workspace/lib/meeting-files.js +58 -0
- package/workspace/lib/meeting-learn.js +139 -0
- package/workspace/lib/meeting-material.js +12 -5
- package/workspace/lib/notes.js +3 -0
- package/workspace/lib/program-chat.js +32 -0
- package/workspace/lib/routes-brief-page.js +8 -1
- package/workspace/lib/routes-calendar-views.js +24 -3
- package/workspace/lib/routes-meeting-material.js +38 -0
- package/workspace/lib/routes-meeting-points.js +23 -3
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-board-actions-test.js +30 -24
- package/workspace/premium-chat-context-test.js +1 -1
- package/workspace/premium-chat-goal-view-test.js +1 -1
- package/workspace/premium-chat-viewer-test.js +1 -1
- package/workspace/premium-core-doc-issue-test.js +13 -7
- package/workspace/premium-discuss-landing-test.js +83 -0
- package/workspace/premium-link-suggest-test.js +103 -0
- package/workspace/premium-report-read-test.js +86 -82
- package/workspace/premium-vw-backlog-test.js +6 -5
- package/workspace/premium-vw-cal-test.js +46 -23
- package/workspace/premium-vw-item-test.js +8 -6
- package/workspace/premium-vw-jira-test.js +3 -2
- package/workspace/premium-vw-meet-test.js +122 -66
- package/workspace/premium-vw-notes-test.js +7 -6
- package/workspace/premium-vw-rec-test.js +14 -13
- package/workspace/premium-vw-slides-test.js +11 -5
- package/workspace/program-panel-test.js +64 -55
- package/workspace/public/pm/bd-acts.js +1 -1
- package/workspace/public/pm/bd-asks.js +22 -7
- package/workspace/public/pm/bd-ini-panel.js +232 -0
- package/workspace/public/pm/bd-pop.js +2 -2
- package/workspace/public/pm/bd-prog-panel.js +176 -191
- package/workspace/public/pm/cozy-board.css +5 -28
- package/workspace/public/pm/cozy-evui.js +4 -2
- package/workspace/public/pm/cozy-home-rows.css +54 -0
- package/workspace/public/pm/cozy-home.css +9 -0
- package/workspace/public/pm/cozy-insights.css +1 -2
- package/workspace/public/pm/cozy-mtg-present.css +160 -0
- package/workspace/public/pm/cozy-panel.css +11 -34
- package/workspace/public/pm/cozy-rec-pill.css +12 -0
- package/workspace/public/pm/cozy-rec-pill.js +46 -0
- package/workspace/public/pm/cozy-viewer.js +307 -43
- package/workspace/public/pm/cozy-vw-mtg.css +96 -94
- package/workspace/public/pm/cozy-vw-rp.css +40 -25
- package/workspace/public/pm/cozy-vw-shell.css +127 -0
- package/workspace/public/pm/cozy-xv.css +51 -0
- package/workspace/public/pm/cozy-xv.js +34 -0
- package/workspace/public/pm/goal-chat.js +1 -1
- package/workspace/public/pm/home-app.js +122 -58
- package/workspace/public/pm/home-chat.js +11 -2
- package/workspace/public/pm/home-day.js +64 -0
- package/workspace/public/pm/home-ini-model.js +1 -1
- package/workspace/public/pm/home-ini.js +197 -54
- package/workspace/public/pm/home-list.js +6 -14
- package/workspace/public/pm/home-mentions.js +187 -0
- package/workspace/public/pm/home-rec-row.js +67 -0
- package/workspace/public/pm/home-review.js +20 -10
- package/workspace/public/pm/home-task.js +19 -18
- package/workspace/public/pm/home-today.js +3 -3
- package/workspace/public/pm/premium-board.js +83 -235
- package/workspace/public/pm/premium-insights.js +118 -82
- package/workspace/public/pm/premium-mtg-present.js +408 -100
- package/workspace/public/pm/premium-mtg-replay.js +70 -10
- package/workspace/public/pm/premium-report-read.js +118 -63
- package/workspace/public/pm/premium-vw-cal.js +62 -34
- package/workspace/public/pm/premium-vw-mtg.js +348 -192
- package/workspace/public/pm/rec-state.js +63 -0
- package/workspace/public/pm/rp-parts.js +33 -8
- package/workspace/public/pm/tk-draft.js +107 -0
- package/workspace/public/pm/tk-model.js +134 -0
- package/workspace/public/pm/tk-send.js +124 -0
- package/workspace/public/pm/tk-tasks.css +120 -0
- package/workspace/public/premium-board.html +0 -1
- package/workspace/server.js +4 -2
- package/workspace/skills/jira-push.skill +3 -3
- package/workspace/test-lists/prd-to-jira.json +6 -0
- package/workspace/test-lists/program-chat.json +6 -0
- package/workspace/test-lists/viewer-home-rows.json +9 -0
- package/workspace/test-lists/viewer-meetings.json +9 -0
- package/workspace/test-lists/viewer-shell-a.json +15 -0
- package/workspace/tk-tasks-test.js +199 -0
|
@@ -11,8 +11,15 @@
|
|
|
11
11
|
* milestone (Deliver, Evaluate), and says so in a toast with Undo; Undo moves it back and keeps it from moving out of that stage by itself again.
|
|
12
12
|
* Tasks (InTasks): grouped by stage, by groups the PM names (drag a task between them; group sets are saved for the workspace), by owner, by status
|
|
13
13
|
* or not at all. Core documents (InDocs): the list column shows only the documents that need a look; the Viewer lists them all with their details.
|
|
14
|
-
* Every write is the PM's press, file mode only: /api/boards/move, /api/boards/tasks/*, /api/lifecycle, /api/core-docs/draft, /api/initiative-layout.
|
|
14
|
+
* Every write is the PM's press, file mode only: /api/boards/move, /api/boards/tasks/*, /api/lifecycle, /api/core-docs/draft, /api/initiative-layout.
|
|
15
|
+
*
|
|
16
|
+
* PRD to Jira (kit 2, T1 to T3; canvas PgTkList, PgTkSent, XvATasks): Tasks group by Epic too, the default once the PRD's stories have
|
|
17
|
+
* drafted tickets (GET /api/jira/tickets). Each epic group lists its tasks, the drafted Jira tickets; its send icon opens the Send sheet
|
|
18
|
+
* (tk-send.js), and a task opens its drafted ticket (tk-draft.js) or, once in Jira, the ticket's Jira view. The PM's own tasks follow
|
|
19
|
+
* under "Your tasks". In shell A the summary card comes first and the group picker, Documents, Stage, the record and the sprint sit
|
|
20
|
+
* under ⋯; the phone keeps the Tasks | Documents | Stage switch. The pure half of the tickets is tk-model.js. */
|
|
15
21
|
import * as MD from './home-ini-model.js';
|
|
22
|
+
import * as TKM from './tk-model.js';
|
|
16
23
|
|
|
17
24
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
18
25
|
const SVG = (d, w = 16, sw = 1.8) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${sw}" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
|
|
@@ -22,7 +29,8 @@ const I = {
|
|
|
22
29
|
};
|
|
23
30
|
const PHONE = 760;
|
|
24
31
|
const isPhone = () => innerWidth <= PHONE;
|
|
25
|
-
const X = { ctx: null, L: new Map(), reading: new Set(), tried: new Set(), view: 'tasks', doc: { by: 'stage', filter: 'all', more: new Set() }, shut: new Set(), pop: null, toastT: 0, addTo: ''
|
|
32
|
+
const X = { ctx: null, L: new Map(), reading: new Set(), tried: new Set(), view: 'tasks', doc: { by: 'stage', filter: 'all', more: new Set() }, shut: new Set(), pop: null, toastT: 0, addTo: '',
|
|
33
|
+
T: new Map(), tReading: new Set(), fold: new Map(), more: new Set() };
|
|
26
34
|
|
|
27
35
|
/* ── reading the layout record ── */
|
|
28
36
|
const curM = () => { const S = X.ctx && X.ctx.S; return S && S.ini && S.ini !== 'product' && S.IMid === S.ini ? S.IM : null; };
|
|
@@ -37,6 +45,18 @@ async function readL(id, M, force) {
|
|
|
37
45
|
X.ctx.drawList(); redrawView();
|
|
38
46
|
}
|
|
39
47
|
const Lof = (id) => X.L.get(id) || { auto: true, held: [], by: 'stage', names: [], of: {}, stage: {}, sets: [], read: false };
|
|
48
|
+
/* ── the drafted Jira tickets (T1) ── */
|
|
49
|
+
async function readT(id, M, force) {
|
|
50
|
+
if (!force && (X.T.has(id) || X.tReading.has(id))) return;
|
|
51
|
+
X.tReading.add(id);
|
|
52
|
+
const r = await X.ctx.pmGet('/api/jira/tickets?initiative=' + encodeURIComponent(id) + (wsOf(M) ? '&ws=' + encodeURIComponent(wsOf(M)) : ''));
|
|
53
|
+
X.tReading.delete(id);
|
|
54
|
+
X.T.set(id, r && r.ok === true ? r : { ok: false, error: (r && r.error) || 'The tickets could not be read.' });
|
|
55
|
+
redrawView();
|
|
56
|
+
}
|
|
57
|
+
const Tof = (id) => X.T.get(id) || null;
|
|
58
|
+
/** The grouping: the PM's choice; until the PM chooses, Epic once tickets are drafted. */
|
|
59
|
+
const byOf = (L, T) => (L.picked ? L.by : T && T.ok && T.drafted ? 'epic' : L.by) || 'stage';
|
|
40
60
|
async function press(id, M, body) {
|
|
41
61
|
const r = await X.ctx.pmPost('/api/initiative-layout', { ws: wsOf(M), initiative: id, ...body });
|
|
42
62
|
if (r && r.ok) { X.L.set(id, { ...r, read: true }); X.ctx.drawList(); redrawView(); return true; }
|
|
@@ -155,8 +175,8 @@ function menu(anchor, items, label) {
|
|
|
155
175
|
: `<button type="button" class="hi-mi${x.on ? ' on' : ''}" role="${x.radio ? 'menuitemradio' : 'menuitem'}"${x.radio ? ` aria-checked="${!!x.on}"` : ''} data-hi-mi="${i}"${x.disabled ? ' disabled' : ''}>${x.icon ? SVG(x.icon, 16) : ''}<span>${esc(x.label)}</span>${x.sub ? `<em>${esc(x.sub)}</em>` : ''}</button>`)).join(''),
|
|
156
176
|
(b) => { const it = items[+b.dataset.hiMi]; closePop(); if (it && it.go) it.go(anchor); }, { menu: true, label });
|
|
157
177
|
}
|
|
158
|
-
function ask(anchor, label, value, go) { // one line of words, inline (no browser prompt)
|
|
159
|
-
openPop(anchor, 'ask', `<label class="hi-field"><span>${esc(label)}</span><input id="hiAsk" maxlength="40" autocomplete="off" value="${esc(value || '')}"></label><div class="hi-acts"><button type="button" class="hi-btn dark" data-hi-go>Save</button><button type="button" class="hi-btn ghost" data-hi-x>Cancel</button></div>`,
|
|
178
|
+
function ask(anchor, label, value, go, o = {}) { // one line of words, inline (no browser prompt)
|
|
179
|
+
openPop(anchor, 'ask', `<label class="hi-field"><span>${esc(label)}</span><input id="hiAsk" maxlength="${o.max || 40}" autocomplete="off" value="${esc(value || '')}"></label><div class="hi-acts"><button type="button" class="hi-btn dark" data-hi-go>Save</button><button type="button" class="hi-btn ghost" data-hi-x>Cancel</button></div>`,
|
|
160
180
|
(b, el) => { if ('hiX' in b.dataset) { closePop(); return; } if ('hiGo' in b.dataset) { const v = el.querySelector('#hiAsk').value.trim(); if (!v) return; closePop(); go(v); } }, { label });
|
|
161
181
|
const i = X.pop.el.querySelector('#hiAsk');
|
|
162
182
|
i.addEventListener('keydown', (e) => { if (e.key === 'Enter') { e.preventDefault(); const v = i.value.trim(); if (v) { closePop(); go(v); } } });
|
|
@@ -226,52 +246,103 @@ function taskRowHtml(t, mine, stages) {
|
|
|
226
246
|
+ pill + (t.av ? `<span class="hi-av" title="${esc(t.owner)}">${esc(t.av)}</span>` : '') + `<span class="hi-due${t.late ? ' late' : ''}">${esc(t.due || (t.req ? 'PRD' : t.state === 'In progress' ? 'running' : ''))}</span>`
|
|
227
247
|
+ `<button type="button" class="hi-ib sm" data-hi-tmore="${esc(t.key)}" aria-haspopup="menu" aria-label="More for ${esc(t.title)}">${SVG(I.more, 14, 3)}</button></div>`;
|
|
228
248
|
}
|
|
249
|
+
/* ── the epic groups (T1) and shell A's summary card (XvATasks) ── */
|
|
250
|
+
const TI = { send: 'M4 12l16-8-6 16-3-7z' };
|
|
251
|
+
const plural = (n, one, many) => n + ' ' + (n === 1 ? one : many);
|
|
252
|
+
const foldOpen = (key, dflt) => (X.fold.has(key) ? X.fold.get(key) : dflt);
|
|
253
|
+
/** A group header: the name, an optional send icon, the count and the fold chevron (PgTkList .gh). */
|
|
254
|
+
function headHtml(key, title, n, open, send = '') {
|
|
255
|
+
return `<div class="tk-gh${send ? ' s' : ''}"><button type="button" class="tk-ghb" data-tk-gfold="${esc(key)}" aria-expanded="${open}"><b>${esc(title)}</b><span class="tk-ghr"><span class="tk-gn">${n}</span>${SVG(open ? I.down : I.right, 16, 2)}</span></button>${send}</div>`;
|
|
256
|
+
}
|
|
257
|
+
function tkRowHtml(r) {
|
|
258
|
+
const ck = r.inJira ? `<span class="tk-ck" role="img" aria-label="In Jira: ${esc(r.status)}"><i class="tk-sq ${esc(r.cat)}"></i></span>` : '<span class="tk-ck" aria-hidden="true"></span>';
|
|
259
|
+
const mark = r.mark ? `<span class="tk-mk ${esc(r.mark[0])}" role="img" aria-label="${esc(r.mark[1])}" title="${esc(r.mark[1])}"></span>` : '';
|
|
260
|
+
return `<button type="button" class="tk-row" data-tk-open="${esc(r.id)}">${ck}<span class="tk-t"><b>${esc(r.title)}</b>${r.sub ? `<span>${esc(r.sub)}</span>` : ''}</span>${mark}${r.av ? `<span class="tk-av" role="img" aria-label="Assigned to ${esc(r.who)}" title="${esc(r.who)}">${esc(r.av)}</span>` : ''}</button>`;
|
|
261
|
+
}
|
|
262
|
+
function epicGroupsHtml(id, M, T) {
|
|
263
|
+
if (!T) return '<p class="hi-small" role="status">Reading the tickets.</p>';
|
|
264
|
+
if (!T.ok) return `<p class="hi-empty">${esc(T.error)}</p>`;
|
|
265
|
+
if (!T.drafted) return T.items
|
|
266
|
+
? `<div class="tk-card tk-empty"><p>The PRD lists ${plural(T.items, 'story', 'stories')}. Each one becomes a task with its Jira ticket drafted in your template. Nothing goes to Jira until you send it.</p><button type="button" class="hi-btn sm dark" data-tk-drafts>Draft the tickets</button></div>`
|
|
267
|
+
: '<p class="hi-empty">The PRD lists no user stories yet. Give it a "User stories" section, one subheading per story, and each one becomes a task here.</p>';
|
|
268
|
+
const out = TKM.ticketGroups(T).map((g) => {
|
|
269
|
+
const key = 'ep:' + id + ':' + g.id, open = foldOpen(key, true);
|
|
270
|
+
const shown = X.more.has(key) || g.rows.length <= 4 ? g.rows : g.rows.slice(0, 3);
|
|
271
|
+
const send = g.send && !T.pushing ? `<button type="button" class="tk-snd" data-tk-sendg="${esc(g.id)}" aria-label="Send ${esc(g.name)} to Jira" title="Send to Jira">${SVG(TI.send, 17)}</button>` : '';
|
|
272
|
+
return `<section class="tk-g" aria-label="${esc(g.name)}">${headHtml(key, g.name, g.n, open, send)}`
|
|
273
|
+
+ (open ? `<div class="tk-list">${shown.map(tkRowHtml).join('')}${shown.length < g.rows.length ? `<button type="button" class="tk-fold" data-tk-more="${esc(key)}">${g.rows.length - shown.length} more${SVG(I.down, 16, 2)}</button>` : ''}</div>` : '') + '</section>';
|
|
274
|
+
}).join('');
|
|
275
|
+
return out + (T.inJira && T.checkedAt ? `<p class="tk-read">${esc(TKM.readLine(T.checkedAt))}</p>` : '');
|
|
276
|
+
}
|
|
277
|
+
/** The summary card (shell A, desktop): what waits on the PM in the tasks, with one primary. Zero is silence. */
|
|
278
|
+
function summaryHtml(id, M, rows, T, by) {
|
|
279
|
+
const VW = X.ctx.VW;
|
|
280
|
+
if (isPhone() || !VW.czSummary) return '';
|
|
281
|
+
const open = rows.filter((r) => !r.done && !r.req).length;
|
|
282
|
+
const meta = [open ? open + ' open' : '', 'grouped by ' + MD.BY_LABEL[by].toLowerCase()].filter(Boolean).join(' · ');
|
|
283
|
+
const G = T && T.ok ? TKM.ticketGroups(T) : [];
|
|
284
|
+
const send = G.reduce((a, g) => a + g.send, 0);
|
|
285
|
+
if (T && T.ok && T.pushing) return VW.czSummary({ line: 'Sending to Jira', tone: 'live', text: 'Claude is creating the tickets with your Atlassian connection. Each task shows its Jira key when it is done.', meta });
|
|
286
|
+
if (send) return VW.czSummary({ line: plural(send, 'ticket is', 'tickets are') + ' drafted, not in Jira', tone: 'you', text: 'Each PRD story is a task with its Jira ticket drafted. Nothing reaches Jira until you send it.', meta, primary: { label: 'Send to Jira', act: 'tk-sendall' } });
|
|
287
|
+
const week = Date.now() + 7 * 864e5;
|
|
288
|
+
const due = rows.filter((r) => !r.done && !r.req && r.end && Date.parse(r.end) <= week).sort((a, b) => a.end.localeCompare(b.end));
|
|
289
|
+
if (!due.length) return VW.czSummary({ meta });
|
|
290
|
+
const words = due.slice(0, 2).map((r) => r.title + (r.due ? ' ' + (/^(today|tomorrow|yesterday)$/.test(r.due) ? r.due : 'by ' + r.due) : ''));
|
|
291
|
+
return VW.czSummary({ line: plural(due.length, 'is', 'are') + ' due this week', tone: due.some((r) => r.late) ? 'warn' : 'you', text: words.join(', and ') + '.', meta,
|
|
292
|
+
primary: { label: 'Open ' + (due[0].title.length > 36 ? due[0].title.slice(0, 35) + '…' : due[0].title), act: 'tk-openfirst' } });
|
|
293
|
+
}
|
|
229
294
|
function tasksView(id, M) {
|
|
230
|
-
const L = Lof(id),
|
|
231
|
-
|
|
295
|
+
const L = Lof(id), T = Tof(id), by = byOf(L, T), rows = MD.taskRows(M, L), stages = (M.acts && M.acts.stages) || [];
|
|
296
|
+
if (!T) readT(id, M);
|
|
232
297
|
const mine = by === 'mine';
|
|
233
298
|
const target = mine ? (L.names.includes(X.addTo) ? X.addTo : L.names[0] || '') : by === 'stage' ? M.acts.stage || '' : '';
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
299
|
+
let groups;
|
|
300
|
+
if (by === 'epic') {
|
|
301
|
+
// the PM's own tasks: the PRD stories are tasks of their epics once drafted, and a Jira row of a pushed ticket is that task
|
|
302
|
+
const keys = new Set(((T && T.ok && T.tickets) || []).map((t) => t.key).filter(Boolean));
|
|
303
|
+
const own = rows.filter((r) => !(T && T.ok && T.drafted && r.req) && !(r.jira && keys.has(r.ref)));
|
|
304
|
+
const k2 = 'ep:' + id + ':mine', open2 = foldOpen(k2, false), n2 = own.filter((r) => !r.done).length;
|
|
305
|
+
groups = epicGroupsHtml(id, M, T)
|
|
306
|
+
+ `<section class="tk-g hi-tg" aria-label="Your tasks">${headHtml(k2, 'Your tasks', n2 || own.length, open2)}${open2 ? own.map((t) => taskRowHtml(t, false, stages)).join('') || '<p class="hi-empty">No task of yours yet. Add one below.</p>' : ''}</section>`;
|
|
307
|
+
} else {
|
|
308
|
+
const G = MD.taskGroups(rows, L, by, stages);
|
|
309
|
+
groups = rows.length ? G.map((g) => {
|
|
310
|
+
const shut = X.shut.has('vt:' + g.key);
|
|
311
|
+
const head = g.title == null ? '' : `<div class="hi-gh"><button type="button" class="hi-ghb" data-hi-vfold="${esc(g.key)}" aria-expanded="${!shut}">${SVG(shut ? I.right : I.down, 14, 2)}<b>${esc(g.title)}</b><span>${g.open} open</span></button>`
|
|
312
|
+
+ (g.mine ? `<button type="button" class="hi-ib sm" data-hi-gmore="${esc(g.title)}" aria-haspopup="menu" aria-label="More for ${esc(g.title)}">${SVG(I.more, 14, 3)}</button>` : '') + '</div>';
|
|
313
|
+
return `<section class="hi-tg" data-hi-drop="${esc(g.mine ? g.title : g.loose ? '' : '')}"${mine ? ' data-hi-dz' : ''} aria-label="${esc(g.title || 'Tasks')}">${head}${shut ? '' : g.rows.map((t) => taskRowHtml(t, mine, stages)).join('') || '<p class="hi-empty">Drag a task here.</p>'}</section>`;
|
|
314
|
+
}).join('') : `<p class="hi-empty">${esc((M.tasks && M.tasks.note) || 'No task yet.')} Add one below.</p>`;
|
|
315
|
+
}
|
|
316
|
+
return summaryHtml(id, M, rows, T, by) + groups
|
|
245
317
|
+ (mine ? `<button type="button" class="hi-btn sm ghost hi-self" data-hi-newgroup>${SVG(I.plus, 14)}New group</button>` : '')
|
|
246
|
-
+
|
|
247
|
-
+ `<div class="hi-add"><label for="ovTask" class="hi-vh">Add a task</label><input id="ovTask" maxlength="200" autocomplete="off" placeholder="Add a task${target ? ' to ' + esc(target) : ''}" data-hi-target="${esc(target)}"><button type="button" class="hi-ib sm" data-ov-add aria-label="Add the task">${SVG(I.next, 14)}</button></div>`
|
|
248
|
-
+ `<div class="hi-foot"><button type="button" class="hi-btn sm ghost" data-ov-record>Open the full record</button>${M.board && M.board.id ? '<button type="button" class="hi-btn sm ghost" data-ov-sprint>Sprint</button>' : ''}</div>`;
|
|
318
|
+
+ `<div class="hi-add"><label for="ovTask" class="hi-vh">Add a task</label><input id="ovTask" maxlength="200" autocomplete="off" placeholder="Add a task${target ? ' to ' + esc(target) : ''}" data-hi-target="${esc(target)}"><button type="button" class="hi-ib sm" data-ov-add aria-label="Add the task">${SVG(I.next, 14)}</button></div>`;
|
|
249
319
|
}
|
|
250
320
|
function docRowHtml(d, cur, later) {
|
|
251
|
-
|
|
252
|
-
|
|
321
|
+
const draft = d.act && d.act.kind === 'draft' && !d.running && !d.path && d.st !== 'stale';
|
|
322
|
+
if (later) return `<div class="czs-it hi-drow later" data-ov-doc="${esc(d.key)}"><span class="ut-tki dash" aria-hidden="true">${SVG(I.doc, 15)}</span><span class="w">${esc(d.title)}<span>comes in ${esc(d.phase)}</span></span>${draft ? `<button type="button" class="hi-btn sm ghost" data-ov-draft="${esc(d.key)}">Draft it now</button>` : ''}</div>`;
|
|
323
|
+
const [pt] = MD.docPill(d, cur);
|
|
253
324
|
// a document with no file yet is never a dead press: it says what happens to it (data-ov-none), and offers the draft when PMOS can write it
|
|
254
325
|
const open = d.path && d.st === 'draft' && d.slot ? `data-ov-dread="${esc(d.key)}"` : d.path ? `data-ov-open="${esc(d.path)}" data-ov-name="${esc(d.title)}"` : `data-ov-none="${esc(d.key)}"`;
|
|
255
|
-
const meta = [d.when, d.by, d.link ? d.link.kind : ''].filter(Boolean).join(' · ') || d.what;
|
|
326
|
+
const meta = [d.when, d.by, d.link ? d.link.kind : '', d.look || !d.path ? pt : ''].filter(Boolean).join(' · ') || d.what;
|
|
256
327
|
return `<div class="hi-drow${d.look ? ' look' : ''}" data-ov-doc="${esc(d.key)}">`
|
|
257
|
-
+ `<button type="button" class="
|
|
258
|
-
+
|
|
328
|
+
+ `<button type="button" class="czs-it" ${open} aria-label="${d.path ? 'Open ' : ''}${esc(d.title)}"><span class="ut-tki${d.path ? '' : ' dash'}" aria-hidden="true">${SVG(I.doc, 15)}</span><span class="w">${esc(d.title)}<span>${esc(meta)}</span>${d.link ? `<span>${esc(d.link.kind + ': ' + d.link.url)}</span>` : ''}</span>${d.look ? '<span class="czs-amb" role="img" aria-label="Needs a look"></span>' : ''}</button>`
|
|
329
|
+
+ '</div>';
|
|
259
330
|
}
|
|
331
|
+
/** Documents in shell A (canvas XvADocs): the summary says what needs a look and holds the one primary (draft the first missing document,
|
|
332
|
+
* else open the first that needs a look); the groups fold below it. Group by, Show and Add a document are under ⋯. */
|
|
260
333
|
function docsView(id, M) {
|
|
261
334
|
const rows = MD.docRows(M), cur = MD.phaseOf(M.acts && M.acts.stage);
|
|
262
|
-
if (!rows.length) return
|
|
263
|
-
const
|
|
264
|
-
const
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
+ `<div class="hi-chips" role="group" aria-label="Show">${chips.map((c) => `<button type="button" class="cz-chip${X.doc.filter === c.k ? ' on' : ''}" aria-pressed="${X.doc.filter === c.k}" data-hi-dfilter="${esc(c.k)}">${esc(c.label)} ${c.n}</button>`).join('')}</div>`
|
|
274
|
-
+ groups + '<p class="hi-small">Press a row to open the document. Core marks the documents a stage needs.</p>';
|
|
335
|
+
if (!rows.length) return '<div class="hi-v hi-v2" data-hi-v="docs">' + VW().czSummary({ text: M.docs && M.docs.missing ? 'The core documents could not be read.' : 'This initiative has no core document yet.', primary: { label: 'Add a document', act: 'adddoc' } }) + '</div>';
|
|
336
|
+
const G = MD.docGroups(rows, M.acts && M.acts.stage, X.doc);
|
|
337
|
+
const look = rows.filter((d) => d.look), miss = rows.filter((d) => !d.path && d.act && d.act.kind === 'draft' && !d.running);
|
|
338
|
+
const said = look.slice(0, 2).map((d) => d.title + ' ' + String(MD.docPill(d, cur)[0] || '').toLowerCase()).concat(miss.filter((d) => !d.look).slice(0, 1).map((d) => 'The ' + d.title + ' is not written yet'));
|
|
339
|
+
const first = miss[0] || null, open = !first && look.find((d) => d.path);
|
|
340
|
+
const pri = first ? { label: 'Draft the ' + first.title, act: 'draft:' + first.key } : open ? { label: 'Open ' + open.title, act: 'open:' + open.key } : null;
|
|
341
|
+
const sum = VW().czSummary({ line: look.length ? look.length + (look.length === 1 ? ' needs a look' : ' need a look') : '', tone: look.length ? 'warn' : '',
|
|
342
|
+
text: said.length ? said.map((x) => x.replace(/^./, (c) => c.toUpperCase())).join('. ') + '.' : 'Every document is in place for ' + (cur || 'this stage') + '.',
|
|
343
|
+
meta: rows.length + (rows.length === 1 ? ' document' : ' documents') + ' · filter and sort are under More', extra: M.docs && M.docs.cap ? `<p class="czs-meta" data-ov-dsum>${esc(M.docs.cap)}</p>` : '', primary: pri });
|
|
344
|
+
const secs = VW().czSections(G.map((g, i) => ({ id: 'd:' + (g.key || i), title: g.title || 'Documents', count: g.rows.length, open: i === 0, html: g.rows.map((d) => docRowHtml(d, cur, g.later)).join('') })), { key: 'docs' });
|
|
345
|
+
return '<div class="hi-v hi-v2" data-hi-v="docs">' + sum + (secs || '<p class="hi-empty">No document matches.</p>') + '</div>';
|
|
275
346
|
}
|
|
276
347
|
function stageView(id, M, ask) {
|
|
277
348
|
const mv = mvOf(id, M), stages = (M.acts && M.acts.stages) || [];
|
|
@@ -293,7 +364,10 @@ function draw(b) {
|
|
|
293
364
|
const S = X.ctx.S, id = S.ini, M = curM();
|
|
294
365
|
if (!M) { b.innerHTML = `<div class="hi-v"><p class="hi-small" role="status">${X.failed === id ? 'The initiative could not be read.' : 'Reading the initiative.'}</p></div>`; return; }
|
|
295
366
|
const v = X.view;
|
|
296
|
-
|
|
367
|
+
// Documents is shell A (XvADocs): no tabs, the summary card and folding groups straight in the body
|
|
368
|
+
if (v === 'docs') { b.innerHTML = docsView(id, M) + '<p class="hi-small" role="status" id="ovMsg"></p>'; return; }
|
|
369
|
+
// the phone keeps the Tasks | Stage switch (PgTkList); in shell A on a desktop the other views sit under ⋯ (XvATasks)
|
|
370
|
+
b.innerHTML = `<div class="hi-v" data-hi-v="${v}">${isPhone() || !X.ctx.VW.czSummary ? segHtml(v) : ''}${v === 'stage' ? stageView(id, M, STAGE_ASK) : tasksView(id, M)}<p class="hi-small" role="status" id="ovMsg"></p></div>`;
|
|
297
371
|
}
|
|
298
372
|
function redrawView() {
|
|
299
373
|
if (!BODY || !BODY.isConnected || !X.ctx) return;
|
|
@@ -302,6 +376,41 @@ function redrawView() {
|
|
|
302
376
|
const st = BODY.scrollTop; draw(BODY); BODY.scrollTop = st;
|
|
303
377
|
if (keep) { const n = BODY.querySelector('#' + keep); if (n) { if (val != null) n.value = val; n.focus(); } }
|
|
304
378
|
}
|
|
379
|
+
/** ⋯ of the initiative in the Viewer (xvMore order: change it, then look back). */
|
|
380
|
+
function moreOf(id, view) {
|
|
381
|
+
const M0 = () => curM();
|
|
382
|
+
const out = [];
|
|
383
|
+
if (view === 'tasks') out.push({ label: 'Group tasks by', on: (b) => { const M = M0(); if (M) groupMenu(b, id, M); } });
|
|
384
|
+
for (const [k, l] of Object.entries(KIND)) if (k !== view) out.push({ label: l, on: () => iniOverview(k) });
|
|
385
|
+
out.push({ sep: true }, { label: 'Open the full record', on: async () => { const M = M0(); if (M) (await import('./premium-vw-item.js')).openWorkItem({ kind: 'initiative', id, title: M.title, ...bw(M) }); } });
|
|
386
|
+
if (M0() && M0().board && M0().board.id) out.push({ label: 'Sprint', on: async () => { const M = M0(); if (M) (await import('./premium-vw-jira.js')).openSprint(bw(M)); } });
|
|
387
|
+
return out;
|
|
388
|
+
}
|
|
389
|
+
function groupMenu(t, id, M) {
|
|
390
|
+
const L = Lof(id), T = Tof(id), by = byOf(L, T);
|
|
391
|
+
const same = (n) => n.join('|').toLowerCase() === L.names.join('|').toLowerCase();
|
|
392
|
+
const st = (M.acts && M.acts.stages) || [], at = Math.max(0, st.indexOf(M.acts.stage));
|
|
393
|
+
const G = T && T.ok ? TKM.ticketGroups(T) : [];
|
|
394
|
+
menu(t, [{ head: 'Group by' }, ...['epic', 'stage', 'mine', 'owner', 'status', 'none'].map((k) => ({ label: MD.BY_LABEL[k],
|
|
395
|
+
sub: k === 'stage' ? st.slice(at, at + 3).join(', ') : k === 'mine' && L.names.length ? L.names.join(', ') : k === 'epic' && G.length ? G.map((g) => g.name).slice(0, 2).join(', ') : '',
|
|
396
|
+
radio: true, on: by === k, go: () => press(id, M, { kind: 'by', by: k }) })),
|
|
397
|
+
{ hr: true }, { head: 'Saved group sets' },
|
|
398
|
+
...(L.sets || []).map((s) => ({ label: s.names.join(' · '), sub: same(s.names) ? 'this one' : s.name !== s.names.join(' · ') ? s.name : '', go: async () => { if (await press(id, M, { kind: 'groups', names: s.names })) press(id, M, { kind: 'by', by: 'mine' }); } })),
|
|
399
|
+
{ label: 'Save these groups as a set', icon: I.plus, disabled: !L.names.length, go: () => press(id, M, { kind: 'set', name: L.names.join(' · '), names: L.names }) }], 'Group tasks by');
|
|
400
|
+
}
|
|
401
|
+
/** The Send sheet (T3): one path to Jira, from a group's send icon, a drafted ticket, the summary card or the Board's Commit row. */
|
|
402
|
+
async function sendSheet(id, M, o = {}) {
|
|
403
|
+
const S = await import('./tk-send.js');
|
|
404
|
+
return S.openSend({ ws: wsOf(M), board: M.board && M.board.id, initiative: id, ...o, toast: X.ctx.toast,
|
|
405
|
+
onDone: async () => { await readT(id, M, true); setTimeout(() => readT(id, curM() || M, true), 4000); } });
|
|
406
|
+
}
|
|
407
|
+
async function openTicket(id, M, tid) {
|
|
408
|
+
const T = Tof(id), t = T && T.ok ? (T.tickets || []).find((x) => x.id === tid) : null;
|
|
409
|
+
if (t && t.inJira && !t.selectable) { (await import('./premium-vw-jira.js')).openTicket({ ...bw(M), initiative: id, ref: t.key }); return; }
|
|
410
|
+
const D = await import('./tk-draft.js');
|
|
411
|
+
D.openDraft({ VW: X.ctx.VW, ws: wsOf(M), initiative: id, id: tid, view: T && T.ok ? T : null, toast: X.ctx.toast, ui: { menu, ask },
|
|
412
|
+
onChange: () => readT(id, M, true), onSend: (x) => sendSheet(id, M, { ticket: x }) });
|
|
413
|
+
}
|
|
305
414
|
export function iniOverview(view) {
|
|
306
415
|
if (!X.ctx) return false;
|
|
307
416
|
const S = X.ctx.S, id = S.ini;
|
|
@@ -309,11 +418,33 @@ export function iniOverview(view) {
|
|
|
309
418
|
X.view = KIND[view] ? view : 'tasks'; // the card's Overview opens on Tasks (InTasks); a list line or the switch names its own view
|
|
310
419
|
STAGE_ASK = null;
|
|
311
420
|
const VW = X.ctx.VW;
|
|
312
|
-
|
|
421
|
+
const docs = X.view === 'docs';
|
|
422
|
+
// render wires the body too, so ← from a drill-in (a drafted ticket) draws the view again with its presses
|
|
423
|
+
BODY = VW.open({ id: 'ov:' + id, kind: KIND[X.view], title: KIND[X.view] + ' · ' + X.ctx.iniTitle(id), icon: ICON[X.view], more: docs ? () => docsMore(id) : moreOf(id, X.view),
|
|
424
|
+
render: (b) => { BODY = b; draw(b); wire(b, id); } });
|
|
313
425
|
if (!curM()) { X.failed = null; X.ctx.loadIni().then(() => { if (S.ini !== id) return; if (!curM()) X.failed = id; X.ctx.drawList(); redrawView(); }); } // a slow first read: read it again rather than say it failed
|
|
314
|
-
wire(BODY, id);
|
|
315
426
|
return true;
|
|
316
427
|
}
|
|
428
|
+
const VW = () => X.ctx.VW;
|
|
429
|
+
/** ⋯ of Documents (the xvMore note: change it, then look back): Group by, Show, Add a document, the tasks and stage, the full record. */
|
|
430
|
+
function docsMore(id) {
|
|
431
|
+
const M = curM(); if (!M) return [];
|
|
432
|
+
const chips = MD.docChips(MD.docRows(M)), on = chips.find((c) => c.k === X.doc.filter);
|
|
433
|
+
return [
|
|
434
|
+
{ label: 'Group by', note: MD.DOC_BY[X.doc.by], on: (b) => menu(b, Object.entries(MD.DOC_BY).map(([k, l]) => ({ label: l, radio: true, on: X.doc.by === k, go: () => { X.doc.by = k; redrawView(); } })), 'Group documents by') },
|
|
435
|
+
{ label: 'Show', note: on ? on.label : '', on: (b) => menu(b, chips.map((c) => ({ label: c.label + ' ' + c.n, radio: true, on: X.doc.filter === c.k, go: () => { X.doc.filter = c.k; redrawView(); } })), 'Show documents') },
|
|
436
|
+
{ label: 'Add a document', on: () => addDoc(id) },
|
|
437
|
+
{ sep: true },
|
|
438
|
+
{ label: 'Tasks', on: () => iniOverview('tasks') },
|
|
439
|
+
{ label: 'Stage', on: () => iniOverview('stage') },
|
|
440
|
+
{ label: 'Open the full record', on: async () => (await import('./premium-vw-item.js')).openWorkItem({ kind: 'initiative', id, title: M.title, ...bw(M) }) },
|
|
441
|
+
];
|
|
442
|
+
}
|
|
443
|
+
async function addDoc(id) {
|
|
444
|
+
const M = curM(), S = X.ctx.S; if (!M) return;
|
|
445
|
+
const A = await import('./home-adddoc.js');
|
|
446
|
+
A.openAddDocVw({ VW: X.ctx.VW, pmPost: X.ctx.pmPost, toast: X.ctx.toast, wait: X.ctx.wait || '', ws: M.board.ws, scope: M.docs.scope, phases: MD.PHASES, title: X.ctx.iniTitle(id), back: () => iniOverview('docs'), onAdded: async () => { await X.ctx.load(); if (S.ini === id) iniOverview('docs'); } });
|
|
447
|
+
}
|
|
317
448
|
function wire(body, id) {
|
|
318
449
|
const S = X.ctx.S;
|
|
319
450
|
const say = (m) => { const el = body.querySelector('#ovMsg'); if (el) el.textContent = m; };
|
|
@@ -340,14 +471,22 @@ function wire(body, id) {
|
|
|
340
471
|
const d = t.dataset;
|
|
341
472
|
if (d.hiView) { iniOverview(d.hiView); return; }
|
|
342
473
|
if ('hiAuto' in d) { press(id, M, { kind: 'auto', on: t.getAttribute('aria-checked') !== 'true' }); return; }
|
|
343
|
-
if ('hiBy' in d) {
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
474
|
+
if ('hiBy' in d) { groupMenu(t, id, M); return; }
|
|
475
|
+
// PRD to Jira (T1 to T3)
|
|
476
|
+
if (d.czsAct === 'tk-sendall') { sendSheet(id, M); return; }
|
|
477
|
+
if (d.czsAct === 'tk-openfirst') {
|
|
478
|
+
const wk = Date.now() + 7 * 864e5, r = MD.taskRows(M, Lof(id)).filter((x) => !x.done && !x.req && x.end && Date.parse(x.end) <= wk).sort((a, b) => a.end.localeCompare(b.end))[0];
|
|
479
|
+
if (r) openTask(id, M, r.key); return;
|
|
480
|
+
}
|
|
481
|
+
if (d.tkGfold) { X.fold.set(d.tkGfold, t.getAttribute('aria-expanded') !== 'true'); redrawView(); return; }
|
|
482
|
+
if (d.tkMore) { X.more.add(d.tkMore); redrawView(); return; }
|
|
483
|
+
if (d.tkSendg != null) { sendSheet(id, M, { group: d.tkSendg }); return; }
|
|
484
|
+
if (d.tkOpen) { openTicket(id, M, d.tkOpen); return; }
|
|
485
|
+
if ('tkDrafts' in d) {
|
|
486
|
+
t.disabled = true;
|
|
487
|
+
const r = await X.ctx.pmPost('/api/jira/draft', { ws: wsOf(M), initiative: id });
|
|
488
|
+
if (!r || r.ok === false) { say((r && r.error) || 'The tickets were not drafted.'); t.disabled = false; return; }
|
|
489
|
+
X.ctx.toast(plural(r.tickets, 'ticket', 'tickets') + ' drafted. Nothing is in Jira yet.'); await readT(id, M, true); return;
|
|
351
490
|
}
|
|
352
491
|
if ('hiNewgroup' in d) { const L = Lof(id); ask(t, 'Name the group', '', (v) => press(id, M, { kind: 'groups', names: L.names.concat(v) })); return; }
|
|
353
492
|
if (d.hiGmore) {
|
|
@@ -383,6 +522,13 @@ function wire(body, id) {
|
|
|
383
522
|
return;
|
|
384
523
|
}
|
|
385
524
|
// documents
|
|
525
|
+
if (d.czsAct === 'adddoc') { addDoc(id); return; }
|
|
526
|
+
if (/^(draft|open):/.test(d.czsAct || '')) {
|
|
527
|
+
const key = d.czsAct.slice(d.czsAct.indexOf(':') + 1), doc = (M.docs.rows || []).find((x) => x.key === key); if (!doc) return;
|
|
528
|
+
if (d.czsAct.startsWith('draft:')) { after(await X.ctx.pmPost('/api/core-docs/draft', { ws: M.board.ws, scope: M.docs.scope, key }), 'The draft started. It waits for you to read.'); return; }
|
|
529
|
+
if (doc.path && doc.st === 'draft' && doc.slot) { const A = await import('./home-draft.js'); A.openDraftVw({ VW: X.ctx.VW, pmGet: X.ctx.pmGet, pmPost: X.ctx.pmPost, toast: X.ctx.toast, wait: X.ctx.wait || '', ws: M.board.ws, scope: M.docs.scope, doc, onIssued: () => X.ctx.load() }); return; }
|
|
530
|
+
X.ctx.openFile({ path: doc.path, name: doc.title }); return;
|
|
531
|
+
}
|
|
386
532
|
if ('hiDby' in d) { menu(t, Object.entries(MD.DOC_BY).map(([k, l]) => ({ label: l, radio: true, on: X.doc.by === k, go: () => { X.doc.by = k; redrawView(); } })), 'Group documents by'); return; }
|
|
387
533
|
if (d.hiDfilter) { X.doc.filter = d.hiDfilter; redrawView(); return; }
|
|
388
534
|
if (d.hiDmore) { X.doc.more.add(d.hiDmore); redrawView(); return; }
|
|
@@ -403,11 +549,7 @@ function wire(body, id) {
|
|
|
403
549
|
A.openDraftVw({ VW: X.ctx.VW, pmGet: X.ctx.pmGet, pmPost: X.ctx.pmPost, toast: X.ctx.toast, wait: X.ctx.wait || '', ws: M.board.ws, scope: M.docs.scope, doc, onIssued: () => X.ctx.load() });
|
|
404
550
|
return;
|
|
405
551
|
}
|
|
406
|
-
if ('ovAdddoc' in d) {
|
|
407
|
-
const A = await import('./home-adddoc.js');
|
|
408
|
-
A.openAddDocVw({ VW: X.ctx.VW, pmPost: X.ctx.pmPost, toast: X.ctx.toast, wait: X.ctx.wait || '', ws: M.board.ws, scope: M.docs.scope, phases: MD.PHASES, title: X.ctx.iniTitle(id), back: () => iniOverview('docs'), onAdded: async () => { await X.ctx.load(); if (S.ini === id) iniOverview('docs'); } });
|
|
409
|
-
return;
|
|
410
|
-
}
|
|
552
|
+
if ('ovAdddoc' in d) { addDoc(id); return; }
|
|
411
553
|
// stage
|
|
412
554
|
if (d.ovMove) { if (t.getAttribute('aria-pressed') === 'true') return; const ok = await after(await X.ctx.pmPost('/api/boards/move', { ...bw(M), id, to: d.ovMove, why: 'Moved by hand' }), 'Moved to ' + d.ovMove + '.'); void ok; return; }
|
|
413
555
|
if (d.ovLife === 'active') { after(await X.ctx.pmPost('/api/lifecycle', { ws: M.board.ws, initiative_id: id, state: 'active', reason: '' }), 'Recorded.'); return; }
|
|
@@ -457,6 +599,7 @@ export function mountIni(ctx) {
|
|
|
457
599
|
X.ctx = ctx;
|
|
458
600
|
if (typeof document === 'undefined') return X;
|
|
459
601
|
if (!document.querySelector('link[data-hi-css]')) { const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = '/pm/home-ini.css'; l.dataset.hiCss = ''; document.head.appendChild(l); }
|
|
602
|
+
if (!document.querySelector('link[data-tk-css]')) { const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = '/pm/tk-tasks.css'; l.dataset.tkCss = ''; document.head.appendChild(l); }
|
|
460
603
|
const list = document.getElementById('hmList');
|
|
461
604
|
if (list) list.addEventListener('click', onList);
|
|
462
605
|
ctx.VW.onChange((v) => { if (!v.open || !/^ov:/.test(v.id || '')) closePop(); });
|
|
@@ -97,23 +97,17 @@ export function tasksOf(D, ini, now = Date.now()) {
|
|
|
97
97
|
function meetRow(m, ini) {
|
|
98
98
|
return { id: 'm:' + (m.id || m.title), kind: 'meeting', ini: ini || null, name: m.title, hint: (m.state === 'now' ? 'Now' : hm(m.start)) + (ini ? ' meeting' : ' · not linked'), state: m.state === 'now' ? 'working' : 'quiet', icon: 'clock', meeting: m };
|
|
99
99
|
}
|
|
100
|
-
/** Today's unread mentions of the PM (GET /api/brief-page mentions). One that names an initiative is that initiative's next step. */
|
|
101
|
-
const mentionsOf = (D) => (D.today && Array.isArray(D.today.mentions) ? D.today.mentions : []).filter((m) => m && !m.read && !m.done);
|
|
102
|
-
function mentionRow(m, ini) {
|
|
103
|
-
return { id: 'men:' + (m.id || m.at), kind: 'mention', ini: ini || null, name: (m.who ? m.who + ' ' : '') + (m.text ? 'asks: ' + m.text : 'named you'),
|
|
104
|
-
hint: (ini ? 'Next step · ' : '') + 'Mention' + (m.where ? ' · ' + m.where : m.source ? ' · ' + cap1(m.source) : ''), state: 'needs', mention: m, link: m.link || '', step: !!ini };
|
|
105
|
-
}
|
|
106
100
|
const meetIni = (m) => (m && (m.initiative || (m.level && m.level.kind === 'initiative' && m.level.id) || (m.about && m.about.kind === 'initiative' && m.about.id))) || null;
|
|
107
101
|
/** A next step's hint without its product's name: the product is the group's header. */
|
|
108
102
|
const bareHint = (x) => { const h = String(x.hint || ''), p = prodOf(x); return p && h.startsWith(p + ' · ') ? h.slice(p.length + 3) : p && h === p ? '' : h; }; // the group names the product; "Across products" stays
|
|
109
103
|
/** Where an initiative is on the eight stages (the row's stage track, HvAC .mt): 0 Triage … 7 Evaluate, or -1 when its stage is not one of them. */
|
|
110
104
|
export const stageAt = (stage) => { const k = stageKey(stage); return k ? STEPS.findIndex((s) => s.key === k) : -1; };
|
|
111
|
-
/** A row under an initiative that is the PM's move now (Your move, and the initiative's count badge): a next step, a
|
|
105
|
+
/** A row under an initiative that is the PM's move now (Your move, and the initiative's count badge): a next step, a session
|
|
112
106
|
* that waits on the PM, or a task of the PM's own that is late. */
|
|
113
|
-
const isMove = (k) => k.step ||
|
|
107
|
+
const isMove = (k) => k.step || (k.kind === 'session' && (k.state === 'needs' || k.state === 'blocked')) || (k.kind === 'task' && k.mine && k.late);
|
|
114
108
|
function iniRowOf(D, r, needs, now) {
|
|
115
|
-
|
|
116
|
-
|
|
109
|
+
// a mention is not a row here: Mentions is its own row at the top of Home (home-mentions.js, XvANew), so it shows once
|
|
110
|
+
const steps = needs.filter((x) => x.ini === r.id && !x.needSession).map((x) => ({ ...x, step: true, hint: 'Next step' + (bareHint(x) ? ' · ' + bareHint(x) : '') }));
|
|
117
111
|
const ses = (D.sessions || []).filter((s) => live(s) && iniOfSession(s) === r.id).map((s) => sessionRow(s, D.desk && D.desk.roles));
|
|
118
112
|
const tasks = tasksOf(D, r.id, now);
|
|
119
113
|
const meet = todayOf(D).filter((m) => meetIni(m) === r.id && m.state !== 'past').map((m) => meetRow(m, r.id));
|
|
@@ -215,8 +209,6 @@ export function homeList(D, o = {}) {
|
|
|
215
209
|
const loose = [];
|
|
216
210
|
for (const x of looseNeeds) loose.push({ ...x, flat: true });
|
|
217
211
|
for (const r of tabRows('today')) loose.push({ id: 'w:' + r.key, kind: 'item', key: r.key, name: r.title, hint: [r.overdue ? 'late' : '', String(r.sub || '').replace(/^Yours\b\s*(·\s*)?/, '')].filter(Boolean).join(' · '), check: true, mine: true, late: !!r.overdue, item: r }); // the check box says it is the PM's own: no "your own note" on every row (testing fixes)
|
|
218
|
-
const inIni = new Set(groups.flatMap((g) => g.inis.concat(g.rest)).map((i) => i.ini));
|
|
219
|
-
for (const m of mentionsOf(D).filter((x) => !(x.initiative && inIni.has(x.initiative)))) loose.push(mentionRow(m, null));
|
|
220
212
|
for (const m of todayOf(D).filter((x) => !meetIni(x) && x.state !== 'past')) loose.push(meetRow(m, null));
|
|
221
213
|
for (const s of (D.sessions || []).filter((s) => live(s) && !iniOfSession(s) && s.shown !== 'needs' && s.shown !== 'blocked')) loose.push({ ...sessionRow(s, D.desk && D.desk.roles), loose: true });
|
|
222
214
|
// the folded line's signals (HvAC .lh): a blue dot when a row waits on the PM, an amber square when one of the PM's own is late
|
|
@@ -241,8 +233,8 @@ export function homeList(D, o = {}) {
|
|
|
241
233
|
}
|
|
242
234
|
|
|
243
235
|
/* ── Your move (HvAOpen) ── */
|
|
244
|
-
/** Every row that is the PM's move, in one list for the Your day sheet: the PM's own late tasks and items first, then each next step
|
|
245
|
-
*
|
|
236
|
+
/** Every row that is the PM's move, in one list for the Your day sheet: the PM's own late tasks and items first, then each next step and
|
|
237
|
+
* waiting session in the list's order. A row keeps its list id, so a press opens what the list row opens. Each row:
|
|
246
238
|
* { id, name, sub (its initiative, or the hint of a row with none), late, state, when (the weekly update's send time) }. */
|
|
247
239
|
function moveOf(groups, needs) {
|
|
248
240
|
const late = [], rest = [], seen = new Set();
|