create-pmos 0.710.0 → 0.712.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 +20 -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 +19 -0
- package/workspace/chat-asks-test.js +1 -1
- package/workspace/guide/layout.md +6 -6
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/bd-backlog.css +1 -1
- package/workspace/public/pm/bd-backlog.js +9 -3
- package/workspace/public/pm/bd-stands.js +1 -1
- package/workspace/public/pm/bd-views.js +9 -1
- package/workspace/public/pm/bd-work-ds.css +15 -0
- package/workspace/public/pm/cozy-home.css +23 -8
- package/workspace/public/pm/cozy-nav.js +6 -5
- package/workspace/public/pm/cozy-pop-work.css +44 -0
- package/workspace/public/pm/cozy-pop-work.js +80 -34
- package/workspace/public/pm/cozy-task-pop.css +13 -0
- package/workspace/public/pm/cozy-today-app.js +31 -10
- package/workspace/public/pm/cozy-today-model.js +4 -2
- package/workspace/public/pm/cozy-today-page.css +27 -0
- package/workspace/public/pm/cozy-today-view.js +96 -29
- package/workspace/public/pm/home-app.js +1 -1
- package/workspace/public/pm/home-ask.js +26 -3
- package/workspace/public/pm/home-chat.js +20 -3
- package/workspace/public/pm/phone-ask.js +7 -7
- package/workspace/public/pm/premium-board.js +1 -1
- package/workspace/test-lists/phone-today-work.json +9 -0
|
@@ -361,50 +361,95 @@ function jiraUrlOf(rows, key) {
|
|
|
361
361
|
const r = (rows || []).find((x) => x && x.jurl && /\/browse\//.test(x.jurl));
|
|
362
362
|
return r ? r.jurl.replace(/\/browse\/[^/?#]+/, '/browse/' + key) : '';
|
|
363
363
|
}
|
|
364
|
-
/* ── a phone (
|
|
365
|
-
* no table:
|
|
366
|
-
*
|
|
367
|
-
*
|
|
368
|
-
* says yes, left says no (pm/cozy-phone-swipe.js); its press opens it
|
|
369
|
-
|
|
364
|
+
/* ── a phone (PhoneWorkDS on Exploring 3, page "phone"; agreed 2026-11-22, job #1540; was Ph2_init): the initiative full screen. No cards,
|
|
365
|
+
* no table, no Gantt: Where it stands (PMOS's words, at most one ✦ proposal and the next 3 dates), the Stages as a strip with the one now
|
|
366
|
+
* marked, the Work breakdown of the stage now (a dot: late in the alert colour, in progress blue, to do a ring; done muted with a tick; a
|
|
367
|
+
* Jira key chip; subtasks nested), the other stages folded to one line that opens them, then the case and the Artefacts. A proposal is
|
|
368
|
+
* swiped: right says yes, left says no (pm/cozy-phone-swipe.js); its press opens it as its own page (why, what changes). A task, a milestone
|
|
369
|
+
* or an artefact opens full screen with Back. The presses are the popup's own data-pw-* ones. */
|
|
370
|
+
const PH_ARTS = new Set(); // initiatives whose documents are unfolded on the phone, per page (kept for the older press)
|
|
371
|
+
const PH_ALL = new Set(); // initiatives whose other stages are unfolded on the phone, per page
|
|
370
372
|
const phSug = (id, say, keep, drop, open) => `<div class="pw-psug" role="listitem" data-sw-right="yes" data-sw-left="no">${SVG(P.spark, 13, 2)}`
|
|
371
|
-
+ (open ? `<button type="button" class="pw-psay" ${open}>${esc(say)}</button>` : `<span class="pw-psay">${esc(say)}</span>`)
|
|
373
|
+
+ (open ? `<button type="button" class="pw-psay" ${open}>${esc(say)}<span class="pw-pwhy"> · why</span></button>` : `<span class="pw-psay">${esc(say)}</span>`)
|
|
372
374
|
+ `<span class="pw-psb" hidden><button type="button" data-sw-yes ${keep} tabindex="-1">Yes</button><button type="button" data-sw-no ${drop} tabindex="-1">No</button></span></div>`;
|
|
375
|
+
const ART_IC = { slides: 'M4 5h16v11H4zM12 16v4M8 20h8', deck: 'M4 5h16v11H4zM12 16v4M8 20h8', prototype: 'M4 5h16v11H4zM12 16v4M8 20h8', design: 'M4 5h16v11H4zM12 16v4M8 20h8',
|
|
376
|
+
doc: 'M7 3.5h7l4 4V20.5H7zM14 3.5v4h4M10 12h5M10 16h5' };
|
|
377
|
+
const artIc = (a) => { const k = String(a.kindName || a.kind || '').toLowerCase(); return ART_IC[Object.keys(ART_IC).find((x) => k.indexOf(x) >= 0) || 'doc']; };
|
|
378
|
+
/** The phone's parts of an initiative, pure (pop-work.test.js and phone-today-work.test.js read it): the next 3 dates, the strip, the stage now
|
|
379
|
+
* and its tasks, and the stages that fold. W: model().W. → { next: [{ uid, title, date, done, late }], strip: [{ name, tone, date }],
|
|
380
|
+
* now: stage row | null, tasks: [task rows of the stage now], others: [{ key, name, n }] } */
|
|
381
|
+
export function phoneParts(W) {
|
|
382
|
+
const rows = (W && W.rows) || [], stages = rows.filter((x) => x.kind === 'stage' && !x.loose);
|
|
383
|
+
const marks = stages.flatMap((x) => x.marks || []).concat(rows.filter((x) => x.kind === 'task' && x.ms).map((x) => ({ uid: x.uid, title: x.title, end: x.end, done: x.done, late: x.late })));
|
|
384
|
+
const seen = new Set(), ms = marks.filter((m) => m && m.end && !seen.has(String(m.uid)) && seen.add(String(m.uid))).sort((a, b) => (a.end < b.end ? -1 : a.end > b.end ? 1 : 0));
|
|
385
|
+
const next = ms.filter((m) => !m.done).slice(0, 3).map((m) => ({ uid: m.uid, title: m.title, date: M.dayText(m.end, W.today), done: false, late: !!m.late }));
|
|
386
|
+
const strip = stages.map((x) => ({ key: x.key, name: x.name, tone: x.done || x.tone === 'dn' ? 'dn' : x.now ? 'now' : '', date: x.now ? (x.date ? 'now · ' + x.date : 'now') : x.start && x.end ? M.dayText(x.start, W.today) + (x.end !== x.start ? ' to ' + M.dayText(x.end, W.today) : '') : '' }));
|
|
387
|
+
const now = stages.find((x) => x.now) || stages.find((x) => !x.done) || null;
|
|
388
|
+
const tasks = [];
|
|
389
|
+
let cur = null;
|
|
390
|
+
for (const x of rows) {
|
|
391
|
+
if (x.kind === 'stage') { cur = x; continue; }
|
|
392
|
+
if (x.kind === 'far') { cur = null; continue; }
|
|
393
|
+
if (cur && now && cur.key === now.key && (x.kind === 'task' || x.kind === 'more')) tasks.push(x);
|
|
394
|
+
}
|
|
395
|
+
const others = stages.filter((x) => (!now || x.key !== now.key) && x.can).map((x) => ({ key: x.key, name: x.name, n: (x.count || '').replace(/^\d+ of /, '') }));
|
|
396
|
+
const far = rows.find((x) => x.kind === 'far');
|
|
397
|
+
if (far) others.push({ key: '', name: far.name, n: (far.tasks || 0) + ((far.tasks || 0) === 1 ? ' task' : ' tasks'), far: true });
|
|
398
|
+
return { next, strip, now, tasks, others };
|
|
399
|
+
}
|
|
400
|
+
function phTask(x) {
|
|
401
|
+
if (x.kind === 'more') return `<li class="pw-ptk2 more"><button type="button" class="pw-dn" data-pw-more="${esc(x.key)}" aria-expanded="false">${esc(x.label)}</button></li>`;
|
|
402
|
+
const tone = x.done ? 'dn' : x.late ? 'late' : x.prog ? 'now' : 'todo';
|
|
403
|
+
const lab = x.done ? 'Done' : x.late ? 'Late' : x.prog ? 'In progress' : 'To do';
|
|
404
|
+
const mark = x.done ? `<span class="pw-ptick" role="img" aria-label="Done">${SVG(P.check, 14, 2)}</span>` : `<i class="pw-pdot2 ${tone}" role="img" aria-label="${lab}"></i>`;
|
|
405
|
+
const meta = [x.ms ? `${SVG(P.dia, 12)}<span>Milestone</span>` : `${SVG(P.box, 12)}`, x.who ? esc(x.who) : '', x.date ? (x.late ? `<em>${esc(x.date)}</em>` : esc(x.date)) : '', x.done ? 'done' : '']
|
|
406
|
+
.filter(Boolean).join('<i aria-hidden="true">·</i>').replace(/^(<svg[^]*?<\/svg>)<i aria-hidden="true">·<\/i>/, '$1');
|
|
407
|
+
const chip = x.ckey ? `<span class="pm-chip pw-pkey">${esc(x.ckey)}</span>` : '';
|
|
408
|
+
return `<li class="pw-ptk2${x.done ? ' done' : ''}"${x.depth ? ` style="--pw-d:${Math.min(x.depth, 3)}"` : ''}>${mark}<div class="pw-ptx"><button type="button" class="pw-tt" data-pw-open="${esc(x.uid)}">${esc(x.title)}</button><small class="pw-pm">${meta}${chip}</small></div></li>`;
|
|
409
|
+
}
|
|
373
410
|
function phoneHtml(W, S, oid, v) {
|
|
374
|
-
const st = (v && v.stage) || {},
|
|
375
|
-
const head = st.name ? `<div class="pw-phd">${st.n ? `<span class="pw-pn">${esc(st.n)}</span>` : ''}<b>${esc(st.name)}</b>${d.left ? `<span class="${d.over ? 'warn' : ''}">${esc(d.left)}</span>` : ''}</div>` : '';
|
|
411
|
+
const st = (v && v.stage) || {}, dr = dropped(), PT = phoneParts(W);
|
|
376
412
|
const miss = st.gate && (st.gate.parts || []).filter((x) => !x.ok).map((x) => x.text);
|
|
377
413
|
const gate = miss && miss.length ? `<p class="pw-pgate">${esc(String(st.gate.label || 'Gate'))}: <span class="warn">${esc(miss.join(' and ').replace(/^./, (c) => c.toUpperCase()))}</span></p>` : '';
|
|
378
|
-
//
|
|
414
|
+
// Where it stands: PMOS's words (the status line, what the gate line says is not said again), one ✦ proposal, the next 3 dates
|
|
379
415
|
const ov = W.overview;
|
|
380
|
-
const lines = ov.lines.filter((L) => L.text).map((L) => `<p class="pw-pl"><b>${esc(L.k)}</b> ${L.edit ? `<span class="pw-otx" data-pw-line="${esc(L.id)}" tabindex="0" role="button" aria-label="${esc('Change the ' + L.k.toLowerCase())}">${esc(L.text)}</span>` : esc(L.text)}${L.serves ? ' ' + esc(L.serves) : ''}</p>`).join('');
|
|
381
416
|
const off = ov.lines.filter((L) => !L.text && L.ask && !dr.has('ov:' + oid + ':' + L.id));
|
|
382
417
|
const from = off.length ? (/ (from .*?)\?$/.exec(off[0].miss || '') || [])[1] || 'with you' : '';
|
|
383
|
-
const
|
|
384
|
-
|
|
385
|
-
const
|
|
386
|
-
|
|
387
|
-
const
|
|
388
|
-
|
|
389
|
-
//
|
|
418
|
+
const said = String(ov.status || '').split(/(?<=\.)\s+/).filter((t) => t && !/cannot pass the gate/i.test(t)).join(' ');
|
|
419
|
+
const s0 = W.suggests[0];
|
|
420
|
+
const one = s0 ? phSug(s0.id, s0.say, `data-pw-keep="${esc(s0.id)}"`, `data-pw-drop="${esc(s0.id)}"`, `data-pw-sug="${esc(s0.id)}"`)
|
|
421
|
+
: off.length ? phSug('', 'Draft the ' + off.map((L) => L.k).join(' and ') + ' ' + from, `data-pw-lkeep="${esc(off.map((L) => L.id).join(','))}"`, `data-pw-ldrop="${esc(off.map((L) => 'ov:' + oid + ':' + L.id).join(','))}"`, `data-pw-lkeep="${esc(off.map((L) => L.id).join(','))}"`) : '';
|
|
422
|
+
const next = PT.next.length ? `<ul class="pw-pnext" aria-label="Next dates">${PT.next.map((m) => `<li><span class="pw-pnd">${SVG(P.dia, 13)}<time class="${m.late ? 'warn' : ''}">${esc(m.date)}</time></span><button type="button" class="pw-tt" data-pw-open="${esc(m.uid)}">${esc(m.title)}</button></li>`).join('')}</ul>` : '';
|
|
423
|
+
const stands = said || one || next ? `<section class="pw-pov" aria-label="Where it stands"><h3>${SVG(P.spark, 14, 2)}Where it stands</h3>${said ? `<p>${esc(said)}</p>` : ''}${one ? `<div class="pw-psugs" role="list">${one}</div>` : ''}${next}</section>` : '';
|
|
424
|
+
// Stages: one strip, the stage now marked
|
|
425
|
+
const strip = PT.strip.length ? `<section class="pw-psec" aria-label="Stages"><h4>Stages</h4><ol class="pw-pstrip">${PT.strip.map((x) => `<li class="${x.tone}"${x.tone === 'now' ? ' aria-current="step"' : ''}><i aria-hidden="true"></i><b>${esc(x.name)}</b>${x.date ? `<small>${esc(x.date)}</small>` : ''}</li>`).join('')}</ol></section>` : '';
|
|
426
|
+
// the Work breakdown of the stage now; the other stages fold to one line that opens them (they keep the popup's own presses)
|
|
427
|
+
const all = PH_ALL.has(oid);
|
|
428
|
+
const nowList = PT.tasks.length ? `<ul class="pw-pwbs2">${PT.tasks.map(phTask).join('')}</ul>` : '<p class="pw-pnone">No task in this stage yet.</p>';
|
|
390
429
|
const dot = (x) => `<i class="pw-pdot ${x.tone === 'dn' || x.status === 'Done' ? 'dn' : x.tone === 'now' || x.status === 'In progress' ? 'now' : 'todo'}" aria-hidden="true"></i>`;
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
430
|
+
let rest = '';
|
|
431
|
+
if (all) {
|
|
432
|
+
let cur = null;
|
|
433
|
+
rest = W.rows.map((x) => {
|
|
434
|
+
if (x.kind === 'stage') { cur = x; if (x.loose || (PT.now && x.key === PT.now.key)) return ''; return `<li class="pw-pst">${dot(x)}<button type="button" class="pw-pstg" data-pw-fold="${esc(x.key)}" aria-expanded="${x.open}"${x.can ? '' : ' disabled'}><b>${esc(x.name)}</b></button><span class="pw-pd">${esc(x.date || x.count || '')}</span></li>`; }
|
|
435
|
+
if (x.kind === 'far') { cur = null; return `<li class="pw-pst">${dot({ status: 'To do' })}<button type="button" class="pw-pstg" data-pw-far aria-expanded="false"><b>${esc(x.name)}</b></button><span class="pw-pd">${esc(x.count)}</span></li>`; }
|
|
436
|
+
if (!cur || (PT.now && cur.key === PT.now.key)) return '';
|
|
437
|
+
return x.kind === 'task' || x.kind === 'more' ? phTask(x) : '';
|
|
438
|
+
}).join('');
|
|
439
|
+
}
|
|
440
|
+
const others = PT.others.length ? `<button type="button" class="pw-pfold" data-pw-phall aria-expanded="${all}"><b>${esc(PT.others.map((x) => x.name).join(', '))}</b><span>${esc(all ? 'tap to fold' : 'tap to open')}</span>${SVG(all ? P.down : P.right, 13)}</button>${all ? `<ul class="pw-pwbs2">${rest}</ul>` : ''}` : '';
|
|
399
441
|
const loose = W.looseN ? `<p class="pw-loose"><button type="button" class="pw-lk" data-pw-backlog>${esc(W.looseN === 1 ? '1 task with no stage is in the Backlog' : W.looseN + ' tasks with no stage are in the Backlog')}${SVG(P.right, 13)}</button></p>` : '';
|
|
400
|
-
const wbs = `<section class="pw-psec" aria-label="Work breakdown"><h4>Work breakdown
|
|
401
|
-
//
|
|
402
|
-
const
|
|
403
|
-
const
|
|
404
|
-
|
|
405
|
-
|
|
442
|
+
const wbs = `<section class="pw-psec" aria-label="Work breakdown"><h4>Work breakdown${PT.now ? ' · ' + esc(PT.now.name) : ''}</h4>${nowList}${others}${loose}</section>`;
|
|
443
|
+
// the case: the lines that are written (Problem, Solution, Expected, Check …), each changeable where the popup lets it be
|
|
444
|
+
const lines = ov.lines.filter((L) => L.text);
|
|
445
|
+
const kase = lines.length ? `<section class="pw-psec" aria-label="The case"><h4>The case</h4><dl class="pw-pcase">${lines.map((L) => `<dt>${esc(L.k)}</dt><dd>${L.edit ? `<span class="pw-otx" data-pw-line="${esc(L.id)}" tabindex="0" role="button" aria-label="${esc('Change the ' + L.k.toLowerCase())}">${esc(L.text)}</span>` : esc(L.text)}${L.serves ? ' ' + esc(L.serves) : ''}</dd>`).join('')}</dl></section>` : '';
|
|
446
|
+
// Artefacts: the merge proposal, then each one with its kind and day; a press opens it full screen
|
|
447
|
+
const arts = W.artefacts.filter((a) => !a.missing), mg = mergeOf(W.artefacts);
|
|
448
|
+
const artH = arts.length || mg ? `<section class="pw-psec" aria-label="Artefacts"><h4>Artefacts · ${esc(arts.length)}</h4>${mg ? `<div class="pw-psugs" role="list">${phSug(mg.id, mg.say, `data-pw-keep="${esc(mg.id)}"`, `data-pw-drop="${esc(mg.id)}"`, `data-pw-sug="${esc(mg.id)}"`)}</div>` : ''}`
|
|
449
|
+
+ `<ul class="pw-parts2">${W.artefacts.map((a, i) => (a.missing ? '' : `<li><button type="button" class="pw-an2" data-pw-art="${i}">${SVG(artIc(a), 16)}<span><b>${esc(a.title)}</b><small>${esc([a.kindName || a.kind || '', a.when || ''].filter(Boolean).join(' · '))}</small></span></button></li>`)).join('')}</ul></section>` : '';
|
|
406
450
|
const ask = `<form class="pw-pask" data-pw-pask><input type="text" maxlength="500" placeholder="Ask PMOS about this work" aria-label="Ask PMOS about this work" autocomplete="off"><button type="submit" aria-label="Send" title="Send">${SVG('M12 19V5M6 11l6-6 6 6', 16, 2)}</button></form>`;
|
|
407
|
-
|
|
451
|
+
void S;
|
|
452
|
+
return `<div class="pw pw-ph">${gate}${stands}${strip}${wbs}${kase}${artH}${ask}</div>`;
|
|
408
453
|
}
|
|
409
454
|
|
|
410
455
|
/* ── the suggestion as its own page (board 22) ── */
|
|
@@ -596,6 +641,7 @@ export function wire(body, h0, x0) {
|
|
|
596
641
|
if (d.pwStatus) { statusMenu(b, d.pwStatus, h, c); return; }
|
|
597
642
|
if (d.pwDate) { dateMenu(b, d.pwDate, c, h); return; }
|
|
598
643
|
if (d.pwName) { rename(b, d.pwName, h); return; }
|
|
644
|
+
if ('pwPhall' in d) { if (PH_ALL.has(c.id)) PH_ALL.delete(c.id); else PH_ALL.add(c.id); redraw(); return; } // a phone: the other stages unfold (PhoneWorkDS)
|
|
599
645
|
if (d.pwOpen) { openSmall(d.pwOpen, c, h, x, body); return; }
|
|
600
646
|
if ('pwBacklog' in d) { const o = x.o() || {}, w = h.where ? h.where() : {}, q = new URLSearchParams({ work: 'backlog' }); if (w.ws || o.ws) q.set('ws', w.ws || o.ws); if (o.id) q.set('ini', o.id); location.href = '/premium-board.html?' + q.toString(); return; }
|
|
601
647
|
// a milestone ◇ opens its full popup (WorkStatesDS 6); a Jira one and a phone keep the small card
|
|
@@ -950,7 +996,7 @@ async function openSmall(uid, c, h, x, body, bt) {
|
|
|
950
996
|
onChange: () => { if (h.reload) h.reload(); },
|
|
951
997
|
// the full popup over the work side (work-ds-quick-edit, WorkStatesDS 4 and 6): ← and the path go back to this initiative, the chat button
|
|
952
998
|
// shows the popup's chat, × closes the popup; a milestone shows its date, the done test and PMOS's suggestion about it
|
|
953
|
-
full:
|
|
999
|
+
full: true, path: [o.from || 'Work', o.product || '', ((x && x.v && x.v()) || {}).title || ''].filter(Boolean),
|
|
954
1000
|
chat: () => { const a = document.querySelector('.cz-pop [data-pop="ask"]'); if (a) a.click(); },
|
|
955
1001
|
closeAll: () => { const k = document.querySelector('.cz-pop [data-pop="close"]'); if (k) k.click(); },
|
|
956
1002
|
head: (t) => {
|
|
@@ -72,3 +72,16 @@ button.ctp-cr:hover { text-decoration: underline; }
|
|
|
72
72
|
.ctp-g { grid-template-columns: minmax(0, 1fr); }
|
|
73
73
|
.ctp-side { position: static; order: -1; }
|
|
74
74
|
}
|
|
75
|
+
|
|
76
|
+
/* PhoneWorkDS (job 1540): on a phone a task or a milestone opens full screen, with ← back to the initiative. No margins, one column. */
|
|
77
|
+
@media (max-width: 760px) {
|
|
78
|
+
.ctp.ctp-full, .ctp.ctp-full.ctp-solo { left: 0; top: 0; right: 0; bottom: 0; width: auto; height: auto; max-width: none; border-radius: 0; box-shadow: none; padding: calc(env(safe-area-inset-top, 0px) + var(--space-12)) var(--space-16) calc(env(safe-area-inset-bottom, 0px) + var(--space-24)); overflow: auto; }
|
|
79
|
+
.ctp-full .ctp-hx { max-width: none; }
|
|
80
|
+
/* no cards on a phone (PhoneWorkDS, job 1540): the task reads as one page, its parts split by a hair line, not boxed */
|
|
81
|
+
.ctp-full .ctp-path > :not(:last-child) { display: none; }
|
|
82
|
+
.ctp-full .pm-block { background: none; border: 0; box-shadow: none; border-radius: 0; padding: var(--space-16) 0; border-top: 1px solid var(--cz-hair); }
|
|
83
|
+
.ctp-full .tkc-f { background: none; box-shadow: none; border-radius: 0; padding-left: 0; padding-right: 0; }
|
|
84
|
+
.ctp-full .ovw.tk-ini { background: none; padding-left: 0; padding-right: 0; border-radius: 0; }
|
|
85
|
+
.ctp-full .pm-block.list .head, .ctp-full .pm-block.list .pm-li { padding-left: 0; padding-right: 0; }
|
|
86
|
+
.ctp-full .ctp-b { padding: 0; }
|
|
87
|
+
}
|
|
@@ -22,7 +22,7 @@ import { wireSwipe } from './cozy-phone-swipe.js'; // the phone: rows and the
|
|
|
22
22
|
|
|
23
23
|
const ASK_SEND = new Set(['session']);
|
|
24
24
|
export function mountToday(ctx) {
|
|
25
|
-
const X = { log: { entries: [], marks: {} }, html: '', model: null, agenda: null, read: false, busy: new Set(),
|
|
25
|
+
const X = { log: { entries: [], marks: {} }, html: '', model: null, agenda: null, read: false, busy: new Set(), job: '', sheet: '', open: false, hide: new Set(), sopen: new Set(), unfiled: new Set(), filedOk: new Set() };
|
|
26
26
|
const el = document.getElementById('tdPage');
|
|
27
27
|
// a desk and a phone both draw Today here; a phone draws its own one column (TP.phonePageHtml, board Ph2_today) while no conversation is
|
|
28
28
|
// open over it (body.hm-plist: home-app.js's phone list state). On a phone Home's list is not drawn on today.html (cozy-today-page.css).
|
|
@@ -91,18 +91,22 @@ export function mountToday(ctx) {
|
|
|
91
91
|
document.dispatchEvent(new CustomEvent('cz:calls', { detail: { count: O.today } }));
|
|
92
92
|
try { localStorage.setItem('pmos.today.count', JSON.stringify({ day: L.today, n: O.today })); } catch { /* a private window */ }
|
|
93
93
|
}
|
|
94
|
-
if (X.type && !(L.types || {})[X.type]) X.type = '';
|
|
95
94
|
const cap = document.getElementById('tdCap'), draft = cap ? cap.value : '', focus = !!cap && document.activeElement === cap;
|
|
95
|
+
// the log filters by job (All, Reply, Do, Decide, Send) on a desk and a phone; a job whose count went to zero goes back to All
|
|
96
|
+
if (X.job && !(L.counts || {})[X.job.toLowerCase()]) X.job = '';
|
|
96
97
|
if (phone()) {
|
|
97
|
-
|
|
98
|
+
// PhoneTodayDS (job #1540): Where it stands, the log with All ⌄, the capture box at the foot, the ✦ proposal's sheet
|
|
99
|
+
if (X.sheet && !(O.suggest || []).some((x) => x.key === X.sheet)) X.sheet = '';
|
|
100
|
+
const html = TP.phonePageHtml(L, A, O, { head: TM.headModel(ctx.now()), job: X.job, open: X.open, sopen: [...X.sopen], filed: filedLine(), now: ctx.now(), draft, mic: !!SPEECH(), sheet: X.sheet });
|
|
98
101
|
if (html === X.html && el.firstChild) return;
|
|
99
102
|
X.html = html; el.classList.add('tdp');
|
|
103
|
+
document.body.classList.toggle('tdp-sheeton', !!X.sheet);
|
|
100
104
|
const sy = scrollY; el.innerHTML = html; scrollTo(0, sy);
|
|
105
|
+
const c2 = document.getElementById('tdCap'); if (c2 && focus) { c2.focus(); c2.setSelectionRange(c2.value.length, c2.value.length); }
|
|
106
|
+
if (X.sheet) { const y = el.querySelector('.tdp-sheet [data-td="ov-yes"]'); if (y) y.focus(); }
|
|
101
107
|
return;
|
|
102
108
|
}
|
|
103
109
|
el.classList.remove('tdp');
|
|
104
|
-
// the log's Tabs filter by job (All, Reply, Do, Decide, Send); a tab whose count went to zero goes back to All
|
|
105
|
-
if (X.job && !(L.counts || {})[X.job.toLowerCase()]) X.job = '';
|
|
106
110
|
const html = TP.pageHtml(L, A, { draft, overview: O, job: X.job, open: X.open || !!X.job, handled: X.job && X.job !== 'Reply' ? [] : handled(), hopen: X.hopen, sopen: [...X.sopen], filed: filedLine() });
|
|
107
111
|
if (html === X.html && el.firstChild) return;
|
|
108
112
|
X.html = html;
|
|
@@ -146,7 +150,7 @@ export function mountToday(ctx) {
|
|
|
146
150
|
/** The popup's chat hidden for this open (round 3 point 7), until the popup's own per-item rule does it. */
|
|
147
151
|
const chatOff = () => setTimeout(() => { const h = document.querySelector('.cz-pop:not([hidden]) [data-pop="hide"]'); if (h && !h.closest('.chat-off')) h.click(); }, 60);
|
|
148
152
|
/** The rows in the order Today shows them, the ones that open something. */
|
|
149
|
-
const order = () => { const L = X.model; if (!L) return []; return [...(L.first || []), ...(L.todayRows || []), ...(X.open || X.
|
|
153
|
+
const order = () => { const L = X.model; if (!L) return []; return [...(L.first || []), ...(L.todayRows || []), ...(X.open || X.job ? L.wait || [] : [])].filter((r) => r && !r.done && r.src !== 'note' && r.src !== 'own' && (!X.job || r.job === X.job)); };
|
|
150
154
|
/** ↑ ↓ (j k) in the popup: the previous or next Today row opens in its place. true when it stepped. */
|
|
151
155
|
function step(d) {
|
|
152
156
|
const list = order(), i = list.findIndex((r) => r.key === X.last);
|
|
@@ -332,7 +336,9 @@ export function mountToday(ctx) {
|
|
|
332
336
|
run(b.dataset.td, b.dataset.key || '', b);
|
|
333
337
|
});
|
|
334
338
|
// the phone's type filter (Today's log · N All ⌄)
|
|
335
|
-
el.addEventListener('change', (e) => { const t = e.target.closest('[data-td-
|
|
339
|
+
el.addEventListener('change', (e) => { const t = e.target.closest('[data-td-job]'); if (t) { X.job = t.value; draw(); } });
|
|
340
|
+
// the proposal's sheet closes on Escape, as a dialog does
|
|
341
|
+
document.addEventListener('keydown', (e) => { if (e.key === 'Escape' && X.sheet) { X.sheet = ''; draw(); } });
|
|
336
342
|
// a phone: a row or the proposal swiped; the act is the one its button had on a desk, said in the toast with Undo
|
|
337
343
|
wireSwipe(el, { on: phone, act: (row, way) => { const act = row.dataset[way === 'right' ? 'swRight' : 'swLeft']; if (act) run(act, row.dataset.key || '', { dataset: {}, disabled: false, isConnected: false }); } });
|
|
338
344
|
}
|
|
@@ -355,7 +361,10 @@ export function mountToday(ctx) {
|
|
|
355
361
|
ctx.toastUndo('Taken out of ' + f.title + '.', async () => { const u = await ctx.pmPost('/api/notes/link', { id: key, initiative: f.ini }).catch(() => null); X.unfiled.delete(key); draw(); return u || { ok: false }; });
|
|
356
362
|
return;
|
|
357
363
|
}
|
|
358
|
-
|
|
364
|
+
// the phone's ✦ proposal: a press opens it as the expanded Suggestion in a sheet (PhoneTodayDS); a swipe still answers it at once
|
|
365
|
+
if (act === 'ov-open') { X.sheet = key; draw(); return; }
|
|
366
|
+
if (act === 'sheet-x') { X.sheet = ''; draw(); return; }
|
|
367
|
+
if (act === 'cap-mic') { listen(b); return; }
|
|
359
368
|
if (act === 'fold') { X.open = !X.open; draw(); return; }
|
|
360
369
|
if (act === 'hfold') { X.hopen = !X.hopen; draw(); return; }
|
|
361
370
|
if (act === 'h-undo') {
|
|
@@ -363,13 +372,12 @@ export function mountToday(ctx) {
|
|
|
363
372
|
if (!m || !m.ok) { b.disabled = false; return ctx.toast('It did not go through. Nothing changed.'); }
|
|
364
373
|
await ctx.reloadMentions(); ctx.toast('Back on Today: it still waits on you.'); return;
|
|
365
374
|
}
|
|
366
|
-
if (act === 'type') { X.type = X.type === key ? '' : key; draw(); return; }
|
|
367
375
|
if (act === 'job') { X.job = key; draw(); return; }
|
|
368
376
|
// the recorded meeting: ✓ keeps it filed where PMOS put it, and the block leaves Today
|
|
369
377
|
if (act === 'filed-ok') { X.filedOk.add(key); draw(); return; }
|
|
370
378
|
if (act === 'ov-yes' || act === 'ov-no') {
|
|
371
379
|
const sg = X.overview && X.overview.suggest.find((x) => x.key === key); if (!sg || X.busy.has(key)) return;
|
|
372
|
-
X.busy.add(key); b.disabled = true;
|
|
380
|
+
X.busy.add(key); b.disabled = true; X.sheet = '';
|
|
373
381
|
try {
|
|
374
382
|
if (act === 'ov-no') { for (const k of sg.keys) await mark1(k, 'keep', {}); X.hide.add(key); ctx.toast('Kept. PMOS will not suggest it again for a month.'); return after(false); }
|
|
375
383
|
const done = []; for (const k of sg.keys) { const m = await mark1(k, 'drop', {}); if (m.ok) done.push(k); }
|
|
@@ -425,5 +433,18 @@ export function mountToday(ctx) {
|
|
|
425
433
|
const j = document.getElementById('tdCap'); if (j) j.focus();
|
|
426
434
|
});
|
|
427
435
|
}
|
|
436
|
+
/* The capture box's mic on a phone (PhoneTodayDS: "type or speak"): the browser's own speech recognition, where it has one, writes the
|
|
437
|
+
* words into the box; the PM reads them and sends. Nothing is sent by itself. */
|
|
438
|
+
function listen(b) {
|
|
439
|
+
const R = SPEECH(); const i = document.getElementById('tdCap'); if (!R || !i) return;
|
|
440
|
+
const rec = new R(); rec.lang = document.documentElement.lang || 'en'; rec.interimResults = false; rec.maxAlternatives = 1;
|
|
441
|
+
b.setAttribute('aria-pressed', 'true');
|
|
442
|
+
rec.onresult = (e) => { const t = e.results && e.results[0] && e.results[0][0] ? e.results[0][0].transcript : ''; const j = document.getElementById('tdCap'); if (j && t) { j.value = (j.value ? j.value + ' ' : '') + t.trim(); j.focus(); } };
|
|
443
|
+
rec.onerror = (e) => { console.info('[phone-today-work] speech', e && e.error); if (e && e.error !== 'aborted' && e.error !== 'no-speech') ctx.toast('PMOS could not hear that. Type the line instead.'); };
|
|
444
|
+
rec.onend = () => { const m = el && el.querySelector('[data-td="cap-mic"]'); if (m) m.setAttribute('aria-pressed', 'false'); };
|
|
445
|
+
try { rec.start(); } catch (e) { console.info('[phone-today-work] speech did not start', e && e.message); }
|
|
446
|
+
}
|
|
428
447
|
return { on, draw, read };
|
|
429
448
|
}
|
|
449
|
+
/** The browser's speech recognition, or null where it has none (then the box has no mic: zero is silence). */
|
|
450
|
+
const SPEECH = () => (typeof window !== 'undefined' && (window.SpeechRecognition || window.webkitSpeechRecognition)) || null;
|
|
@@ -426,8 +426,10 @@ export function overviewModel(L, A = {}) {
|
|
|
426
426
|
if (freeW || nextW) parts.push(cap1([freeW, nextW].filter(Boolean).join('; ')) + '.');
|
|
427
427
|
const suggest = [];
|
|
428
428
|
const old = (L.rows || []).filter((r) => !r.done && r.type === 'Check' && !r.kept && (r.carried || 0) > OLD_CHECK_DAYS);
|
|
429
|
-
if ((L.old || []).length) suggest.push({ key: 'old-tasks', text: plural(L.old.length, 'old task has', 'old tasks have') + ' passed dates by more than ' + OLD_TASK_DAYS + ' days, so they are not on Today. Clear them from Today', act: 'drop', keys: L.old
|
|
430
|
-
|
|
429
|
+
if ((L.old || []).length) suggest.push({ key: 'old-tasks', text: plural(L.old.length, 'old task has', 'old tasks have') + ' passed dates by more than ' + OLD_TASK_DAYS + ' days, so they are not on Today. Clear them from Today', act: 'drop', keys: L.old,
|
|
430
|
+
why: 'Their dates passed more than ' + OLD_TASK_DAYS + ' days ago. They stay in their work; only Today stops listing them.' });
|
|
431
|
+
if (old.length) suggest.push({ key: 'drop-old-checks', text: 'Drop the ' + plural(old.length, 'check', 'checks') + ' due more than ' + OLD_CHECK_DAYS + ' days ago', act: 'drop', keys: old.map((r) => r.key),
|
|
432
|
+
items: old.map((r) => r.title), why: 'Nobody kept them, and their dates passed more than ' + OLD_CHECK_DAYS + ' days ago. Dropping takes them off your log; their work keeps them.' });
|
|
431
433
|
const chips = TYPES.filter((t) => (L.types || {})[t]).map((t) => ({ type: t, n: L.types[t] }));
|
|
432
434
|
return { said: parts.join(' '), suggest, chips, refs, today: forToday };
|
|
433
435
|
}
|
|
@@ -145,4 +145,31 @@ button.td-ev:focus-visible { outline: none; box-shadow: var(--glow); }
|
|
|
145
145
|
.tdp-cwl { all: unset; box-sizing: border-box; width: 100%; display: flex; align-items: center; justify-content: space-between; min-height: 48px; font-size: var(--fs-body); color: var(--cz-ink); cursor: pointer; }
|
|
146
146
|
.tdp-cwl svg { color: var(--cz-ink3); }
|
|
147
147
|
.tdp :focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 2px; }
|
|
148
|
+
/* PhoneTodayDS (job 1540): the row's dot (Komorebi swatches pm-sw-*), "why" after the proposal, the All ⌄ pill, the capture box at the
|
|
149
|
+
foot and the proposal's sheet (the expanded Suggestion, pm-sug x). Tokens only. */
|
|
150
|
+
body.cz-today.hm-plist #hmDesk { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 96px); }
|
|
151
|
+
.tdp-dot { flex: none; width: var(--space-8); height: var(--space-8); margin: 9px 3px 0; border-radius: var(--radius-pill); }
|
|
152
|
+
.tdp-dot.alert { background: var(--alert); } .tdp-dot.blue { background: var(--blue); } .tdp-dot.muted { background: var(--line); }
|
|
153
|
+
.tdp-b svg { margin-top: 5px; color: var(--muted); }
|
|
154
|
+
.tdp-why { color: var(--muted); }
|
|
155
|
+
.tdp-f { border: 1px solid var(--line); border-radius: var(--radius-pill); padding: 0 var(--space-8) 0 var(--space-4); }
|
|
156
|
+
.tdp-f svg { right: var(--space-8); }
|
|
157
|
+
.tdp-f select { color: var(--ink); min-height: 32px; padding: 0 22px 0 var(--space-8); text-align: left; }
|
|
158
|
+
.tdp-none { padding: var(--space-16) 0; font-size: var(--fs-body); color: var(--muted); line-height: var(--lh-body); }
|
|
159
|
+
.tdp-cap { position: fixed; left: var(--space-12); right: var(--space-12); bottom: calc(env(safe-area-inset-bottom, 0px) + var(--space-12)); z-index: 30; display: flex; align-items: center; gap: var(--space-4); padding: var(--space-4) var(--space-4) var(--space-4) var(--space-16); border-radius: var(--radius-pill); background: var(--well); box-shadow: var(--raise); }
|
|
160
|
+
.tdp-in { flex: 1; min-width: 0; border: 0; background: none; font: inherit; font-size: var(--fs-field); color: var(--ink); padding: var(--space-8) 0; outline: none; }
|
|
161
|
+
.tdp-in::placeholder { color: var(--muted); }
|
|
162
|
+
.tdp-mic { flex: none; width: 40px; height: 40px; border: 0; border-radius: var(--radius-pill); background: none; color: var(--muted); display: inline-grid; place-items: center; padding: 0; cursor: pointer; }
|
|
163
|
+
.tdp-mic[aria-pressed="true"] { color: var(--alert); }
|
|
164
|
+
.tdp-go { flex: none; width: 40px; height: 40px; padding: 0; border-radius: var(--radius-pill); display: inline-grid; place-items: center; }
|
|
165
|
+
body.tdp-sheeton { overflow: hidden; }
|
|
166
|
+
.tdp-sheet { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; justify-content: flex-end; }
|
|
167
|
+
.tdp-scrim { position: absolute; inset: 0; border: 0; padding: 0; background: var(--ink); opacity: .32; cursor: default; }
|
|
168
|
+
.tdp-sh { position: relative; display: flex; flex-direction: column; gap: var(--space-8); padding: var(--space-8) var(--space-16) calc(env(safe-area-inset-bottom, 0px) + var(--space-16)); border-radius: var(--radius-panel) var(--radius-panel) 0 0; background: var(--card); box-shadow: var(--lift); }
|
|
169
|
+
.tdp-grab { align-self: center; width: 36px; height: var(--space-4); border-radius: var(--radius-pill); background: var(--line); }
|
|
170
|
+
.tdp-sh .pm-sug.x { font-size: var(--fs-body); }
|
|
171
|
+
.tdp-sh .pm-sug.x dl { display: flex; flex-direction: column; gap: var(--space-4); }
|
|
172
|
+
.tdp-sh .pm-sug.x dt { margin-top: var(--space-8); font-size: var(--fs-label); }
|
|
173
|
+
.tdp-sh .pm-sug.x .ans { gap: var(--space-12); }
|
|
174
|
+
.tdp-sh .pm-sug.x .ans .pm-btn { width: 44px; height: 44px; padding: 0; border-radius: var(--radius-pill); display: inline-grid; place-items: center; }
|
|
148
175
|
}
|
|
@@ -35,7 +35,6 @@ const TI = {
|
|
|
35
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
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
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']);
|
|
38
|
-
const BULLET = { task: ['•', 'Task'], event: ['○', 'Event'], note: ['–', 'Note'], lab: ['✦', 'PMOS suggests'] };
|
|
39
38
|
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
39
|
const plural = (n, a, b) => n + ' ' + (n === 1 ? a : b);
|
|
41
40
|
/** A Suggestion (pm-sug): ✦, one sentence, ✓ primary and ✕ outline. */
|
|
@@ -104,7 +103,6 @@ export function overviewHtml(O) {
|
|
|
104
103
|
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
104
|
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>`;
|
|
106
105
|
}
|
|
107
|
-
const PLURAL = { Ask: 'Asks', Decision: 'Decisions', Check: 'Checks', Milestone: 'Milestones', Task: 'Tasks', Report: 'Reports', Note: 'Notes' }; // the phone's type filter
|
|
108
106
|
/** The jobs the log's Tabs filter by, in order. */
|
|
109
107
|
export const JOBS = [['Reply', 'reply'], ['Do', 'do'], ['Decide', 'decide'], ['Send', 'send']];
|
|
110
108
|
|
|
@@ -198,7 +196,7 @@ export function pageHtml(L, A, o = {}) {
|
|
|
198
196
|
* (pm/cozy-phone-swipe.js): right does or accepts, left drops or puts off, and the toast says what happened with Undo. A row rests flat.
|
|
199
197
|
* Pure: Node imports it (today-log.test.js). */
|
|
200
198
|
export const SWIPE_HINT = 'Swipe any row: right to do or accept, left to drop or put off.';
|
|
201
|
-
const PI = { undo: 'M9 14L4 9l5-5M4 9h11a5 5 0 0 1 0 10h-3', chev: 'M9 6l6 6-6 6', down: 'M7 10l5 5 5-5', spark: 'M12 3l1.8 5.4L19 10.2l-5.2 1.8L12 17.4l-1.8-5.4L5 10.2l5.2-1.8z' };
|
|
199
|
+
const PI = { mic: 'M12 3a3 3 0 0 0-3 3v6a3 3 0 0 0 6 0V6a3 3 0 0 0-3-3zM5 11a7 7 0 0 0 14 0M12 18v3', up: 'M12 19V5M6 11l6-6 6 6', undo: 'M9 14L4 9l5-5M4 9h11a5 5 0 0 1 0 10h-3', chev: 'M9 6l6 6-6 6', down: 'M7 10l5 5 5-5', spark: 'M12 3l1.8 5.4L19 10.2l-5.2 1.8L12 17.4l-1.8-5.4L5 10.2l5.2-1.8z' };
|
|
202
200
|
/** What a swipe does on a row: { right, left } acts of the click handler ('done', 'tomorrow', 'lab-keep', …), '' when that way does nothing. */
|
|
203
201
|
export function swipeActs(r) {
|
|
204
202
|
if (!r || r.done || r.src === 'note' || r.src === 'gone') return { right: '', left: '' };
|
|
@@ -218,52 +216,120 @@ export function nextEvent(A, now = Date.now()) {
|
|
|
218
216
|
}
|
|
219
217
|
const durPhone = (min) => { const h = Math.floor(min / 60), m = min % 60; return h ? (m >= 30 ? h + '.5 h' : h + ' h') : m + ' min'; };
|
|
220
218
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
219
|
+
/* PhoneTodayDS (Exploring 3, page "phone"; agreed 2026-11-22, job #1540): the job a row asks of you, with its small icon, and its dot:
|
|
220
|
+
* late in the alert colour, a line for today blue, the rest muted. The system's colour tokens (--alert, --blue, --muted), no page colour. */
|
|
221
|
+
const JOB_IC = { Reply: I.reply, Decide: I.decide, Send: I.send, Do: TI.Task };
|
|
222
|
+
/** The dot of a phone row: 'alert' when it is late, 'blue' when it is first or waits today, 'muted' for the rest. */
|
|
223
|
+
export function rowDot(r, o = {}) {
|
|
224
|
+
if (!r || r.done) return 'muted';
|
|
225
|
+
if (r.late) return 'alert';
|
|
226
|
+
return o.wait ? 'muted' : 'blue';
|
|
227
|
+
}
|
|
228
|
+
/** PMOS's fix line under a row: the one thing PMOS proposes on it, '' when it proposes nothing (zero is silence). */
|
|
229
|
+
export function fixLine(r) {
|
|
230
|
+
if (!r || r.done) return '';
|
|
231
|
+
if (r.drop) return 'Drop it from your log: it has waited ' + plural(r.carried || 0, 'day', 'days') + '.';
|
|
232
|
+
if (r.looks) return 'Looks answered: ' + (r.looks.who ? r.looks.who + ' replied' : 'someone replied') + ' “' + r.looks.text + '”. Close it?';
|
|
233
|
+
if (r.members && r.drafts) return 'PMOS drafts them for you to read.';
|
|
234
|
+
if (r.src === 'lab' && r.why) return r.why;
|
|
235
|
+
return '';
|
|
236
|
+
}
|
|
237
|
+
/** One row of the phone's log (PhoneTodayDS): a dot, the title, then the job with its icon and the work (and the late word); PMOS's fix
|
|
238
|
+
* line under it when PMOS proposes something. o.wait: the row is in Can wait. */
|
|
239
|
+
export function phoneRowHtml(r, o = {}) {
|
|
224
240
|
const sw = swipeActs(r);
|
|
225
241
|
const opens = !r.done && r.src !== 'own' && r.src !== 'gone' && r.src !== 'note';
|
|
226
242
|
const title = opens ? `<button type="button" class="tdp-t" data-td="open" data-key="${esc(r.key)}">${esc(r.title)}</button>` : `<span class="tdp-t">${esc(r.title)}</span>`;
|
|
227
|
-
const
|
|
228
|
-
|
|
229
|
-
const
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
243
|
+
const jb = r.job || (r.bullet === 'event' ? 'Event' : r.bullet === 'note' || r.src === 'note' ? 'Note' : '');
|
|
244
|
+
const late = lateOf(r);
|
|
245
|
+
const meta = [jb ? `${svg(JOB_IC[jb] || (jb === 'Event' ? KIND.event[0] : TI.Note), 13, 1.8)}<span>${esc(jb)}</span>` : '', r.work ? esc(r.work) : '',
|
|
246
|
+
late ? `<em>${esc(late)}</em>` : r.when && !r.done ? esc(r.when) : ''].filter(Boolean).join('<i aria-hidden="true">·</i>');
|
|
247
|
+
const fx = fixLine(r);
|
|
248
|
+
const fix = fx ? `<span class="tdp-pro">${svg(PI.spark, 13, 1.9)}<span>${esc(fx)}</span></span>` : '';
|
|
249
|
+
const dot = rowDot(r, o), dl = r.done ? 'Done' : dot === 'alert' ? 'Late' : dot === 'blue' ? 'For today' : 'Can wait';
|
|
234
250
|
const say = sw.right ? ` aria-describedby="tdpHint"` : '';
|
|
235
251
|
return `<li class="tdp-r${r.done ? ' done' : ''}${r.first && !r.done ? ' first' : ''}" data-key="${esc(r.key)}"${sw.right ? ` data-sw-right="${sw.right}"` : ''}${sw.left ? ` data-sw-left="${sw.left}"` : ''}${say}>`
|
|
236
|
-
+ `<
|
|
252
|
+
+ (r.done ? `<span class="tdp-b" role="img" aria-label="Done">${svg(I.done, 13, 2)}</span>` : `<i class="tdp-dot ${dot}" role="img" aria-label="${dl}"></i>`)
|
|
253
|
+
+ `<div class="tdp-x">${title}${meta ? `<small class="tdp-m">${meta}</small>` : ''}${fix}</div></li>`;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/** Where it stands on a phone (PhoneTodayDS): the cause, not counts. The lead line and why it leads, then how many dates are late and
|
|
257
|
+
* how many of them PMOS has a fix for, then the free time or the next meeting. '' on a day with nothing open. L: logModel(), O: overviewModel(),
|
|
258
|
+
* A: agendaModel(). PURE. */
|
|
259
|
+
export function phoneStands(L, O = {}, A = {}) {
|
|
260
|
+
const open = [...(L.first || []), ...(L.todayRows || [])].filter((r) => r && !r.done && r.src !== 'note');
|
|
261
|
+
if (!open.length) return '';
|
|
262
|
+
const lead = open.find((r) => r.late) || open[0];
|
|
263
|
+
// why it leads, said once: a reason the title already says ("Weekly update is ready to send" · "Ready to send") is not said again
|
|
264
|
+
const reason = String(lead.reason || '').trim(), inTitle = reason && lead.title.toLowerCase().indexOf(reason.toLowerCase()) >= 0;
|
|
265
|
+
const why = lateOf(lead) ? 'is ' + lateOf(lead) : lead.type === 'Ask' && lead.who && lead.who.length ? 'waits on your answer to ' + lead.who.join(' and ')
|
|
266
|
+
: reason && !inTitle ? reason.replace(/^(Late|Due|Goes|You|A)\b/, (w) => w.toLowerCase()) : lead.job && !inTitle ? 'waits on you to ' + lead.job.toLowerCase() + ' it' : '';
|
|
267
|
+
const parts = [clipT(lead.title, 60) + (lead.work && lead.title.indexOf(lead.work) < 0 ? ' (' + lead.work + ')' : '') + (why ? ' ' + why : '') + '.'];
|
|
268
|
+
if (!why) parts[0] = 'First: ' + parts[0];
|
|
269
|
+
const late = open.filter((r) => r.late && r !== lead), fixes = open.filter((r) => r.late && fixLine(r)).length;
|
|
270
|
+
if (late.length) parts.push(cap(plural(late.length, 'other date is', 'other dates are')) + ' late' + (fixes ? '; PMOS has a fix for ' + (fixes === late.length + (lead.late ? 1 : 0) ? (fixes === 1 ? 'it' : fixes === 2 ? 'both' : 'all ' + fixes) : fixes) : '') + '.');
|
|
271
|
+
const free = A && A.free ? 'You have ' + durPhone(A.free) + ' free' : '';
|
|
272
|
+
const next = A && A.next ? (A.nextFirst ? 'your first meeting is at ' : 'your next meeting is at ') + A.next : '';
|
|
273
|
+
if (free || next) parts.push(cap([free, next].filter(Boolean).join('; ')) + '.');
|
|
274
|
+
return parts.join(' ');
|
|
237
275
|
}
|
|
276
|
+
const clipT = (s, n) => { const t = String(s || '').replace(/\s+/g, ' ').trim(); return t.length > n ? t.slice(0, n - 1).trimEnd() + '…' : t; };
|
|
238
277
|
|
|
239
|
-
/**
|
|
278
|
+
/** The ✦ proposal opened as a sheet (PhoneTodayDS: "tap opens the expanded Suggestion"): the Komorebi expanded Suggestion (pm-sug x)
|
|
279
|
+
* with what changes, why, and Yes or No. sg: overviewModel().suggest[i]. '' with none. */
|
|
280
|
+
export function phoneSheetHtml(sg) {
|
|
281
|
+
if (!sg) return '';
|
|
282
|
+
const items = (sg.items || []).slice(0, 5);
|
|
283
|
+
const more = (sg.keys || []).length - items.length;
|
|
284
|
+
const what = items.length ? `<dt>What changes</dt><dd><ul>${items.map((t) => `<li>${esc(t)}</li>`).join('')}${more > 0 ? `<li>${esc(plural(more, 'more line', 'more lines'))}</li>` : ''}</ul></dd>` : '';
|
|
285
|
+
return `<div class="tdp-sheet" role="dialog" aria-modal="true" aria-label="PMOS suggests"><button type="button" class="tdp-scrim" data-td="sheet-x" aria-label="Close"></button>`
|
|
286
|
+
+ `<div class="tdp-sh"><i class="tdp-grab" aria-hidden="true"></i><div class="pm-sug x"><div class="ttl">${ic(I.spark, 16, 'pm-star')}<span>${esc(sg.text)}</span></div>`
|
|
287
|
+
+ `<dl>${what}${sg.why ? `<dt>Why</dt><dd>${esc(sg.why)}</dd>` : ''}</dl>`
|
|
288
|
+
+ `<div class="ans">${ib('ov-no', 'No, keep them', I.no, sg.key, '', 'outline')}${ib('ov-yes', 'Yes: ' + sg.text, I.yes, sg.key, '', 'primary')}</div></div></div></div>`;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/** The capture box at the foot of Today on a phone (PhoneTodayDS): type a line, or speak where the browser can. The same form as the
|
|
292
|
+
* desk's (#tdCapF, #tdCap), so the same press adds the line. o: { draft, mic } */
|
|
293
|
+
export function phoneCapHtml(o = {}) {
|
|
294
|
+
return `<form class="tdp-cap" id="tdCapF" autocomplete="off"><label class="td-vh" for="tdCap">Log a task, an event or a note</label>`
|
|
295
|
+
+ `<input id="tdCap" class="tdp-in" name="line" type="text" maxlength="240" enterkeyhint="send" placeholder="Log a task, an event or a note" value="${esc(o.draft || '')}" title="Start with o for an event, a dash for a note, ! for first" />`
|
|
296
|
+
+ (o.mic ? `<button type="button" class="tdp-mic" data-td="cap-mic" aria-label="Speak a line" title="Speak">${svg(PI.mic, 18, 1.8)}</button>` : '')
|
|
297
|
+
+ `<button type="submit" class="tdp-go pm-btn primary" aria-label="Log it" title="Log it">${svg(PI.up, 18, 2)}</button></form>`;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/** Today on a phone (PhoneTodayDS). L: logModel(), A: agendaModel(), O: overviewModel();
|
|
301
|
+
* o: { head, job, open, sopen, filed: { title, sub, id } | null, now, draft, mic } */
|
|
240
302
|
export function phonePageHtml(L, A, O, o = {}) {
|
|
241
303
|
const H = o.head ? `<header class="tdp-top"><span class="td-when">${esc(o.head.when)}</span><h1>${esc(o.head.hello)}</h1></header>` : '';
|
|
242
304
|
const filed = o.filed ? `<section class="tdp-filed" aria-label="The meeting you recorded"><div><b>${esc('Recording filed under ' + o.filed.title)}</b>${o.filed.sub ? `<small>${esc(o.filed.sub)}</small>` : ''}</div>`
|
|
243
305
|
+ `<button type="button" class="tdp-ib pm-btn outline" data-td="filed-undo" data-key="${esc(o.filed.id)}" aria-label="${esc('Undo: take the recording out of ' + o.filed.title)}" title="Undo">${svg(PI.undo, 18, 1.8)}</button></section>` : '';
|
|
244
|
-
const
|
|
306
|
+
const job = o.job || '';
|
|
307
|
+
const pick = (rows) => (job ? (rows || []).filter((r) => r.job === job) : rows || []);
|
|
308
|
+
const all = [...(L.first || []), ...(L.todayRows || [])];
|
|
245
309
|
const shown = pick(L.first).concat(pick(L.todayRows));
|
|
246
310
|
const wait = pick(L.wait);
|
|
247
311
|
const sg = O && O.suggest && O.suggest[0];
|
|
248
312
|
const anySwipe = !!sg || shown.some((r) => swipeActs(r).right);
|
|
249
|
-
//
|
|
250
|
-
const zero = !
|
|
313
|
+
// Where it stands: the cause, at most one ✦ proposal (its "why" opens the sheet), and the hint once there is something to swipe
|
|
314
|
+
const zero = !all.length;
|
|
315
|
+
const said = zero ? '' : phoneStands(L, O, A);
|
|
251
316
|
const ov = zero
|
|
252
317
|
? `<p class="tdp-zero">${esc(o.quiet || 'Nothing is open for today.')}</p>`
|
|
253
|
-
: `<section class="tdp-ov" aria-label="
|
|
254
|
-
+ (sg ? `<ul class="tdp-sgl"><li class="tdp-sg" data-key="${esc(sg.key)}" data-sw-right="ov-yes" data-sw-left="ov-no" aria-describedby="tdpHint"><button type="button" class="tdp-sgt" data-td="ov-open" data-key="${esc(sg.key)}">${svg(PI.spark, 13, 1.9)}<span>${esc(sg.text)}</span></button></li></ul>` : '')
|
|
318
|
+
: `<section class="tdp-ov" aria-label="Where it stands"><h2>${svg(PI.spark, 15, 1.9)}<span>Where it stands</span></h2>${said ? `<p>${esc(said)}</p>` : ''}`
|
|
319
|
+
+ (sg ? `<ul class="tdp-sgl"><li class="tdp-sg" data-key="${esc(sg.key)}" data-sw-right="ov-yes" data-sw-left="ov-no" aria-describedby="tdpHint"><button type="button" class="tdp-sgt" data-td="ov-open" data-key="${esc(sg.key)}" aria-haspopup="dialog">${svg(PI.spark, 13, 1.9)}<span>${esc(sg.text)}<span class="tdp-why"> · why</span></span></button></li></ul>` : '')
|
|
255
320
|
+ (anySwipe ? `<p class="tdp-hint" id="tdpHint">${esc(SWIPE_HINT)}</p>` : '') + '</section>';
|
|
256
321
|
// the next event, with ● Record (a meeting records; with no event, Record starts a recording of its own)
|
|
257
322
|
const N = nextEvent(A, o.now);
|
|
258
323
|
const ev = `<section class="tdp-ev" aria-label="Next event"><button type="button" class="tdp-evt"${N.key && !N.own ? ` data-td="ev" data-key="${esc(N.key)}"` : ' tabindex="-1" disabled'}><b>${esc(N.title)}</b>${N.sub ? `<small>${esc(N.sub)}</small>` : ''}</button>`
|
|
259
324
|
+ `<button type="button" class="tdp-rec" data-td="${N.play ? 'rec-ev' : 'rec'}" data-key="${esc(N.key)}" aria-label="${esc(N.play ? 'Record ' + N.title : 'Record a meeting')}"><i aria-hidden="true"></i>Record</button></section>`;
|
|
260
|
-
// the log: its count and the
|
|
261
|
-
const
|
|
262
|
-
const
|
|
263
|
-
const filter =
|
|
264
|
-
+
|
|
265
|
-
const log = zero ? '' : `<section class="tdp-log" aria-label="Today’s log"><div class="tdp-lh"><h2>Today’s log · ${esc(
|
|
266
|
-
+ `<ul class="tdp-rows">${shown.map((r) => phoneRowHtml(r) + (r.members && (o.sopen || []).includes(r.key) ? r.members.map((m) => phoneRowHtml(m)).join('') : '')).join('')}</ul
|
|
325
|
+
// the log: its count and the job filter (All ⌄: Reply, Do, Decide, Send; a job with no line is left out), then the rows
|
|
326
|
+
const c = L.counts || {};
|
|
327
|
+
const jobs = JOBS.filter(([, k]) => c[k]);
|
|
328
|
+
const filter = jobs.length ? `<label class="tdp-f"><span class="td-vh">Show</span><select data-td-job aria-label="Show one job"><option value=""${job ? '' : ' selected'}>All</option>`
|
|
329
|
+
+ jobs.map(([j, k]) => `<option value="${esc(j)}"${job === j ? ' selected' : ''}>${esc(j + ' ' + c[k])}</option>`).join('') + `</select>${svg(PI.down, 14)}</label>` : '';
|
|
330
|
+
const log = zero ? '' : `<section class="tdp-log" aria-label="Today’s log"><div class="tdp-lh"><h2>Today’s log · ${esc(job ? shown.length : L.open || shown.length)}</h2>${filter}</div>`
|
|
331
|
+
+ (shown.length ? `<ul class="tdp-rows">${shown.map((r) => phoneRowHtml(r) + (r.members && (o.sopen || []).includes(r.key) ? r.members.map((m) => phoneRowHtml(m)).join('') : '')).join('')}</ul>`
|
|
332
|
+
: `<p class="tdp-none">${esc('Nothing to ' + job.toLowerCase() + ' today.')}</p>`) + '</section>';
|
|
267
333
|
// Can wait: one line, folded; a zero day says it as its own short section (Ph2_todayzero)
|
|
268
334
|
let cw = '';
|
|
269
335
|
if (wait.length) {
|
|
@@ -271,9 +337,10 @@ export function phonePageHtml(L, A, O, o = {}) {
|
|
|
271
337
|
const old = oldest ? 'the oldest waits ' + oldest + (oldest === 1 ? ' day' : ' days') : '';
|
|
272
338
|
if (zero) cw = `<section class="tdp-cw0" aria-label="Can wait"><h2>Can wait <em>${esc(wait.length)}</em></h2><button type="button" class="tdp-cwl" data-td="fold" aria-expanded="${!!o.open}"><span>${esc(old ? cap(old) : plural3(wait.length))}</span>${svg(o.open ? PI.down : PI.chev, 16)}</button></section>`;
|
|
273
339
|
else cw = `<button type="button" class="tdp-cw" data-td="fold" aria-expanded="${!!o.open}"><b>Can wait</b><span>${esc(wait.length + ' more' + (old ? ' · ' + old : ''))}</span>${svg(PI.down, 14)}</button>`;
|
|
274
|
-
if (o.open) cw += `<ul class="tdp-rows tdp-waitl">${wait.map((r) => phoneRowHtml(r)).join('')}</ul>`;
|
|
340
|
+
if (o.open) cw += `<ul class="tdp-rows tdp-waitl">${wait.map((r) => phoneRowHtml(r, { wait: true })).join('')}</ul>`;
|
|
275
341
|
}
|
|
276
|
-
|
|
342
|
+
const sheet = o.sheet && sg && o.sheet === sg.key ? phoneSheetHtml(sg) : '';
|
|
343
|
+
return `${H}${filed}${ov}${ev}${log}${cw}${phoneCapHtml(o)}${sheet}`;
|
|
277
344
|
}
|
|
278
345
|
const cap = (s) => s.charAt(0).toUpperCase() + s.slice(1);
|
|
279
346
|
const plural3 = (n) => n + (n === 1 ? ' line' : ' lines');
|
|
@@ -949,7 +949,7 @@ function drawAsk() {
|
|
|
949
949
|
}
|
|
950
950
|
el.hidden = false;
|
|
951
951
|
const R = sessionRows(S.D.sessions || [], { titleOf: (id) => (iniRowOf(id) ? iniTitle(id) : ''), now: NOW() });
|
|
952
|
-
const h = askHtml(askGroups(R.all, S.D.sessions || [], { titleOf: (id) => (iniRowOf(id) ? iniTitle(id) : ''), now: NOW() }), { ready: S.ready });
|
|
952
|
+
const h = askHtml(askGroups(R.all, S.D.sessions || [], { titleOf: (id) => (iniRowOf(id) ? iniTitle(id) : ''), productOf: (id) => (H.boardRows(S.D).some((r) => r.id === id) && H.productName(S.D) !== 'This product' ? H.productName(S.D) : ''), now: NOW() }), { ready: S.ready });
|
|
953
953
|
if (el.__h !== h) { el.__h = h; el.innerHTML = h; }
|
|
954
954
|
}
|
|
955
955
|
/* A phone chat has no floating menu, so while a meeting records its pill sits in the top bar (XcbOptions B, case 7): a red dot and the
|