create-pmos 0.644.0 → 0.646.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 -33
- package/payload/KIT-VERSION +1 -1
- package/payload/design-system/charts/README.md +2 -1
- package/payload/design-system/charts/components/Funnel/README.md +50 -0
- package/payload/design-system/charts/components/Funnel/preview.html +11 -0
- package/payload/design-system/charts/components/bundle.css +1 -0
- package/payload/design-system/charts/components/bundle.js +20 -1
- package/payload/design-system/charts/spec.md +2 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/changelog.json +26 -0
- package/workspace/design-system/charts/README.md +2 -1
- package/workspace/design-system/charts/components/Funnel/README.md +50 -0
- package/workspace/design-system/charts/components/Funnel/preview.html +11 -0
- package/workspace/design-system/charts/components/bundle.css +1 -0
- package/workspace/design-system/charts/components/bundle.js +20 -1
- package/workspace/design-system/charts/spec.md +2 -1
- package/workspace/guide/layout.md +15 -12
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/charts.css +1 -0
- 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/cozy-vw-mtg.css +87 -74
- package/workspace/public/pm/cozy-vw-rp.css +52 -45
- package/workspace/public/pm/cozy-vw.css +83 -74
- package/workspace/public/pm/premium-vw-cal.css +21 -15
- package/workspace/public/pm/premium-vw-meet.css +11 -11
- package/workspace/public/pm/premium-vw-rec.css +11 -11
- package/workspace/public/pm/premium-vw-report.css +14 -14
|
@@ -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
|