create-pmos 0.610.0 → 0.612.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 +135 -27
- package/payload/KIT-VERSION +2 -2
- 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/payload/state/log.md +1 -1
- package/workspace/board-columns-test.js +2 -1
- package/workspace/board-deliveries-test.js +2 -1
- package/workspace/board-programs-test.js +7 -3
- package/workspace/board-publish-ui-test.js +2 -1
- package/workspace/board-shared-ui-test.js +2 -1
- package/workspace/board-workflows-test.js +2 -1
- package/workspace/briefing-premium-board-test.js +3 -2
- package/workspace/briefing-premium-calendar-2-test.js +3 -2
- package/workspace/briefing-premium-calendar-3-test.js +1 -1
- package/workspace/briefing-premium-calendar-test.js +1 -1
- package/workspace/briefing-premium-doc-edit-test.js +2 -1
- package/workspace/briefing-premium-insights-test.js +4 -3
- package/workspace/briefing-premium-test.js +3 -2
- package/workspace/calm-timeline-test.js +2 -1
- package/workspace/changelog.json +134 -0
- package/workspace/core-docs-workflow-test.js +2 -1
- package/workspace/ev-everywhere-test.js +3 -2
- package/workspace/guide/home.md +2 -2
- package/workspace/guide/index.md +4 -0
- package/workspace/guide/layout.md +97 -3
- package/workspace/guide/programs.md +16 -2
- package/workspace/guide/routine.md +65 -0
- package/workspace/guide/scheduled-tasks-and-cli.md +1 -1
- package/workspace/guide/settings-and-switches.md +2 -2
- package/workspace/impact-screens-test.js +3 -1
- package/workspace/ini-workflow-test.js +2 -1
- package/workspace/lib/board-premium.js +12 -4
- package/workspace/lib/classic-board.js +15 -0
- package/workspace/lib/cos-chat.js +1 -0
- package/workspace/lib/doc-library.js +43 -12
- package/workspace/lib/doc-path.js +30 -0
- package/workspace/lib/engine/boards.js +4 -2
- package/workspace/lib/events-place.js +368 -0
- package/workspace/lib/events-stated.js +129 -0
- package/workspace/lib/initiative-chat.js +1 -0
- package/workspace/lib/insights-premium.js +13 -1
- package/workspace/lib/library-find.js +162 -0
- package/workspace/lib/library-items.js +250 -0
- package/workspace/lib/notes.js +9 -1
- package/workspace/lib/plan-items.js +17 -3
- package/workspace/lib/route-modules.js +4 -0
- package/workspace/lib/routes-artefacts.js +5 -2
- package/workspace/lib/routes-boards.js +6 -2
- package/workspace/lib/routes-doc-sheet.js +1 -0
- package/workspace/lib/routes-events-place.js +203 -0
- package/workspace/lib/routes-library.js +155 -0
- package/workspace/lib/routes-pop-work.js +39 -0
- package/workspace/lib/routes-report-setups.js +32 -1
- package/workspace/lib/routes-today-log.js +48 -0
- package/workspace/lib/routine-reports.js +84 -0
- package/workspace/lib/status-when.js +36 -0
- package/workspace/lib/task-items.js +5 -3
- package/workspace/lib/today-log.js +131 -0
- package/workspace/live-pill-round-test.js +10 -7
- package/workspace/metric-drafts-ui-test.js +3 -1
- package/workspace/milestone-pins-test.js +2 -1
- package/workspace/milestone-suggest-test.js +3 -1
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/panels-test.js +2 -1
- package/workspace/premium-board-actions-test.js +3 -1
- package/workspace/premium-rec-tab-test.js +2 -1
- package/workspace/premium-vw-backlog-test.js +3 -1
- package/workspace/premium-vw-item-test.js +3 -1
- package/workspace/premium-vw-jira-test.js +3 -1
- package/workspace/premium-vw-meet-test.js +2 -1
- package/workspace/premium-vw-notes-test.js +3 -2
- package/workspace/product-lane-test.js +2 -1
- package/workspace/program-charter-test.js +3 -1
- package/workspace/program-leave-test.js +2 -1
- package/workspace/program-order-test.js +2 -1
- package/workspace/program-panel-test.js +3 -1
- package/workspace/public/pm/artefact-kind.js +87 -0
- package/workspace/public/pm/bd-ini-panel.js +77 -12
- package/workspace/public/pm/bd-prog-panel.js +55 -8
- package/workspace/public/pm/bd-span.js +5 -0
- package/workspace/public/pm/bd-work.css +192 -0
- package/workspace/public/pm/bd-work.js +483 -0
- package/workspace/public/pm/cozy-bar.css +11 -0
- package/workspace/public/pm/cozy-bar.js +99 -0
- package/workspace/public/pm/cozy-day-pick.css +27 -0
- package/workspace/public/pm/cozy-day-pick.js +97 -0
- package/workspace/public/pm/cozy-ev.css +2 -5
- package/workspace/public/pm/cozy-events-view.js +274 -0
- package/workspace/public/pm/cozy-events.css +179 -0
- package/workspace/public/pm/cozy-events.js +278 -0
- package/workspace/public/pm/cozy-evmodel.js +1 -1
- package/workspace/public/pm/cozy-goals.css +172 -0
- package/workspace/public/pm/cozy-library.css +125 -0
- package/workspace/public/pm/cozy-live-pill.js +1 -0
- package/workspace/public/pm/cozy-nav.js +6 -7
- package/workspace/public/pm/cozy-pick.css +3 -0
- package/workspace/public/pm/cozy-pop-work.css +224 -0
- package/workspace/public/pm/cozy-pop-work.js +668 -0
- package/workspace/public/pm/cozy-popup.css +11 -2
- package/workspace/public/pm/cozy-popup.js +67 -9
- package/workspace/public/pm/cozy-routine-job.js +203 -0
- package/workspace/public/pm/cozy-routine-model.js +219 -0
- package/workspace/public/pm/cozy-routine-pop.js +318 -0
- package/workspace/public/pm/cozy-routine.css +155 -0
- package/workspace/public/pm/cozy-routine.js +335 -0
- package/workspace/public/pm/cozy-schedwork.js +6 -5
- package/workspace/public/pm/cozy-settings.js +1 -5
- package/workspace/public/pm/cozy-status-when.js +48 -0
- package/workspace/public/pm/cozy-today-app.js +236 -0
- package/workspace/public/pm/cozy-today-model.js +176 -0
- package/workspace/public/pm/cozy-today-page.css +100 -0
- package/workspace/public/pm/cozy-today-view.js +76 -0
- package/workspace/public/pm/cozy-viewer.js +19 -8
- package/workspace/public/pm/cozy-vw-mtg.css +39 -0
- package/workspace/public/pm/goals-model.js +205 -0
- package/workspace/public/pm/goals-open.js +124 -0
- package/workspace/public/pm/home-app.js +18 -3
- package/workspace/public/pm/home-chat.js +4 -2
- package/workspace/public/pm/home-ini.js +43 -10
- package/workspace/public/pm/ini-edit.js +3 -1
- package/workspace/public/pm/ini-view-model.js +1 -1
- package/workspace/public/pm/library-model.js +197 -0
- package/workspace/public/pm/library-open.js +37 -0
- package/workspace/public/pm/page-chat.js +12 -2
- package/workspace/public/pm/pop-work-model.js +493 -0
- package/workspace/public/pm/premium-board.js +204 -17
- package/workspace/public/pm/premium-goals.js +213 -0
- package/workspace/public/pm/premium-library.js +436 -0
- package/workspace/public/pm/premium-shell.js +1 -1
- package/workspace/public/pm/premium-vw-mtg.js +79 -1
- package/workspace/public/pm/scope-chip.js +204 -0
- package/workspace/public/premium-board.html +1 -0
- package/workspace/public/premium-events.html +44 -0
- package/workspace/public/premium-goals.html +37 -0
- package/workspace/public/premium-library.html +39 -0
- package/workspace/public/premium-routine.html +33 -0
- package/workspace/public/today.html +50 -0
- package/workspace/ready-dash-ui-test.js +3 -1
- package/workspace/rename-test.js +2 -1
- package/workspace/run-tests.js +4 -1
- package/workspace/server.js +4 -2
- package/workspace/sort-order-test.js +2 -1
- package/workspace/split-merge-ui-test.js +3 -1
- package/workspace/stage-card-tasks-test.js +3 -1
- package/workspace/stage-card-test.js +2 -1
- package/workspace/task-delete-test.js +2 -1
- package/workspace/task-links-test.js +2 -1
- package/workspace/task-milestones-test.js +4 -2
- package/workspace/task-plans-test.js +3 -1
- package/workspace/task-press-test.js +3 -1
- package/workspace/task-views-test.js +3 -1
- package/workspace/test-lists/doc-path.json +9 -0
- package/workspace/test-lists/events-place.json +11 -0
- package/workspace/test-lists/goals-place.json +9 -0
- package/workspace/test-lists/library-place.json +9 -0
- package/workspace/test-lists/pop-work.json +9 -0
- package/workspace/test-lists/routine-place.json +9 -0
- package/workspace/test-lists/status-when.json +9 -0
- package/workspace/test-lists/today-log.json +9 -0
- package/workspace/test-lists/work-view.json +9 -0
- package/workspace/timeline-holds-test.js +3 -1
- package/workspace/tk-tasks-test.js +2 -1
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/* pm/cozy-today-view.js — Today, the markup (slice 5 of the six-place navigation; board 1 on Exploring 2; initiative today-log-page).
|
|
2
|
+
* Pure: it turns pm/cozy-today-model.js into HTML, and Node imports it (today-log.test.js). home-app.js draws it into #tdPage on today.html
|
|
3
|
+
* and handles every press (data-td="…").
|
|
4
|
+
*
|
|
5
|
+
* One page, no views (one container rule): the title and the quiet count line sit on the panel; Today's log is one card with a thin
|
|
6
|
+
* border; today's agenda is one grey box on the right.
|
|
7
|
+
* The first line captures a task, an event or a note. Enter only adds the row: it opens no popup and starts no session.
|
|
8
|
+
* A row: "!" when it comes first, its bullet (• task, ○ event, – note, × done, ✦ a PMOS suggestion), What, Work, Job, When, and on
|
|
9
|
+
* hover or focus three plain icons: done, move to tomorrow, set a date. A Lab finding has ✓ (keep: start an initiative) and ✕ (drop).
|
|
10
|
+
* Carried too long, a ✦ line under the row: PMOS suggests to drop it, ✓ ✕.
|
|
11
|
+
* Press a row or an agenda event: the popup on its work (home-app.js).
|
|
12
|
+
* Every icon-only button has an aria-label. The UI says PMOS. Text from records goes through esc(). */
|
|
13
|
+
|
|
14
|
+
export const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
15
|
+
const svg = (d, w = 15, sw = 1.9) => `<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>`;
|
|
16
|
+
export const I = {
|
|
17
|
+
done: 'M5 12.5l4.5 4.5L19 7.5', tomorrow: 'M5 12h14M13 6l6 6-6 6', date: 'M4 5.5h16v14H4zM4 10h16M8.5 3.5v4M15.5 3.5v4', plus: 'M12 6v12M6 12h12',
|
|
18
|
+
yes: 'M5 12.5l4.5 4.5L19 7.5', no: 'M6 6l12 12M18 6L6 18', cal: 'M4 5.5h16v14H4zM4 10h16M8.5 3.5v4M15.5 3.5v4',
|
|
19
|
+
};
|
|
20
|
+
const BULLET = { task: ['•', 'Task'], event: ['○', 'Event'], note: ['–', 'Note'], lab: ['✦', 'PMOS suggests'] };
|
|
21
|
+
const ib = (act, label, d, key, extra = '') => `<button type="button" class="td-ib" data-td="${act}" data-key="${esc(key)}" aria-label="${esc(label)}" title="${esc(label)}"${extra}>${svg(d)}</button>`;
|
|
22
|
+
|
|
23
|
+
/** One row of the log. */
|
|
24
|
+
export function rowHtml(r) {
|
|
25
|
+
const [b, bl] = r.done ? ['×', 'Done'] : BULLET[r.bullet] || BULLET.task;
|
|
26
|
+
const acts = r.done ? '' : r.src === 'lab'
|
|
27
|
+
? ib('lab-keep', 'Keep it: start an initiative from ' + r.title, I.yes, r.key) + ib('lab-drop', 'Drop it: ' + r.title, I.no, r.key)
|
|
28
|
+
: ib('done', 'Done: ' + r.title, I.done, r.key) + ib('tomorrow', 'Move to tomorrow: ' + r.title, I.tomorrow, r.key) + ib('date', 'Set a date: ' + r.title, I.date, r.key, ' aria-haspopup="dialog"');
|
|
29
|
+
const cls = ['td-r', r.done ? 'done' : '', r.bullet === 'note' ? 'note' : '', r.src === 'lab' ? 'lab' : ''].filter(Boolean).join(' ');
|
|
30
|
+
// a note, an own event and a done row open nothing: their words are the whole of it
|
|
31
|
+
const opens = !r.done && r.src !== 'own' && r.src !== 'gone';
|
|
32
|
+
const title = opens ? `<button type="button" class="td-t" data-td="open" data-key="${esc(r.key)}">${esc(r.title)}</button>` : `<span class="td-t">${esc(r.title)}</span>`;
|
|
33
|
+
const sug = r.drop ? `<div class="td-sg" role="group" aria-label="PMOS suggests"><b aria-hidden="true">✦</b><span>Carried ${esc(r.carried)} days. PMOS suggests: drop it from your log.</span>`
|
|
34
|
+
+ ib('drop', 'Drop it', I.yes, r.key) + ib('keep', 'Keep it', I.no, r.key) + '</div>' : '';
|
|
35
|
+
const why = r.src === 'lab' && r.why ? `<div class="td-sg lab"><span>${esc(r.why)}</span></div>` : '';
|
|
36
|
+
return `<div class="${cls}" data-key="${esc(r.key)}" role="row"><span class="td-p" role="cell">${r.first && !r.done ? '<b aria-label="First">!</b>' : ''}</span>`
|
|
37
|
+
+ `<span class="td-b" role="cell"><i role="img" aria-label="${esc(bl)}">${b}</i></span><span role="cell" class="td-wt">${title}</span>`
|
|
38
|
+
+ `<span class="td-w" role="cell">${esc(r.work)}</span><span class="td-k" role="cell">${esc(r.job)}</span>`
|
|
39
|
+
+ `<span class="td-d${r.late && !r.done ? ' late' : ''}" role="cell">${esc(r.when)}</span><span class="td-a" role="cell">${acts}</span>${sug}${why}</div>`;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Today's log: the title and its count line, the capture line, the one card. L: logModel(). o: { news: N new for you, draft: the line being typed } */
|
|
43
|
+
export function logHtml(L, o = {}) {
|
|
44
|
+
const head = `<div class="td-h"><h2>Today’s log</h2>${L.line ? `<span class="td-sum">${esc(L.line)}</span>` : ''}</div>`;
|
|
45
|
+
const cap = `<form class="td-in" id="tdCapF" autocomplete="off"><label class="td-in-l" for="tdCap">${svg(I.plus, 16)}<span class="td-vh">Log a task, an event or a note</span></label>`
|
|
46
|
+
+ `<input id="tdCap" name="line" type="text" maxlength="240" placeholder="Log a task, an event or a note" value="${esc(o.draft || '')}" aria-describedby="tdCapKey" />`
|
|
47
|
+
+ `<span class="td-key" id="tdCapKey" aria-label="Start with o for an event, a dash for a note, ! for first">•<em>task</em>o<em>event</em>–<em>note</em>!<em>first</em></span></form>`;
|
|
48
|
+
const rows = L.rows.length ? L.rows.map(rowHtml).join('') : '';
|
|
49
|
+
const table = rows ? `<div class="td-tt" role="table" aria-label="Today’s log"><div class="td-r td-hd" role="row"><span role="columnheader"></span><span role="columnheader"><span class="td-vh">Bullet</span></span><span role="columnheader">What</span><span role="columnheader">Work</span><span role="columnheader">Job</span><span role="columnheader">When</span><span role="columnheader"><span class="td-vh">Actions</span></span></div>${rows}</div>`
|
|
50
|
+
: '<p class="td-none">Nothing waits on you today.</p>';
|
|
51
|
+
const news = o.news > 0 ? `<button type="button" class="td-more" data-td="news">${esc(o.news)} new for you</button>` : '';
|
|
52
|
+
return `<section class="td-log" aria-label="Today’s log">${head}${cap}${table}${news}</section>`;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** Today's agenda in one grey box: the hours, the meetings and the PM's own events, the line for now. A: agendaModel(). */
|
|
56
|
+
export function agendaHtml(A) {
|
|
57
|
+
const PX = 56;
|
|
58
|
+
const hours = [];
|
|
59
|
+
for (let h = A.from; h <= A.to; h += 2) hours.push(`<span class="td-hr" style="--y:${(h - A.from) * PX}px">${String(h).padStart(2, '0')}:00</span>`);
|
|
60
|
+
const ev = A.items.map((x) => {
|
|
61
|
+
const short = x.h * PX < 46; // a short slot says its time and title on one line
|
|
62
|
+
const st = `--y:${Math.round(x.top * PX) + 1}px;--h:${Math.max(30, Math.round(x.h * PX) - 3)}px`;
|
|
63
|
+
const cls = ['td-ev', x.kind, short ? 'short' : '', x.past ? 'past' : '', x.nowOn ? 'on' : ''].filter(Boolean).join(' ');
|
|
64
|
+
const label = x.title + ', ' + x.sub;
|
|
65
|
+
return x.kind === 'own' ? `<div class="${cls}" style="${st}" aria-label="${esc(label)}"><b>${esc(x.title)}</b><small>${esc(x.sub)}</small></div>`
|
|
66
|
+
: `<button type="button" class="${cls}" style="${st}" data-td="ev" data-key="${esc(x.key)}" aria-label="${esc(label)}"><b>${esc(x.title)}</b><small>${esc(x.sub)}</small></button>`;
|
|
67
|
+
}).join('');
|
|
68
|
+
const nowLine = A.now != null ? `<i class="td-now" style="--y:${Math.round(A.now * PX)}px" aria-hidden="true"></i>` : '';
|
|
69
|
+
const grid = A.empty ? '<p class="td-none">No meeting today.</p>'
|
|
70
|
+
: `<div class="td-tl" style="--rows:${A.to - A.from};--px:${PX}px">${hours.join('')}${ev}${nowLine}</div>`;
|
|
71
|
+
return `<aside class="td-ag" aria-label="Today’s agenda"><div class="td-agh"><h2>Today</h2><small>${esc(A.sub)}</small>`
|
|
72
|
+
+ `<button type="button" class="td-ib" data-td="cal" aria-label="Open the calendar" title="Open the calendar">${svg(I.cal, 16)}</button></div>${grid}</aside>`;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** The whole page. */
|
|
76
|
+
export function pageHtml(L, A, o = {}) { return `<div class="td">${logHtml(L, o)}${agendaHtml(A)}</div>`; }
|
|
@@ -28,6 +28,8 @@
|
|
|
28
28
|
* cancels, an empty or unchanged name saves nothing. jira draws "Rename the Jira … too" under the field, off by default.
|
|
29
29
|
* The caller writes the record and says "Renamed" with Undo; the header shows the saved name at once.
|
|
30
30
|
* true goes to Home with ?about=<kind>:<id>&label=<title>; { href } goes there; fn() runs instead.
|
|
31
|
+
* from the page the item was opened from ('Library', 'Routine'): in the popup the header reads ← and "from › title"; both close to the page
|
|
32
|
+
* kindChip the small kind chip after the title in the popup ('Meeting notes', 'Report', 'Prototype')
|
|
31
33
|
* back true: keep the item shown now, so ← comes back to it. Without back, opening an item forgets what was behind it.
|
|
32
34
|
* keep true: this item takes the place of the one shown now, and what was behind that one stays behind this one (a view switch)
|
|
33
35
|
* add { label, on(button) }: a quiet + before ⋯ (Home's "New session" on an initiative, canvas HbC). Not drawn on a phone.
|
|
@@ -192,24 +194,31 @@ export function headHtml(it) {
|
|
|
192
194
|
const kind = o.kind && !sameAs(o.kind, o.title) ? `<p class="cz-vw-kind">${esc(o.kind)}</p>` : '';
|
|
193
195
|
const disc = o.discuss && !o.pop && (!o.home || o.discussHome) ? ib('discuss', 'Discuss in chat', P.chat) : ''; // in the popup the chat is beside it
|
|
194
196
|
// a press marked menu (the initiative's Dashboard, batch 18 item 1) goes into ⋯ on a phone, so the title keeps the room
|
|
195
|
-
|
|
197
|
+
// in the popup the work side's header is the title and ⋯ only (board 20): its quiet icon presses go into ⋯; a solid primary stays
|
|
198
|
+
const toMenu = (x) => (phone && x.menu) || (o.pop && !x.solid);
|
|
199
|
+
const inMenu = (o.presses || []).some((x) => x && x.act && x.label && toMenu(x));
|
|
196
200
|
const more = inMenu || typeof o.more === 'function' || (Array.isArray(o.more) && o.more.some((m) => m && !m.sep)) || o.url ? ib('more', 'More', P.more, ' aria-haspopup="menu" aria-expanded="false"') : '';
|
|
197
201
|
const add = o.add && o.add.label && !phone ? ib('add', o.add.label, P.add) : '';
|
|
198
202
|
const pressHtml = (x) => (x.solid
|
|
199
203
|
? `<button type="button" class="cz-vw-pri${x.text && !phone ? '' : ' i'}${x.blue ? ' blue' : ''}" data-cz-vw="press" data-cz-vw-p="${esc(x.act)}" aria-label="${esc(x.label)}" title="${esc(x.label)}">${svg(path(x.icon), 15, 2.2)}${x.text && !phone ? `<span>${esc(x.text)}</span>` : ''}</button>`
|
|
200
204
|
: `<button type="button" class="cz-vw-ib" data-cz-vw="press" data-cz-vw-p="${esc(x.act)}" aria-label="${esc(x.label)}" title="${esc(x.label)}"${x.pressed != null ? ` aria-pressed="${x.pressed ? 'true' : 'false'}"` : ''}${x.lead ? ' aria-haspopup="menu"' : ''}>${svg(path(x.icon), 18)}</button>`);
|
|
201
|
-
const shown = (o.presses || []).filter((x) => x && x.act && x.label && !(
|
|
205
|
+
const shown = (o.presses || []).filter((x) => x && x.act && x.label && !toMenu(x));
|
|
202
206
|
// lead: a press that stands before Discuss (the initiative's kind of work, batch 29 item 11, KdV1-3)
|
|
203
207
|
const lead = shown.filter((x) => x.lead).map(pressHtml).join(''), own = shown.filter((x) => !x.lead).map(pressHtml).join('');
|
|
204
208
|
const sub = o.sub ? `<p class="cz-vw-sub">${esc(o.sub)}</p>` : '';
|
|
205
209
|
// the popup's path (board 22: initiative › suggestion): each step behind is a press that goes back to it
|
|
206
|
-
|
|
210
|
+
// from: the page the item was opened from (Library, Routine; board 34): its name is the path's first step, and it closes back to the page
|
|
211
|
+
const from = o.pop && o.from ? `<button type="button" data-cz-vw-path="from">${esc(o.from)}</button><span aria-hidden="true">›</span>` : '';
|
|
212
|
+
const pth = o.pop && ((o.path || []).length || from) ? `<nav class="cz-vw-path" aria-label="Path">${from}${(o.path || []).map((t, i, a) => `<button type="button" data-cz-vw-path="${i - a.length}">${esc(t || 'Back')}</button><span aria-hidden="true">›</span>`).join('')}</nav>` : '';
|
|
213
|
+
// kindChip: the small kind chip after the title in the popup (Meeting notes, Report, Prototype)
|
|
214
|
+
const kchip = o.pop && o.kindChip ? `<span class="cz-vw-kchip">${esc(o.kindChip)}</span>` : '';
|
|
207
215
|
const chip = o.chip && (o.chip.n > 0 || o.chip.looking) ? `<button type="button" class="cz-vw-chip${o.chip.looking ? ' live' : ''}" data-cz-vw="chip" aria-haspopup="dialog" aria-label="${esc(o.chip.label || 'PMOS proposes ' + o.chip.n + '. Open')}" title="${esc(o.chip.label || 'PMOS proposes')}">${svg(ICONS.spark, 13, 2)}${o.chip.n > 0 && !o.chip.quiet ? `<b>${esc(o.chip.n)}</b>` : ''}</button>` : '';
|
|
208
|
-
|
|
216
|
+
const canBack = o.canBack || !!from;
|
|
217
|
+
return (canBack || phone ? ib('back', o.canBack ? (o.backTo ? 'Back to ' + o.backTo : 'Back') : from ? 'Back to ' + o.from : 'Close the viewer', P.back) : '')
|
|
209
218
|
+ (o.fwdTo ? ib('fwd', 'Forward to ' + o.fwdTo, P.fwd) : '')
|
|
210
219
|
+ (o.check ? `<button type="button" class="cz-vw-tile cz-vw-chk s-${esc(o.check.state || 'todo')}" data-cz-vw="press" data-cz-vw-p="check" aria-label="${esc(o.check.label || 'Mark done')}" title="${esc(o.check.title || o.check.label || 'Mark done')}"${o.check.disabled ? ' disabled' : ''}><span class="bx"></span></button>`
|
|
211
220
|
: `<span class="cz-vw-tile" aria-hidden="true">${svg(path(o.icon), 17)}</span>`)
|
|
212
|
-
+ (o.renaming ? renHtml(o) : `<div class="cz-vw-t">${pth || kind}<h3 class="cz-vw-title${chip ? ' has-chip' : ''}${o.wrap ? ' wrap' : ''}" id="czVwTitle">${o.rename ? `<button type="button" class="cz-vw-rn" data-cz-vw-rn aria-label="${esc('Rename ' + (o.title || ''))}" title="Rename">${esc(o.title || '')}</button>` : chip ? `<span class="cz-vw-tt">${esc(o.title || '')}</span>` : esc(o.title || '')}${chip}</h3>${sub}</div>`)
|
|
221
|
+
+ (o.renaming ? renHtml(o) : `<div class="cz-vw-t">${pth || kind}<h3 class="cz-vw-title${chip ? ' has-chip' : ''}${o.wrap ? ' wrap' : ''}" id="czVwTitle">${o.rename ? `<button type="button" class="cz-vw-rn" data-cz-vw-rn aria-label="${esc('Rename ' + (o.title || ''))}" title="Rename">${esc(o.title || '')}</button>` : chip ? `<span class="cz-vw-tt">${esc(o.title || '')}</span>` : esc(o.title || '')}${chip}</h3>${kchip}${sub}</div>`)
|
|
213
222
|
+ lead + disc + own + add + more
|
|
214
223
|
// ⧉ (batch 18 item 15, TbT7Place): where a page arranges panels, one placement press takes the place of ⤢ (Full screen is in it)
|
|
215
224
|
+ (phone || o.pop ? '' : o.place ? ib('place', 'Arrange', P.place, ' aria-haspopup="menu" aria-expanded="false"')
|
|
@@ -434,7 +443,7 @@ function moreMenu(b) {
|
|
|
434
443
|
if (old) { old.remove(); b.setAttribute('aria-expanded', 'false'); return; }
|
|
435
444
|
const items = ((typeof V.cur.more === 'function' ? V.cur.more() : V.cur.more) || []).filter(Boolean).slice(); // a function is asked each time ⋯ opens, so its notes are current
|
|
436
445
|
// on a phone the presses marked menu lead the menu (they left the header)
|
|
437
|
-
if (V.ph) { const mp = (V.cur.presses || []).filter((x) => x && x.
|
|
446
|
+
if (V.ph || V.pop) { const mp = (V.cur.presses || []).filter((x) => x && x.act && x.label && (V.ph ? x.menu : !x.solid)); if (mp.length) items.unshift(...mp.map((x) => ({ label: x.label, icon: x.icon, on: () => { if (typeof V.cur.onPress === 'function') V.cur.onPress(x.act, b); } })), { sep: true }); }
|
|
438
447
|
if (V.cur.url) { // the item's own address looks back, so it goes before the red stop-or-remove group, which stays last
|
|
439
448
|
const at = items.findIndex((x) => x && x.danger), tab = { label: V.cur.full ? 'Open in full' : 'Open in a new tab', on: () => window.open(V.cur.url, '_blank', 'noopener') };
|
|
440
449
|
if (at < 0) items.push({ sep: true }, tab); else items.splice(at > 0 && items[at - 1].sep ? at - 1 : at, 0, { sep: true }, tab);
|
|
@@ -493,7 +502,7 @@ function mount() {
|
|
|
493
502
|
use(x);
|
|
494
503
|
const f = e.target.closest('[data-czs-fold]'); if (f && el.contains(f)) { toggleFold(f); return; }
|
|
495
504
|
if (e.target.closest('[data-cz-vw-rn]')) { startRename(); return; } // the title is the rename press (RnATask)
|
|
496
|
-
const pa = e.target.closest('[data-cz-vw-path]'); if (pa) { const n = +pa.dataset.czVwPath; guarded(() => step(n), pa); return; } // the popup's path
|
|
505
|
+
const pa = e.target.closest('[data-cz-vw-path]'); if (pa) { if (pa.dataset.czVwPath === 'from') { guarded(() => close(), pa); return; } const n = +pa.dataset.czVwPath; guarded(() => step(n), pa); return; } // the popup's path
|
|
497
506
|
const b = e.target.closest('[data-cz-vw]'); if (!b || b.disabled || !el.querySelector('.cz-vw-hd').contains(b)) return;
|
|
498
507
|
const a = b.dataset.czVw;
|
|
499
508
|
if (a === 'close') guarded(close, b);
|
|
@@ -615,6 +624,8 @@ export function open(it) {
|
|
|
615
624
|
// pop (the popup, slice 2): on a desk the item goes in the popup's own Viewer, and the popup shows the chat about pop beside it
|
|
616
625
|
const pn = !o._inst && G.popNext && Date.now() - G.popNext.t < 8000 ? G.popNext : null; if (pn) G.popNext = null; // popNext(): this open pops
|
|
617
626
|
const popArg = o.pop || (pn && pn.pop);
|
|
627
|
+
// the header's from and kindChip may come with the pending popNext(about) (Library's POP.openWork), so no opener has to pass them
|
|
628
|
+
if (pn && pn.pop && typeof pn.pop === 'object' && (pn.pop.from || pn.pop.kindChip) && !o.from && !o.kindChip) o = { ...o, from: pn.pop.from || '', kindChip: pn.pop.kindChip || '' };
|
|
618
629
|
// a published read-only Board has no chat; 'beside' (the PM's choice, cozy-popup.js) keeps work beside the page, unless the popup shows
|
|
619
630
|
// already (it takes what opens next) or the open is the chat icon's own (force)
|
|
620
631
|
const toPop = !o._inst && !!popArg && !!G.popH && !isPhone() && !window.PMOS_READONLY && (!!popArg.force || popShown() || !popBeside());
|
|
@@ -648,7 +659,7 @@ export function open(it) {
|
|
|
648
659
|
V.drill = false; H.adopt = false;
|
|
649
660
|
const sameKind = V.cur && kindKey(V.cur.kind) === kindKey(o.kind);
|
|
650
661
|
leave();
|
|
651
|
-
V.cur = { id: o.id == null ? null : String(o.id), kind: o.kind || '', title: o.title || '', icon: o.icon, url: o.url || '', full: !!o.full, onClose: o.onClose, more: o.more, discuss: o.discuss, discussHome: !!o.discussHome, add: o.add || null, sub: o.sub || '', check: o.check || null, presses: o.presses || null, wrap: !!o.wrap, chip: o.chip && (o.chip.n > 0 || o.chip.looking) ? o.chip : null, onPress: o.onPress, guard: o.guard, rename: o.rename && typeof o.rename.save === 'function' ? o.rename : null, args: o };
|
|
662
|
+
V.cur = { id: o.id == null ? null : String(o.id), kind: o.kind || '', title: o.title || '', icon: o.icon, url: o.url || '', full: !!o.full, onClose: o.onClose, more: o.more, discuss: o.discuss, discussHome: !!o.discussHome, add: o.add || null, sub: o.sub || '', check: o.check || null, presses: o.presses || null, wrap: !!o.wrap, chip: o.chip && (o.chip.n > 0 || o.chip.looking) ? o.chip : null, onPress: o.onPress, guard: o.guard, rename: o.rename && typeof o.rename.save === 'function' ? o.rename : null, from: o.from || '', kindChip: o.kindChip || '', args: o };
|
|
652
663
|
el.setAttribute('aria-label', 'Viewer: ' + (o.kind || o.title || 'item'));
|
|
653
664
|
redraw();
|
|
654
665
|
el.querySelectorAll('.cz-vw-menu,.cz-vw-trail').forEach((m) => m.remove());
|
|
@@ -533,3 +533,42 @@
|
|
|
533
533
|
/* the meeting share popover (shareable-meeting-notes): on a cozy page that does not load premium.css or cozy-viewer.css (premium-viewer.html), it names the cozy tokens itself. It lives here, not in premium-vw-doc.css, because the console type check (premium-console-type S1) would turn --sans and --mono back to the console fonts */
|
|
534
534
|
.cz-vw-hd > .vwshp{--hair:var(--cz-hair);--ink:var(--cz-ink);--ink-2:var(--cz-ink2);--ink-3:var(--cz-ink3);--ember:var(--cz-blue);--card:var(--cz-card);--card-solid:var(--cz-card);
|
|
535
535
|
--well:var(--cz-well);--ok:var(--cz-ok);--bad:var(--cz-red);--sans:var(--cz-sans);--mono:var(--cz-mono);--card-shadow:var(--cz-lift);border-radius:18px;padding:10px;max-height:calc(100dvh - 140px);overflow:auto}
|
|
536
|
+
|
|
537
|
+
/* a held meeting's notes, one view from every place (board 34, StLibMeetingOpen; Library audit item 6) */
|
|
538
|
+
.vzh-w { display: grid; grid-template-columns: minmax(0, 1fr) 300px; column-gap: 22px; align-items: start; }
|
|
539
|
+
.vzh-o { padding: 4px 2px 24px; font-size: var(--fs-body); line-height: var(--lh-body); color: var(--cz-ink); }
|
|
540
|
+
.vzh-o p { margin: 0 0 6px; }
|
|
541
|
+
.vzh-o h6 { margin: 20px 0 4px; font-size: var(--fs-label); font-weight: var(--fw-strong); line-height: var(--lh-label); color: var(--cz-ink2); }
|
|
542
|
+
.vzh-o ul { margin: 0; padding-left: 18px; }
|
|
543
|
+
.vzh-o li + li { margin-top: 3px; }
|
|
544
|
+
.vzh-t { border-radius: 12px; box-shadow: inset 0 0 0 1px var(--cz-hair); overflow: hidden; }
|
|
545
|
+
.vzh-r { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0 12px; border: 0; background: none; text-align: left; font: inherit; color: inherit; cursor: pointer; }
|
|
546
|
+
.vzh-r:disabled { cursor: default; }
|
|
547
|
+
.vzh-r + .vzh-r { box-shadow: inset 0 1px 0 var(--cz-hair); }
|
|
548
|
+
.vzh-r:not(:disabled):hover { background: var(--cz-well); }
|
|
549
|
+
.vzh-r i { width: 7px; height: 7px; border-radius: 50%; background: var(--cz-ink); flex: 0 0 auto; }
|
|
550
|
+
.vzh-r span { flex: 1 1 0%; min-width: 0; }
|
|
551
|
+
.vzh-r em { font-style: normal; font-size: var(--fs-meta); line-height: var(--lh-meta); color: var(--cz-ink3); white-space: nowrap; }
|
|
552
|
+
.vzh-sg { margin: 16px 0; border-radius: 12px; background: var(--cz-card); box-shadow: inset 0 0 0 1px var(--cz-hair); padding: 8px 12px; }
|
|
553
|
+
.vzh-sg .vzh-sgh { margin: 0 0 2px; font-size: var(--fs-badge); font-weight: var(--fw-strong); line-height: var(--lh-badge); color: var(--cz-blueink); }
|
|
554
|
+
.vzh-sg div { display: flex; align-items: center; gap: 8px; font-size: var(--fs-meta); line-height: var(--lh-meta); }
|
|
555
|
+
.vzh-sg div span { flex: 1 1 0%; min-width: 0; }
|
|
556
|
+
.vzh-sg button { flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; border: 0; background: var(--cz-card); box-shadow: inset 0 0 0 1px var(--cz-hair); color: var(--cz-ink); cursor: pointer; font-size: var(--fs-meta); }
|
|
557
|
+
.vzh-sg button.y { background: var(--cz-solid); color: var(--cz-onsolid); box-shadow: none; }
|
|
558
|
+
.vzh-s { border-radius: 16px; background: var(--cz-well); padding: 12px 14px 14px; font-size: var(--fs-meta); line-height: var(--lh-meta); color: var(--cz-ink); }
|
|
559
|
+
.vzh-s h6 { margin: 4px 2px; font-size: var(--fs-badge); font-weight: var(--fw-strong); line-height: var(--lh-badge); color: var(--cz-ink3); }
|
|
560
|
+
.vzh-s .r { display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 2px; box-shadow: inset 0 1px 0 var(--cz-hair); }
|
|
561
|
+
.vzh-s h6 + .r { box-shadow: none; }
|
|
562
|
+
.vzh-s .r span { flex: 1 1 0%; min-width: 0; color: var(--cz-ink2); }
|
|
563
|
+
.vzh-s .r em { font-style: normal; text-align: right; }
|
|
564
|
+
.vzh-s .vzh-sel { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: 0; border-radius: 999px; background: var(--cz-card); font: inherit; font-weight: var(--fw-strong); white-space: nowrap; color: var(--cz-ink); cursor: pointer; }
|
|
565
|
+
.vzh-s .vzh-sel svg { fill: none; stroke: currentColor; stroke-width: 2; }
|
|
566
|
+
.vzh-s .r .vzh-sel svg[width="12"] { fill: currentColor; stroke: none; }
|
|
567
|
+
.vzh-s p { margin: 12px 2px 0; color: var(--cz-ink3); }
|
|
568
|
+
.vzh-s .vzh-more { margin: 8px 2px 0; }
|
|
569
|
+
.vzh-back { margin: 0 0 8px; }
|
|
570
|
+
@media (max-width: 760px) { .vzh-w { grid-template-columns: minmax(0, 1fr); row-gap: 12px; } }
|
|
571
|
+
.vzh-s .vzh-sel { max-width: 190px; }
|
|
572
|
+
.vzh-s .vzh-sel span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
|
|
573
|
+
.vzh-s .vzh-sel svg { flex: 0 0 auto; }
|
|
574
|
+
.vzh-sg button svg { fill: none; stroke: currentColor; stroke-width: 2.2; }
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/* pm/goals-model.js — what Goals shows, from one product's GET /api/insights-premium model (initiative goals-place, slice 9 of the six-place
|
|
2
|
+
* navigation; boards 8, 13, 31, 32 and 33 on Exploring 2, handover /mnt/project-files/goals-handover/). PURE: no DOM, no fetch, no clock of its
|
|
3
|
+
* own; `today` ('YYYY-MM-DD') comes in.
|
|
4
|
+
*
|
|
5
|
+
* periodOf(F) → { label, sub } | null the OKR period chip: "H2 2026", "Jul 1 – Dec 31 · day 141 of 184"
|
|
6
|
+
* northStarOf(model, drafts) → { state: set | draft | none, title, sub, row?, goal? } the card above the table
|
|
7
|
+
* tableOf(model, today, filter) → { objectives, budgets, unlinked, total, shown } the one table: Objective › Key result › Levers › Initiative
|
|
8
|
+
* krPage(model, key, today) → the key result in the popup (board 31) | null
|
|
9
|
+
* setupOf(model, ns) → the setup page (board 32): names to confirm, sources to connect, targets and levers
|
|
10
|
+
* verdictOf(model, id, today) → the verdict page of an outcome (board 33) | null
|
|
11
|
+
* iniItem(r, model, today) → { id, title, line, tone, dm, verdict } one initiative's line in the Initiative column
|
|
12
|
+
* krTokens(tokens) → "KR-A1, A2, A3" · "KR-C1 to C4"
|
|
13
|
+
* FILTERS the filter: All, Slipping, Not read, Read
|
|
14
|
+
*
|
|
15
|
+
* NOTHING HERE MAKES A NUMBER UP (the proven-only rule). A key result with no reading shows "—" and says what it waits on. A target is the KR metric
|
|
16
|
+
* record's target, else the OKR file's own words, else "No target in your OKR file". An objective's name is the file's; a North Star is a kept
|
|
17
|
+
* record or an open PMOS draft, never a guess. Zero is silence: an objective with no key result shown, a budget with no work and an empty Unlinked
|
|
18
|
+
* row are not drawn. */
|
|
19
|
+
|
|
20
|
+
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
21
|
+
const DAY = 864e5;
|
|
22
|
+
const ms = (d) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(d || '')); return m ? Date.UTC(+m[1], +m[2] - 1, +m[3]) : null; };
|
|
23
|
+
export const mdy = (d) => { const t = ms(d); if (t === null) return ''; const x = new Date(t); return MON[x.getUTCMonth()] + ' ' + x.getUTCDate(); };
|
|
24
|
+
/** Whole days from a to b (b − a); null when either is not a day. */
|
|
25
|
+
export const daysTo = (a, b) => { const x = ms(a), y = ms(b); return x === null || y === null ? null : Math.round((y - x) / DAY); };
|
|
26
|
+
const noun = (n, one, many) => n + ' ' + (n === 1 ? one : many);
|
|
27
|
+
|
|
28
|
+
export const FILTERS = Object.freeze([['all', 'All'], ['slip', 'Slipping'], ['unread', 'Not read'], ['read', 'Read']]);
|
|
29
|
+
|
|
30
|
+
/** "O-A" → "Objective A", "O1" → "Objective 1", "Objective 2" stays. */
|
|
31
|
+
export function objLabel(token) {
|
|
32
|
+
const s = String(token || '').trim();
|
|
33
|
+
const m = /^O-?([A-Za-z0-9]+)$/i.exec(s);
|
|
34
|
+
return m ? 'Objective ' + m[1].toUpperCase() : s.replace(/^objective/i, 'Objective');
|
|
35
|
+
}
|
|
36
|
+
/** Key result ids said short: the first in full, the rest without their shared prefix; four or more in a row of one letter say "KR-C1 to C4". */
|
|
37
|
+
export function krTokens(tokens) {
|
|
38
|
+
const T = (tokens || []).filter(Boolean);
|
|
39
|
+
if (!T.length) return '';
|
|
40
|
+
const pre = (t) => (/^(KR-?)(.*)$/i.exec(t) || [null, '', t]);
|
|
41
|
+
const parts = T.map((t) => { const p = pre(t); return { pre: p[1], rest: p[2] }; });
|
|
42
|
+
const run = parts.map((p) => /^([A-Za-z]*)(\d+)$/.exec(p.rest));
|
|
43
|
+
if (T.length >= 4 && run.every((m) => m && m[1] === run[0][1]) && run.every((m, i) => i === 0 || +m[2] === +run[i - 1][2] + 1)) return T[0] + ' to ' + parts[T.length - 1].rest;
|
|
44
|
+
return T[0] + T.slice(1).map((t, i) => ', ' + (parts[i + 1].pre && parts[i + 1].pre === parts[0].pre ? parts[i + 1].rest : t)).join('');
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function periodOf(F) {
|
|
48
|
+
const P = F && F.period;
|
|
49
|
+
if (!P || !P.label) return null;
|
|
50
|
+
const span = P.fromAt && P.toAt ? mdy(P.fromAt) + ' – ' + mdy(P.toAt) : '';
|
|
51
|
+
const day = P.day && P.days ? 'day ' + P.day + ' of ' + P.days : '';
|
|
52
|
+
return { label: P.label, sub: [span, day].filter(Boolean).join(' · ') };
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** The North Star: a kept record (role north-star), else an open PMOS draft (GET /api/metric-drafts, group North Star), else none. */
|
|
56
|
+
export function northStarOf(model, drafts) {
|
|
57
|
+
const g = ((model && model.goals) || []).find((x) => x && x.role === 'north-star');
|
|
58
|
+
if (g) return { state: 'set', goal: g.id, title: g.title, sub: g.nowTxt ? 'Now ' + g.nowTxt + (g.targetTxt ? ' · target ' + g.targetTxt : '') : 'Not read yet' };
|
|
59
|
+
const rows = (drafts && Array.isArray(drafts.rows) ? drafts.rows : []).filter((r) => r && r.group === 'North Star' && r.state === 'open');
|
|
60
|
+
if (rows.length) {
|
|
61
|
+
const r = rows[0];
|
|
62
|
+
return { state: 'draft', row: r.id, title: String(r.name || r.metric || '').trim() || 'A North Star', sub: String(r.why || r.basis || '').trim() || 'PMOS drafted it from your key results. The rest hangs from it once you approve.' };
|
|
63
|
+
}
|
|
64
|
+
return { state: 'none', title: 'No North Star yet', sub: 'Your OKR file names none. Ask PMOS to draft one from your key results; you approve it with a tick.' };
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const DOT = { on: 'ok', close: 'rk', behind: 'rk', broken: 'rd' };
|
|
68
|
+
const goalOf = (model, id) => (id && ((model && model.goals) || []).find((g) => g.id === id)) || null;
|
|
69
|
+
|
|
70
|
+
/** One key result row. */
|
|
71
|
+
function krRow(model, o, k, today) {
|
|
72
|
+
const g = goalOf(model, k.goal), F = model.okrFile || {};
|
|
73
|
+
const read = !!(k.read && g);
|
|
74
|
+
const dot = read ? DOT[(g.reading || {}).dot] || '' : '';
|
|
75
|
+
const due = k.due || (F.period && F.period.toAt) || null, d = due ? daysTo(today, due) : null;
|
|
76
|
+
const sub = read ? 'read ' + mdy((g.reading && g.reading.at) || (g.lastRead && g.lastRead.day) || '') + (g.reading && g.reading.source ? ' · ' + g.reading.source : '')
|
|
77
|
+
: k.decision ? 'waits on a decision' + (k.due ? ', due ' + mdy(k.due) : '')
|
|
78
|
+
: k.need ? 'waits on ' + k.need : g && g.recipe ? 'PMOS reads it' : 'no source named';
|
|
79
|
+
return {
|
|
80
|
+
key: k.key, token: k.token, title: k.title, dot, sub: sub.replace(/\s·\s$/, ''), read, goal: k.goal || null, need: read ? '' : k.need || '',
|
|
81
|
+
act: read ? g.nowTxt : '', target: g && g.targetTxt ? g.targetTxt : '', tone: dot === 'rk' ? 'risk' : dot === 'rd' ? 'late' : '',
|
|
82
|
+
left: d === null ? '' : d > 0 ? noun(d, 'day', 'days') : d === 0 ? 'today' : noun(-d, 'day', 'days') + ' over', due,
|
|
83
|
+
moves: (k.moves || []).map((r) => r.id),
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
const passes = (row, filter) => filter === 'slip' ? row.dot === 'rk' || row.dot === 'rd' : filter === 'unread' ? !row.read : filter === 'read' ? row.read : true;
|
|
87
|
+
|
|
88
|
+
/** The outcome promise of an initiative (model.outcomes), by id. */
|
|
89
|
+
const outcomeOf = (model, id) => ((model && model.outcomes) || []).find((r) => r && r.id === id) || null;
|
|
90
|
+
|
|
91
|
+
export function iniItem(r, model, today) {
|
|
92
|
+
const o = outcomeOf(model, r.id), p = o && o.promise;
|
|
93
|
+
const base = { id: r.id, title: r.title, ws: r.ws || '', line: '', tone: '', dm: '', verdict: false };
|
|
94
|
+
if (o && o.verdict) return { ...base, line: 'judged: ' + o.verdict.verdict, dm: 'ok' };
|
|
95
|
+
if (p && p.horizon) {
|
|
96
|
+
if (p.overdue) return { ...base, line: 'overdue · due ' + mdy(p.horizon), tone: 'late', dm: 'rd', verdict: true };
|
|
97
|
+
return { ...base, line: 'check due ' + mdy(p.horizon), dm: 'q' };
|
|
98
|
+
}
|
|
99
|
+
const d = r.endAt ? daysTo(today, r.endAt) : null;
|
|
100
|
+
if (d !== null && d < 0 && r.status !== 'done') return { ...base, line: noun(-d, 'day', 'days') + ' over', tone: 'late' };
|
|
101
|
+
if (r.status === 'late') return { ...base, line: 'late', tone: 'late' };
|
|
102
|
+
if (d !== null && d >= 0) return { ...base, line: d === 0 ? 'ships today' : 'ships in ' + noun(d, 'day', 'days') };
|
|
103
|
+
return { ...base, line: r.stageLabel || '' };
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** The levers of an objective: KR metric records with role input whose kr anchor names one of its key results. */
|
|
107
|
+
function leversOf(model, o) {
|
|
108
|
+
const toks = o.krs.map((k) => String(k.token).toLowerCase());
|
|
109
|
+
return ((model && model.goals) || []).filter((g) => g && g.role === 'input' && g.kr && toks.some((t) => new RegExp('(^|[^a-z0-9])' + t.replace(/[-.]/g, '\\$&') + '($|[^a-z0-9.])', 'i').test(g.kr)))
|
|
110
|
+
.map((g) => ({ id: g.id, title: g.title, txt: g.nowTxt || 'not read', tone: DOT[(g.reading || {}).dot] === 'rk' ? 'risk' : DOT[(g.reading || {}).dot] === 'rd' ? 'late' : '' }));
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** The work of an objective's rows, each initiative once, laid over the rows of the key results it moves; overlapping spans share one cell. */
|
|
114
|
+
function iniSpans(rows, model, today, byId) {
|
|
115
|
+
const at = new Map();
|
|
116
|
+
rows.forEach((k, i) => { for (const id of k.moves) { const s = at.get(id); if (s) s.last = i; else at.set(id, { first: i, last: i }); } });
|
|
117
|
+
const list = [...at.entries()].map(([id, s]) => ({ ...s, item: iniItem(byId.get(id) || { id, title: id }, model, today) })).sort((a, b) => a.first - b.first || a.last - b.last);
|
|
118
|
+
const cells = [];
|
|
119
|
+
for (const x of list) {
|
|
120
|
+
const c = cells[cells.length - 1];
|
|
121
|
+
if (c && x.first <= c.last) { c.last = Math.max(c.last, x.last); c.items.push(x.item); } else cells.push({ first: x.first, last: x.last, items: [x.item] });
|
|
122
|
+
}
|
|
123
|
+
return cells.map((c) => ({ from: c.first + 1, span: c.last - c.first + 1, items: c.items }));
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export function tableOf(model, today, filter = 'all') {
|
|
127
|
+
const F = model && model.okrFile;
|
|
128
|
+
const byId = new Map();
|
|
129
|
+
if (F) for (const o of F.objectives) for (const k of o.krs) for (const r of k.moves || []) byId.set(r.id, r);
|
|
130
|
+
const objectives = [];
|
|
131
|
+
let total = 0, shown = 0;
|
|
132
|
+
for (const o of (F && F.objectives) || []) {
|
|
133
|
+
const all = o.krs.map((k) => krRow(model, o, k, today));
|
|
134
|
+
total += all.length;
|
|
135
|
+
const rows = all.filter((r) => passes(r, filter));
|
|
136
|
+
shown += rows.length;
|
|
137
|
+
if (!rows.length) continue;
|
|
138
|
+
const slip = all.filter((r) => r.dot === 'rk' || r.dot === 'rd').length;
|
|
139
|
+
objectives.push({ id: o.id, label: objLabel(o.token), title: o.title || '', slip: slip ? slip + ' slipping' : '', krs: rows, levers: leversOf(model, o), inis: iniSpans(rows, model, today, byId) });
|
|
140
|
+
}
|
|
141
|
+
const whole = filter === 'all';
|
|
142
|
+
const budgets = whole ? ((model && model.budgets) || []).filter((b) => b && (b.moves || []).length).map((b) => ({
|
|
143
|
+
id: b.id, label: b.id, share: b.reading && b.reading.share !== null && b.reading.share !== undefined && typeof b.cap === 'number' ? Math.round(b.reading.share * 100) + '% of ' + Math.round(b.cap * 100) + '%' : '',
|
|
144
|
+
over: !!(b.reading && b.reading.over), covers: b.covers || '', items: b.moves.map((r) => iniItem(r, model, today)),
|
|
145
|
+
})) : [];
|
|
146
|
+
const unlinked = whole ? ((model && model.unlinked) || []).map((r) => iniItem(r, model, today)) : [];
|
|
147
|
+
return { objectives, budgets, unlinked, total, shown };
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** Every key result of the file, flat, with its objective. */
|
|
151
|
+
const flat = (F) => ((F && F.objectives) || []).flatMap((o) => o.krs.map((k) => ({ o, k })));
|
|
152
|
+
|
|
153
|
+
export function krPage(model, key, today) {
|
|
154
|
+
const F = model && model.okrFile, hit = flat(F).find((x) => x.k.key === key);
|
|
155
|
+
if (!hit) return null;
|
|
156
|
+
const { o, k } = hit, row = krRow(model, o, k, today), g = goalOf(model, k.goal);
|
|
157
|
+
const read = row.read
|
|
158
|
+
? { head: row.act + (g.reading && g.reading.at ? ' on ' + mdy(g.reading.at) : ''), sub: g.reading && g.reading.source ? 'From ' + g.reading.source + '.' : '' }
|
|
159
|
+
: { head: 'Not read yet', sub: k.decision ? 'It waits on a decision' + (k.due ? ', due ' + mdy(k.due) : '') + '.' : row.need ? 'It waits on ' + row.need + '. PMOS has not read it yet.' : 'Your OKR file names no source for it.' };
|
|
160
|
+
const target = g && g.targetTxt ? { head: g.targetTxt + (g.by ? ' by ' + g.by : ''), sub: '' } : k.line ? { head: k.line, sub: 'In your OKR file, not yet a number PMOS can read against.' } : { head: 'No target in your OKR file', sub: '' };
|
|
161
|
+
const leftTxt = row.left ? (row.left === 'today' ? 'Due today' : /over$/.test(row.left) ? row.left : row.left + ' left') + (row.due ? ', to ' + mdy(row.due) : '') : '';
|
|
162
|
+
target.sub = [target.sub, leftTxt].filter(Boolean).join(' ');
|
|
163
|
+
const levers = leversOf(model, { krs: [k] });
|
|
164
|
+
const byId = new Map((k.moves || []).map((r) => [r.id, r]));
|
|
165
|
+
const inis = [...byId.values()].map((r) => iniItem(r, model, today));
|
|
166
|
+
const frees = row.need ? flat(F).filter((x) => !x.k.read && x.k.need === row.need).map((x) => x.k.token) : [];
|
|
167
|
+
return {
|
|
168
|
+
key, token: k.token, title: k.title, sub: k.token + ' · ' + objLabel(o.token) + (o.title ? ', ' + o.title : ''), goal: k.goal || null,
|
|
169
|
+
read, target, levers, inis,
|
|
170
|
+
sug: row.need ? { need: row.need, say: 'Connect ' + row.need, why: 'Frees ' + krTokens(frees) + '. PMOS tests a read before it keeps it.' } : null,
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export function setupOf(model, ns) {
|
|
175
|
+
const F = model && model.okrFile;
|
|
176
|
+
if (!F) return null;
|
|
177
|
+
const names = F.objectives.map((o) => ({ id: o.id, label: objLabel(o.token) + (o.title ? ': ' + o.title : ''), krs: krTokens(o.krs.map((k) => k.token)), named: !!o.title }));
|
|
178
|
+
const by = new Map();
|
|
179
|
+
for (const { k } of flat(F)) if (!k.read && k.need) { if (!by.has(k.need)) by.set(k.need, []); by.get(k.need).push(k.token); }
|
|
180
|
+
const sources = [...by.entries()].sort((a, b) => b[1].length - a[1].length).map(([need, toks]) => ({ need, frees: 'Frees ' + krTokens(toks) }));
|
|
181
|
+
const withTarget = flat(F).filter(({ k }) => { const g = goalOf(model, k.goal); return g && g.targetTxt; }).length;
|
|
182
|
+
return { ns: ns || northStarOf(model, null), names, sources, targets: withTarget ? '' : 'Your OKR file gives no target number and names no levers. Once a key result is read, PMOS drafts a target and the levers behind it. You approve each with a tick.' };
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export function verdictOf(model, id, today) {
|
|
186
|
+
const o = outcomeOf(model, id);
|
|
187
|
+
if (!o) return null;
|
|
188
|
+
const p = o.promise || {}, late = p.horizon ? daysTo(p.horizon, today) : null;
|
|
189
|
+
const hit = flat(model.okrFile).find((x) => (x.k.moves || []).some((r) => r.id === id));
|
|
190
|
+
const g = hit ? goalOf(model, hit.k.goal) : null;
|
|
191
|
+
const krGot = hit ? (hit.k.read && g ? g.nowTxt : hit.k.need ? 'Waits on ' + hit.k.need : 'Not read yet') : '';
|
|
192
|
+
const head = p.horizon ? 'Outcome · check ' + (late > 0 ? 'was due ' + mdy(p.horizon) + ', ' + noun(late, 'day', 'days') + ' ago' : 'due ' + mdy(p.horizon)) : 'Outcome';
|
|
193
|
+
return {
|
|
194
|
+
id, title: o.title, head,
|
|
195
|
+
sub: (o.endAt ? 'Shipped ' + mdy(o.endAt) + '. ' : '') + (p.metric || p.horizon ? 'PMOS has the promise and can read what you got.' : 'No promise was written when it was approved.'),
|
|
196
|
+
rows: [
|
|
197
|
+
['Result', p.metric || 'As approved with the initiative', 'Not read yet'],
|
|
198
|
+
hit ? ['Key result it moves', hit.k.token + ' ' + hit.k.title, krGot] : null,
|
|
199
|
+
['Verdict', o.verdict ? o.verdict.verdict : 'Not judged', o.verdict ? o.verdict.learned || '' : 'Worked, partly, or did not'],
|
|
200
|
+
].filter(Boolean),
|
|
201
|
+
reads: [{ label: 'The promise written when the initiative was approved', val: o.title, ini: id },
|
|
202
|
+
hit ? { label: 'Key result ' + hit.k.token + ' and its source', val: hit.k.read ? 'read' : hit.k.need || hit.k.source || 'no source named', key: hit.k.key, late: !hit.k.read } : null].filter(Boolean),
|
|
203
|
+
judged: !!o.verdict,
|
|
204
|
+
};
|
|
205
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/* pm/goals-open.js — what Goals opens in the one popup (initiative goals-place, slice 9 of the six-place navigation; boards 31, 32 and 33 on
|
|
2
|
+
* Exploring 2). The thing is on the left, Ask PMOS about it on the right (cozy-popup.js openWork). The look is the popup's own (cozy-pop-work.css,
|
|
3
|
+
* the .pw classes slice 3 drew the suggestion page with) plus cozy-goals.css.
|
|
4
|
+
*
|
|
5
|
+
* openKr(ctx, key) a key result (board 31): What PMOS read, Target and time left, Levers, Initiative that names it, one ✦ to connect its source
|
|
6
|
+
* openSetup(ctx) Set up (board 32): the North Star, Names to confirm, Sources to connect, Targets and levers
|
|
7
|
+
* openVerdict(ctx, id) the verdict on an outcome whose check is due (board 33): Did it do what it promised?, When you say yes, What PMOS reads
|
|
8
|
+
* openIni(ctx, id) an initiative, as every place opens it (premium-vw-item.js), slice 3's popup
|
|
9
|
+
* ctx = { model, ws, today, ns, keepNs(row), dropNs(row), toast(text) }
|
|
10
|
+
*
|
|
11
|
+
* A ✓ that asks PMOS to act (connect a source, draft the North Star, judge an outcome, name an objective) puts the words in the chat on the right
|
|
12
|
+
* for the PM to send: nothing is sent or written by the press itself. The North Star draft's ✓ and ✕ are the metric-drafts keep and drop the page
|
|
13
|
+
* owns (ctx.keepNs, ctx.dropNs), with Undo. The UI says PMOS only; icon-only buttons carry aria-label. */
|
|
14
|
+
import * as POP from './cozy-popup.js';
|
|
15
|
+
import * as VW from './cozy-viewer.js';
|
|
16
|
+
import * as GM from './goals-model.js';
|
|
17
|
+
|
|
18
|
+
const CSS = ['./cozy-pop-work.css', './cozy-goals.css'].map((p) => new URL(p, import.meta.url).href);
|
|
19
|
+
if (typeof document !== 'undefined' && document.head) for (const h of CSS) if (!document.querySelector(`link[href="${h}"]`)) { const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = h; document.head.appendChild(l); }
|
|
20
|
+
|
|
21
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
22
|
+
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>`;
|
|
23
|
+
const P = { check: 'M5 12l5 5 9-10', x: 'M6 6l12 12M18 6L6 18', right: 'M10 7l5 5-5 5', chat: 'M4 5h16v11H9l-5 4z', spark: 'M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z' };
|
|
24
|
+
const ib = (attr, label, d, cls = '') => `<button type="button" class="pw-ib${cls ? ' ' + cls : ''}" ${attr} aria-label="${esc(label)}" title="${esc(label)}">${SVG(d)}</button>`;
|
|
25
|
+
const row = (attr, label, val, cls = '') => `<button type="button" class="pw-src gl-src" ${attr}><span>${esc(label)}</span><span class="gl-srcv"><small class="${cls}">${esc(val || '')}</small>${SVG(P.right, 14)}</span></button>`;
|
|
26
|
+
const ask = '<button type="button" class="pw-ask" data-gl-ask>' + SVG(P.chat, 15) + 'Ask PMOS about this</button>';
|
|
27
|
+
|
|
28
|
+
/** The words go in the chat on the right, as a draft the PM sends. The chat shows first when it was hidden. */
|
|
29
|
+
export function toChat(text) {
|
|
30
|
+
const a = document.querySelector('.cz-pop [data-pop="ask"]'); if (a && !a.closest('[hidden]')) a.click();
|
|
31
|
+
let n = 0;
|
|
32
|
+
const put = () => {
|
|
33
|
+
const ta = document.querySelector('.cz-pop-chat textarea, .cz-pop-chat [contenteditable="true"]');
|
|
34
|
+
if (!ta) { if (++n < 30) setTimeout(put, 50); return; }
|
|
35
|
+
if ('value' in ta) { ta.value = text; ta.dispatchEvent(new Event('input', { bubbles: true })); } else ta.textContent = text;
|
|
36
|
+
ta.focus();
|
|
37
|
+
};
|
|
38
|
+
put();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function show(ctx, it, html, on) {
|
|
42
|
+
const about = { id: String(it.id).replace(/[^A-Za-z0-9._:-]+/g, '-').slice(0, 100), kind: 'goal', title: it.about || it.title, ws: ctx.ws || undefined };
|
|
43
|
+
const item = { kind: it.kind, title: it.title, icon: it.icon || 'chart', id: it.id, back: !!it.back,
|
|
44
|
+
render: (b) => { b.innerHTML = html(); b.onclick = (e) => { const t = e.target.closest('button,a'); if (t) on(t, e, b); }; } };
|
|
45
|
+
if (it.back && POP.isOpen()) { VW.drill(); VW.open(item); return; }
|
|
46
|
+
POP.openWork({ about, open: () => VW.open(item) });
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/* ── a key result (board 31) ── */
|
|
50
|
+
export function openKr(ctx, key, back = false) {
|
|
51
|
+
const K = GM.krPage(ctx.model, key, ctx.today); if (!K) return false;
|
|
52
|
+
const fact = (label, head, sub) => `<div class="gl-f"><small>${esc(label)}</small><b>${esc(head)}</b>${sub ? `<span>${esc(sub)}</span>` : ''}</div>`;
|
|
53
|
+
const html = () => `<div class="pw pw-sp gl-pg">`
|
|
54
|
+
+ `<div class="pw-spc gl-top"><p class="pw-sugh">Key result · ${esc(K.sub)}</p><h3>${esc(K.title)}</h3></div>`
|
|
55
|
+
+ `<div class="gl-fs">${fact('What PMOS read', K.read.head, K.read.sub)}${fact('Target and time left', K.target.head, K.target.sub)}`
|
|
56
|
+
+ fact('Levers', K.levers.length ? K.levers.map((l) => l.title + ' ' + l.txt).join(' · ') : 'None named', '') + '</div>'
|
|
57
|
+
+ (K.inis.length ? `<h4>Initiative that names it</h4><div class="pw-card">${K.inis.map((i) => row(`data-gl-ini="${esc(i.id)}"${i.verdict ? ' data-gl-verdict' : ''}`, i.title, i.line, i.tone === 'late' ? 'warn' : 'grey')).join('')}</div>` : '')
|
|
58
|
+
+ (K.goal ? `<div class="pw-card">${row(`data-gl-chart="${esc(K.goal)}"`, 'Readings and chart', 'Intelligence', 'grey')}</div>` : '')
|
|
59
|
+
+ (K.sug ? `<div class="gl-sg"><i class="pw-spark" aria-hidden="true">${SVG(P.spark, 14, 2)}</i><div><b>${esc(K.sug.say)}</b><span>${esc(K.sug.why)}</span></div>${ib('data-gl-connect', 'Yes, ask PMOS to connect ' + K.sug.need, P.check, 'sm')}</div>` : '')
|
|
60
|
+
+ ask + '</div>';
|
|
61
|
+
show(ctx, { id: 'kr:' + key, kind: 'Key result', title: K.token + ' · ' + K.title, icon: 'goal', back }, html, (t) => {
|
|
62
|
+
const d = t.dataset;
|
|
63
|
+
if (d.glIni) { if ('glVerdict' in d) openVerdict(ctx, d.glIni, true); else openIni(ctx, d.glIni); return; }
|
|
64
|
+
if (d.glChart) { location.assign('/premium-intelligence.html?' + (ctx.ws ? 'ws=' + encodeURIComponent(ctx.ws) + '&' : '') + 'goal=' + encodeURIComponent(d.glChart)); return; }
|
|
65
|
+
if ('glConnect' in d) { toChat('Connect ' + K.sug.need + ' so you can read ' + K.token + '. ' + K.sug.why + ' Tell me what you need from me.'); return; }
|
|
66
|
+
if ('glAsk' in d) toChat('About ' + K.token + ' ' + K.title + ': am I on track, and what should I do next?');
|
|
67
|
+
});
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/* ── Set up (board 32) ── */
|
|
72
|
+
export function openSetup(ctx) {
|
|
73
|
+
const S = GM.setupOf(ctx.model, ctx.ns); if (!S) return false;
|
|
74
|
+
const ns = S.ns;
|
|
75
|
+
const top = ns.state === 'draft'
|
|
76
|
+
? `<div class="pw-spc gl-top"><p class="pw-sugh">${SVG(P.spark, 13, 2)} PMOS drafted this</p><h3>${esc(ns.title)}</h3><p>Your North Star. ${esc(ns.sub)}</p><span class="pw-spb">${ib('data-gl-nskeep', 'Approve this North Star', P.check, 'solid')}${ib('data-gl-nsdrop', 'No', P.x)}</span></div>`
|
|
77
|
+
: ns.state === 'set'
|
|
78
|
+
? `<div class="pw-spc gl-top gl-set"><p class="pw-sugh">North Star</p><h3>${esc(ns.title)}</h3><p>${esc(ns.sub)}</p></div>`
|
|
79
|
+
: `<div class="pw-spc gl-top"><p class="pw-sugh">North Star · not set</p><h3>${esc(ns.title)}</h3><p>${esc(ns.sub)}</p><span class="pw-spb">${ib('data-gl-nsdraft', 'Ask PMOS to draft the North Star', P.spark)}</span></div>`;
|
|
80
|
+
const html = () => `<div class="pw pw-sp gl-pg">${top}`
|
|
81
|
+
+ `<h4>Names to confirm</h4><div class="pw-card">${S.names.map((n) => row(`data-gl-name="${esc(n.id)}"`, n.label, n.krs, 'grey')).join('')}</div>`
|
|
82
|
+
+ (S.sources.length ? `<h4>Sources to connect, so a grey dot can turn into a reading</h4><div class="pw-card">${S.sources.map((s) => row(`data-gl-src="${esc(s.need)}"`, s.need, s.frees, 'warn')).join('')}</div>` : '')
|
|
83
|
+
+ (S.targets ? `<h4>Targets and levers</h4><p>${esc(S.targets)}</p>` : '')
|
|
84
|
+
+ ask + '</div>';
|
|
85
|
+
show(ctx, { id: 'goals:setup:' + (ctx.ws || ''), kind: 'Goals', title: 'Set up', about: 'Setting up Goals', icon: 'chart' }, html, async (t, e, b) => {
|
|
86
|
+
const d = t.dataset;
|
|
87
|
+
if ('glNskeep' in d) { t.disabled = true; await ctx.keepNs(ns.row); b.innerHTML = '<div class="pw gl-pg"><p class="grey">Kept. The North Star is set.</p></div>'; return; }
|
|
88
|
+
if ('glNsdrop' in d) { t.disabled = true; await ctx.dropNs(ns.row); return; }
|
|
89
|
+
if ('glNsdraft' in d) { toChat('Draft a North Star for this product from its key results. I approve it with a tick.'); return; }
|
|
90
|
+
if (d.glName) { const n = S.names.find((x) => x.id === d.glName); if (n) toChat((n.named ? 'Check the name of ' : 'Name ') + n.label + ' (' + n.krs + '). Draft it from its key results; I approve it with a tick.'); return; }
|
|
91
|
+
if (d.glSrc) { const s = S.sources.find((x) => x.need === d.glSrc); if (s) toChat('Connect ' + s.need + '. ' + s.frees + '. Test a read before you keep it, and tell me what you need from me.'); return; }
|
|
92
|
+
if ('glAsk' in d) toChat('About setting up Goals: what should I confirm or connect first?');
|
|
93
|
+
});
|
|
94
|
+
return true;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/* ── the verdict on an outcome (board 33) ── */
|
|
98
|
+
export function openVerdict(ctx, id, back = false) {
|
|
99
|
+
const V = GM.verdictOf(ctx.model, id, ctx.today); if (!V) { openIni(ctx, id); return false; }
|
|
100
|
+
const html = () => `<div class="pw pw-sp gl-pg">`
|
|
101
|
+
+ `<div class="pw-spc gl-top"><p class="pw-sugh">${esc(V.head)}</p><h3>${esc(V.title)}</h3><p>${esc(V.sub)}</p>${V.judged ? '' : `<span class="pw-spb">${ib('data-gl-judge', 'Judge this outcome now', P.check, 'solid')}</span>`}</div>`
|
|
102
|
+
+ `<h4>Did it do what it promised?</h4><div class="pw-card pw-chg" role="table"><div class="pw-cr pw-th" role="row"><span role="columnheader">What</span><span role="columnheader">Promised</span><span role="columnheader">Got</span></div>`
|
|
103
|
+
+ V.rows.map((r, i) => `<div class="pw-cr" role="row"><span role="cell">${esc(r[0])}</span><span role="cell"${i === V.rows.length - 1 && !V.judged ? ' class="grey"' : ''}>${esc(r[1])}</span><span role="cell" class="grey">${esc(r[2])}</span></div>`).join('') + '</div>'
|
|
104
|
+
+ (V.judged ? '' : '<h4>When you say yes</h4><p>PMOS reads the result, sets it beside the promise and gives a verdict with the reason. It also lines the result up against what shipped around it. Nothing changes in your plan until you approve the lesson.</p>')
|
|
105
|
+
+ `<h4>What PMOS reads</h4><div class="pw-card">${V.reads.map((r) => row(r.key ? `data-gl-kr="${esc(r.key)}"` : `data-gl-ini="${esc(r.ini)}"`, r.label, r.val, r.late ? 'warn' : 'grey')).join('')}</div>`
|
|
106
|
+
+ ask + '</div>';
|
|
107
|
+
show(ctx, { id: 'outcome:' + id, kind: 'Outcome', title: V.title, back }, html, (t) => {
|
|
108
|
+
const d = t.dataset;
|
|
109
|
+
if ('glJudge' in d) { toChat('Judge the outcome of ' + V.title + ': read the result, set it beside the promise and give me a verdict with the reason. Change nothing in the plan until I approve the lesson.'); return; }
|
|
110
|
+
if (d.glKr) { openKr(ctx, d.glKr, true); return; }
|
|
111
|
+
if (d.glIni) { openIni(ctx, d.glIni); return; }
|
|
112
|
+
if ('glAsk' in d) toChat('About the outcome of ' + V.title + ': did it do what it promised?');
|
|
113
|
+
});
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/* ── an initiative: as every place opens it (slice 3) ── */
|
|
118
|
+
export function openIni(ctx, id) {
|
|
119
|
+
const r = (ctx.model.outcomes || []).find((x) => x.id === id) || ((ctx.model.okrFile && ctx.model.okrFile.objectives) || []).flatMap((o) => o.krs.flatMap((k) => k.moves || [])).find((x) => x.id === id)
|
|
120
|
+
|| (ctx.model.unlinked || []).find((x) => x.id === id) || (ctx.model.budgets || []).flatMap((b) => b.moves || []).find((x) => x.id === id) || { id, title: id };
|
|
121
|
+
if (POP.isOpen()) VW.drill();
|
|
122
|
+
POP.openWork({ about: { id, kind: 'initiative', title: r.title, ws: ctx.ws || undefined },
|
|
123
|
+
open: () => import('./premium-vw-item.js').then((M) => M.openWorkItem({ kind: 'initiative', id, ws: ctx.ws || '', title: r.title })) });
|
|
124
|
+
}
|