create-pmos 0.556.0 → 0.558.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 +27 -81
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/changelog.json +26 -0
- package/workspace/guide/home.md +7 -2
- package/workspace/guide/initiatives-and-next-steps.md +18 -2
- package/workspace/lib/board-premium.js +2 -1
- package/workspace/lib/coming-up.js +51 -0
- package/workspace/lib/initiative-cli.js +4 -4
- package/workspace/lib/initiative-premium.js +1 -1
- package/workspace/lib/initiative-writer.js +28 -4
- package/workspace/lib/routes-autonomy.js +12 -0
- package/workspace/lib/routes-boards.js +5 -4
- package/workspace/lib/routes-initiatives.js +12 -0
- package/workspace/lib/routes-intake.js +6 -2
- package/workspace/lib/work-kind.js +48 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/bd-asks.js +16 -10
- package/workspace/public/pm/bd-ini-panel.js +11 -1
- package/workspace/public/pm/bd-next.js +14 -4
- package/workspace/public/pm/bd-views.js +3 -2
- package/workspace/public/pm/cozy-board.css +10 -0
- package/workspace/public/pm/cozy-viewer.js +11 -5
- package/workspace/public/pm/home-ini.js +10 -1
- package/workspace/public/pm/ini-agent.js +122 -30
- package/workspace/public/pm/ini-view-model.js +3 -2
- package/workspace/public/pm/ini-view.css +5 -2
- package/workspace/public/pm/ini-view.js +4 -3
- package/workspace/public/pm/premium-board.js +3 -2
- package/workspace/public/pm/work-kind.js +82 -0
- package/workspace/test-files.json +1 -1
|
@@ -243,7 +243,7 @@ export function iniView(r, ctx = {}) {
|
|
|
243
243
|
// the way to finish the stage (R5): the stage's count, and its milestone tasks, the open ones by date, the done ones counted
|
|
244
244
|
const msRows = curRows.filter((x) => x.ms && !x.wont);
|
|
245
245
|
const gates = {
|
|
246
|
-
open: msRows.filter((x) => !x.closed).sort((a, b2) => (a.end || '9999').localeCompare(b2.end || '9999')).map((x) => ({ id: x.uid, name: x.title, date: x.end ? dateY(x.end, today) : '', late: x.late,
|
|
246
|
+
open: msRows.filter((x) => !x.closed).sort((a, b2) => (a.end || '9999').localeCompare(b2.end || '9999')).map((x) => ({ id: x.uid, name: x.title, date: x.end ? dateY(x.end, today) : '', iso: x.end || '', late: x.late,
|
|
247
247
|
ago: x.late ? between(dayOf(x.end), today) : 0, left: !x.late && x.end && dayOf(x.end) >= today ? between(today, dayOf(x.end)) : null, owner: x.owner, av: x.av })),
|
|
248
248
|
done: msRows.filter((x) => x.closed).length,
|
|
249
249
|
};
|
|
@@ -255,6 +255,7 @@ export function iniView(r, ctx = {}) {
|
|
|
255
255
|
doneOf, nDone: sDone, nTotal: sTotal, nLate: curRows.filter((x) => !x.closed && x.late).length, gates, day: days != null ? 'day ' + days + (usual != null ? ' of ~' + usual : '') : '', dayOver: days != null && usual != null && days > usual,
|
|
256
256
|
clock: days != null && !line.chip ? (usual != null ? days + ' of ~' + usual + ' days' : plural(days, 'day', 'days')) : '', line, ready,
|
|
257
257
|
ladder: list.map((s) => ({ name: s.name, ms: s.ms, cls: s.status })), dates, next: nx,
|
|
258
|
+
endIso: r.end && !finished ? String(r.end).slice(0, 10) : '', // the plan's end as a date: Coming up sorts by it (pm/ini-agent.js comingUp)
|
|
258
259
|
// the old stages' own days, kept after a switch merged them (batch 20 item 3, canvas WmD): "Before the switch: Triage 4 days · Discover 12 days"
|
|
259
260
|
before: Array.isArray(tr.before) && tr.before.length ? 'Before the switch: ' + tr.before.map((b) => b.name + ' ' + plural(b.days, 'day', 'days')).join(' · ') : '',
|
|
260
261
|
aria: cur >= 0 ? 'Stage ' + (cur + 1) + ' of ' + list.length + ' of ' + ((r.wf && r.wf.name) || 'Product feature') + ': ' + st.name + '.' + (nx ? ' Next stage: ' + nx.name + '.' : '') : 'No stage on record.',
|
|
@@ -330,7 +331,7 @@ export function iniView(r, ctx = {}) {
|
|
|
330
331
|
summary.wf = r.wf || { id: PF_ID, name: 'Product feature', icon: 'feature' };
|
|
331
332
|
summary.program = ctx.program || null;
|
|
332
333
|
const today2 = (n) => String(n).padStart(2, '0');
|
|
333
|
-
return { anchor: r.kr || '', vs: r.__vs || null, links: r.__vs && r.__vs.draft ? null : r.links || null, prd: (r.trail && r.trail.links && r.trail.links.prd) || null, desc: (r.trail && r.trail.desc) || r.desc || null, id: r.id || null, key: r.key, title: r.title, today: today.getFullYear() + '-' + today2(today.getMonth() + 1) + '-' + today2(today.getDate()), summary, stage, tasks, docs: ctx.docs != null ? ctx.docs : null, linked: linkedOf(r), jiraAt: jiraIn ? ctx.jiraAt || '' : '', jiraRead: ctx.jiraReadAt || '',
|
|
334
|
+
return { anchor: r.kr || '', kind: r.kind || 'product', vs: r.__vs || null, links: r.__vs && r.__vs.draft ? null : r.links || null, prd: (r.trail && r.trail.links && r.trail.links.prd) || null, desc: (r.trail && r.trail.desc) || r.desc || null, id: r.id || null, key: r.key, title: r.title, today: today.getFullYear() + '-' + today2(today.getMonth() + 1) + '-' + today2(today.getDate()), summary, stage, tasks, docs: ctx.docs != null ? ctx.docs : null, linked: linkedOf(r), jiraAt: jiraIn ? ctx.jiraAt || '' : '', jiraRead: ctx.jiraReadAt || '',
|
|
334
335
|
// split or merge (batch 11 item 14): Claude's suggestion for it, and where its work went when it was merged
|
|
335
336
|
suggest: r.suggest || null, merged: mergedOf(r),
|
|
336
337
|
// what Claude proposes under the one blue ✦, and what a ✓ kept from elsewhere (batch 12 items 2, 3 and 4; pm/ini-props.js)
|
|
@@ -1346,8 +1346,11 @@ button.ia-xr:hover { background: var(--cz-well); }
|
|
|
1346
1346
|
.ia-dr em { display: block; font-style: normal; font-size: var(--fs-label); color: var(--cz-ink3); }
|
|
1347
1347
|
.ia-dr .yd-alt.sm { flex: none; width: 36px; height: 36px; }
|
|
1348
1348
|
.ia-fl { display: flex; gap: 8px; align-items: flex-start; margin: 8px 8px 4px; padding: 9px 12px; border-radius: 12px; background: var(--cz-latebg); color: var(--cz-late); font-size: var(--fs-label); line-height: 1.45; }
|
|
1349
|
-
.ia-fl svg
|
|
1350
|
-
|
|
1349
|
+
.ia-fl svg { flex: none; margin-top: 2px; }
|
|
1350
|
+
/* Coming up (batch 29 item 7, board CuA): the PMOS's work row with a quiet sign; the kill check is amber */
|
|
1351
|
+
.ia-dr .ck.up { background: var(--cz-well); color: var(--cz-blueink); }
|
|
1352
|
+
.ia-dr .ck.up.k { background: var(--cz-latebg); color: var(--cz-late); }
|
|
1353
|
+
.ia-up { padding-right: 12px; }
|
|
1351
1354
|
@media (max-width: 760px) { .ia-xr { flex-direction: column; gap: 2px; } .ia-xr > b { width: auto; } }
|
|
1352
1355
|
.ia .yd-ok, .ia .yd-alt { flex: none; border: 0; padding: 0; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; font: inherit; width: 36px; height: 36px; border-radius: 18px; }
|
|
1353
1356
|
.ia .yd-ok { background: var(--cz-blue); color: var(--cz-onsolid); }
|
|
@@ -418,7 +418,7 @@ export function viewHtml(v, o = {}) {
|
|
|
418
418
|
if (v.merged) return `<div class="iv" data-iv="${esc(v.id || v.key || '')}"><div class="iv-cols"><div class="iv-cl">${smMerged(v.merged)}</div><div class="iv-cr">${foldsHtml(v, o)}${o.tail || ''}</div></div></div>`;
|
|
419
419
|
// One reading column: summary, milestones and proposals, then content-sized Tasks and document folds.
|
|
420
420
|
return `<div class="iv" data-iv="${esc(v.id || v.key || '')}"><div class="iv-cols"><div class="iv-cl">${ctrlHtml(v, o)}${o.sm !== false ? smCard(v.suggest, v.title) : ''}</div>`
|
|
421
|
-
+ `<div class="iv-cr">${v.id ? IA.sectionsHtml(AM, v, v.id, { all: IA.allOpen(v.id) }) : ''}<section class="iv-tasks" aria-label="Tasks">${tasksHtml(v, o)}</section>${foldsHtml(v, o)}${o.tail || ''}</div></div></div>`;
|
|
421
|
+
+ `<div class="iv-cr">${v.id ? IA.sectionsHtml(AM, v, v.id, { all: IA.allOpen(v.id), cuAll: IA.cuOpen(v.id) }) : ''}<section class="iv-tasks" aria-label="Tasks">${tasksHtml(v, o)}</section>${foldsHtml(v, o)}${o.tail || ''}</div></div></div>`;
|
|
422
422
|
}
|
|
423
423
|
|
|
424
424
|
/* ── the presses ── */
|
|
@@ -430,14 +430,14 @@ export function wireView(body, h) {
|
|
|
430
430
|
const chip = () => { const id = idOf(); if (id && VIEWED.has(id)) PP.sync(VIEWED.get(id), body.__iv || {}); drafts(id); about(id); agent(id); fitMission(body); };
|
|
431
431
|
// agent-run (AwB): the experiment and Claude's work, read every 30 s at most; they draw alone (and the gate with them) when they change
|
|
432
432
|
const wsOf = () => { const H = body.__iv || {}; return ((H.where && H.where()) || {}).ws || ''; };
|
|
433
|
-
const agent = (id) => { if (id && VIEWED.has(id)) IA.want(wsOf(), id, () => paintAgent(id)); };
|
|
433
|
+
const agent = (id) => { if (id && VIEWED.has(id)) IA.want(wsOf(), id, () => paintAgent(id), (VIEWED.get(id) || {}).title); };
|
|
434
434
|
const paintAgent = (id) => {
|
|
435
435
|
if (idOf() !== id || !VIEWED.has(id)) return;
|
|
436
436
|
const v0 = VIEWED.get(id), M = IA.cached(id), g = IA.gateOf(M), v = g ? { ...v0, stage: { ...v0.stage, gate: g } } : v0;
|
|
437
437
|
VIEWED.set(id, v);
|
|
438
438
|
// replace only what changed: a node another press holds (a task card's day picker) is never swapped for an identical copy
|
|
439
439
|
const swap = (n, html) => { const t = document.createElement('template'); t.innerHTML = html; const x = t.content.firstElementChild; if (!x || !x.isEqualNode(n)) n.outerHTML = html; };
|
|
440
|
-
const at = body.querySelector('[data-ia]'); if (at) swap(at, IA.sectionsHtml(M, v, id, { all: IA.allOpen(id) }));
|
|
440
|
+
const at = body.querySelector('[data-ia]'); if (at) swap(at, IA.sectionsHtml(M, v, id, { all: IA.allOpen(id), cuAll: IA.cuOpen(id) }));
|
|
441
441
|
if (g) for (const n of body.querySelectorAll('.iv-gate')) swap(n, srcGateHtml({ gate: g }));
|
|
442
442
|
};
|
|
443
443
|
// the success measure Claude drafted: read once per page load, the view draws again when it arrives
|
|
@@ -486,6 +486,7 @@ export function wireView(body, h) {
|
|
|
486
486
|
if ('iaCancel' in d) { e.preventDefault(); paintAgent(id); return; }
|
|
487
487
|
if (d.iaUndo) { e.preventDefault(); IA.undo(b, wsOf(), () => paintAgent(id), H.toast); return; }
|
|
488
488
|
if ('iaMore' in d) { e.preventDefault(); IA.toggleMore(id); paintAgent(id); return; }
|
|
489
|
+
if ('iaCumore' in d) { e.preventDefault(); IA.toggleCu(id); paintAgent(id); return; }
|
|
489
490
|
if (d.ivMc) { e.preventDefault(); const M = MD.measuresOf(id); mcToggle(id, d.ivMc, { proposal: !!(M && M.mode === 'open') }); if (H.redraw) H.redraw(); later(b, (r) => r.querySelector(`[data-iv-mc="${d.ivMc}"]`), true); return; }
|
|
490
491
|
if (d.abMore && AB.pressMore(b, H.redraw)) { e.preventDefault(); return; }
|
|
491
492
|
if (d.md && MD.press(b, { redraw: H.redraw, toast: H.toast })) { e.preventDefault(); return; }
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
* chip row picks one (its own stages become the columns and the track's header) or All (the three categories, each row its own stages).
|
|
19
19
|
* Where no record holds a value for an initiative, the element says so: nothing is invented. */
|
|
20
20
|
import './fetch-share.js'; // first: identical GETs in flight are asked once (page-open-speed)
|
|
21
|
+
import * as WK from './work-kind.js'; // the kind of work before each title (batch 29 item 11, KdBd)
|
|
21
22
|
import { pmPost } from './http.js';
|
|
22
23
|
import { followDoc } from './doc-follow.js';
|
|
23
24
|
import { $, $$, esc, store, chatAbout, setPageGaps } from './premium-shell.js';
|
|
@@ -505,7 +506,7 @@ function trackRow(r, cls = '', po = false) {
|
|
|
505
506
|
}).join('');
|
|
506
507
|
const many = TK.mode === 'cats'; // All: each row names its workflow with its icon (WfATrack)
|
|
507
508
|
return `<div class="bt-r bt-l${cls}${peek && peek.key === r.key && peek.kind !== 'acts' ? ' sel' : ''}${r.acts && r.acts.life === 'hold' ? ' held' : ''}" role="row" data-row="${esc(r.key)}"${po ? ` data-po-id="${esc(r.id)}"` : ''}>${po ? PO.gripHtml(r.title) : ''}`
|
|
508
|
-
+ `<button type="button" class="ini2 bt-nm" data-key="${esc(r.key)}" role="rowheader" aria-haspopup="dialog"><b>${r.inProgram ? PG.memberIcon(PGS, r.inProgram) : ''}${many ? WF.wfIcon(WF.wfOf(r), 18) : ''}${SM.nameHtml(r)}</b><span class="cs s-${s.tone}"${s.from ? ` title="${esc(s.from)}"` : ''}><i class="cz-dot ${s.tone}"></i>${esc(s.text)}</span><span class="bt-pst">${t.ms ? '<i class="cz-ms" aria-hidden="true"></i>' : ''}${esc(t.label)} · ${DAYS(t)}</span></button>`
|
|
509
|
+
+ `<button type="button" class="ini2 bt-nm" data-key="${esc(r.key)}" role="rowheader" aria-haspopup="dialog"><b>${r.inProgram ? PG.memberIcon(PGS, r.inProgram) : ''}${many ? WF.wfIcon(WF.wfOf(r), 18) : ''}${WK.iconHtml(r.kind)}${SM.nameHtml(r)}</b><span class="cs s-${s.tone}"${s.from ? ` title="${esc(s.from)}"` : ''}><i class="cz-dot ${s.tone}"></i>${esc(s.text)}</span><span class="bt-pst">${t.ms ? '<i class="cz-ms" aria-hidden="true"></i>' : ''}${esc(t.label)} · ${DAYS(t)}</span></button>`
|
|
509
510
|
+ `<div class="${cellsCls()}" role="presentation"${cellsStyle()}>${cells}</div>`
|
|
510
511
|
+ `<div class="bt-dl" role="cell">${nextHtml(r, { self: M.board.self, icon: !small() })}</div></div>`; // the Next cell (XocA): what finishes the step next
|
|
511
512
|
}
|
|
@@ -1231,7 +1232,7 @@ Acts.init({ M: () => M, wf: wfState, load, say, panel: actsPanel, close: closePa
|
|
|
1231
1232
|
BI.mount({ M: () => M, statusOf, dayTitle, usual: usualOf, fmt, md, ago, segHtml, barHtml: V.barHtml, grill: (id) => GR[id], rowOf, pageHref, askHref, refreshJira: () => refreshJira(), viewDoc,
|
|
1232
1233
|
send: (r) => import('./tk-send.js').then((S) => S.openSend({ ws: r.ws || M.board.ws || null, board: r.boardId || M.board.id, initiative: r.id, toast: say })),
|
|
1233
1234
|
moreAct: (r, k, b) => Acts.open.more(r, k, b), hold: (r, i, b) => Acts.open.hold(r, i, b), grillOpen: (r, b) => Asks.openGrill(r.id, r.title, (r.track && r.track.label) || 'Triage', false, b), onShow: iniShown, onHide: iniHidden,
|
|
1234
|
-
programOf: (r) => programOf(PGS, r.ws || M.board.ws || '', r.id), openProgram: (id, b) => PG.openProgram(id, b), reload: load, toast: say, rename: renameIni, setTask, setDates, removeTask, addTask, openTask, turnProgram, moveItems, smItems, smPress, openIniId });
|
|
1235
|
+
programOf: (r) => programOf(PGS, r.ws || M.board.ws || '', r.id), openProgram: (id, b) => PG.openProgram(id, b), reload: load, redraw: () => { if (M) drawInit(); }, toast: say, rename: renameIni, setTask, setDates, removeTask, addTask, openTask, turnProgram, moveItems, smItems, smPress, openIniId });
|
|
1235
1236
|
/** Tap the title to rename (canvas RnAIni): the list, the Timeline and the panel show the new name at once; Undo is the same press.
|
|
1236
1237
|
* The Jira box opens Home's chat about it with the request typed, for the PM to send (PMOS holds no Jira credential, D53). */
|
|
1237
1238
|
// a name the PM just saved holds over a read that predates it (the board derives off the request path) until a read says it too
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/* pm/work-kind.js — the kind of work of an initiative, on the page (batch 29 item 11; main canvas KdA, KdAP, KdV1-3, KdBd; lib/work-kind.js
|
|
2
|
+
* on the server). One kind per initiative: Product management, Full SDLC or Project management. A record with none reads as Product.
|
|
3
|
+
*
|
|
4
|
+
* KINDS · LABEL · SHORT · CAPTION · GLYPH the three kinds, their names, the switch's caption and their 16 px stroke glyphs
|
|
5
|
+
* kindOf(v) → kind 'product' for anything that is not one of the three
|
|
6
|
+
* glyph(kind, w) → <svg> the glyph, aria-hidden
|
|
7
|
+
* iconHtml(kind) → the Board's icon before a title (role img, the full name in its label and tooltip)
|
|
8
|
+
* segHtml(kind, lean) → New initiative's field: the pill switch (role radio), the caption, and the blue ✦ line when PMOS picked it (lean)
|
|
9
|
+
* pressOf(kind) → the Viewer header's press { act: 'kind', … } (cozy-viewer presses, lead: before Discuss)
|
|
10
|
+
* pick(btn, kind, onPick) the small menu of the three kinds under the header's press; onPick(kind) runs on a new one
|
|
11
|
+
*
|
|
12
|
+
* A hint, not a lane (D107): no gate and no stage reads it. Copy says PMOS. */
|
|
13
|
+
|
|
14
|
+
export const KINDS = ['product', 'sdlc', 'project'];
|
|
15
|
+
export const LABEL = { product: 'Product management', sdlc: 'Full SDLC', project: 'Project management' };
|
|
16
|
+
export const SHORT = { product: 'Product', sdlc: 'Full SDLC', project: 'Project' };
|
|
17
|
+
export const CAPTION = {
|
|
18
|
+
product: 'Decide what to build and whether it worked. Engineers build it; PMOS writes the specs.',
|
|
19
|
+
sdlc: 'From idea to shipped. PMOS also builds it, as pull requests you merge.',
|
|
20
|
+
project: 'Get a piece of work delivered on time. Others do the work; PMOS chases, syncs and reports.',
|
|
21
|
+
};
|
|
22
|
+
// compass · code brackets · three offset bars (KdA's G map)
|
|
23
|
+
export const GLYPH = {
|
|
24
|
+
product: '<circle cx="12" cy="12" r="8"/><path d="M15.5 8.5l-2 5-5 2 2-5z"/>',
|
|
25
|
+
sdlc: '<path d="M8 8l-4 4 4 4M16 8l4 4-4 4M13.5 6l-3 12"/>',
|
|
26
|
+
project: '<rect x="3" y="5" width="9" height="3" rx="1.5"/><rect x="8" y="10.5" width="12" height="3" rx="1.5"/><rect x="5" y="16" width="8" height="3" rx="1.5"/>',
|
|
27
|
+
};
|
|
28
|
+
// the same glyphs as one path each, for hosts that take a path (cozy-viewer presses)
|
|
29
|
+
export const PATH = {
|
|
30
|
+
product: 'M12 4a8 8 0 1 0 0 16a8 8 0 1 0 0-16M15.5 8.5l-2 5-5 2 2-5z',
|
|
31
|
+
sdlc: 'M8 8l-4 4 4 4M16 8l4 4-4 4M13.5 6l-3 12',
|
|
32
|
+
project: 'M4.5 5h6a1.5 1.5 0 0 1 0 3h-6a1.5 1.5 0 0 1 0-3zM9.5 10.5h9a1.5 1.5 0 0 1 0 3h-9a1.5 1.5 0 0 1 0-3zM6.5 16h5a1.5 1.5 0 0 1 0 3h-5a1.5 1.5 0 0 1 0-3z',
|
|
33
|
+
};
|
|
34
|
+
import { openPop, closePop } from './hi-pop.js';
|
|
35
|
+
|
|
36
|
+
const SPARK = 'M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z';
|
|
37
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
38
|
+
|
|
39
|
+
export const kindOf = (v) => (KINDS.includes(v) ? v : 'product');
|
|
40
|
+
export const glyph = (k, w = 16) => `<svg width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${GLYPH[kindOf(k)]}</svg>`;
|
|
41
|
+
|
|
42
|
+
export function iconHtml(k) {
|
|
43
|
+
const n = LABEL[kindOf(k)];
|
|
44
|
+
return `<span class="kd-g" role="img" aria-label="${esc(n)}" title="${esc(n)}">${glyph(k)}</span>`;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function segHtml(k0, lean) {
|
|
48
|
+
const k = kindOf(k0);
|
|
49
|
+
const btn = (x) => `<button type="button" role="radio" aria-checked="${x === k}" aria-pressed="${x === k}" data-kind="${x}">${glyph(x)}${esc(SHORT[x])}</button>`;
|
|
50
|
+
return `<span class="bd-flbl" id="nwKindL">Kind of work</span><div class="bd-seg kd-seg" role="radiogroup" aria-labelledby="nwKindL">${KINDS.map(btn).join('')}</div>`
|
|
51
|
+
+ `<p class="kd-cap"><b>${esc(LABEL[k])}.</b> ${esc(CAPTION[k])}</p>`
|
|
52
|
+
+ (lean ? `<p class="kd-lean"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="${SPARK}"/></svg><span>PMOS picked this from the name. Tap another kind to change it.</span></p>` : '');
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function pressOf(k) {
|
|
56
|
+
const n = LABEL[kindOf(k)];
|
|
57
|
+
return { act: 'kind', label: 'Kind of work: ' + n + '. Tap to change.', icon: PATH[kindOf(k)], lead: true };
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** The header's menu of the three kinds (the initiative's shared popover, pm/hi-pop.js; a sheet on a phone). onPick(kind) runs on a new one. */
|
|
61
|
+
export function pick(btn, k0, onPick) {
|
|
62
|
+
const k = kindOf(k0);
|
|
63
|
+
const html = KINDS.map((x) => `<button type="button" class="hi-mi${x === k ? ' on' : ''}" role="menuitemradio" aria-checked="${x === k}" data-kind="${x}" title="${esc(CAPTION[x])}">${glyph(x)}<span>${esc(LABEL[x])}</span></button>`).join('');
|
|
64
|
+
openPop(btn, 'kind', html, (b) => { const nk = b.dataset.kind; closePop(); if (nk && nk !== k && onPick) onPick(nk); }, { menu: true, label: 'Kind of work', focus: '.hi-mi.on' });
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** The Viewer's change (KdV1-3): POST /api/initiatives/kind, then the toast with Undo and a new read. h: { pmPost, ws, id, from, to, toast(text,
|
|
68
|
+
* undo?), apply(kind) (the page shows the new kind at once: the rows are read again in the background), reload() }. → true when it changed.
|
|
69
|
+
* Only the record's kind line changes; lines someone wrote in the experiment stay as written. */
|
|
70
|
+
export async function change(h) {
|
|
71
|
+
const r = await h.pmPost('/api/initiatives/kind', { ws: h.ws || undefined, id: h.id, kind: h.to }).catch(() => null);
|
|
72
|
+
if (!r || !r.ok) { if (h.toast) h.toast((r && r.error) || 'The kind of work was not changed.'); return false; }
|
|
73
|
+
const back = r.from || kindOf(h.from);
|
|
74
|
+
if (h.apply) h.apply(kindOf(h.to));
|
|
75
|
+
if (h.toast) h.toast('Kind of work: ' + LABEL[kindOf(h.to)] + '.', async () => {
|
|
76
|
+
const u = await h.pmPost('/api/initiatives/kind', { ws: h.ws || undefined, id: h.id, kind: back }).catch(() => null);
|
|
77
|
+
if (u && u.ok && h.apply) h.apply(back);
|
|
78
|
+
if (h.reload) await h.reload();
|
|
79
|
+
});
|
|
80
|
+
if (h.reload) await h.reload();
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"product-list-linked.test.js",
|
|
64
64
|
"briefing-premium-sources.test.js",
|
|
65
65
|
"briefing-premium-drafts.test.js",
|
|
66
|
-
"agent-inbox.test.js",
|
|
66
|
+
"agent-inbox.test.js", "kind-of-work.test.js",
|
|
67
67
|
"session-rail.test.js",
|
|
68
68
|
"briefing-premium-metrics.test.js",
|
|
69
69
|
"trends-review.test.js",
|