create-pmos 0.615.0 → 0.616.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 +44 -14
- 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 +43 -0
- package/workspace/guide/backlog.md +70 -0
- package/workspace/guide/cli.md +1 -0
- package/workspace/guide/index.md +1 -0
- package/workspace/guide/layout.md +3 -2
- package/workspace/guide/programs.md +1 -1
- package/workspace/guide/routine.md +1 -1
- package/workspace/lib/backlog.js +323 -0
- package/workspace/lib/day-run.js +3 -2
- package/workspace/lib/doc-library.js +26 -3
- package/workspace/lib/jira-status.js +4 -1
- package/workspace/lib/mention-cli.js +7 -5
- package/workspace/lib/mention-store.js +9 -5
- package/workspace/lib/route-modules.js +1 -0
- package/workspace/lib/routes-backlog.js +283 -0
- package/workspace/lib/routes-boards.js +13 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/bd-backlog.css +158 -0
- package/workspace/public/pm/bd-backlog.js +531 -0
- package/workspace/public/pm/bk-model.js +169 -0
- package/workspace/public/pm/cozy-pick.js +6 -3
- package/workspace/public/pm/cozy-routine.js +3 -2
- package/workspace/public/pm/cozy-today-app.js +23 -5
- package/workspace/public/pm/cozy-today-model.js +44 -10
- package/workspace/public/pm/cozy-today-page.css +9 -1
- package/workspace/public/pm/cozy-today-view.js +14 -9
- package/workspace/public/pm/home-app.js +5 -0
- package/workspace/public/pm/mention-one-model.js +6 -4
- package/workspace/public/pm/premium-board.js +21 -3
- package/workspace/public/pm/premium-goals.js +12 -9
- package/workspace/public/pm/premium-library.js +15 -3
- package/workspace/public/premium-board.html +1 -0
- package/workspace/skills/morning-brief.skill +1 -1
- package/workspace/test-lists/backlog.json +9 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/* pm/bk-model.js — the pure half of the Backlog in Work (initiative work-backlog; boards BkList and BkSelect on Exploring 2): which group a
|
|
2
|
+
* task sits in, the quick filters with their counts, the tune panel's facets and sort, and the "Showing … · N hidden" line. No DOM, no fetch:
|
|
3
|
+
* pm/bd-backlog.js draws and wires; bk-model.test.js tests this file in node.
|
|
4
|
+
*
|
|
5
|
+
* THE GROUPS, in this order (brief Part A 4): Needs your review · PMOS is working · PMOS can take these · With people · Nobody has these ·
|
|
6
|
+
* No home · Done by PMOS today. With Part B off (partB false) only With people, Nobody has these and No home exist; the grouping is the same code, so Part B adds
|
|
7
|
+
* groups without a redraw. A task is in one group: what PMOS is doing with it first, then where it lives (no initiative = No home), then
|
|
8
|
+
* whether PMOS can take it, then whether a person has it.
|
|
9
|
+
*
|
|
10
|
+
* Stage is not a task's (Wawan, 2026-11-19: "Stage not apply to task, it only apply to initiative"): nothing here reads a task's stage. */
|
|
11
|
+
|
|
12
|
+
export const GROUPS = [
|
|
13
|
+
{ k: 'review', n: 'Needs your review', sub: 'PMOS finished these and cannot pass them alone', open: true, b: true },
|
|
14
|
+
{ k: 'working', n: 'PMOS is working', sub: 'nothing needed from you', open: true, b: true },
|
|
15
|
+
{ k: 'take', n: 'PMOS can take these', sub: 'it has what it needs to start', open: true, b: true },
|
|
16
|
+
{ k: 'people', n: 'With people', sub: '', open: false },
|
|
17
|
+
{ k: 'open', n: 'Nobody has these', sub: '', open: false }, // design check 1: "Open" already means every open task (the first chip)
|
|
18
|
+
{ k: 'nohome', n: 'No home', sub: 'in no initiative', open: false },
|
|
19
|
+
{ k: 'done', n: 'Done by PMOS today', sub: 'passed its checks, no review needed. Undo is on each', open: false, b: true },
|
|
20
|
+
];
|
|
21
|
+
export const CHIPS = [
|
|
22
|
+
['all', 'All open'], ['review', 'Needs you'], ['working', 'PMOS working'], ['take', 'PMOS can take'], ['people', 'With people'], ['nohome', 'No home'], ['jira', 'Jira tickets'], ['sprint', 'This sprint'],
|
|
23
|
+
];
|
|
24
|
+
const GROUP_CHIPS = new Set(['review', 'working', 'take', 'people', 'nohome']);
|
|
25
|
+
export const FACETS = [['ini', 'Initiative'], ['who', 'Who'], ['epic', 'Epic'], ['sprint', 'Sprint'], ['status', 'Status']];
|
|
26
|
+
export const SORTS = [['due', 'Due date'], ['ini', 'Initiative'], ['who', 'Who'], ['name', 'Name']];
|
|
27
|
+
export const SHOW = 5; // the rows an open group shows before its "N more"
|
|
28
|
+
|
|
29
|
+
/** The group of one task. */
|
|
30
|
+
export function groupOf(t, partB = true) {
|
|
31
|
+
const a = t.agent;
|
|
32
|
+
if (partB && a && a.state === 'review') return 'review';
|
|
33
|
+
if (partB && a && a.state === 'working') return 'working';
|
|
34
|
+
if (partB && a && a.state === 'done' && a.today !== false) return 'done'; // an earlier day's result is a plain row again
|
|
35
|
+
if (!t.ini) return 'nohome';
|
|
36
|
+
if (partB && t.take && !t.declined) return 'take';
|
|
37
|
+
if (t.whoKind && t.whoKind !== 'none') return 'people';
|
|
38
|
+
return 'open';
|
|
39
|
+
}
|
|
40
|
+
/** An open task: anything but a task PMOS finished today. */
|
|
41
|
+
export const isOpen = (t) => !(t.agent && t.agent.state === 'done' && t.agent.today !== false);
|
|
42
|
+
|
|
43
|
+
/** The value of a facet on a task (what the tune panel lists and filters by). */
|
|
44
|
+
export function facetOf(t, f) {
|
|
45
|
+
if (f === 'ini') return t.iniTitle || 'No initiative';
|
|
46
|
+
if (f === 'who') return t.agent && t.agent.state !== 'failed' ? 'PMOS' : t.who || 'None';
|
|
47
|
+
if (f === 'epic') return t.src === 'jira' ? (t.epic ? t.epic.name || t.epic.key : 'No epic') : 'Not a Jira ticket';
|
|
48
|
+
if (f === 'sprint') return t.sprint ? t.sprint.name : 'No sprint';
|
|
49
|
+
if (f === 'status') return t.state;
|
|
50
|
+
return '';
|
|
51
|
+
}
|
|
52
|
+
/** Each facet's values with their counts, most first: { ini: [[value, n]], … } over `tasks`. */
|
|
53
|
+
export function facetsOf(tasks) {
|
|
54
|
+
const out = {};
|
|
55
|
+
for (const [f] of FACETS) {
|
|
56
|
+
const m = new Map();
|
|
57
|
+
for (const t of tasks) { const v = facetOf(t, f); m.set(v, (m.get(v) || 0) + 1); }
|
|
58
|
+
out[f] = [...m].sort((a, b) => b[1] - a[1] || String(a[0]).localeCompare(String(b[0])));
|
|
59
|
+
}
|
|
60
|
+
return out;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** Does task `t` pass the quick filters `chips` (a Set) and the facet picks `pick` ({ facet: Set of values })? Group chips widen each
|
|
64
|
+
* other (Needs you + No home shows both); Jira tickets and This sprint narrow. */
|
|
65
|
+
export function keeps(t, chips, pick, partB = true) {
|
|
66
|
+
const C = chips || new Set();
|
|
67
|
+
const groups = [...C].filter((c) => GROUP_CHIPS.has(c));
|
|
68
|
+
if (groups.length && !groups.includes(groupOf(t, partB))) return false;
|
|
69
|
+
if (C.has('jira') && t.src !== 'jira') return false;
|
|
70
|
+
if (C.has('sprint') && !(t.sprint && t.sprint.state === 'active')) return false;
|
|
71
|
+
for (const [f, set] of Object.entries(pick || {})) if (set && set.size && !set.has(facetOf(t, f))) return false;
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
/** The counts the chips show: over the open tasks, each chip alone. */
|
|
75
|
+
export function chipCounts(tasks, partB = true) {
|
|
76
|
+
const open = tasks.filter(isOpen), n = { all: open.length };
|
|
77
|
+
for (const [k] of CHIPS) if (k !== 'all') n[k] = open.filter((t) => keeps(t, new Set([k]), null, partB)).length;
|
|
78
|
+
return n;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const dueKey = (t) => (t.due ? String(t.due).slice(0, 10) : '9999');
|
|
82
|
+
/** The rows in an order: late first by how late, then by due day, then by name; or by initiative, who or name. */
|
|
83
|
+
export function sortRows(rows, by = 'due') {
|
|
84
|
+
const name = (t) => String(t.title || '').toLowerCase();
|
|
85
|
+
const cmp = {
|
|
86
|
+
due: (a, b) => (b.late || 0) - (a.late || 0) || dueKey(a).localeCompare(dueKey(b)) || name(a).localeCompare(name(b)),
|
|
87
|
+
ini: (a, b) => String(a.iniTitle || '~').localeCompare(String(b.iniTitle || '~')) || dueKey(a).localeCompare(dueKey(b)),
|
|
88
|
+
who: (a, b) => String(a.who || '~').localeCompare(String(b.who || '~')) || dueKey(a).localeCompare(dueKey(b)),
|
|
89
|
+
name: (a, b) => name(a).localeCompare(name(b)),
|
|
90
|
+
}[by] || ((a, b) => name(a).localeCompare(name(b)));
|
|
91
|
+
return rows.slice().sort(cmp);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** The groups to draw: [{ k, n, sub, rows, people? }], empty groups left out (zero is silence). o: { chips, pick, sort, partB, ini }. */
|
|
95
|
+
export function groupsOf(tasks, o = {}) {
|
|
96
|
+
const partB = o.partB !== false;
|
|
97
|
+
// o.ini: one initiative's tasks only (the initiative popup draws its tasks with this list; No home is then empty)
|
|
98
|
+
const shown = tasks.filter((t) => (!o.ini || t.ini === o.ini) && keeps(t, o.chips, o.pick, partB));
|
|
99
|
+
const out = [];
|
|
100
|
+
for (const g of GROUPS) {
|
|
101
|
+
if (g.b && !partB) continue;
|
|
102
|
+
let rows = sortRows(shown.filter((t) => groupOf(t, partB) === g.k), o.sort);
|
|
103
|
+
if (g.k === 'nohome') rows = rows.filter((t) => t.propose).concat(rows.filter((t) => !t.propose)); // PMOS's ✦ proposals first
|
|
104
|
+
if (!rows.length) continue;
|
|
105
|
+
let sub = g.sub;
|
|
106
|
+
if (g.k === 'people') {
|
|
107
|
+
const by = new Map();
|
|
108
|
+
for (const t of rows) by.set(t.who, (by.get(t.who) || 0) + 1);
|
|
109
|
+
sub = [...by].sort((a, b) => (a[0] === 'You') - (b[0] === 'You') || b[1] - a[1]).map(([w, n]) => (w === 'You' ? 'you' : w) + ' ' + n).join(', ');
|
|
110
|
+
}
|
|
111
|
+
if (g.k === 'nohome') { const p = rows.filter((t) => t.propose).length; sub = 'in no initiative' + (p ? '. PMOS can place ' + p : ''); }
|
|
112
|
+
out.push({ k: g.k, n: g.n, sub, rows, open: g.open });
|
|
113
|
+
}
|
|
114
|
+
return out;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** The "Showing … · N hidden · Show all" line: '' when nothing is filtered. */
|
|
118
|
+
export function showingLine(tasks, o = {}) {
|
|
119
|
+
const open = tasks.filter(isOpen), partB = o.partB !== false;
|
|
120
|
+
const on = (o.chips && o.chips.size) || Object.values(o.pick || {}).some((s) => s && s.size);
|
|
121
|
+
if (!on) return null;
|
|
122
|
+
const kept = open.filter((t) => keeps(t, o.chips, o.pick, partB)).length;
|
|
123
|
+
const what = [...(o.chips || [])].map((c) => (CHIPS.find(([k]) => k === c) || [c, c])[1]);
|
|
124
|
+
for (const [f, set] of Object.entries(o.pick || {})) if (set && set.size) what.push((FACETS.find(([k]) => k === f) || [f, f])[1] + ': ' + [...set].join(', '));
|
|
125
|
+
return { text: 'Showing ' + what.join(' · '), hidden: open.length - kept };
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** The State cell's words: the state, then one short note (late, what PMOS will do, where PMOS stands). → { dot, text, note, tone }
|
|
129
|
+
* In "PMOS can take these" the point of the row is what PMOS will do: late first (red, short), then the action, and no "To do" (the group
|
|
130
|
+
* says it). A reason is two or three words ("goes out to Daryl", "changes sign-in", "goes to the CFO"). */
|
|
131
|
+
const REVIEW_WORD = { pr: 'Pull request ready', message: 'Message ready', doc: 'Document ready' };
|
|
132
|
+
export function stateOf(t, gk, o = {}) {
|
|
133
|
+
const a = t.agent;
|
|
134
|
+
// o.noLate: a Due column shows beside (the initiative popup's list), so the late words live there and State says only the state
|
|
135
|
+
const late = t.late && !o.noLate ? t.late + (t.late === 1 ? ' day late' : ' days late') : '';
|
|
136
|
+
if (a && a.state === 'review') return { dot: 'amber', text: REVIEW_WORD[a.review] || 'Ready', note: a.why || '', tone: '' };
|
|
137
|
+
if (a && a.state === 'working') {
|
|
138
|
+
if (a.pr) return { dot: 'blue', text: 'Pull request open', note: "the repo's checks decide", tone: '' };
|
|
139
|
+
return { dot: 'blue', text: 'Working', note: a.why || '', tone: '' };
|
|
140
|
+
}
|
|
141
|
+
if (a && a.state === 'done' && a.today !== false) return { dot: 'green', text: 'Done', note: a.why || '', tone: '' };
|
|
142
|
+
if (a && a.state === 'failed') return { dot: 'grey', text: t.state, note: 'PMOS could not finish: ' + (a.why || 'it stopped'), tone: 'late' };
|
|
143
|
+
if ((gk ? gk === 'take' : groupOf(t) === 'take') && t.take) {
|
|
144
|
+
return late ? { dot: 'red', text: late, note: t.take.what, tone: 'late' } : { dot: 'grey', text: t.take.what, note: '', tone: '' };
|
|
145
|
+
}
|
|
146
|
+
if (late) return { dot: 'red', text: t.state, note: late, tone: 'late' };
|
|
147
|
+
return { dot: t.state === 'To do' ? 'grey' : 'blue', text: t.state, note: '', tone: '' };
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** The line under the chips: the kind of work and what it means. modes: [{ product, mode, label, kinds: { product, project, sdlc } }].
|
|
151
|
+
* The line is true (design check 1): one kind on every initiative → "IDPF runs as Full SDLC: …"; kinds that differ → "Most work here runs
|
|
152
|
+
* as Full SDLC (9 of 12 initiatives): …". → { lead, label, tail, what } | '' */
|
|
153
|
+
const WHAT = {
|
|
154
|
+
product: 'PMOS writes documents and drafts replies; a reply waits for you before it goes.',
|
|
155
|
+
project: 'PMOS also chases dates and drafts status notes; anything that goes out waits for you.',
|
|
156
|
+
sdlc: 'PMOS does the task and asks you only when the result cannot be undone or goes out to people.',
|
|
157
|
+
};
|
|
158
|
+
const LABEL = { product: 'Product management', project: 'Project management', sdlc: 'Full SDLC' };
|
|
159
|
+
export function modeLine(modes) {
|
|
160
|
+
const L = (modes || []).filter(Boolean);
|
|
161
|
+
if (!L.length) return '';
|
|
162
|
+
const n = { product: 0, project: 0, sdlc: 0 };
|
|
163
|
+
for (const m of L) for (const k of Object.keys(n)) n[k] += (m.kinds && m.kinds[k]) || 0;
|
|
164
|
+
const total = n.product + n.project + n.sdlc;
|
|
165
|
+
const top = total ? ['sdlc', 'project', 'product'].reduce((b, k) => (n[k] > n[b] ? k : b), 'sdlc') : (L[0].mode || 'product');
|
|
166
|
+
const name = L.length === 1 ? L[0].product : null;
|
|
167
|
+
if (!total || n[top] === total) return { lead: (name || 'All work here') + ' runs as ', label: LABEL[top], tail: '', what: WHAT[top] };
|
|
168
|
+
return { lead: 'Most work here runs as ', label: LABEL[top], tail: ` (${n[top]} of ${total} initiatives)`, what: WHAT[top] };
|
|
169
|
+
}
|
|
@@ -15,6 +15,9 @@
|
|
|
15
15
|
* a press ticks or unticks and the list stays open, the last tick stays, and the pick applies when the list closes (Escape, a press outside,
|
|
16
16
|
* the chip again, or the sheet's scrim). Arrow keys move in the list. Add a product is the last row. Nothing here writes but savePick. */
|
|
17
17
|
import { pmGet, pmPost } from './http.js';
|
|
18
|
+
import { productName } from './scope-chip.js'; // one display name per product on every page ("IDPF", not "pmos-idpf"); used at draw time only
|
|
19
|
+
/** A product's name as every page prints it; the pick's own name until the names are in. */
|
|
20
|
+
const nameOf = (p) => productName(p && p.ws, (p && p.name) || '');
|
|
18
21
|
|
|
19
22
|
export const TONES = 3;
|
|
20
23
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"]/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"' }[c]));
|
|
@@ -45,13 +48,13 @@ const isAll = (P) => !!P && P.products.length > 1 && P.products.every((p) => p.o
|
|
|
45
48
|
/** The words of the chip (its tooltip and accessible name): "Products on Home: acme-shop, acme-web", or "… all 3". */
|
|
46
49
|
export function chipWords(P, label) {
|
|
47
50
|
if (!P || !P.products.length) return label + ': none registered';
|
|
48
|
-
return label + ': ' + (isAll(P) ? 'all ' + P.products.length : P.products.filter((p) => p.on).map(
|
|
51
|
+
return label + ': ' + (isAll(P) ? 'all ' + P.products.length : P.products.filter((p) => p.on).map(nameOf).join(', '));
|
|
49
52
|
}
|
|
50
53
|
export function chipHtml(P, o = {}) {
|
|
51
54
|
const T = o.tones || tonesOf(P ? P.products : []), on = P ? P.products.filter((p) => p.on) : [];
|
|
52
55
|
// o.names (Work and Goals, slice 1): the full name of the first ticked product, "+2" for the others, "All products" when every one is ticked
|
|
53
56
|
const first = on.slice().sort((a, b) => (b.primary ? 1 : 0) - (a.primary ? 1 : 0))[0];
|
|
54
|
-
const inner = !P ? '' : o.names ? `<span class="ppk-all ppk-nmc">${isAll(P) ? 'All products' : first ? esc(first
|
|
57
|
+
const inner = !P ? '' : o.names ? `<span class="ppk-all ppk-nmc">${isAll(P) ? 'All products' : first ? esc(nameOf(first)) + (on.length > 1 ? ` <em>+${on.length - 1}</em>` : '') : 'No product'}</span>`
|
|
55
58
|
: isAll(P) ? '<span class="ppk-all">All</span>'
|
|
56
59
|
: `<span class="ppk-stk">${on.slice(0, 3).map((p) => `<i class="ppk-t t${T[p.ws] || 0}">${esc(codeOf(p))}</i>`).join('')}${on.length > 3 ? `<i class="ppk-t ppk-n">+${on.length - 3}</i>` : ''}</span>`;
|
|
57
60
|
const words = chipWords(P, o.label || 'Products'), id = o.id || 'ppChip', open = !!cur && cur.id === id; // a page that draws again keeps the open state
|
|
@@ -67,7 +70,7 @@ function itemsHtml(c) {
|
|
|
67
70
|
const box = (st) => `<i class="ppk-tk${st === 'true' ? ' on' : st === 'mixed' ? ' part' : ''}" aria-hidden="true">${st === 'true' ? svg(TICK, 13, 3.4) : st === 'mixed' ? svg(PART, 12, 3.4) : ''}</i>`;
|
|
68
71
|
const rows = P.products.map((p) => {
|
|
69
72
|
const on = c.tick.has(p.ws), line = c.o.lines ? c.o.lines(p.ws) : '';
|
|
70
|
-
return `<button type="button" class="ppk-mi" role="menuitemcheckbox" aria-checked="${on}" data-pp="${esc(p.ws)}"><span class="ppk-tl t${T[p.ws] || 0}" aria-hidden="true">${esc(codeOf(p))}</span><span class="ppk-nm"><b>${esc(p
|
|
73
|
+
return `<button type="button" class="ppk-mi" role="menuitemcheckbox" aria-checked="${on}" data-pp="${esc(p.ws)}"><span class="ppk-tl t${T[p.ws] || 0}" aria-hidden="true">${esc(codeOf(p))}</span><span class="ppk-nm"><b>${esc(nameOf(p))}</b>${line ? `<em>${esc(line)}</em>` : ''}</span>${box(String(on))}</button>`;
|
|
71
74
|
}).join('');
|
|
72
75
|
return (P.products.length > 1 ? `<button type="button" class="ppk-mi" role="menuitemcheckbox" aria-checked="${all}" data-pp="*"><span class="ppk-nm"><b>All products</b></span>${box(all)}</button><div class="ppk-sep" role="separator"></div>` : '')
|
|
73
76
|
+ rows + (`${P.products.length ? '<div class="ppk-sep" role="separator"></div>' : ''}<button type="button" class="ppk-mi" role="menuitem" data-pp-add><span class="ppk-pl" aria-hidden="true">${svg(PLUS, 18, 2.2)}</span><span class="ppk-nm"><b>Add a product</b></span></button>`)
|
|
@@ -18,7 +18,7 @@ import * as VW from './cozy-viewer.js';
|
|
|
18
18
|
import * as POP from './cozy-popup.js';
|
|
19
19
|
import { KINDS, routineRows, routineGroups, didLine, kindCounts, productsOf, productName } from './cozy-routine-model.js';
|
|
20
20
|
import * as PK from './cozy-pick.js'; // the saved product pick of Work, Today and Goals
|
|
21
|
-
import { scopeChipHtml, openScope, scopeWords, whenNames, displayName } from './scope-chip.js'; // one chip for products, programs and projects (shared with Events)
|
|
21
|
+
import { scopeChipHtml, openScope, scopeWords, whenNames, displayName, productName as shownName } from './scope-chip.js'; // one chip for products, programs and projects (shared with Events)
|
|
22
22
|
import { atOf } from './cozy-evmodel.js';
|
|
23
23
|
import { openReport } from './cozy-routine-pop.js';
|
|
24
24
|
import { openJob, openNew } from './cozy-routine-job.js'; // reads, jobs, services and your tasks: manage them in the popup (round 3 item 3)
|
|
@@ -59,7 +59,8 @@ async function load() {
|
|
|
59
59
|
return up && up !== x ? up : null;
|
|
60
60
|
};
|
|
61
61
|
const own = displayName; // the chip's rule (pm/scope-chip.js), so the column and the chip agree
|
|
62
|
-
|
|
62
|
+
await whenNames(); // every page prints a product by the one shared name (productName in pm/scope-chip.js), never a second map
|
|
63
|
+
S.ws = raw.map((x) => { const m = mainOf(x); return { id: x.id, name: shownName(x.id, m ? own(m) : own(x)), slug: x.name || x.id, main: m ? m.id : null }; });
|
|
63
64
|
const home = (raw.find((x) => x.home) || raw[0] || {}).id; // Horizon scan and Report finder are settings of the home product
|
|
64
65
|
const per = await Promise.all(S.ws.map((x) => Promise.all([pmGet('/api/report-setups/routine?ws=' + enc(x.id)).catch(() => null), pmGet('/api/autonomy?ws=' + enc(x.id)).catch(() => null)])));
|
|
65
66
|
const [rf, sc, pk, scan, rs, pg] = await Promise.all([pmGet('/api/refresh').catch(() => null), pmGet('/api/schedules?all=1').catch(() => null), PK.readPick().catch(() => null),
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
*
|
|
3
3
|
* mountToday(ctx) once, from home-app.js on today.html (body[data-today]). ctx is what Home already has:
|
|
4
4
|
* { S, VW, POP, pmGet, pmPost, toast, toastUndo, isPhone, now(), rank() → rankMove's answer, rows() → Home's rows by id (a Map),
|
|
5
|
-
* titleOf(ini), hasIni(ini), boardWs(), boardId(), goIni(id), select(id), movePress(btn), openFinished(f), openReviewVw(), openMeeting(m),
|
|
5
|
+
* titleOf(ini), hasIni(ini), boardWs(), boardId(), goIni(id), select(id), movePress(btn), openFinished(f), openReviewVw(), openMeeting(m), startCalls(ids) → { started, failed },
|
|
6
6
|
* openCalendar(), openInbox(), openLab(l), reload(), review() → the weekly review's model, meetings() → today's meetings, news() → how
|
|
7
7
|
* many are new for you, chatNow() → the chat's target }
|
|
8
8
|
* → { on() → Today is drawn, draw(), read() }
|
|
@@ -14,12 +14,13 @@
|
|
|
14
14
|
* a Lab finding kept or dropped (POST /api/lab/*). Each says what it did in the toast, with Undo. Reads: GET /api/today-log, and GET
|
|
15
15
|
* /api/events-place for the reports that go out today (placed at their time on the agenda). */
|
|
16
16
|
import * as TM from './cozy-today-model.js';
|
|
17
|
+
import { productName, whenNames } from './scope-chip.js';
|
|
17
18
|
import * as TP from './cozy-today-view.js';
|
|
18
19
|
import * as OM from './mention-one-model.js'; // the one mention's title and the self check's proof line (Today round 3)
|
|
19
20
|
|
|
20
21
|
const ASK_SEND = new Set(['session']);
|
|
21
22
|
export function mountToday(ctx) {
|
|
22
|
-
const X = { log: { entries: [], marks: {} }, html: '', model: null, agenda: null, read: false, busy: new Set(), type: '', open: false, hide: new Set() };
|
|
23
|
+
const X = { log: { entries: [], marks: {} }, html: '', model: null, agenda: null, read: false, busy: new Set(), type: '', open: false, hide: new Set(), sopen: new Set() };
|
|
23
24
|
const el = document.getElementById('tdPage');
|
|
24
25
|
const on = () => !!el && !ctx.isPhone();
|
|
25
26
|
const day = () => TM.dayKey(ctx.now());
|
|
@@ -46,6 +47,12 @@ export function mountToday(ctx) {
|
|
|
46
47
|
const tabs = (ctx.S.D.work && ctx.S.D.work.queue && ctx.S.D.work.queue.tabs) || [];
|
|
47
48
|
return ((tabs.find((t) => t.key === 'today') || { groups: [] }).groups || []).flatMap((g) => g.rows || []);
|
|
48
49
|
};
|
|
50
|
+
/* a product's display name, never its id (audit round 2): the one name function every page prints (pm/scope-chip.js); redrawn once the names are in */
|
|
51
|
+
let namesIn = false;
|
|
52
|
+
function productOf(ws) {
|
|
53
|
+
if (!namesIn) { namesIn = true; Promise.resolve(whenNames()).then(() => { X.html = ''; draw(); }).catch(() => {}); }
|
|
54
|
+
return productName(ws, '');
|
|
55
|
+
}
|
|
49
56
|
function models() {
|
|
50
57
|
const S = ctx.S, D = S.D, now = ctx.now(), byId = ctx.rows();
|
|
51
58
|
// Your move's rows, with what Home's own rows know of each (its task and its due day): a late task is dated, a next step is not
|
|
@@ -55,7 +62,7 @@ export function mountToday(ctx) {
|
|
|
55
62
|
const R = ctx.review();
|
|
56
63
|
const lab = (S.lab || []).flatMap((l) => (l.items || []).map((f) => ({ ...f, ws: l.ws, board: l.board })));
|
|
57
64
|
const L = TM.logModel({ rank: ctx.rank(), move, items: tdItems(), drafts, review: R && R.open && !R.done ? { title: 'Your weekly review' } : null,
|
|
58
|
-
own: X.log.entries, marks: X.log.marks, lab, titleOf: ctx.titleOf, now });
|
|
65
|
+
own: X.log.entries, marks: X.log.marks, lab, titleOf: ctx.titleOf, productOf, now });
|
|
59
66
|
const lead = L.rows.find((r) => !r.done && r.src !== 'note' && r.src !== 'own' && r.src !== 'lab');
|
|
60
67
|
const A = TM.agendaModel({ meetings: ctx.meetings(), own: X.log.entries, reports: X.reports || [], focus: lead ? { key: lead.key, title: lead.title } : null, now,
|
|
61
68
|
iniOf: (m) => (m && (m.initiative || (m.level && m.level.kind === 'initiative' && m.level.id) || (m.about && m.about.kind === 'initiative' && m.about.id))) || null });
|
|
@@ -81,7 +88,7 @@ export function mountToday(ctx) {
|
|
|
81
88
|
}
|
|
82
89
|
if (X.type && !(L.types || {})[X.type]) X.type = '';
|
|
83
90
|
const cap = document.getElementById('tdCap'), draft = cap ? cap.value : '', focus = !!cap && document.activeElement === cap;
|
|
84
|
-
const html = TP.pageHtml(L, A, { draft, overview: O, type: X.type, open: X.open || !!X.type, handled: X.type && X.type !== 'Ask' ? [] : handled(), hopen: X.hopen });
|
|
91
|
+
const html = TP.pageHtml(L, A, { draft, overview: O, type: X.type, open: X.open || !!X.type, handled: X.type && X.type !== 'Ask' ? [] : handled(), hopen: X.hopen, sopen: [...X.sopen] });
|
|
85
92
|
if (html === X.html && el.firstChild) return;
|
|
86
93
|
X.html = html;
|
|
87
94
|
const st = el.parentNode ? el.parentNode.scrollTop : 0;
|
|
@@ -89,7 +96,7 @@ export function mountToday(ctx) {
|
|
|
89
96
|
if (el.parentNode) el.parentNode.scrollTop = st;
|
|
90
97
|
const c2 = document.getElementById('tdCap'); if (c2 && focus) { c2.focus(); c2.setSelectionRange(c2.value.length, c2.value.length); }
|
|
91
98
|
}
|
|
92
|
-
const rowOf = (key) => (X.model ? X.model.rows.find((r) => r.key === key) : null);
|
|
99
|
+
const rowOf = (key) => (X.model ? X.model.rows.flatMap((r) => [r, ...(r.members || [])]).find((r) => r.key === key) : null);
|
|
93
100
|
const snap = (r) => ({ title: r.title, work: r.work, job: r.job, type: r.type });
|
|
94
101
|
async function mark1(key, act, extra) {
|
|
95
102
|
const r = await ctx.pmPost('/api/today-log/mark', { key, act, day: day(), ...extra }).catch(() => null);
|
|
@@ -121,6 +128,7 @@ export function mountToday(ctx) {
|
|
|
121
128
|
function open(r) {
|
|
122
129
|
if (!r) return;
|
|
123
130
|
const ref = r.ref || {};
|
|
131
|
+
if (r.members) { if (X.sopen.has(r.key)) X.sopen.delete(r.key); else X.sopen.add(r.key); draw(); return; } // the same step for N initiatives: list them
|
|
124
132
|
X.last = r.key; // ↑ ↓ (j k) step from here (round 3 point 6)
|
|
125
133
|
if (r.src === 'ask') {
|
|
126
134
|
// a mention opens that one mention in the popup, about it, with the chat hidden (round 3 points 1 to 7); never the Mentions list
|
|
@@ -209,6 +217,15 @@ export function mountToday(ctx) {
|
|
|
209
217
|
ctx.toastUndo('Dropped from your log.', async () => { const u = await mark(r.key, 'undrop'); after(false); return u; });
|
|
210
218
|
return after(false);
|
|
211
219
|
}
|
|
220
|
+
/** ✓ on "N initiatives have no PRD": PMOS starts one draft per initiative, each for the PM to read; ✕ is not offered again for a month. */
|
|
221
|
+
async function same(r, yes) {
|
|
222
|
+
if (!yes) { const m = await mark1(r.key, 'keep', {}); if (!m.ok) return ctx.toast('It did not go through: ' + m.error + '.'); ctx.toast('PMOS will not offer it again for a month.'); return after(false); }
|
|
223
|
+
const ids = r.members.map((x) => x.ref && x.ref.call && x.ref.call.id).filter(Boolean);
|
|
224
|
+
const res = ctx.startCalls ? await ctx.startCalls(ids).catch(() => null) : null;
|
|
225
|
+
if (!res || !res.started) return ctx.toast((res && res.error) || 'PMOS did not start them. Nothing changed.');
|
|
226
|
+
ctx.toast('PMOS started ' + res.started + (res.started === 1 ? ' draft' : ' drafts') + '. Each waits for you to read' + (res.failed ? '; ' + res.failed + ' did not start' : '') + '.');
|
|
227
|
+
return after(true);
|
|
228
|
+
}
|
|
212
229
|
async function keep(r) {
|
|
213
230
|
const m = await mark(r.key, 'keep');
|
|
214
231
|
if (!m.ok) return ctx.toast('It was not kept: ' + m.error + '.');
|
|
@@ -322,6 +339,7 @@ export function mountToday(ctx) {
|
|
|
322
339
|
else if (act === 'keep') await keep(r);
|
|
323
340
|
else if (act === 'lab-keep' || act === 'lab-drop') await lab(r, act === 'lab-keep');
|
|
324
341
|
else if (act === 'lk-yes' || act === 'lk-no') await looks(r, act === 'lk-yes');
|
|
342
|
+
else if (act === 'same-yes' || act === 'same-no') await same(r, act === 'same-yes');
|
|
325
343
|
} finally { X.busy.delete(key); if (b.isConnected) b.disabled = false; }
|
|
326
344
|
});
|
|
327
345
|
// the first line: Enter adds the row, and nothing else happens (no popup, no session)
|
|
@@ -63,6 +63,9 @@ const DECIDE_RE = /^(decide|confirm|choose|pick|approve|accept|sign|agree|review
|
|
|
63
63
|
const jobOfAsk = (r) => (r.kind === 'call' ? (r.call && r.call.kind === 'update' ? 'Send' : DECIDE_RE.test(String((r.call && r.call.name) || r.title || '')) ? 'Decide' : 'Do')
|
|
64
64
|
: r.kind === 'mention' ? 'Reply' : SEND_KINDS.has(r.kind) ? 'Send' : r.kind === 'kr' || r.kind === 'extra' ? 'Do' : 'Decide');
|
|
65
65
|
const cap1 = (s) => String(s || '').replace(/^[a-z]/, (c) => c.toUpperCase());
|
|
66
|
+
/** No ids in a title (audit round 2): "KR-A1 Signup conversion up: …" reads "Signup conversion up: …". */
|
|
67
|
+
const ID_SHAPED = /^(?:[0-9a-f]{8,}|[a-z0-9]+(?:[-_][a-z0-9]+)+)$/;
|
|
68
|
+
export const noId = (t) => String(t || '').replace(/^(?:[A-Z]{1,4}-[A-Z0-9][\w.]*|health:[\w-]+)\s+/, '');
|
|
66
69
|
/** An ask's What and Work, split as the board says them: the rank names a row "<work>: <what>" (a verdict, a grill finding, a meeting's or a
|
|
67
70
|
* program's milestone changes, the changes to keep); What is the thing to do, Work the initiative or program it is about. */
|
|
68
71
|
export function splitAsk(r, workName) {
|
|
@@ -145,6 +148,8 @@ export function logModel(o = {}) {
|
|
|
145
148
|
const marks = o.marks || {}, titleOf = typeof o.titleOf === 'function' ? o.titleOf : () => '';
|
|
146
149
|
const out = [], seen = new Set(), old = [];
|
|
147
150
|
const work = (ini, fallback) => (ini ? titleOf(ini) || fallback || '' : fallback || '');
|
|
151
|
+
// a product's display name (o.productOf(ws)); a bare id ("pmos-idpf", a hex hash) is never shown
|
|
152
|
+
const productOf = (x) => { const v = String(x || '').trim(); if (!v) return ''; const n = typeof o.productOf === 'function' ? o.productOf(v) || '' : ''; return n || (ID_SHAPED.test(v) ? '' : v); };
|
|
148
153
|
const put = (r) => {
|
|
149
154
|
if (!r.key || seen.has(r.key)) return;
|
|
150
155
|
seen.add(r.key);
|
|
@@ -185,8 +190,10 @@ export function logModel(o = {}) {
|
|
|
185
190
|
did: didLeft(m).did, ...(m.looks ? { looks: { who: String(m.looks.who || '').trim().split(/\s+/)[0], text: m.looks.text } } : {}) });
|
|
186
191
|
continue;
|
|
187
192
|
}
|
|
188
|
-
|
|
189
|
-
|
|
193
|
+
// Work holds an initiative; a product shows by its display name, never its id (audit round 2)
|
|
194
|
+
const prodW = c ? c.sub : (r.shared || []).map((x) => productOf(x)).filter(Boolean)[0] || productOf(r.ws || '');
|
|
195
|
+
put({ key: c ? 'call:' + c.id : r.key, src: 'ask', bullet: 'task', title: noId(sp.what || r.title || (c && c.name) || ''), ini: r.ini || (c && c.ini) || null, ws: r.ws || '',
|
|
196
|
+
work: work(r.ini || (c && c.ini), prodW) || sp.work, job: jobOfAsk(r), carried, late: carried >= LATE_DAYS,
|
|
190
197
|
when: whenWord({ carried, send }, today), first: r.rank <= 2 || (c && c.kind === 'update' && /^(today|now)/i.test(String(c.when || ''))) || false, ref: r });
|
|
191
198
|
}
|
|
192
199
|
// the rest of Your move: the PM's own late tasks and the next steps (a call is in the asks already; an item is in the items)
|
|
@@ -227,6 +234,7 @@ export function logModel(o = {}) {
|
|
|
227
234
|
const ex = (rank.expired || []).length;
|
|
228
235
|
if (ex) out.push({ key: 'expired:' + today, keys: ['expired:' + today], src: 'note', bullet: 'note', type: 'Note', first: false, title: plural(ex, 'ask', 'asks') + ' expired after 14 days with no answer. PMOS wrote why in History',
|
|
229
236
|
work: '', ini: null, ws: '', job: 'Note', when: '', late: false, carried: 0, done: false, drop: false, dates: 'mark', ref: null });
|
|
237
|
+
sameJob(out, marks);
|
|
230
238
|
const open = out.filter((r) => !r.done), done = out.filter((r) => r.done);
|
|
231
239
|
const n = (j) => open.filter((r) => r.job === j).length;
|
|
232
240
|
const counts = { decide: n('Decide'), do: n('Do'), reply: n('Reply'), send: n('Send'), notes: open.filter((r) => r.bullet === 'note').length, events: open.filter((r) => r.bullet === 'event').length };
|
|
@@ -241,14 +249,37 @@ export function logModel(o = {}) {
|
|
|
241
249
|
const merged = open.reduce((k, r) => k + (r.merged ? r.merged - 1 : 0), 0);
|
|
242
250
|
return { rows: G.first.concat(G.today, done, G.wait), first: G.first, todayRows: G.today.concat(done), wait: G.wait, open: open.length, done: done.length, counts, types, merged, line, today, old };
|
|
243
251
|
}
|
|
252
|
+
/** SAME JOB, MANY INITIATIVES (audit round 2): open asks that read the same for two or more initiatives ("Draft the PRD, or let PMOS draft
|
|
253
|
+
* it" five times) become one row: "5 initiatives have no PRD", its members under it when opened. When each one is a step PMOS drafts, a ✦
|
|
254
|
+
* line says "PMOS drafts them for you to read" with ✓ ✕ (✕ is kept for a month as the mark kept on the group). In place, on out. */
|
|
255
|
+
export function sameJob(out, marks = {}) {
|
|
256
|
+
const by = new Map();
|
|
257
|
+
for (const r of out) {
|
|
258
|
+
if (r.done || r.src !== 'ask' || !r.ref || r.ref.kind !== 'call' || !(r.ini || r.work)) continue;
|
|
259
|
+
const k = r.job + '|' + String(r.title).toLowerCase(); if (!by.has(k)) by.set(k, []); by.get(k).push(r);
|
|
260
|
+
}
|
|
261
|
+
for (const L of by.values()) {
|
|
262
|
+
const inis = new Set(L.map((r) => r.ini || r.work)); if (inis.size < 2) continue; // the initiative, or its name when the call carries no id
|
|
263
|
+
const t = L[0].title, m = /^Draft the (.+?)(?:, or let PMOS draft it)?$/i.exec(t), n = inis.size;
|
|
264
|
+
const key = 'same:' + String(t).toLowerCase().replace(/[^a-z0-9]+/g, '-'), mk = marks[key] || {};
|
|
265
|
+
const at = out.indexOf(L[0]);
|
|
266
|
+
const row = { ...L[0], key, keys: L.flatMap((r) => r.keys || [r.key]), title: m ? n + ' initiatives have no ' + m[1] : n + ' initiatives: ' + t, ini: null, work: '',
|
|
267
|
+
carried: Math.max(...L.map((r) => r.carried || 0)), late: L.some((r) => r.late), first: L.some((r) => r.first), members: L.map((r) => ({ ...r, member: true, title: r.work || r.title, work: '', type: '', job: '', reason: '' })), ref: { kind: 'same' }, // under the group each one is named by its initiative
|
|
268
|
+
drafts: !!m && !(mk.kept), reason: '' };
|
|
269
|
+
row.when = '';
|
|
270
|
+
for (const r of L) out.splice(out.indexOf(r), 1);
|
|
271
|
+
out.splice(Math.min(at, out.length), 0, row);
|
|
272
|
+
}
|
|
273
|
+
return out;
|
|
274
|
+
}
|
|
244
275
|
/** PMOS HANDLED (design check of round 3, point 6): the asks the self check cleared today from proof (his reply, a closed ticket, the ask
|
|
245
276
|
* taken back), as the folded last group, each with Undo. answered: the Mentions answered list; o: { today, now, cleared: ids PMOS saw
|
|
246
277
|
* leave Today today }. A row: { id, title, proof }. An ask whose proof is from today, or that PMOS saw leave today, is one of them. */
|
|
247
278
|
export function handledModel(answered, o = {}) {
|
|
248
279
|
const today = o.today || dayKey(o.now || Date.now()), cleared = new Set(o.cleared || []);
|
|
249
|
-
return (answered || []).filter((m) => m && m.auto && m.proof && (cleared.has(m.id) || dayKey(Date.parse(m.proof.at || '') || 0) === today))
|
|
280
|
+
return (answered || []).filter((m) => m && m.auto && m.proof && (cleared.has(m.id) || dayKey(Date.parse(m.proof.cleared || m.proof.at || '') || 0) === today))
|
|
250
281
|
.map((m) => { const who = (Array.isArray(m.people) && m.people.length ? m.people : [m.who || '']).map((x) => String(x).trim().split(/\s+/)[0]).filter(Boolean);
|
|
251
|
-
return { id: m.id, title: (who.length ? names(who) + ': ' : '') + askTitle(m), proof: proofText(m.proof, o.now) }; });
|
|
282
|
+
return { id: m.id, title: (who.length ? names(who) + ': ' : '') + askTitle(m), proof: proofText(m.proof, o.now, { full: true }) }; });
|
|
252
283
|
}
|
|
253
284
|
/** A task late more than this many days is an old import, not a Today row (round 3 point 12). */
|
|
254
285
|
export const OLD_TASK_DAYS = 30;
|
|
@@ -270,6 +301,7 @@ export function whyOf(r, today) {
|
|
|
270
301
|
if (r.src === 'draft') return 'PMOS finished it, needs your look';
|
|
271
302
|
if (r.src === 'review') return 'Your weekly review is open';
|
|
272
303
|
if (r.src === 'lab') return 'PMOS found it, keep or drop';
|
|
304
|
+
if (ref.kind === 'same') return ''; // the title says it already; the ✦ line is the whole of it (design check of #1392)
|
|
273
305
|
if (c) {
|
|
274
306
|
if (c.kind === 'update') return c.when ? 'Goes out ' + c.when : 'Ready to send';
|
|
275
307
|
if (c.kind === 'session' && (c.state === 'blocked' || c.state === 'needs')) return 'A session waits on you';
|
|
@@ -382,18 +414,18 @@ export function agendaModel(o = {}) {
|
|
|
382
414
|
items.push({ key: 'r:' + (r.key || r.title), kind: 'report', title: r.title || 'A report', sub: r.time + ' · the report goes out', a: a.getTime(), b: a.getTime() + 30 * 60000, ini: null, ref: r });
|
|
383
415
|
}
|
|
384
416
|
items.sort((x, y) => x.a - y.a);
|
|
385
|
-
// focus time: the first open row of the log, in the first free
|
|
386
|
-
|
|
387
|
-
|
|
417
|
+
// focus time: the first open row of the log, in the first free gap of 30 minutes or more BETWEEN two events from now (a dashed box; audit
|
|
418
|
+
// round 2: it ends at the next event, never after the last one, and none on a day with no events)
|
|
419
|
+
const F = o.focus, evs = items.filter((y) => y.kind === 'meeting' || y.kind === 'own');
|
|
420
|
+
if (F && F.key && F.title && evs.length) {
|
|
388
421
|
const end = new Date(now); end.setHours(18, 0, 0, 0);
|
|
389
422
|
const d8 = new Date(now); d8.setHours(8, 0, 0, 0); // focus time is in the working day: from now, never before 08:00
|
|
390
423
|
let at = Math.max(Math.ceil(now / (5 * 60000)) * 5 * 60000, d8.getTime()), got = null;
|
|
391
|
-
for (const x of
|
|
424
|
+
for (const x of evs) { // the gap ends at the next event's start; the stretch after the last event is not a gap
|
|
392
425
|
if (x.b <= at) continue;
|
|
393
426
|
if (x.a - at >= 30 * 60000) { got = [at, Math.min(x.a, end.getTime())]; break; }
|
|
394
427
|
at = Math.max(at, x.b);
|
|
395
428
|
}
|
|
396
|
-
if (!got && end.getTime() - at >= 30 * 60000) got = [at, end.getTime()];
|
|
397
429
|
if (got && got[1] - got[0] >= 30 * 60000) {
|
|
398
430
|
items.push({ key: 'f:' + F.key, kind: 'focus', title: F.title, sub: hm(got[0]) + ' to ' + hm(got[1]) + ' · focus time PMOS holds for this call', a: got[0], b: got[1], ini: null, ref: F, row: F.key });
|
|
399
431
|
items.sort((x, y) => x.a - y.a);
|
|
@@ -421,7 +453,9 @@ export function agendaModel(o = {}) {
|
|
|
421
453
|
const sub = DOW[d.getDay()] + ' ' + d.getDate() + ' ' + MON[d.getMonth()] + (free ? ' · ' + durWord(free) + ' free' : '');
|
|
422
454
|
const meets = items.filter((x) => x.kind === 'meeting' || x.kind === 'own');
|
|
423
455
|
const nx = meets.find((x) => x.a >= now);
|
|
424
|
-
|
|
456
|
+
// a day with no event: one quiet line, not an empty grid (audit round 2)
|
|
457
|
+
const quiet = meets.length ? '' : 'No events today' + (free ? ' · ' + durWord(free) + ' free' : '');
|
|
458
|
+
return { items, from, to, now: t >= 0 && t <= to - from ? t : null, sub, empty: !items.length, quiet, free, next: nx ? hm(nx.a) : '', nextFirst: !!nx && !meets.some((x) => x.a < now) };
|
|
425
459
|
}
|
|
426
460
|
|
|
427
461
|
const DOW_LONG = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
|
|
@@ -156,4 +156,12 @@ button.td-ev:focus-visible { outline: 2px solid var(--cz-blue); outline-offset:
|
|
|
156
156
|
/* PMOS handled · N (design check of round 3): the asks the self check cleared today, each with Undo */
|
|
157
157
|
.td-undo { border: 0; background: none; padding: 4px 6px; font: inherit; font-size: var(--fs-meta); color: var(--cz-blueink); cursor: pointer; }
|
|
158
158
|
.td-undo:hover, .td-undo:focus-visible { text-decoration: underline; }
|
|
159
|
-
.td-r.hd .td-rs { text-decoration: none; }
|
|
159
|
+
.td-r.hd .td-rs { text-decoration: none; white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; } /* the proof in full: it is why he can trust it */
|
|
160
|
+
.td-r.hd .td-a { opacity: 1; } /* Undo on every handled row, not only on hover */
|
|
161
|
+
/* audit round 2: the same step for N initiatives lists its members under it when opened; a day with no event is one quiet line */
|
|
162
|
+
.td-t svg { vertical-align: -2px; margin-left: 4px; color: var(--cz-ink3); }
|
|
163
|
+
.td-t[aria-expanded="true"] svg { transform: rotate(180deg); }
|
|
164
|
+
.td-r.mem .td-wt { padding-left: 18px; }
|
|
165
|
+
.td-r.mem .td-t { font-weight: var(--fw-regular); }
|
|
166
|
+
.td-ag.quiet { align-self: start; }
|
|
167
|
+
.td-quiet { margin: 6px 0 0; font-size: var(--fs-row); color: var(--cz-ink2); }
|
|
@@ -28,19 +28,22 @@ const BULLET = { task: ['•', 'Task'], event: ['○', 'Event'], note: ['–', '
|
|
|
28
28
|
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>`;
|
|
29
29
|
|
|
30
30
|
/** One row of the log. */
|
|
31
|
-
export function rowHtml(r) {
|
|
31
|
+
export function rowHtml(r, o = {}) {
|
|
32
32
|
const [b, bl] = r.done ? ['×', 'Done'] : BULLET[r.bullet] || BULLET.task;
|
|
33
33
|
const acts = r.done || r.src === 'note' ? '' : r.src === 'lab'
|
|
34
34
|
? 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)
|
|
35
35
|
: 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"');
|
|
36
|
-
const cls = ['td-r', r.done ? 'done' : '', r.bullet === 'note' ? 'note' : '', r.src === 'lab' ? 'lab' : '', r.reason ? 'why' : ''].filter(Boolean).join(' ');
|
|
36
|
+
const cls = ['td-r', r.done ? 'done' : '', r.bullet === 'note' ? 'note' : '', r.src === 'lab' ? 'lab' : '', r.reason ? 'why' : '', r.member ? 'mem' : ''].filter(Boolean).join(' ');
|
|
37
37
|
// a note, an own event and a done row open nothing: their words are the whole of it
|
|
38
38
|
const opens = !r.done && r.src !== 'own' && r.src !== 'gone' && r.src !== 'note';
|
|
39
|
-
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>`;
|
|
39
|
+
const title = opens ? `<button type="button" class="td-t" data-td="open" data-key="${esc(r.key)}"${r.members ? ` aria-expanded="${!!o.sopen}"` : ''}>${esc(r.title)}${r.members ? svg(I.more, 13) : ''}</button>` : `<span class="td-t">${esc(r.title)}</span>`;
|
|
40
40
|
const sug = r.drop ? `<div class="td-sg" role="group" aria-label="PMOS suggests"><b aria-hidden="true">✦</b><span>PMOS suggests: drop it from your log.</span>`
|
|
41
41
|
+ ib('drop', 'Drop it', I.yes, r.key) + ib('keep', 'Keep it', I.no, r.key) + '</div>' : '';
|
|
42
42
|
const lk = r.looks && !r.done ? `<div class="td-sg" role="group" aria-label="PMOS suggests"><b aria-hidden="true">✦</b><span>Looks answered: ${esc(r.looks.who ? r.looks.who + ' replied' : 'someone replied')} “${esc(r.looks.text)}”. Close it?</span>`
|
|
43
43
|
+ ib('lk-yes', 'Yes, close it: it is answered', I.yes, r.key) + ib('lk-no', 'No, it still waits on me', I.no, r.key) + '</div>' : '';
|
|
44
|
+
// the same step for N initiatives: PMOS drafts them, he approves once (audit round 2)
|
|
45
|
+
const sj = r.members && r.drafts && !r.done ? `<div class="td-sg" role="group" aria-label="PMOS suggests"><b aria-hidden="true">✦</b><span>PMOS drafts them for you to read.</span>`
|
|
46
|
+
+ ib('same-yes', 'Yes, draft them', I.yes, r.key) + ib('same-no', 'No, not now', I.no, r.key) + '</div>' : '';
|
|
44
47
|
const why = r.src === 'lab' && r.why ? `<div class="td-sg lab"><span>${esc(r.why)}</span></div>` : '';
|
|
45
48
|
// what PMOS did on it, from records (round 3 point 13): a small ✦ with the count; its words on hover and for a screen reader
|
|
46
49
|
const did = r.did && r.did.length && !r.done ? `<span class="td-did" title="${esc('PMOS did: ' + r.did.join('; '))}" aria-label="${esc('PMOS did: ' + r.did.join('; '))}"><b aria-hidden="true">✦</b>${r.did.length}</span>` : '';
|
|
@@ -49,7 +52,7 @@ export function rowHtml(r) {
|
|
|
49
52
|
return `<div class="${cls}" data-key="${esc(r.key)}" role="row"><span class="td-p" role="cell">${r.first && !r.done && r.src === 'own' ? '<b aria-label="First">!</b>' : ''}</span>`
|
|
50
53
|
+ `<span class="td-b" role="cell"><i role="img" aria-label="${esc(bl)}">${b}</i></span><span role="cell" class="td-wt">${title}${reason}</span>${type}`
|
|
51
54
|
+ `<span class="td-w" role="cell">${esc(r.work)}</span><span class="td-k" role="cell">${esc(r.job)}</span>`
|
|
52
|
-
+ `<span class="td-d${r.late && !r.done ? ' late' : ''}" role="cell">${esc(r.when)}</span><span class="td-a" role="cell">${acts}</span>${sug}${lk}${why}</div>`;
|
|
55
|
+
+ `<span class="td-d${r.late && !r.done ? ' late' : ''}" role="cell">${esc(r.when)}</span><span class="td-a" role="cell">${acts}</span>${sug}${sj}${lk}${why}</div>`;
|
|
53
56
|
}
|
|
54
57
|
|
|
55
58
|
/** The Overview, one grey box under the head, written by PMOS (✦): where to start and why, the free time, the suggestions with ✓ ✕,
|
|
@@ -77,15 +80,17 @@ export function logHtml(L, o = {}) {
|
|
|
77
80
|
+ `<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" />`
|
|
78
81
|
+ `<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>`;
|
|
79
82
|
const pick = (rows) => (o.type ? (rows || []).filter((r) => r.type === o.type) : rows || []);
|
|
83
|
+
const so = new Set(o.sopen || []);
|
|
84
|
+
const rowHtml1 = (r) => (r.members ? rowHtml(r, { sopen: so.has(r.key) }) + (so.has(r.key) ? r.members.map((m) => rowHtml(m)).join('') : '') : rowHtml(r));
|
|
80
85
|
const first = pick(L.first), today = pick(L.todayRows), wait = pick(L.wait);
|
|
81
86
|
let body = '';
|
|
82
|
-
if (first.length) body += groupRow('Do first') + first.map(
|
|
83
|
-
if (today.length) body += groupRow('Today') + today.map(
|
|
87
|
+
if (first.length) body += groupRow('Do first') + first.map(rowHtml1).join('');
|
|
88
|
+
if (today.length) body += groupRow('Today') + today.map(rowHtml1).join('');
|
|
84
89
|
if (wait.length) {
|
|
85
90
|
const oldest = Math.max(0, ...wait.map((r) => r.carried || 0));
|
|
86
91
|
const said = (first.length || today.length ? wait.length + ' more' : plural2(wait.length)) + (oldest ? ' · the oldest waits ' + oldest + (oldest === 1 ? ' day' : ' days') : '');
|
|
87
92
|
body += `<div class="td-gr" role="row"><span role="cell"><button type="button" class="td-fold" data-td="fold" aria-expanded="${!!o.open}">Can wait <em>${esc(said)}</em>${svg(I.more, 14)}</button></span></div>`;
|
|
88
|
-
if (o.open) body += wait.map(
|
|
93
|
+
if (o.open) body += wait.map(rowHtml1).join('');
|
|
89
94
|
}
|
|
90
95
|
// PMOS handled · N: what the self check cleared today, folded last, Undo on each (design check of round 3, point 6)
|
|
91
96
|
const hd = o.handled || [];
|
|
@@ -122,9 +127,9 @@ export function agendaHtml(A) {
|
|
|
122
127
|
return `<button type="button" class="${cls}" style="${st}" data-td="ev" data-key="${esc(x.key)}" aria-label="${esc(label)}">${inner}</button>`;
|
|
123
128
|
}).join('');
|
|
124
129
|
const nowLine = A.now != null ? `<i class="td-now" style="--t:${pc(A.now)}" aria-hidden="true"></i>` : '';
|
|
125
|
-
return `<aside class="td-ag" aria-label="Today’s agenda"><div class="td-agh"><h2>Today</h2><small>${esc(A.sub)}</small>`
|
|
130
|
+
return `<aside class="td-ag${A.quiet && !A.items.length ? ' quiet' : ''}" aria-label="Today’s agenda"><div class="td-agh"><h2>Today</h2><small>${esc(A.quiet && !A.items.length ? A.sub.split(' · ')[0] : A.sub)}</small>`
|
|
126
131
|
+ `<a class="td-evl" href="/premium-events.html">Events</a></div>`
|
|
127
|
-
+ `<div class="td-tl" style="--rows:${H}">${hours.join('')}${ev}${nowLine}</div></aside
|
|
132
|
+
+ (A.quiet && !A.items.length ? `<p class="td-quiet">${esc(A.quiet)}</p></aside>` : `<div class="td-tl" style="--rows:${H}">${hours.join('')}${ev}${nowLine}</div></aside>`);
|
|
128
133
|
}
|
|
129
134
|
|
|
130
135
|
/** The page head: the day and the time, small, then the greeting. Hd: headModel(). */
|
|
@@ -2405,6 +2405,11 @@ if (TD_PAGE) TDY = mountToday({ S, VW, POP, pmGet, pmPost, toast, toastUndo, isP
|
|
|
2405
2405
|
openMention: (id, o) => { const L = MEN.mentionsOf(S.D), m = [...L.waiting, ...L.toread, ...L.answered].find((x) => x.id === id) || (o && o.m); if (!m) return false; MEN.openOneMention(m, menCtx(), o || {}); return true; },
|
|
2406
2406
|
mentions: () => MEN.mentionsOf(S.D), mentionAct: (id, act) => pmPost('/api/mentions/act', { id, act }), reloadMentions: () => MEN.load(menCtx()).then(() => drawList()),
|
|
2407
2407
|
movePress: (b) => movePress(b), openFinished, openReviewVw, openMeeting: (m) => openMeeting(m), openCalendar,
|
|
2408
|
+
// the same step for N initiatives (audit round 2): ✓ starts each one's ✦ proposal (a draft PMOS writes for the PM to read), never more
|
|
2409
|
+
startCalls: async (ids) => { let started = 0, failed = 0; const N = H.needsOf(S.D);
|
|
2410
|
+
for (const id of ids) { const r = N.find((x) => x.id === id), w = r && r.row && r.row.dialog && r.row.dialog.write; if (!w || w.kind !== 'start') { failed++; continue; }
|
|
2411
|
+
const x = await startAgent({ ws: w.ws || WS || undefined, task: 'draft', initiative: w.initiative, what: w.what }); if (x.ok) started++; else failed++; }
|
|
2412
|
+
if (started) load(); return { started, failed, error: started ? '' : 'PMOS did not start them. Nothing changed.' }; },
|
|
2408
2413
|
openInbox: () => MORE.openInbox(searchGo, ''), reload: () => load(), review: () => L.reviewModel(S.D, NOW()), meetings: () => H.todayOf(S.D),
|
|
2409
2414
|
news: () => (S.news && S.news.ok ? S.news.count || 0 : 0), chatNow: () => (chat.current ? chat.current() : null),
|
|
2410
2415
|
openLab: (f) => import('./cozy-lab-ins.js').then((LB) => LB.openLab({ where: () => ({ ws: f.ws, board: f.board }), iniHref: (id) => '/premium-initiative.html?' + (f.ws ? 'ws=' + encodeURIComponent(f.ws) + '&' : '') + 'id=' + encodeURIComponent(id), toast: (m, undo) => (undo ? toastUndo(m, undo) : toast(m)) })) });
|
|
@@ -14,7 +14,7 @@ const WD = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
|
|
14
14
|
const MO = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
15
15
|
const SRC = { slack: 'Slack', jira: 'Jira', confluence: 'Confluence', mail: 'email', gmail: 'Gmail', figma: 'Figma', doc: 'the document' };
|
|
16
16
|
const T = (iso) => { const t = typeof iso === 'number' ? iso : Date.parse(iso || ''); return Number.isFinite(t) ? t : 0; };
|
|
17
|
-
const
|
|
17
|
+
const clip0 = (s, n) => { s = String(s || '').replace(/\s+/g, ' ').trim(); return s.length > n ? s.slice(0, n - 1).trimEnd() + '…' : s; };
|
|
18
18
|
const first = (who) => String(who || 'someone').replace(/[,;:]+$/, '').trim().split(/\s+/)[0];
|
|
19
19
|
export const srcName = (s) => SRC[s] || (s ? String(s).charAt(0).toUpperCase() + String(s).slice(1) : 'its source');
|
|
20
20
|
const hm = (t) => { const d = new Date(t); return String(d.getHours()).padStart(2, '0') + ':' + String(d.getMinutes()).padStart(2, '0'); };
|
|
@@ -37,7 +37,7 @@ export function askTitle(m) {
|
|
|
37
37
|
if (!s) return 'An ask';
|
|
38
38
|
if (notASentence(s)) return asWritten(m);
|
|
39
39
|
s = s.charAt(0).toUpperCase() + s.slice(1);
|
|
40
|
-
return
|
|
40
|
+
return clip0(s, 120);
|
|
41
41
|
}
|
|
42
42
|
/** The cleaner made no sentence of it ("the PM whether the PM requires …", "for test card details …"): design check of round 3, point 3. */
|
|
43
43
|
export const notASentence = (s) => /^(the pm|pm|you|him|her|them|for|to|about|that|of)\b/i.test(String(s || '').trim());
|
|
@@ -74,10 +74,12 @@ export function blanksOf(text) { const out = []; let m, i = 0; BLANK.lastIndex =
|
|
|
74
74
|
export function fill(text, values = []) { let i = 0; return String(text || '').replace(BLANK, (all) => { const v = String(values[i++] || '').trim(); return v || all; }); }
|
|
75
75
|
|
|
76
76
|
/** The proof the self check found, said once: "You replied Tue 17 Nov: “We go with CAS.”" */
|
|
77
|
-
export function proofText(p, now = Date.now()) {
|
|
77
|
+
export function proofText(p, now = Date.now(), o = {}) {
|
|
78
78
|
if (!p) return '';
|
|
79
|
+
const clip = (t, n) => (o.full ? String(t || '').replace(/\s+/g, ' ').trim() : clip0(t, n)); // full: PMOS handled shows the proof whole
|
|
79
80
|
if (p.how === 'replied') return 'You replied ' + dayText(p.at) + (p.text ? ': “' + clip(p.text, 90) + '”' : '');
|
|
80
81
|
if (p.how === 'closed') return 'The ticket is ' + String(p.text || 'closed').toLowerCase() + ' (read ' + whenText(p.at, now) + ')';
|
|
82
|
+
if (p.how === 'others') return (p.who ? first(p.who) : 'Someone') + ' answered ' + dayText(p.at) + (p.text ? ': “' + clip(p.text, 90) + '”' : '');
|
|
81
83
|
if (p.how === 'withdrawn') return 'They took the ask back' + (p.text ? ': “' + clip(p.text, 90) + '”' : '');
|
|
82
84
|
return '';
|
|
83
85
|
}
|
|
@@ -99,7 +101,7 @@ export function didLeft(m, o = {}) {
|
|
|
99
101
|
const blanks = m && m.draft ? blanksOf(m.draft) : [];
|
|
100
102
|
if (m && m.draft && !m.drafted) did.push(blanks.length ? 'started the reply' : 'drafted the reply');
|
|
101
103
|
if (m && m.drafted) did.push('copied the reply for ' + (typeof m.drafted === 'string' ? m.drafted : src));
|
|
102
|
-
if (m && m.task) did.push('made it a task: ' +
|
|
104
|
+
if (m && m.task) did.push('made it a task: ' + clip0(m.task.title || 'Reply to ' + who, 60));
|
|
103
105
|
if (m && m.watch) did.push('is watching for ' + m.watch.what);
|
|
104
106
|
if (m && m.proof) did.push('checked ' + src + ': ' + proofText(m.proof, o.now).replace(/^You/, 'you').replace(/^The/, 'the').replace(/^They/, 'they'));
|
|
105
107
|
let left;
|