create-pmos 0.645.0 → 0.647.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +27 -27
- package/payload/KIT-VERSION +1 -1
- package/payload/design-system/ui/components/Suggestion/README.md +8 -0
- package/payload/design-system/ui/components/Timeline/README.md +8 -0
- package/payload/design-system/ui/components/bundle.css +38 -0
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/changelog.json +26 -0
- package/workspace/design-system/ui/components/Suggestion/README.md +8 -0
- package/workspace/design-system/ui/components/Timeline/README.md +8 -0
- package/workspace/design-system/ui/components/bundle.css +38 -0
- package/workspace/guide/layout.md +24 -12
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/bd-backlog.js +21 -11
- package/workspace/public/pm/bd-ds.css +0 -7
- package/workspace/public/pm/bd-span.js +10 -5
- package/workspace/public/pm/bd-stands.js +165 -0
- package/workspace/public/pm/bd-work-ds.css +107 -0
- package/workspace/public/pm/bd-work.css +8 -77
- package/workspace/public/pm/bd-work.js +79 -46
- package/workspace/public/pm/cozy-today-app.js +10 -5
- package/workspace/public/pm/cozy-today-model.js +11 -5
- package/workspace/public/pm/cozy-today-page.css +50 -135
- package/workspace/public/pm/cozy-today-view.js +147 -98
- package/workspace/public/pm/komorebi.css +39 -0
- package/workspace/public/pm/premium-board.js +57 -10
- package/workspace/public/pm/readonly.js +3 -0
- package/workspace/public/premium-board.html +4 -1
|
@@ -1,146 +1,195 @@
|
|
|
1
|
-
/* pm/cozy-today-view.js — Today, the markup (slice 5 of the six-place navigation;
|
|
1
|
+
/* pm/cozy-today-view.js — Today, the markup (slice 5 of the six-place navigation; initiative today-log-page).
|
|
2
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
3
|
* and handles every press (data-td="…").
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
5
|
+
* On a desk the page is built only from PMOS design system parts (Komorebi, workspace/design-system/ui; agreed design "TodayDS" on the
|
|
6
|
+
* Exploring 3 canvas, page today, 2026-11-20). Layout Main + side:
|
|
7
|
+
* Main the head (the day, then the greeting); the Overview, a Summary block (pm-block): one sentence whose item names open the item, and
|
|
8
|
+
* PMOS's Suggestions (pm-sug, ✓ primary, ✕ outline); Today's log, a List block (pm-block list): its heading and one set of Tabs
|
|
9
|
+
* (pm-tabs: All, Reply, Do, Decide, Send with counts, a zero tab left out), the capture Input (pm-input), then the groups: Do first
|
|
10
|
+
* (the Now group, pm-group now, its first row lit), Today (pm-group), and Later folded (pm-fold "N can wait"), PMOS handled folded last.
|
|
11
|
+
* Row a ListRow (pm-li): the kind icon, the title, a why line ("for <work> · due <date>", or who waits), a late Badge (pm-badge alert),
|
|
12
|
+
* and on hover or focus icon Buttons: first by job (Done, Reply, Decide, Send), then Move to tomorrow and Set a date. A ✦ Suggestion
|
|
13
|
+
* under the row when PMOS proposes something on it (drop it, looks answered, draft them).
|
|
14
|
+
* Side a Timeline block (pm-block flat) with the day's events only: past ones dashed (pm-ev over), the rest raised, the now line in the
|
|
15
|
+
* alert colour, a link to Events; a meeting with a call has the play Button (join and record in one press, meeting-buddy). Below it,
|
|
16
|
+
* a Summary block for the meeting PMOS recorded and filed, with one Suggestion (keep it filed, or take it out).
|
|
15
17
|
* Every icon-only button has an aria-label. The UI says PMOS. Text from records goes through esc(). */
|
|
16
18
|
|
|
17
19
|
export const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
18
20
|
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>`;
|
|
21
|
+
/** The system's icon (pm-ic: stroke, size and caps come from the part). */
|
|
22
|
+
const ic = (d, w = 16, cls = '') => `<svg class="pm-ic${cls ? ' ' + cls : ''}" aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24"><path d="${d}"/></svg>`;
|
|
19
23
|
export const I = {
|
|
20
24
|
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',
|
|
21
25
|
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', more: 'M8 10l4 4 4-4', play: 'M8 5v14l11-7z',
|
|
26
|
+
reply: 'M5 5h14v10H9l-4 4z', decide: 'M12 4l8 8-8 8-8-8z', send: 'M4 12l16-8-6 16-3-7z',
|
|
27
|
+
spark: 'M12 3l1.8 5.4L19 10.2l-5.2 1.8L12 17.4l-1.8-5.4L5 10.2l5.2-1.8z',
|
|
28
|
+
sun: 'M12 3v2M12 19v2M5 5l1.4 1.4M17.6 17.6L19 19M3 12h2M19 12h2M5 19l1.4-1.4M17.6 6.4L19 5M12 8a4 4 0 1 0 0 8 4 4 0 0 0 0-8z',
|
|
22
29
|
};
|
|
23
|
-
/** The small sign of each type
|
|
30
|
+
/** The small sign of each type (one stroke icon). */
|
|
24
31
|
const TI = {
|
|
25
32
|
Ask: 'M5 5h14v10H9l-4 4z', Decision: 'M12 4l8 8-8 8-8-8z', Check: 'M5 12.5l4.5 4.5L19 7.5', Milestone: 'M6 20V4M6 5h11l-2.5 3.5L17 12H6',
|
|
26
33
|
Task: 'M5 5h14v14H5z', Report: 'M7 3.5h7l4 4V20.5H7zM14 3.5v4h4M10 12h5M10 16h5', Note: 'M6 12h12',
|
|
27
34
|
};
|
|
35
|
+
/** The kind icon of a row on a desk: its type, or what the PM typed (an event, a note), a PMOS finding, or done. */
|
|
36
|
+
const KIND = { event: ['M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16z', 'Event'], note: [TI.Note, 'Note'], lab: [I.spark, 'PMOS suggests'], done: [I.done, 'Done'] };
|
|
37
|
+
const kindOf = (r) => (r.done ? KIND.done : r.src === 'lab' ? KIND.lab : r.bullet === 'event' ? KIND.event : r.bullet === 'note' || r.src === 'note' ? KIND.note : [TI[r.type] || TI.Task, r.type || 'Task']);
|
|
28
38
|
const BULLET = { task: ['•', 'Task'], event: ['○', 'Event'], note: ['–', 'Note'], lab: ['✦', 'PMOS suggests'] };
|
|
29
|
-
const ib = (act, label, d, key, extra = '', v = '') => `<button type="button" class="td-ib pm-btn${v ? ' ' + v : ''}" data-td="${act}" data-key="${esc(key)}" aria-label="${esc(label)}" title="${esc(label)}"${extra}>${
|
|
39
|
+
const ib = (act, label, d, key, extra = '', v = '') => `<button type="button" class="td-ib pm-btn${v ? ' ' + v : ''}" data-td="${act}" data-key="${esc(key)}" aria-label="${esc(label)}" title="${esc(label)}"${extra}>${ic(d)}</button>`;
|
|
40
|
+
const plural = (n, a, b) => n + ' ' + (n === 1 ? a : b);
|
|
41
|
+
/** A Suggestion (pm-sug): ✦, one sentence, ✓ primary and ✕ outline. */
|
|
42
|
+
const sugHtml = (say, yes, no, key, cls = '') => `<div class="td-sg pm-sug${cls ? ' ' + cls : ''}" role="group" aria-label="PMOS suggests">${ic(I.spark, 16, 'pm-star')}<span class="say">${esc(say)}</span>`
|
|
43
|
+
+ ib(yes[0], yes[1], I.yes, key, '', 'primary') + ib(no[0], no[1], I.no, key, '', 'outline') + '</div>';
|
|
30
44
|
|
|
31
|
-
/**
|
|
45
|
+
/** The late Badge of a row: how long it is late, or how long a person waits; '' when it is not late. */
|
|
46
|
+
export function lateOf(r) {
|
|
47
|
+
if (!r || !r.late || r.done || !(r.carried > 0)) return '';
|
|
48
|
+
return r.type === 'Ask' || (r.src !== 'move' && r.src !== 'item' && !/ late$/.test(r.reason || '')) ? plural(r.carried, 'day', 'days') : plural(r.carried, 'day', 'days') + ' late';
|
|
49
|
+
}
|
|
50
|
+
/** The why line under a title: "for <work> · due <date>", or who waits; what the Badge says is not said again. */
|
|
51
|
+
export function whyLine(r) {
|
|
52
|
+
const badge = lateOf(r);
|
|
53
|
+
let reason = r.reason || '';
|
|
54
|
+
if (badge && /^\d+ days? late$/.test(reason)) reason = '';
|
|
55
|
+
if (badge && r.type === 'Ask') reason = reason.replace(/ \d+ days?$/, '');
|
|
56
|
+
const when = r.when ? (r.late && !r.done && /^\d+ [A-Z][a-z]{2}/.test(r.when) ? 'due ' + r.when : r.when) : '';
|
|
57
|
+
return [r.work ? 'for ' + r.work : '', when, reason].filter(Boolean).join(' · ');
|
|
58
|
+
}
|
|
59
|
+
/** The first action of a row, by its job: Done for a thing to do, else the item opens where the PM replies, decides or sends. */
|
|
60
|
+
const JOB_ACT = { Reply: ['open', 'Reply', I.reply], Decide: ['open', 'Decide', I.decide], Send: ['open', 'Send', I.send] };
|
|
61
|
+
|
|
62
|
+
/** One row of the log: a ListRow (pm-li). o.lit: the lit first row of Do first; o.sopen: its members are listed. */
|
|
32
63
|
export function rowHtml(r, o = {}) {
|
|
33
|
-
const [
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
64
|
+
const [kd, kl] = kindOf(r);
|
|
65
|
+
const t = r.title;
|
|
66
|
+
let acts = '';
|
|
67
|
+
if (!r.done && r.src !== 'note') {
|
|
68
|
+
if (r.src === 'lab') acts = ib('lab-keep', 'Keep it: start an initiative from ' + t, I.yes, r.key) + ib('lab-drop', 'Drop it: ' + t, I.no, r.key);
|
|
69
|
+
else {
|
|
70
|
+
const j = JOB_ACT[r.job];
|
|
71
|
+
acts = (j ? ib(j[0], j[1] + ': ' + t, j[2], r.key) : '') + ib('done', 'Done: ' + t, I.done, r.key)
|
|
72
|
+
+ ib('tomorrow', 'Move to tomorrow: ' + t, I.tomorrow, r.key) + ib('date', 'Set a date: ' + t, I.date, r.key, ' aria-haspopup="dialog"');
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
const cls = ['td-li', 'pm-li', o.lit && !r.done ? 'now' : '', r.done ? 'done' : '', r.bullet === 'note' || r.src === 'note' ? 'note' : '', r.src === 'lab' ? 'lab' : '', r.member ? 'mem nest' : ''].filter(Boolean).join(' ');
|
|
38
76
|
// a note, an own event and a done row open nothing: their words are the whole of it
|
|
39
77
|
const opens = !r.done && r.src !== 'own' && r.src !== 'gone' && r.src !== 'note';
|
|
40
|
-
const title = opens ? `<button type="button" class="td-t" data-td="open" data-key="${esc(r.key)}"${r.members ? ` aria-expanded="${!!o.sopen}"` : ''}>${esc(
|
|
41
|
-
const
|
|
42
|
-
+ ib('drop', 'Drop it', I.yes, r.key, '', 'primary') + ib('keep', 'Keep it', I.no, r.key, '', 'outline') + '</div>' : '';
|
|
43
|
-
const lk = r.looks && !r.done ? `<div class="td-sg pm-sug" role="group" aria-label="PMOS suggests"><b aria-hidden="true">✦</b><span class="say">Looks answered: ${esc(r.looks.who ? r.looks.who + ' replied' : 'someone replied')} “${esc(r.looks.text)}”. Close it?</span>`
|
|
44
|
-
+ ib('lk-yes', 'Yes, close it: it is answered', I.yes, r.key, '', 'primary') + ib('lk-no', 'No, it still waits on me', I.no, r.key, '', 'outline') + '</div>' : '';
|
|
45
|
-
// the same step for N initiatives: PMOS drafts them, he approves once (audit round 2)
|
|
46
|
-
const sj = r.members && r.drafts && !r.done ? `<div class="td-sg pm-sug" role="group" aria-label="PMOS suggests"><b aria-hidden="true">✦</b><span class="say">PMOS drafts them for you to read.</span>`
|
|
47
|
-
+ ib('same-yes', 'Yes, draft them', I.yes, r.key, '', 'primary') + ib('same-no', 'No, not now', I.no, r.key, '', 'outline') + '</div>' : '';
|
|
48
|
-
const why = r.src === 'lab' && r.why ? `<div class="td-sg lab"><span>${esc(r.why)}</span></div>` : '';
|
|
78
|
+
const title = opens ? `<button type="button" class="t td-t" data-td="open" data-key="${esc(r.key)}"${r.members ? ` aria-expanded="${!!o.sopen}"` : ''}>${esc(t)}${r.members ? ic(I.more, 14) : ''}</button>` : `<span class="t td-t">${esc(t)}</span>`;
|
|
79
|
+
const first = r.first && !r.done && r.src === 'own' ? '<span class="pm-badge blue">First</span>' : '';
|
|
49
80
|
// 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
|
|
50
81
|
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>` : '';
|
|
51
|
-
const
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
+ `<span class="
|
|
56
|
-
|
|
82
|
+
const why = r.member ? '' : whyLine(r);
|
|
83
|
+
const w = why || did ? `<span class="w td-rs">${did}${esc(why)}</span>` : '';
|
|
84
|
+
const late = lateOf(r);
|
|
85
|
+
const row = `<div class="${cls}" data-key="${esc(r.key)}"><span class="td-kind" role="img" aria-label="${esc(kl)}">${ic(kd)}</span><span class="txt">${title}${w}</span>`
|
|
86
|
+
+ `${first}${late ? `<span class="pm-badge alert">${esc(late)}</span>` : ''}${acts ? `<span class="acts td-a">${acts}</span>` : ''}</div>`;
|
|
87
|
+
const sug = r.drop ? sugHtml('PMOS suggests: drop it from your log.', ['drop', 'Drop it'], ['keep', 'Keep it'], r.key) : '';
|
|
88
|
+
const lk = r.looks && !r.done ? sugHtml('Looks answered: ' + (r.looks.who ? r.looks.who + ' replied' : 'someone replied') + ' “' + r.looks.text + '”. Close it?', ['lk-yes', 'Yes, close it: it is answered'], ['lk-no', 'No, it still waits on me'], r.key) : '';
|
|
89
|
+
// the same step for N initiatives: PMOS drafts them, he approves once (audit round 2)
|
|
90
|
+
const sj = r.members && r.drafts && !r.done ? sugHtml('PMOS drafts them for you to read.', ['same-yes', 'Yes, draft them'], ['same-no', 'No, not now'], r.key) : '';
|
|
91
|
+
const lab = r.src === 'lab' && r.why ? `<p class="td-sg lab pm-meta">${esc(r.why)}</p>` : '';
|
|
92
|
+
return row + sug + sj + lk + lab;
|
|
57
93
|
}
|
|
58
94
|
|
|
59
|
-
/** The Overview,
|
|
60
|
-
*
|
|
61
|
-
export function overviewHtml(O
|
|
62
|
-
if (!O || (!O.said && !O.
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
95
|
+
/** The Overview, a Summary block written by PMOS (✦): one sentence whose item names open the item, then PMOS's Suggestions.
|
|
96
|
+
* O: overviewModel(). */
|
|
97
|
+
export function overviewHtml(O) {
|
|
98
|
+
if (!O || (!O.said && !(O.suggest || []).length)) return '';
|
|
99
|
+
let said = esc(O.said || '');
|
|
100
|
+
for (const x of O.refs || []) {
|
|
101
|
+
const t = esc(x.text), at = said.indexOf(t);
|
|
102
|
+
if (at >= 0) said = said.slice(0, at) + `<button type="button" class="td-ln" data-td="open" data-key="${esc(x.key)}">${t}</button>` + said.slice(at + t.length);
|
|
103
|
+
}
|
|
104
|
+
const sug = (O.suggest || []).map((x) => sugHtml(x.text, ['ov-yes', x.text], ['ov-no', 'Keep them: ' + x.text], x.key, 'td-ovs')).join('');
|
|
105
|
+
return `<section class="td-ov pm-block" aria-label="Overview"><h2 class="pm-h-sm pm-row">${ic(I.spark, 16, 'pm-star')}Overview</h2>${said ? `<p>${said}</p>` : ''}${sug}</section>`;
|
|
69
106
|
}
|
|
70
|
-
const PLURAL = { Ask: 'Asks', Decision: 'Decisions', Check: 'Checks', Milestone: 'Milestones', Task: 'Tasks', Report: 'Reports', Note: 'Notes' };
|
|
71
|
-
|
|
72
|
-
const
|
|
73
|
-
const groupRow = (label, n, now) => `<div class="td-gr pm-group${now ? ' now' : ''}" role="row"><span role="cell">${esc(label)}${n ? ` <em>${esc(n)}</em>` : ''}</span></div>`;
|
|
107
|
+
const PLURAL = { Ask: 'Asks', Decision: 'Decisions', Check: 'Checks', Milestone: 'Milestones', Task: 'Tasks', Report: 'Reports', Note: 'Notes' }; // the phone's type filter
|
|
108
|
+
/** The jobs the log's Tabs filter by, in order. */
|
|
109
|
+
export const JOBS = [['Reply', 'reply'], ['Do', 'do'], ['Decide', 'decide'], ['Send', 'send']];
|
|
74
110
|
|
|
75
|
-
/** Today's log
|
|
76
|
-
*
|
|
77
|
-
* o: { draft: the line being typed, type: the chip that filters, open: Can wait is unfolded } */
|
|
111
|
+
/** Today's log, a List block: the heading and the Tabs, the capture Input, the groups Do first, Today, Later (folded) and PMOS handled.
|
|
112
|
+
* L: logModel(). o: { draft: the line being typed, job: the tab that filters ('' is All), open: Later is unfolded, handled, hopen, sopen } */
|
|
78
113
|
export function logHtml(L, o = {}) {
|
|
79
|
-
const
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
const
|
|
114
|
+
const c = L.counts || {}, job = o.job || '';
|
|
115
|
+
const tab = (j, label, n) => `<button type="button" class="td-tab pm-tab" role="tab" data-td="job" data-key="${esc(j)}" aria-selected="${job === j}">${esc(label)} <span class="td-n">${esc(n)}</span></button>`;
|
|
116
|
+
const shownJobs = JOBS.filter(([, k]) => c[k]);
|
|
117
|
+
const tabs = shownJobs.length ? `<div class="td-tabs pm-tabs" role="tablist" aria-label="Show one job">${tab('', 'All', L.open || 0)}${shownJobs.map(([j, k]) => tab(j, j, c[k])).join('')}</div>` : '';
|
|
118
|
+
const head = `<div class="head"><h2 class="pm-h">Today’s log</h2><span class="sp"></span>${tabs}</div>`;
|
|
119
|
+
const cap = `<form class="td-in" id="tdCapF" autocomplete="off"><label class="td-vh" for="tdCap">Log a task, an event or a note</label>`
|
|
120
|
+
+ `<input id="tdCap" class="pm-input" name="line" type="text" maxlength="240" placeholder="Log a task, an event or a note" value="${esc(o.draft || '')}" aria-describedby="tdCapKey" title="Start with o for an event, a dash for a note, ! for first" />`
|
|
121
|
+
+ `<span class="td-vh" id="tdCapKey">Start with o for an event, a dash for a note, ! for first</span></form>`;
|
|
122
|
+
const pick = (rows) => (job ? (rows || []).filter((r) => r.job === job) : rows || []);
|
|
84
123
|
const so = new Set(o.sopen || []);
|
|
85
|
-
const
|
|
124
|
+
const one = (r, lit) => (r.members ? rowHtml(r, { sopen: so.has(r.key), lit }) + (so.has(r.key) ? r.members.map((m) => rowHtml(m)).join('') : '') : rowHtml(r, { lit }));
|
|
86
125
|
const first = pick(L.first), today = pick(L.todayRows), wait = pick(L.wait);
|
|
87
126
|
let body = '';
|
|
88
|
-
if (first.length) body +=
|
|
89
|
-
if (today.length) body +=
|
|
127
|
+
if (first.length) body += `<div class="td-gr pm-group now">${ic(I.sun, 14)}Do first</div><div class="rows">${first.map((r, i) => one(r, i === 0)).join('')}</div>`;
|
|
128
|
+
if (today.length) body += `<div class="td-gr pm-group">Today</div><div class="rows">${today.map((r) => one(r)).join('')}</div>`;
|
|
90
129
|
if (wait.length) {
|
|
91
130
|
const oldest = Math.max(0, ...wait.map((r) => r.carried || 0));
|
|
92
|
-
const said =
|
|
93
|
-
body += `<
|
|
94
|
-
if (o.open) body += wait.map(
|
|
131
|
+
const said = wait.length + ' can wait' + (oldest ? ' · the oldest waits ' + plural(oldest, 'day', 'days') : '');
|
|
132
|
+
body += `<button type="button" class="td-fold pm-fold" data-td="fold" aria-expanded="${!!o.open}">Later <span class="td-n">${esc(said)}</span>${ic(I.more, 14)}</button>`;
|
|
133
|
+
if (o.open) body += `<div class="rows">${wait.map((r) => one(r)).join('')}</div>`;
|
|
95
134
|
}
|
|
96
135
|
// PMOS handled · N: what the self check cleared today, folded last, Undo on each (design check of round 3, point 6)
|
|
97
136
|
const hd = o.handled || [];
|
|
98
137
|
if (hd.length) {
|
|
99
|
-
body += `<
|
|
100
|
-
if (o.hopen) body += hd.map((h) => `<div class="td-
|
|
101
|
-
+ `<span
|
|
102
|
-
+ `<
|
|
103
|
-
+ `<button type="button" class="td-undo pm-btn" data-td="h-undo" data-key="${esc(h.id)}" aria-label="${esc('Undo: it still waits on me, ' + h.title)}" title="Undo">${svg(PI.undo, 15, 1.8)}</button></span></div>`).join('');
|
|
138
|
+
body += `<button type="button" class="td-fold pm-fold" data-td="hfold" aria-expanded="${!!o.hopen}">PMOS handled <span class="td-n">${esc(hd.length)}</span>${ic(I.more, 14)}</button>`;
|
|
139
|
+
if (o.hopen) body += '<div class="rows">' + hd.map((h) => `<div class="td-li pm-li done hd" data-key="hd:${esc(h.id)}"><span class="td-kind" role="img" aria-label="Done">${ic(I.done)}</span>`
|
|
140
|
+
+ `<span class="txt"><span class="t td-t">${esc(h.title)}</span><span class="w td-rs">${esc(h.proof)}</span></span><span class="acts td-a">`
|
|
141
|
+
+ `<button type="button" class="td-undo pm-btn" data-td="h-undo" data-key="${esc(h.id)}" aria-label="${esc('Undo: it still waits on me, ' + h.title)}" title="Undo">${ic(PI.undo)}</button></span></div>`).join('') + '</div>';
|
|
104
142
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
const table = body ? `<div class="td-tt${noWork ? ' nowork' : ''}" role="table" aria-label="Today’s log">${HEAD_ROW}${body}</div>` : '<p class="td-none">Nothing waits on you today.</p>';
|
|
108
|
-
return `<section class="td-log pm-block list" aria-label="Today’s log">${head}${cap}${table}</section>`;
|
|
143
|
+
const list = body || `<p class="td-none pm-meta">${job ? 'Nothing to ' + job.toLowerCase() + ' today.' : 'Nothing waits on you today.'}</p>`;
|
|
144
|
+
return `<section class="td-log pm-block list" aria-label="Today’s log">${head}${cap}${list}</section>`;
|
|
109
145
|
}
|
|
110
|
-
const plural2 = (n) => n + (n === 1 ? ' line' : ' lines');
|
|
111
146
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
*
|
|
147
|
+
const hm = (ms) => { const d = new Date(ms); return String(d.getHours()).padStart(2, '0') + ':' + String(d.getMinutes()).padStart(2, '0'); };
|
|
148
|
+
/** Today's agenda, a Timeline block (pm-block flat): the day's events only, each at its time, past ones dashed, the now line in the alert
|
|
149
|
+
* colour where it falls, and a link to Events. No hour grid. A day with no event is one quiet line. A: agendaModel(). */
|
|
115
150
|
export function agendaHtml(A) {
|
|
116
|
-
const
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
151
|
+
const quiet = A.quiet && !A.items.length;
|
|
152
|
+
const head = `<div class="head"><h2 class="pm-h">Today</h2><span class="pm-meta">${esc(quiet ? A.sub.split(' · ')[0] : A.sub)}</span><span class="sp"></span><a class="td-evl" href="/premium-events.html">Events</a></div>`;
|
|
153
|
+
if (quiet) return `<aside class="td-ag pm-block flat" aria-label="Today’s agenda">${head}<p class="td-quiet pm-meta">${esc(A.quiet)}</p></aside>`;
|
|
154
|
+
const nowMin = A.now != null ? Math.round((A.from + A.now) * 60) : null;
|
|
155
|
+
const nowLine = nowMin != null ? `<span class="td-at td-nowt">${String(Math.floor(nowMin / 60)).padStart(2, '0')}:${String(nowMin % 60).padStart(2, '0')}</span><i class="td-now" aria-hidden="true"></i>` : '';
|
|
156
|
+
let placed = nowMin == null, rows = '';
|
|
157
|
+
for (const x of A.items) {
|
|
158
|
+
if (!placed && x.top > A.now) { rows += nowLine; placed = true; }
|
|
159
|
+
const soon = A.now != null && !x.past && !x.nowOn && x.top > A.now && (x.top - A.now) * 60 <= 60 ? 'in ' + Math.max(1, Math.round((x.top - A.now) * 60)) + ' min · ' : '';
|
|
160
|
+
const cls = ['td-ev', 'pm-ev', x.kind, x.past ? 'past over' : '', x.nowOn ? 'on' : ''].filter(Boolean).join(' ');
|
|
124
161
|
const label = x.title + ', ' + x.sub;
|
|
125
|
-
const inner = `<b>${
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
162
|
+
const inner = `<b>${esc(x.title)}</b><span class="pm-meta">${esc(soon + x.sub)}</span>`;
|
|
163
|
+
const ev = x.kind === 'own' || x.kind === 'report' ? `<div class="${cls}" aria-label="${esc(label)}">${inner}</div>`
|
|
164
|
+
: x.kind === 'focus' ? `<button type="button" class="${cls}" data-td="open" data-key="${esc(x.row)}" aria-label="${esc(label)}">${inner}</button>`
|
|
165
|
+
: `<button type="button" class="${cls}" data-td="ev" data-key="${esc(x.key)}" aria-label="${esc(label)}">${inner}</button>`;
|
|
166
|
+
// meeting-buddy: one press opens the call and starts the recording. A link, so the browser always opens the call, even when the
|
|
167
|
+
// recording tab is held back; cozy-today-app.js starts the recording on the same press.
|
|
168
|
+
const play = x.play ? `<a class="td-play pm-btn primary" href="${esc(x.join)}" target="_blank" rel="noopener noreferrer" data-td="play" data-key="${esc(x.key)}" aria-label="${esc('Join ' + x.title + ' and record it')}" title="Join and record">${ic(I.play)}</a>` : '';
|
|
169
|
+
rows += `<span class="td-at pm-meta">${esc(hm(x.a))}</span><div class="td-evw">${ev}${play}</div>`;
|
|
170
|
+
}
|
|
171
|
+
if (!placed) rows += nowLine;
|
|
172
|
+
return `<aside class="td-ag pm-block flat" aria-label="Today’s agenda">${head}<div class="td-tl">${rows}</div></aside>`;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/** The meeting PMOS recorded and filed, a Summary block under the agenda with one Suggestion: keep it filed there (✓), or take it out (✕).
|
|
176
|
+
* f: { id, title (the work), meeting, sub } from cozy-today-app.js filedLine(); '' with none. */
|
|
177
|
+
export function filedHtml(f) {
|
|
178
|
+
if (!f) return '';
|
|
179
|
+
return `<section class="td-rec pm-block" aria-label="The meeting you recorded"><h2 class="pm-h-sm pm-row">${ic(I.spark, 16, 'pm-star')}${esc((f.meeting || 'Your meeting') + ', recorded')}</h2>`
|
|
180
|
+
+ `<p>${esc((f.sub ? f.sub + '. ' : '') + 'PMOS filed it under ' + f.title + '.')}</p>`
|
|
181
|
+
+ sugHtml('Keep it filed under ' + f.title, ['filed-ok', 'Yes, keep it there'], ['filed-undo', 'No, take it out of ' + f.title], f.id) + '</section>';
|
|
137
182
|
}
|
|
138
183
|
|
|
139
184
|
/** The page head: the day and the time, small, then the greeting. Hd: headModel(). */
|
|
140
|
-
export const headHtml = (Hd) => `<header class="td-top"><
|
|
185
|
+
export const headHtml = (Hd) => `<header class="td-top"><div class="td-when pm-meta">${esc(Hd.when)}</div><h1 class="title">${esc(Hd.hello)}</h1></header>`;
|
|
141
186
|
|
|
142
|
-
/** The whole page: the Overview and the log
|
|
143
|
-
|
|
187
|
+
/** The whole page, Main + side: the Overview and the log, then the agenda and the recorded meeting beside them.
|
|
188
|
+
* o: { head, overview: overviewModel(), filed, …logHtml's o } */
|
|
189
|
+
export function pageHtml(L, A, o = {}) {
|
|
190
|
+
return `${o.head ? headHtml(o.head) : ''}<div class="td"><div class="td-main">${o.overview ? overviewHtml(o.overview) : ''}${logHtml(L, o)}</div>`
|
|
191
|
+
+ `<div class="td-side">${agendaHtml(A)}${filedHtml(o.filed)}</div></div>`;
|
|
192
|
+
}
|
|
144
193
|
|
|
145
194
|
/* ── Today on a phone (phone design, boards Ph2_today, Ph2_todayzero, Ph2_recdone; build brief nav-structure/phone/build-brief-v2.md) ──
|
|
146
195
|
* One column, no cards and no boxes: the day and the greeting, "Recording filed under …" with Undo after a meeting, the ✦ Overview with at
|
|
@@ -61,12 +61,51 @@
|
|
|
61
61
|
.pm-ds .pm-sug{display:flex;align-items:center;gap:10px;background:var(--blue-tint);border-radius:var(--radius-md);padding:4px 4px 4px 12px;font-size:13px}
|
|
62
62
|
.pm-ds .pm-sug .say{flex:1}
|
|
63
63
|
.pm-ds .pm-star{color:var(--blue)}
|
|
64
|
+
.pm-ds .pm-sug.x{flex-direction:column;align-items:stretch;gap:10px;padding:14px 16px}
|
|
65
|
+
.pm-ds .pm-sug.x .ttl{display:flex;align-items:center;gap:8px;font-weight:600}
|
|
66
|
+
.pm-ds .pm-sug.x .ttl .pm-ic{color:var(--blue)}
|
|
67
|
+
.pm-ds .pm-sug.x dl{display:grid;grid-template-columns:110px 1fr;gap:6px 12px;margin:0;font-size:14px;line-height:20px}
|
|
68
|
+
.pm-ds .pm-sug.x dt{color:var(--muted)}
|
|
69
|
+
.pm-ds .pm-sug.x dd{margin:0;min-width:0}
|
|
70
|
+
.pm-ds .pm-sug.x dd ul{margin:0;padding-left:18px}
|
|
71
|
+
.pm-ds .pm-sug.x dd li{margin:0 0 2px}
|
|
72
|
+
.pm-ds .pm-sug.x dd.src{color:var(--muted)}
|
|
73
|
+
.pm-ds .pm-sug.x .ans{display:flex;gap:8px;justify-content:flex-end}
|
|
64
74
|
.pm-ds .pm-ev{border:1px solid var(--line);border-radius:var(--radius-md);background:var(--card);box-shadow:var(--raise);padding:6px 10px;display:flex;flex-direction:column;line-height:1.35;font-size:13px}
|
|
65
75
|
.pm-ds .pm-ev b{font-weight:600}
|
|
66
76
|
.pm-ds .pm-ev.over{background:none;box-shadow:none;border-style:dashed;color:var(--muted)}
|
|
67
77
|
.pm-ds .pm-fold{height:44px;display:flex;align-items:center;gap:8px;padding:0 14px;border:0;border-top:1px dashed var(--line);background:none;width:100%;font:inherit;font-size:13px;font-weight:600;color:var(--muted);text-align:left;cursor:pointer}
|
|
68
78
|
.pm-ds .pm-group{height:32px;display:flex;align-items:center;gap:8px;padding:0 14px;font-size:13px;font-weight:600;background:var(--well);color:var(--muted)}
|
|
69
79
|
.pm-ds .pm-group.now{background:var(--leaf-tint);color:var(--ink)}
|
|
80
|
+
.pm-ds .pm-dia{position:absolute;top:50%;width:12px;height:12px;margin:-6px 0 0 -6px;padding:0;transform:rotate(45deg);background:var(--card);border:2px solid var(--ink);border-radius:2px;box-sizing:border-box;cursor:pointer;z-index:2}
|
|
81
|
+
.pm-ds .pm-dia.late{border-color:var(--alert)}
|
|
82
|
+
.pm-ds .pm-dia.dn{background:var(--leaf);border-color:var(--leaf)}
|
|
83
|
+
.pm-ds .pm-dia.n{width:18px;height:18px;margin:-9px 0 0 -9px;background:var(--ink);border-color:var(--ink);display:flex;align-items:center;justify-content:center}
|
|
84
|
+
.pm-ds .pm-dia.n>b{transform:rotate(-45deg);color:var(--card);font-size:11px;line-height:1;font-weight:600}
|
|
85
|
+
.pm-ds .pm-dia:focus-visible{outline:none;box-shadow:var(--glow)}
|
|
86
|
+
.pm-ds .pm-now{position:absolute;top:0;bottom:0;width:2px;margin-left:-1px;background:var(--alert);z-index:1}
|
|
87
|
+
.pm-ds .pm-now>span{position:absolute;bottom:100%;left:50%;transform:translateX(-50%);font-size:13px;font-style:normal;font-weight:600;color:var(--alert);white-space:nowrap}
|
|
88
|
+
.pm-ds .pm-gt{position:relative;height:24px}
|
|
89
|
+
.pm-ds .pm-gt>.b{position:absolute;top:7px;height:10px;border-radius:var(--radius-pill);background:var(--well);box-shadow:inset 0 0 0 1px var(--line)}
|
|
90
|
+
.pm-ds .pm-gt>.b.dn{background:var(--leaf);box-shadow:none}
|
|
91
|
+
.pm-ds .pm-gt>.b.nw{background:var(--blue);box-shadow:none}
|
|
92
|
+
.pm-ds .pm-dline{position:relative;padding:0 40px 0 8px}
|
|
93
|
+
.pm-ds .pm-dline .axis{position:relative;height:20px;font-size:13px;color:var(--muted)}
|
|
94
|
+
.pm-ds .pm-dline .axis .tk{position:absolute;top:0;transform:translateX(-50%);white-space:nowrap}
|
|
95
|
+
.pm-ds .pm-dline .line{position:relative;height:calc(24px + var(--rows,1) * 86px);background:linear-gradient(var(--line),var(--line)) 0 12px/100% 1px no-repeat}
|
|
96
|
+
.pm-ds .pm-dline .line>.pm-now{bottom:auto;height:34px;top:-8px}
|
|
97
|
+
.pm-ds .pm-dline .ms{position:absolute;top:0;width:0}
|
|
98
|
+
.pm-ds .pm-dline .ms>.pm-dia{top:12px}
|
|
99
|
+
.pm-ds .pm-dline .ms .lb{position:absolute;top:calc(28px + var(--row) * 86px);left:-6px;display:flex;flex-direction:column;align-items:flex-start;gap:0;width:max-content;max-width:220px;font-size:13px;line-height:20px}
|
|
100
|
+
.pm-ds .pm-dline .ms .lb b{font-size:15px;line-height:24px;font-weight:600}
|
|
101
|
+
.pm-ds .pm-dline .ms .lb .code{font-family:var(--font-mono);color:var(--muted)}
|
|
102
|
+
.pm-ds .pm-dline .ms.low::before{content:"";position:absolute;left:0;top:20px;height:calc(var(--row) * 86px + 6px);border-left:1px dashed var(--line)}
|
|
103
|
+
.pm-ds .pm-dline .ms.late .lb .code{color:var(--alert)}
|
|
104
|
+
.pm-ds .pm-more{position:absolute;top:20px;display:flex;flex-direction:column;align-items:center;gap:2px;border:0;background:none;padding:0;font:inherit;font-size:13px;color:var(--muted);cursor:pointer}
|
|
105
|
+
.pm-ds .pm-more.r{right:0}
|
|
106
|
+
.pm-ds .pm-more.l{left:-8px}
|
|
107
|
+
.pm-ds .pm-more b{min-width:24px;height:20px;padding:0 6px;border-radius:var(--radius-pill);background:var(--ink);color:var(--card);font-size:11px;line-height:20px;font-weight:600}
|
|
108
|
+
.pm-ds .pm-more:focus-visible{outline:none;box-shadow:var(--glow);border-radius:var(--radius-sm)}
|
|
70
109
|
.pm-ds .pm-block{background:var(--card);border:1px solid var(--line);border-radius:var(--radius-card);box-shadow:var(--raise);padding:16px 18px;display:flex;flex-direction:column;gap:12px;min-width:0}
|
|
71
110
|
.pm-ds .pm-block.flat{background:var(--well);box-shadow:none;border-color:transparent}
|
|
72
111
|
.pm-ds .pm-block .head{display:flex;align-items:center;gap:10px}
|
|
@@ -62,7 +62,8 @@ import { setSay } from './cozy-xv.js';
|
|
|
62
62
|
import { narrowForm } from './pn-narrow.js';
|
|
63
63
|
import * as BP2 from './bd-pane.js';
|
|
64
64
|
import * as WV from './bd-work.js'; // Work, one view on a desk (slice 4 of the six-place navigation, initiative work-one-view)
|
|
65
|
-
import * as BK from './bd-backlog.js';
|
|
65
|
+
import * as BK from './bd-backlog.js';
|
|
66
|
+
import * as ST from './bd-stands.js'; // Where it stands, its Suggestion and the Next milestones line (initiative work-design-system-blocks, WorkDS) // the Backlog beside Initiatives in Work: every task in one list (initiative work-backlog)
|
|
66
67
|
import * as LS from './load-shapes.js'; // the skeleton and the slow-case line while the board is read (page-open-speed, SpD) // the Board as the first panel: fit(), the rows that open beside, the open row's mark
|
|
67
68
|
import * as SWN from './cozy-status-when.js'; // the day a status move really happened, in the toast (round 3 point 18)
|
|
68
69
|
|
|
@@ -616,18 +617,55 @@ const wkGoalOf = (r) => { if (!GOALS) return ''; const k = (GOALS.of || {})[Stri
|
|
|
616
617
|
const wkProgOf = (r) => { const p = programOf(PGS, r.ws || (M && M.board.ws) || '', r.id); return p ? p.title || p.id : ''; };
|
|
617
618
|
function drawWork(L) {
|
|
618
619
|
const pk = prodKey((M.board && (M.board.product || M.board.name)) || ''), lay = SO.layout();
|
|
619
|
-
|
|
620
|
+
// WorkDS: Where it stands (a Summary block and one Suggestion), the Initiatives table, then the Next milestones date line on the table's scale
|
|
621
|
+
const list = WV.listHtml(L, { tpx: WK_TPX, many: wkMany(), sel: peek && peek.kind === 'ini' ? peek.key : null, rowOf, bar: wkBar,
|
|
620
622
|
product: wkProduct, goalOf: wkGoalOf, programOf: wkProgOf, order: (rows) => sortInis(pk, rows, lay, INI_ACC),
|
|
621
623
|
goalGroups: (rows) => (GOALS ? GL.asGroups(rows, GOALS, (rs) => sortInis(pk, rs, lay, INI_ACC)) : null),
|
|
622
624
|
canMove: (r) => !ROC && !!(r.track && r.acts && (r.acts.stages || []).length > 1) });
|
|
625
|
+
const W = WV.lastWindow(), vis = WV.filterRows(L, { product: wkProduct, programOf: wkProgOf });
|
|
626
|
+
return ST.standsHtml(vis, { sug: !ROC }) + list + (W && WV.read().tl !== false ? ST.dlineHtml(ST.nextMilestones(vis), W, { sub: 'all initiatives', ro: ROC, lw: ($('#ibBody').clientWidth || innerWidth) - 120 }) : '');
|
|
627
|
+
}
|
|
628
|
+
/** The Suggestion's answers (WorkDS): Yes keeps the proposal (POST /api/proposals/keep, Undo in the toast), No drops it (POST
|
|
629
|
+
* /api/proposals/drop), the pencil opens the initiative, where its proposals can be changed before they are kept. */
|
|
630
|
+
async function sugPress(b) {
|
|
631
|
+
const r = rowOf(b.dataset.key); if (!r) return;
|
|
632
|
+
const at = { ws: r.ws || M.board.ws || undefined, board: r.boardId || M.board.id };
|
|
633
|
+
if (b.dataset.wksug === 'edit') { openIni(r, b); return; }
|
|
634
|
+
b.disabled = true;
|
|
635
|
+
if (b.dataset.wksug === 'yes') {
|
|
636
|
+
const res = await pmPost('/api/proposals/keep', { ...at, initiative: b.dataset.ini, ids: [b.dataset.pid] }).catch(() => null);
|
|
637
|
+
if (!res || !res.ok) { b.disabled = false; say((res && res.error) || 'It did not land. The server did not say why.'); return; }
|
|
638
|
+
say(res.said || 'Done.', res.batch ? async () => { const u = await pmPost('/api/proposals/undo', { ...at, batch: res.batch }).catch(() => null); say(u && u.ok ? 'Put back.' : (u && u.error) || 'The undo did not land.'); load(); } : null);
|
|
639
|
+
} else {
|
|
640
|
+
const res = await pmPost('/api/proposals/drop', { ...at, initiative: b.dataset.ini, sig: b.dataset.sig }).catch(() => null);
|
|
641
|
+
if (!res || !res.ok) { b.disabled = false; say((res && res.error) || 'It did not land. The server did not say why.'); return; }
|
|
642
|
+
say('PMOS will not suggest this again.');
|
|
643
|
+
}
|
|
644
|
+
load();
|
|
645
|
+
}
|
|
646
|
+
/* the timeline scrolls sideways (WorkDS): a trackpad's sideways swipe or a drag on the timeline; no scrollbar. A drag that moved does not
|
|
647
|
+
* also press what is under it. */
|
|
648
|
+
{
|
|
649
|
+
const body = $('#ibBody'); let drag = null, raf = 0, moved = false;
|
|
650
|
+
const pxDays = () => { const W = WV.lastWindow(), x = $('#ibBody .wk-i .wk-bw') || $('#ibBody .wk-tl'); const w = x ? x.getBoundingClientRect().width : 0; return W && w ? (W.to - W.from) / 864e5 / w : 0; };
|
|
651
|
+
const redraw = () => { if (raf) return; raf = requestAnimationFrame(() => { raf = 0; drawInit(); }); };
|
|
652
|
+
body.addEventListener('wheel', (e) => {
|
|
653
|
+
if (curView() !== 'work' || !e.target.closest('.wk-x, .pm-dline') || Math.abs(e.deltaX) <= Math.abs(e.deltaY)) return;
|
|
654
|
+
e.preventDefault(); const k = pxDays(); if (!k) return; WV.scrollBy(e.deltaX * k); redraw();
|
|
655
|
+
}, { passive: false });
|
|
656
|
+
body.addEventListener('pointerdown', (e) => { if (curView() !== 'work' || e.button !== 0 || !e.target.closest('.wk-x, .pm-dline') || e.target.closest('button')) return; drag = { x: e.clientX, k: pxDays() }; moved = false; });
|
|
657
|
+
addEventListener('pointermove', (e) => { if (!drag || !drag.k) return; const dx = e.clientX - drag.x; if (!moved && Math.abs(dx) < 5) return; moved = true; document.body.classList.add('wk-drag'); WV.scrollBy(-dx * drag.k); drag.x = e.clientX; redraw(); });
|
|
658
|
+
addEventListener('pointerup', () => { if (!drag) return; drag = null; document.body.classList.remove('wk-drag'); if (moved) setTimeout(() => { moved = false; }, 0); });
|
|
659
|
+
body.addEventListener('click', (e) => { if (moved) { e.stopImmediatePropagation(); e.preventDefault(); } }, true);
|
|
623
660
|
}
|
|
624
661
|
/** One row's bar on Work: the Board's own (pm/bd-span.js rowBar, Wawan's round 2): done, now, planned, every milestone ◇ with its popup, the
|
|
625
662
|
* gap line, the late line. W: Work's window { from, to }. The track's width is measured once drawn, so close ◇s merge at about 40 px. */
|
|
626
663
|
let WK_TPX = 0;
|
|
627
664
|
function wkBar(r, W) {
|
|
628
665
|
const span = +W.to - +W.from || 1, X = (d) => ((+d - +W.from) / span) * 100;
|
|
629
|
-
const px = WK_TPX || Math.max(320, Math.round(innerWidth * 0.4))
|
|
630
|
-
|
|
666
|
+
const px = WK_TPX || Math.max(320, Math.round(innerWidth * 0.4));
|
|
667
|
+
// milestones less than 8 days apart merge into one numbered mark (WorkDS)
|
|
668
|
+
return rowBar(r, X, new Date(), { pxPct: px / 100, reach: 8, mode: 'all', label: false, endIn: true });
|
|
631
669
|
}
|
|
632
670
|
const wkMeasure = () => { const x = $('#ibBody .wk-i .wk-bw'); const w = x ? Math.round(x.getBoundingClientRect().width) : 0; if (w && Math.abs(w - WK_TPX) > 40) { WK_TPX = w; return true; } return false; };
|
|
633
671
|
/** A press in the list that is Work's own (a column title, the span, the timeline's hide, a Stage cell, a bar, the closed line). → true when handled. */
|
|
@@ -636,9 +674,10 @@ function workPress(e) {
|
|
|
636
674
|
if (p.kind === 'inside') return true; // a press in the open stage card stays there
|
|
637
675
|
if (p.kind === 'spanmenu') { spanMenu(); return true; }
|
|
638
676
|
if (p.kind === 'stage') { if (!ROC) stageMenu(rowOf(p.key), p.el); return true; }
|
|
677
|
+
if (p.kind === 'menu') { toggleWorkMenu(p.el); return true; }
|
|
639
678
|
if (!WV.apply(p)) return false;
|
|
640
679
|
drawInit(); wkCount(); if (WK_MENU) drawWorkMenu();
|
|
641
|
-
const f = p.kind === 'sort' ? `[data-wksort="${p.k}"]` : p.kind === 'span' ?
|
|
680
|
+
const f = p.kind === 'sort' ? `[data-wksort="${p.k}"]` : p.kind === 'span' ? `[data-wkspick="${p.span}"]` : p.kind === 'nav' ? `[data-wknav="${p.dir}"]` : p.kind === 'timeline' ? (p.on ? '[data-wktl="off"]' : '[data-wktl="on"]') : p.kind === 'closed' ? '[data-wkclosed]' : null;
|
|
642
681
|
const n = f && $('#ibBody ' + f); if (n) n.focus();
|
|
643
682
|
return true;
|
|
644
683
|
}
|
|
@@ -733,7 +772,7 @@ function drawWorkMenu(focus) {
|
|
|
733
772
|
const was = focus || (WK_MENU.contains(document.activeElement) ? wkSel(document.activeElement) : null);
|
|
734
773
|
const sc = WK_MENU.firstElementChild ? WK_MENU.firstElementChild.scrollTop : 0;
|
|
735
774
|
WK_MENU.innerHTML = WV.menuHtml({ many: wkMany(), sprint: ROC ? null : (M && M.jira && M.jira.sprint) || null, ro: ROC });
|
|
736
|
-
const m = WK_MENU.firstElementChild, b =
|
|
775
|
+
const m = WK_MENU.firstElementChild, b = wkBtnOf().getBoundingClientRect();
|
|
737
776
|
const top = Math.round(b.bottom + 8);
|
|
738
777
|
m.style.top = top + 'px'; m.style.left = Math.max(8, Math.round(b.right - m.offsetWidth)) + 'px';
|
|
739
778
|
m.style.maxHeight = Math.max(240, innerHeight - top - 12) + 'px'; // it scrolls inside the window; Filter's title and Clear stay on top
|
|
@@ -751,10 +790,12 @@ const wkSel = (el) => {
|
|
|
751
790
|
for (const a of ['wkgroup', 'wkcolsw', 'wkx']) if (d[a]) return `[data-${a}="${d[a]}"]`;
|
|
752
791
|
return x.hasAttribute('data-wktlsw') ? '[data-wktlsw]' : x.hasAttribute('data-wkcols') ? '[data-wkcols]' : x.hasAttribute('data-wkclear') ? '[data-wkcols]' : '[data-wkcols]';
|
|
753
792
|
};
|
|
754
|
-
|
|
793
|
+
/** The button the menu opened from, as drawn now: the Initiatives block's Choose columns is drawn again with the list. */
|
|
794
|
+
const wkBtnOf = () => (WK_MENU && $(WK_MENU.__sel)) || WK_MENU.__btn;
|
|
795
|
+
function closeWorkMenu(back) { if (!WK_MENU) return; const b = wkBtnOf(); WK_MENU.remove(); WK_MENU = null; b.setAttribute('aria-expanded', 'false'); b.classList.remove('on'); if (back) b.focus(); }
|
|
755
796
|
function toggleWorkMenu(btn) {
|
|
756
797
|
if (WK_MENU) { closeWorkMenu(true); return; }
|
|
757
|
-
WK_MENU = document.createElement('div'); WK_MENU.__btn = btn; document.body.appendChild(WK_MENU);
|
|
798
|
+
WK_MENU = document.createElement('div'); WK_MENU.__btn = btn; WK_MENU.__sel = btn.matches('[data-wkmenu]') ? '#ibBody [data-wkmenu]' : '#bdFilter'; document.body.appendChild(WK_MENU);
|
|
758
799
|
btn.setAttribute('aria-expanded', 'true'); btn.classList.add('on');
|
|
759
800
|
drawWorkMenu();
|
|
760
801
|
const f = WK_MENU.querySelector('[data-wkgroup].on') || WK_MENU.querySelector('button'); if (f) f.focus();
|
|
@@ -767,7 +808,7 @@ function toggleWorkMenu(btn) {
|
|
|
767
808
|
WV.wireDrag(WK_MENU, (k) => { drawInit(); drawWorkMenu(k ? `[data-wkcolsw="${k}"]` : null); });
|
|
768
809
|
}
|
|
769
810
|
// a press inside the menu draws it again, so its target may have left the page by now: that is not a press outside
|
|
770
|
-
document.addEventListener('click', (e) => { if (WK_MENU && e.target.isConnected && !WK_MENU.contains(e.target) && !e.target.closest('#bdFilter')) closeWorkMenu(); });
|
|
811
|
+
document.addEventListener('click', (e) => { if (WK_MENU && e.target.isConnected && !WK_MENU.contains(e.target) && !e.target.closest('#bdFilter, [data-wkmenu]')) closeWorkMenu(); });
|
|
771
812
|
function workExtra(k, btn) {
|
|
772
813
|
if (k === 'jira') { refreshJira(null).then(() => { drawWorkMore(); drawWorkMenu(); }); drawWorkMore(); return; }
|
|
773
814
|
if (k === 'you') { if (F.chips.has('you')) F.chips.delete('you'); else F.chips.add('you'); drawInit(); drawWorkMore(); return; }
|
|
@@ -820,6 +861,7 @@ function drawInit() {
|
|
|
820
861
|
if (fk) { const n = $$('#ibBody [data-key]').find((x) => x.dataset.key === fk); if (n) n.focus({ preventScroll: true }); }
|
|
821
862
|
if (v === 'time') TL.mount(body);
|
|
822
863
|
if (v === 'work' && wkMeasure()) { drawInit(); return; } // the bars' ◇s merge by the track's real width: once measured, draw again
|
|
864
|
+
if (v === 'work' && WK_MENU) { const b = $(WK_MENU.__sel); if (b) { b.setAttribute('aria-expanded', 'true'); b.classList.add('on'); } }
|
|
823
865
|
$('#bdShowing').innerHTML = showingHtml(L.length); $('#bdShowing').hidden = !$('#bdShowing').innerHTML;
|
|
824
866
|
drawViewMenu();
|
|
825
867
|
document.body.dataset.bdView = v;
|
|
@@ -845,7 +887,12 @@ $('#bdShowing').addEventListener('click', (e) => {
|
|
|
845
887
|
});
|
|
846
888
|
function setSpan(s) { span = s; store.set(SPAN_KEY, span); drawChips(); drawInit(); }
|
|
847
889
|
$('#ibBody').addEventListener('click', (e) => {
|
|
848
|
-
if (curView() === 'work'
|
|
890
|
+
if (curView() === 'work') {
|
|
891
|
+
const op = e.target.closest('[data-wkopen]'); if (op) { e.preventDefault(); openIni(rowOf(op.dataset.wkopen), op); return; }
|
|
892
|
+
const sg = e.target.closest('[data-wksug]'); if (sg) { sugPress(sg); return; }
|
|
893
|
+
const dl = e.target.closest('[data-wkdl]'); if (dl) { WV.apply({ kind: 'nav', dir: dl.dataset.wkdl === 'back' ? 'back' : 'on' }); drawInit(); const n = $(`#ibBody [data-wkdl="${dl.dataset.wkdl}"]`) || $('#ibBody [data-wknav="today"]'); if (n) n.focus(); return; }
|
|
894
|
+
if (workPress(e)) return;
|
|
895
|
+
}
|
|
849
896
|
if (e.target.closest('#fold, [data-mefold]')) { foldOpen = !foldOpen; drawInit(); const f = $('#fold') || $('#ibBody [data-mefold]'); if (f) f.focus(); return; }
|
|
850
897
|
const gf = e.target.closest('[data-fold]'); if (gf) { const k = gf.dataset.fold; PG.fold(k); drawInit(); const b = $$('#ibBody [data-fold]').find((x) => x.dataset.fold === k); if (b) b.focus(); return; }
|
|
851
898
|
const pc = e.target.closest('[data-pcat]'); if (pc) { const k = pc.dataset.pcat; V.togglePcat(k); drawInit(); const b = $$('#ibBody [data-pcat]').find((x) => x.dataset.pcat === k); if (b) b.focus(); return; }
|
|
@@ -33,6 +33,9 @@ export const VIEW_CONTROLS = [
|
|
|
33
33
|
// Work, one view (shared-copy brief Part A 3, Part B i): a column's sort, the span and its menu, hide and show the timeline, the closed fold,
|
|
34
34
|
// a row (opens its popup), a bar (its stage card) and the card itself, Show all; the find field and the tune panel's filter and sort
|
|
35
35
|
'.wk-hd', '[data-wkspan]', '[data-wkspick]', '[data-wktl]', '[data-wkclosed]', '.wk-i[data-key]', '[data-wkbar] .tg-bar', '[data-wkbar] .wk-bar', '.wk-card', '[data-wkclear]',
|
|
36
|
+
// WorkDS (initiative work-ds-initiatives): Where it stands' names (open the initiative), the scale tabs, Earlier / Go to today / Later,
|
|
37
|
+
// Choose columns (the copy's filter and sort), the timeline switch in it, the Next milestones line's +N marks
|
|
38
|
+
'[data-wkopen]', '[data-wknav]', '[data-wkmenu]', '.wk-menu [data-wktlsw]', '[data-wkdl="on"]', '[data-wkdl="back"]',
|
|
36
39
|
'#bdFind', '#roFind', '#bdFilter', '.wk-menu [data-wkf]', '.wk-menu [data-wkmore]', '.wk-menu [data-wksortp]', '.wk-menu [data-wksortx]', '.wk-menu [data-wkreset]',
|
|
37
40
|
// the popup of a row, read only (Part A 4): its close and its edge, Details, a stage's fold, the done and far folds
|
|
38
41
|
'.cz-pop [data-pop="close"]', '.pw [data-pw-details]', '.pw [data-pw-fold]', '.pw [data-pw-more]', '.pw [data-pw-grip]', '.pw [data-pw-done]', '.pw [data-pw-far]', '.pw [data-pw-tl]', '.pw [data-pw-span]', '.hi-pop [data-sp]',
|