create-pmos 0.397.0 → 0.399.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.
Files changed (195) hide show
  1. package/package.json +25 -25
  2. package/payload/KIT-VERSION +2 -2
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/payload/state/log.md +1 -1
  7. package/workspace/briefing-premium-adddoc-test.js +105 -52
  8. package/workspace/briefing-premium-board-test.js +284 -128
  9. package/workspace/briefing-premium-calendar-2-test.js +135 -198
  10. package/workspace/briefing-premium-calendar-3-test.js +143 -418
  11. package/workspace/briefing-premium-calendar-test.js +85 -196
  12. package/workspace/briefing-premium-doc-edit-test.js +99 -83
  13. package/workspace/briefing-premium-initiative-test.js +175 -290
  14. package/workspace/briefing-premium-insights-test.js +414 -219
  15. package/workspace/briefing-premium-metrics-test.js +55 -97
  16. package/workspace/briefing-premium-products-test.js +44 -28
  17. package/workspace/briefing-premium-sources-test.js +70 -49
  18. package/workspace/briefing-premium-test.js +155 -648
  19. package/workspace/briefing-premium-work-test.js +88 -283
  20. package/workspace/changelog.json +24 -0
  21. package/workspace/ev-everywhere-test.js +210 -0
  22. package/workspace/fixtures/board-premium-trail.js +32 -0
  23. package/workspace/fixtures/premium-viewer-fixtures.js +187 -0
  24. package/workspace/guide/briefing-premium.md +3 -1
  25. package/workspace/guide/home.md +68 -0
  26. package/workspace/guide/index.md +1 -0
  27. package/workspace/lib/agent-roles.js +71 -0
  28. package/workspace/lib/board-grill.js +63 -0
  29. package/workspace/lib/board-premium.js +121 -24
  30. package/workspace/lib/board-trail.js +223 -0
  31. package/workspace/lib/home-work-item.js +58 -0
  32. package/workspace/lib/initiative-layout.js +77 -0
  33. package/workspace/lib/insights-goals.js +196 -0
  34. package/workspace/lib/insights-premium.js +64 -15
  35. package/workspace/lib/insights-records.js +115 -0
  36. package/workspace/lib/jira-tickets.js +1 -1
  37. package/workspace/lib/meeting-points.js +52 -0
  38. package/workspace/lib/news-for-you.js +88 -0
  39. package/workspace/lib/notes-series.js +29 -6
  40. package/workspace/lib/report-confirm.js +48 -0
  41. package/workspace/lib/route-modules.js +12 -0
  42. package/workspace/lib/routes-board-docs.js +46 -0
  43. package/workspace/lib/routes-board-grill.js +90 -0
  44. package/workspace/lib/routes-board-trail.js +33 -0
  45. package/workspace/lib/routes-home-desk.js +176 -0
  46. package/workspace/lib/routes-home-review.js +108 -0
  47. package/workspace/lib/routes-initiative-layout.js +57 -0
  48. package/workspace/lib/routes-insights-premium.js +16 -4
  49. package/workspace/lib/routes-insights-records.js +133 -0
  50. package/workspace/lib/routes-meeting-points.js +37 -0
  51. package/workspace/lib/routes-news.js +57 -0
  52. package/workspace/lib/routes-notes.js +3 -1
  53. package/workspace/lib/routes-report-confirm.js +31 -0
  54. package/workspace/lib/routes-search.js +38 -0
  55. package/workspace/lib/routes-viewer.js +108 -0
  56. package/workspace/lib/search-index.js +176 -0
  57. package/workspace/lib/transcript-steps.js +123 -0
  58. package/workspace/lib/viewer-meeting.js +205 -0
  59. package/workspace/lib/viewer-report.js +89 -0
  60. package/workspace/package-lock.json +2 -2
  61. package/workspace/package.json +1 -1
  62. package/workspace/premium-board-actions-test.js +128 -82
  63. package/workspace/premium-briefing-depth-test.js +104 -90
  64. package/workspace/premium-chat-attach-test.js +54 -63
  65. package/workspace/premium-chat-chart-tab-test.js +37 -37
  66. package/workspace/premium-chat-context-test.js +19 -18
  67. package/workspace/premium-chat-goal-view-test.js +23 -23
  68. package/workspace/premium-chat-notes-test.js +26 -31
  69. package/workspace/premium-chat-report-tab-test.js +46 -28
  70. package/workspace/premium-chat-term-test.js +16 -16
  71. package/workspace/premium-chat-viewer-test.js +60 -59
  72. package/workspace/premium-core-doc-issue-test.js +52 -43
  73. package/workspace/premium-html-viewer-test.js +14 -17
  74. package/workspace/premium-phone-card-test.js +10 -3
  75. package/workspace/premium-phone-room-test.js +41 -35
  76. package/workspace/premium-report-read-test.js +152 -197
  77. package/workspace/premium-viewer-download-test.js +19 -22
  78. package/workspace/premium-viewer-flicker-test.js +11 -16
  79. package/workspace/premium-viewer-share-test.js +6 -9
  80. package/workspace/premium-viewer-test.js +41 -60
  81. package/workspace/premium-vw-backlog-test.js +53 -33
  82. package/workspace/premium-vw-cal-test.js +97 -128
  83. package/workspace/premium-vw-copy-test.js +17 -33
  84. package/workspace/premium-vw-doc-test.js +17 -10
  85. package/workspace/premium-vw-item-test.js +50 -49
  86. package/workspace/premium-vw-jira-test.js +53 -27
  87. package/workspace/premium-vw-meet-test.js +115 -187
  88. package/workspace/premium-vw-notes-test.js +88 -109
  89. package/workspace/premium-vw-rec-test.js +71 -194
  90. package/workspace/premium-vw-slides-test.js +46 -50
  91. package/workspace/premium-welcome-test.js +3 -2
  92. package/workspace/premium-work-depth-test.js +61 -53
  93. package/workspace/public/pm/bd-acts.js +383 -0
  94. package/workspace/public/pm/bd-asks.js +261 -0
  95. package/workspace/public/pm/bd-pop.js +59 -0
  96. package/workspace/public/pm/bd-span.js +222 -82
  97. package/workspace/public/pm/bd-stages.js +25 -11
  98. package/workspace/public/pm/bd-views.js +169 -0
  99. package/workspace/public/pm/c3-doc-sheet.js +1 -1
  100. package/workspace/public/pm/c3-md.js +3 -395
  101. package/workspace/public/pm/c3-phone-detail.js +1 -1
  102. package/workspace/public/pm/c3-phone-model.js +3 -68
  103. package/workspace/public/pm/chat-term.js +3 -3
  104. package/workspace/public/pm/cozy-board.css +798 -230
  105. package/workspace/public/pm/cozy-ev.css +228 -0
  106. package/workspace/public/pm/cozy-evmodel.js +106 -0
  107. package/workspace/public/pm/cozy-evui.js +47 -0
  108. package/workspace/public/pm/cozy-home.css +570 -142
  109. package/workspace/public/pm/cozy-home.js +5 -3
  110. package/workspace/public/pm/cozy-insights.css +437 -170
  111. package/workspace/public/pm/cozy-md.js +396 -0
  112. package/workspace/public/pm/cozy-nav.js +104 -29
  113. package/workspace/public/pm/cozy-news.js +140 -0
  114. package/workspace/public/pm/cozy-placeholder.js +26 -0
  115. package/workspace/public/pm/cozy-search.js +203 -0
  116. package/workspace/public/pm/cozy-settings.js +198 -0
  117. package/workspace/public/pm/cozy-sources.js +89 -0
  118. package/workspace/public/pm/cozy-today.css +217 -0
  119. package/workspace/public/pm/cozy-viewer.css +3 -3
  120. package/workspace/public/pm/cozy-viewer.js +145 -0
  121. package/workspace/public/pm/cozy-vw-mtg.css +350 -0
  122. package/workspace/public/pm/cozy-vw-rp.css +152 -0
  123. package/workspace/public/pm/cozy-vw.css +485 -0
  124. package/workspace/public/pm/cozy.css +83 -1
  125. package/workspace/public/pm/home-adddoc.js +48 -0
  126. package/workspace/public/pm/home-app.js +1179 -0
  127. package/workspace/public/pm/home-around.js +413 -0
  128. package/workspace/public/pm/home-chat.js +512 -0
  129. package/workspace/public/pm/home-data.js +312 -0
  130. package/workspace/public/pm/home-dictate.js +54 -0
  131. package/workspace/public/pm/home-draft.js +68 -0
  132. package/workspace/public/pm/home-ini-model.js +190 -0
  133. package/workspace/public/pm/home-ini.css +171 -0
  134. package/workspace/public/pm/home-ini.js +456 -0
  135. package/workspace/public/pm/home-list.js +276 -0
  136. package/workspace/public/pm/home-more.js +132 -0
  137. package/workspace/public/pm/home-phone-card.js +109 -0
  138. package/workspace/public/pm/home-review.js +104 -0
  139. package/workspace/public/pm/home-task.js +67 -0
  140. package/workspace/public/pm/home-today.js +144 -0
  141. package/workspace/public/pm/home-work.js +547 -0
  142. package/workspace/public/pm/phone-moment.js +69 -0
  143. package/workspace/public/pm/pm-work-view.js +1 -1
  144. package/workspace/public/pm/premium-attach.js +4 -0
  145. package/workspace/public/pm/premium-board.js +548 -395
  146. package/workspace/public/pm/premium-chart-tab.js +109 -62
  147. package/workspace/public/pm/premium-deck.js +3 -3
  148. package/workspace/public/pm/premium-first.js +23 -21
  149. package/workspace/public/pm/premium-insights.js +1102 -581
  150. package/workspace/public/pm/premium-meeting.js +61 -549
  151. package/workspace/public/pm/premium-mtg-present.js +138 -0
  152. package/workspace/public/pm/premium-mtg-replay.js +142 -0
  153. package/workspace/public/pm/premium-notes.js +1 -1
  154. package/workspace/public/pm/premium-report-frame.css +20 -0
  155. package/workspace/public/pm/premium-report-read.js +669 -476
  156. package/workspace/public/pm/premium-report-tab.js +116 -67
  157. package/workspace/public/pm/premium-shell.js +76 -123
  158. package/workspace/public/pm/premium-viewer.js +22 -1
  159. package/workspace/public/pm/premium-vw-cal.js +277 -48
  160. package/workspace/public/pm/premium-vw-doc.css +6 -0
  161. package/workspace/public/pm/premium-vw-doc.js +40 -2
  162. package/workspace/public/pm/premium-vw-file.js +2 -2
  163. package/workspace/public/pm/premium-vw-meet.js +6 -83
  164. package/workspace/public/pm/premium-vw-mtg.js +958 -0
  165. package/workspace/public/pm/premium-vw-notes.js +116 -68
  166. package/workspace/public/pm/premium-vw-open.js +35 -0
  167. package/workspace/public/pm/premium-vw-page.js +16 -0
  168. package/workspace/public/pm/premium-vw-rec.js +11 -218
  169. package/workspace/public/pm/premium-vw-slides.css +5 -0
  170. package/workspace/public/pm/premium-vw-slides.js +44 -8
  171. package/workspace/public/pm/rp-parts.js +269 -0
  172. package/workspace/public/pm/term-view.js +22 -0
  173. package/workspace/public/premium-board.html +29 -70
  174. package/workspace/public/premium-initiative.html +8 -48
  175. package/workspace/public/premium-insights.html +26 -64
  176. package/workspace/public/premium-viewer.html +20 -0
  177. package/workspace/public/premium.html +18 -107
  178. package/workspace/r/m1.png +0 -0
  179. package/workspace/r/m2.png +0 -0
  180. package/workspace/r/m3.png +0 -0
  181. package/workspace/r/nl.png +0 -0
  182. package/workspace/server.js +18 -3
  183. package/workspace/test-files.json +1 -0
  184. package/workspace/test-lists/home-libs.json +9 -0
  185. package/workspace/test-lists/initiative-layout.json +9 -0
  186. package/workspace/test-lists/premium-report-read.json +1 -1
  187. package/workspace/test-lists/premium-uncovered-meetings.json +9 -0
  188. package/workspace/test-lists/premium-uncovered-reports.json +9 -0
  189. package/workspace/test-lists/premium-vw-agreed.json +9 -0
  190. package/workspace/test-lists/premium-vw-notes.json +1 -1
  191. package/workspace/test-lists/uf-everywhere.json +15 -0
  192. package/workspace/test-lists/uf-home.json +9 -0
  193. package/workspace/test-lists/uncovered-board.json +9 -0
  194. package/workspace/public/pm/premium-work.js +0 -729
  195. package/workspace/public/pm/premium.js +0 -1146
@@ -0,0 +1,104 @@
1
+ /* pm/home-review.js — the weekly review in the Viewer (initiative premium-uncovered-features, H1; canvas HmReview).
2
+ *
3
+ * Four short steps, each one keeping what the PM decided: Sort what came in, Check what you wait on, Look at untouched work, Pick next
4
+ * week's three. The ladder shows the steps done and the one on now; the step on now opens as a card with its rows. A step is done with
5
+ * POST /api/home-review/step (its note: "4 sorted · 1 kept"); an untouched initiative that was looked at is kept with
6
+ * POST /api/home-review/keep. The rows' own presses are the routes My work already uses (/api/pm-items/*) and the lifecycle route for
7
+ * a hold (POST /api/lifecycle, with the reason on the record). Every write is the PM's press. "My work" beside "Weekly review" switches the
8
+ * Viewer to My work (home-work.js).
9
+ * h: { VW, pmPost, toast, D() (Home's data), reload() (reads Home again), ws(), iniTitle(id), askAbout(stale), openWork(), now() } */
10
+ import { esc, svg, P } from './home-today.js';
11
+ import { reviewModel, staleInis } from './home-list.js';
12
+
13
+ const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
14
+ const dayLabel = (iso) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); return m ? +m[3] + ' ' + MON[+m[2] - 1] : ''; };
15
+ const plural = (n, one, many) => n + ' ' + (n === 1 ? one : many);
16
+ /** The seg over My work and the weekly review: which of the two the Viewer shows. */
17
+ export const tabsHtml = (on) => `<div class="cz-seg ut-tabs" role="group" aria-label="Show"><button type="button" data-ut-tab="work" aria-pressed="${on === 'work'}">My work</button><button type="button" data-ut-tab="review" aria-pressed="${on === 'review'}">Weekly review</button></div>`;
18
+
19
+ export function openReview(h) {
20
+ const st = { done: {}, picked: new Set(), msg: '', busy: false };
21
+ const work = () => h.D().work || null;
22
+ const tab = (k) => (((work() && work().queue && work().queue.tabs) || []).find((t) => t.key === k) || { groups: [] }).groups.flatMap((g) => g.rows || []);
23
+ function stepBody(s, R) {
24
+ const D = h.D(), kept = R.kept || {};
25
+ if (s.key === 'sort') {
26
+ const rows = tab('inbox').concat(tab('tray'));
27
+ return (rows.slice(0, 8).map((r) => `<div class="ut-trow"><span><b>${esc(r.title)}</b>${r.sub ? ` <span class="ut-mut">· ${esc(r.sub)}</span>` : ''}</span>${st.done[r.key] ? `<span class="cz-pill ${st.done[r.key] === 'kept' ? 'q' : 'ok'}">${st.done[r.key] === 'kept' ? 'Kept' : 'In Today'}</span>` : `<button type="button" class="ut-btn sm soft" data-rv-today="${esc(r.id)}" data-k="${esc(r.key)}">Today</button><button type="button" class="ut-btn sm ghost" data-rv-keep="${esc(r.id)}" data-k="${esc(r.key)}">Keep</button>`}</div>`).join('')
28
+ || '<p class="ut-small ut-mut">Nothing came in that is not placed.</p>');
29
+ }
30
+ if (s.key === 'wait') {
31
+ const rows = (work() && work().waiting ? work().waiting.rows : []);
32
+ return rows.slice(0, 8).map((r) => `<div class="ut-trow"><span><b>${esc(r.title)}</b>${r.sub ? ` <span class="ut-mut">· ${esc(r.sub)}</span>` : ''}</span>${st.done[r.key] ? '<span class="cz-pill ok">Done</span>' : `<button type="button" class="ut-btn sm ghost" data-rv-done="${esc(r.id)}" data-k="${esc(r.key)}">It came in</button>`}</div>`).join('')
33
+ || '<p class="ut-small ut-mut">Nobody owes you anything.</p>';
34
+ }
35
+ if (s.key === 'untouched') {
36
+ const rows = staleInis(D, h.now());
37
+ const items = (work() && work().review && work().review.ids) || [];
38
+ const iRows = ((work() && work().rows) || []).filter((r, i, a) => items.includes(r.id) && a.findIndex((x) => x.id === r.id) === i);
39
+ const pill = (k) => (k.how === 'asked' ? '<span class="cz-pill">Asked in chat</span>' : k.how === 'held' ? '<span class="cz-pill q">On hold</span>' : '<span class="cz-pill ok">Kept going</span>');
40
+ return rows.slice(0, 8).map((r) => `<div class="ut-trow"><span><b>${esc(r.title)}</b> <span class="ut-mut">· ${esc([r.stage, plural(r.days, 'day', 'days')].filter(Boolean).join(' ') + (r.owner ? '' : ' · no owner'))}</span></span>`
41
+ + (kept[r.id] ? pill(kept[r.id]) : `<button type="button" class="ut-btn sm soft" data-rv-go="${esc(r.id)}">Keep going</button><button type="button" class="ut-btn sm ghost" data-rv-ask="${esc(r.id)}">Ask in chat</button>`) + '</div>').join('')
42
+ + iRows.slice(0, 6).map((r) => `<div class="ut-trow"><span><b>${esc(r.title)}</b> <span class="ut-mut">· ${esc(r.sub || 'your list')}</span></span>${st.done[r.key] ? '<span class="cz-pill ok">Done</span>' : `<button type="button" class="ut-btn sm ghost" data-rv-done="${esc(r.id)}" data-k="${esc(r.key)}">Done</button>`}</div>`).join('')
43
+ || '<p class="ut-small ut-mut">Nothing has sat untouched for 14 days.</p>';
44
+ }
45
+ const rows = tab('today').concat(tab('upcoming')).slice(0, 10);
46
+ return rows.map((r) => `<div class="ut-trow"><span><b>${esc(r.title)}</b>${r.sub ? ` <span class="ut-mut">· ${esc(r.sub)}</span>` : ''}</span><button type="button" class="cz-chip${st.picked.has(r.id) ? ' on' : ''}" data-rv-pick="${esc(r.id)}" aria-pressed="${st.picked.has(r.id)}"${!st.picked.has(r.id) && st.picked.size >= 3 ? ' disabled' : ''}>${st.picked.has(r.id) ? 'Picked' : 'Pick'}</button></div>`).join('')
47
+ + (rows.length ? `<p class="ut-small ut-mut">${st.picked.size} of 3 picked. Each one becomes P1 on your list.</p>` : '<p class="ut-small ut-mut">Your list has nothing for next week yet.</p>');
48
+ }
49
+ function noteOf(key) {
50
+ const vals = Object.values(st.done);
51
+ if (key === 'sort') { const k = vals.filter((x) => x === 'kept').length, t = vals.filter((x) => x === 'today').length; return t + k ? plural(t + k, 'sorted', 'sorted') + (k ? ' · ' + k + ' kept' : '') : 'Nothing to sort'; }
52
+ if (key === 'wait') { const d = vals.filter((x) => x === 'done').length; return d ? d + ' came in' : 'Checked'; }
53
+ if (key === 'untouched') { const R = reviewModel(h.D(), h.now()); return plural(Object.keys(R.kept || {}).length, 'looked at', 'looked at'); }
54
+ return st.picked.size ? st.picked.size + ' picked' : 'None picked';
55
+ }
56
+ const draw = (b) => {
57
+ const R = reviewModel(h.D(), h.now());
58
+ const steps = R.steps.map((s) => {
59
+ if (s.done) return `<div class="ut-step"><span class="ut-chk on">${svg(P.check, 12)}</span><b>${esc(s.label)}</b><span class="ut-small ut-mut">${esc(s.note)}</span></div>`;
60
+ if (s.now) return `<div class="ut-step now" role="group" aria-label="${esc(s.label)}, now"><div class="h"><span class="ut-chk"></span><b>${esc(s.label)}</b><span class="ut-small ut-bl"><b>Now</b></span></div>`
61
+ + `<div>${stepBody(s, R)}</div><div class="ut-acts"><button type="button" class="ut-btn sm pri" data-rv-step="${s.key}"${st.busy ? ' disabled' : ''}>Done with this step</button></div></div>`;
62
+ return `<div class="ut-step later"><span class="ut-chk"></span><b>${esc(s.label)}</b></div>`;
63
+ }).join('');
64
+ const last = R.last ? 'Last review: ' + dayLabel(R.last.week) + (R.last.minutes ? ' · ' + plural(R.last.minutes, 'minute', 'minutes') : '') : 'This is your first weekly review here.';
65
+ b.innerHTML = `<div class="ut-vc">${tabsHtml('review')}<div><h2 class="ut-h2">Weekly review · ${esc(R.label)}</h2><p class="ut-sub">${R.done ? 'Done for this week. Each step kept what you decided.' : 'Four short steps. Each one keeps what you decided.'}</p></div>`
66
+ + `<div class="cz-ladder" role="img" aria-label="${R.steps.filter((x) => x.done).length} of 4 steps done">${R.steps.map((s) => `<i class="${s.done ? 'done' : s.now ? 'now' : ''}"></i>`).join('')}</div>`
67
+ + `<div class="ut-steps">${steps}</div><p class="ut-small ut-mut" role="status" id="rvMsg">${esc(st.msg)}</p><p class="ut-small ut-mut ut-foot">${esc(last)}</p></div>`;
68
+ };
69
+ const body = h.VW.open({ id: 'review', kind: 'My work', title: 'Weekly review', icon: 'list', render: draw });
70
+ const say = (m) => { st.msg = m; const el = body.querySelector('#rvMsg'); if (el) el.textContent = m; };
71
+ const post = async (path, b) => { const r = await h.pmPost(path, b).catch(() => null); if (!r || r.ok !== true) { say((r && r.error) || 'Nothing was changed.'); return null; } return r; };
72
+ const redraw = async () => { await h.reload(); if (body.isConnected) draw(body); };
73
+ body.onclick = async (e) => {
74
+ const b = e.target.closest('button'); if (!b || b.disabled) return;
75
+ const d = b.dataset;
76
+ if (d.utTab === 'work') { h.openWork(); return; }
77
+ if (d.rvToday) { if (await post('/api/pm-items/flag', { id: d.rvToday, flagged: true })) { st.done[d.k] = 'today'; draw(body); } return; }
78
+ if (d.rvKeep) { if (await post('/api/pm-items/keep', { id: d.rvKeep })) { st.done[d.k] = 'kept'; draw(body); } return; }
79
+ if (d.rvDone) { if (await post('/api/pm-items/done', { id: d.rvDone })) { st.done[d.k] = 'done'; draw(body); } return; }
80
+ if (d.rvPick) { if (st.picked.has(d.rvPick)) st.picked.delete(d.rvPick); else if (st.picked.size < 3) st.picked.add(d.rvPick); draw(body); return; }
81
+ if (d.rvGo) { if (await post('/api/home-review/keep', { ws: h.ws(), initiative: d.rvGo, how: 'kept' })) { h.toast('Kept going. It is not asked about again this week.'); redraw(); } return; }
82
+ if (d.rvAsk) {
83
+ const s = staleInis(h.D(), h.now()).find((x) => x.id === d.rvAsk); if (!s) return;
84
+ if (await post('/api/home-review/keep', { ws: h.ws(), initiative: s.id, how: 'asked' })) { h.askAbout(s, { hold: () => hold(s), keep: () => post('/api/home-review/keep', { ws: h.ws(), initiative: s.id, how: 'kept' }).then(redraw) }); redraw(); }
85
+ return;
86
+ }
87
+ if (d.rvStep) {
88
+ st.busy = true; draw(body);
89
+ if (d.rvStep === 'pick') for (const id of st.picked) await post('/api/pm-items/edit', { id, fields: { priority: 'P1' } });
90
+ const r = await post('/api/home-review/step', { ws: h.ws(), week: reviewModel(h.D(), h.now()).week || undefined, step: d.rvStep, note: noteOf(d.rvStep) });
91
+ st.busy = false; st.done = {};
92
+ if (r) { st.msg = ''; await redraw(); if (reviewModel(h.D(), h.now()).done) h.toast('The weekly review is done for this week.'); } else draw(body);
93
+ }
94
+ };
95
+ async function hold(s) {
96
+ const r = await post('/api/lifecycle', { ws: h.ws(), initiative_id: s.id, state: 'on-hold', reason: 'Weekly review: no change for ' + s.days + ' days' });
97
+ if (!r) return false;
98
+ await post('/api/home-review/keep', { ws: h.ws(), initiative: s.id, how: 'held' });
99
+ h.toast('On hold. The reason is on the record.');
100
+ await redraw();
101
+ return true;
102
+ }
103
+ return body;
104
+ }
@@ -0,0 +1,67 @@
1
+ /* pm/home-task.js — one task in the Viewer (initiative premium-uncovered-features, H1; canvas HmMyWork, the Viewer).
2
+ *
3
+ * A PMOS task of an initiative (GET /api/boards/items, src "pmos") opens here from the list: its check, its title and where it sits
4
+ * ("Session list v2 · task · due today"), its due chip, its status, what the PM needs for it (the initiative, its core documents and its
5
+ * Jira item), and the two presses of the canvas: talk it through in the chat, and Done. Every write is the board's own route
6
+ * (POST /api/boards/tasks/state) and is the PM's press; a refusal shows the route's reason and changes nothing.
7
+ * The PM's own items (a note, a mention made into a task) open in My work's item view (home-work.js), drawn in the same shape. */
8
+ import { esc, svg, P } from './home-today.js';
9
+
10
+ const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
11
+ const STATES = ['To do', 'In progress', 'In review', 'Done'];
12
+ const dayDiff = (iso, now) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); if (!m) return null; const a = new Date(+m[1], +m[2] - 1, +m[3]); const t = new Date(now); t.setHours(0, 0, 0, 0); return Math.round((a - t) / 86400000); };
13
+ /** The due chip's words: "Due today", "Due tomorrow", "2 days late", "Due 30 Oct", or "No date". Pure. */
14
+ export function dueText(iso, now = Date.now()) {
15
+ const d = dayDiff(iso, now);
16
+ if (d == null) return 'No date';
17
+ if (d === 0) return 'Due today';
18
+ if (d === 1) return 'Due tomorrow';
19
+ if (d < 0) return -d + (d === -1 ? ' day late' : ' days late');
20
+ const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(iso); return 'Due ' + +m[3] + ' ' + MON[+m[2] - 1];
21
+ }
22
+
23
+ /** h: { VW, pmPost, toast, now, ws, board, iniTitle(id), docs(id) → [{ title, path }], openIni(id), openDoc(doc), askInChat(task), openRecord(task), onChange() } */
24
+ export function openTask(task, h) {
25
+ const st = { msg: '', busy: false };
26
+ const t = task;
27
+ const draw = (b) => {
28
+ const now = h.now ? h.now() : Date.now();
29
+ const done = t.status === 'Done';
30
+ const due = dueText(t.end, now);
31
+ const where = [h.iniTitle(t.ini), 'task', due === 'No date' ? '' : due.replace(/^Due /, '').toLowerCase(), t.owner && !/^(pm|you)(:|$)/i.test(t.owner) ? 'with ' + t.owner : ''].filter(Boolean).join(' · ');
32
+ const docs = (h.docs ? h.docs(t.ini) : []) || [];
33
+ const need = [`<div class="ut-trow">${svg(P.flag, 16)}<span>${esc(h.iniTitle(t.ini))} <span class="ut-mut">· the initiative</span></span><button type="button" class="ut-btn sm soft" data-tk="ini">Open</button></div>`]
34
+ .concat(docs.slice(0, 4).map((d, i) => `<div class="ut-trow">${svg(P.doc, 16)}<span>${esc(d.title)}</span><button type="button" class="ut-btn sm soft" data-tk-doc="${i}">Open</button></div>`))
35
+ .concat(t.ref && t.src !== 'pmos' ? [`<div class="ut-trow">${svg(P.ticket, 16)}<span>${esc(t.ref)}</span></div>`] : []);
36
+ b.innerHTML = `<div class="ut-vc">`
37
+ + `<div class="ut-vh"><button type="button" class="hm-ck" data-tk="done" aria-label="${done ? 'Done' : 'Mark ' + esc(t.title) + ' done'}"${done ? ' disabled' : ''}><span class="ut-chk${done ? ' on' : ''}">${done ? svg(P.check, 12) : ''}</span></button>`
38
+ + `<div><h2 class="ut-h2">${esc(t.title)}</h2><p class="ut-sub">${esc(where)}</p></div>`
39
+ + `<button type="button" class="ut-ib" data-tk="record" aria-label="Open the task's record" title="The task's record">${svg(P.dots, 16, 'dots')}</button></div>`
40
+ + `<div class="ut-chips"><span class="cz-chip${/late/.test(due) ? ' on' : ''}">${esc(due)}</span>${STATES.filter((x) => x !== 'Done').map((x) => `<button type="button" class="cz-chip${t.status === x ? ' on' : ' gh'}" data-tk-state="${esc(x)}" aria-pressed="${t.status === x}">${esc(x)}</button>`).join('')}</div>`
41
+ + `<p class="ut-lbl">What you need for it</p><div>${need.join('')}</div>`
42
+ + `<div class="ut-foot"><button type="button" class="ut-btn pri" data-tk="chat">Talk it through in chat</button><button type="button" class="ut-btn" data-tk="done"${done ? ' disabled' : ''}>Done</button></div>`
43
+ + `<p class="ut-small ut-mut" role="status" id="tkMsg">${esc(st.msg)}</p></div>`;
44
+ };
45
+ const body = h.VW.open({ id: 'task:' + t.uid, kind: 'Task', title: t.title, icon: 'M5 12l5 5 9-10', render: draw });
46
+ const setState = async (state) => {
47
+ if (st.busy) return; st.busy = true;
48
+ const r = await h.pmPost('/api/boards/tasks/state', { ws: h.ws, board: t.board || h.board, task: t.uid, state }).catch(() => null);
49
+ st.busy = false;
50
+ if (!r || r.ok !== true) { st.msg = (r && r.error) || 'The status did not change.'; draw(body); return; }
51
+ t.status = state; st.msg = '';
52
+ h.toast(state === 'Done' ? 'Done. It leaves your list.' : 'Now ' + state.toLowerCase() + '.');
53
+ if (state === 'Done') h.VW.close(); else draw(body);
54
+ if (h.onChange) h.onChange();
55
+ };
56
+ body.onclick = (e) => {
57
+ const b = e.target.closest('button'); if (!b || b.disabled) return;
58
+ const k = b.dataset.tk;
59
+ if (b.dataset.tkState) { if (b.dataset.tkState !== t.status) setState(b.dataset.tkState); return; }
60
+ if (b.dataset.tkDoc != null && b.dataset.tkDoc !== '') { const d = (h.docs ? h.docs(t.ini) : [])[+b.dataset.tkDoc]; if (d && h.openDoc) h.openDoc(d); return; }
61
+ if (k === 'done') setState('Done');
62
+ else if (k === 'ini') h.openIni(t.ini);
63
+ else if (k === 'chat') h.askInChat(t);
64
+ else if (k === 'record' && h.openRecord) h.openRecord(t);
65
+ };
66
+ return body;
67
+ }
@@ -0,0 +1,144 @@
1
+ /* pm/home-today.js — draws Home's one list (initiative premium-uncovered-features, H1 and H2; canvas HmMyWork, HmReview, HmProducts,
2
+ * HmDay, HmMic, HmPhone, HmPhone2).
3
+ *
4
+ * The list column, top to bottom: the head (Today, the products picker when Home reads more than one product, New), the Today card through
5
+ * the day, the filters (Today, Waiting, Kept, Done), one group per product ("PMOS · 2 of 4 goals on track") with its own next steps and its
6
+ * initiatives (the ones where it is your turn first, each with its tasks, next steps, sessions and meetings nested under it), "Not in an
7
+ * initiative", the capture box ("Add a task. PMOS files it under its initiative") and "Untouched 14+ days". Another product's group can be
8
+ * closed: "Partner portal · 2 initiatives · 1 your turn".
9
+ * The model is home-list.js (pure). This file only turns it into HTML: every control is a <button> (or the capture form) with a data-hm-*
10
+ * press that home-app.js handles. Text from the records goes through esc(). */
11
+
12
+ export const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
13
+ export const P = {
14
+ chevR: 'M10 7l5 5-5 5', chevD: 'M7 10l5 5 5-5', plus: 'M12 5v14M5 12h14', x: 'M6 6l12 12M18 6L6 18', check: 'M5 12l5 5 9-10',
15
+ mic: 'M12 3a3 3 0 0 0-3 3v6a3 3 0 0 0 6 0V6a3 3 0 0 0-3-3M5 11a7 7 0 0 0 14 0M12 18v3', clock: 'M12 4a8 8 0 1 0 0 16a8 8 0 1 0 0-16M12 8v4l3 2',
16
+ pause: 'M8 5v14M16 5v14', stop: 'M7 7h10v10H7z', list: 'M9 6h11M9 12h11M9 18h11', doc: 'M7 3h7l5 5v13H7zM14 3v5h5',
17
+ gate: 'M12 3l7 3v6c0 4-3 7-7 9-4-2-7-5-7-9V6z', flag: 'M5 21V4h11l-2 4 2 4H5', cal: 'M4 6h16v14H4zM4 10h16', pin: 'M9 4h6l-1 6 3 3H7l3-3zM12 13v7',
18
+ decide: 'M12 3v18M5 8l7-5 7 5', ret: 'M9 14L4 9l5-5M4 9h10a6 6 0 0 1 0 12h-3', back: 'M19 12H5M11 6l-6 6 6 6', warn: 'M12 4l9 16H3zM12 10v4M12 17v.5',
19
+ chat: 'M4 5h16v11H9l-5 4z', dots: 'M5 12h.01M12 12h.01M19 12h.01', send: 'M5 12h14M13 6l6 6-6 6', ticket: 'M3 5h18v4H3zM3 11h18v4H3z',
20
+ };
21
+ export const svg = (d, w = 16, cls = '') => `<svg aria-hidden="true"${cls ? ` class="${cls}"` : ''} width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
22
+ const ROW_ICON = { decision: P.decide, blocked: P.warn, waited: P.clock, src: P.doc, source: P.doc, ev: P.gate, run: P.ret, update: P.doc, meeting: P.cal };
23
+ const dotOf = (st) => ({ needs: 'you', blocked: 'late', working: 'ok', wait: 'none' }[st] || 'none');
24
+ const iconOfNeed = (r) => (r.kind === 'update' ? P.doc : r.row && r.row.dialog && r.row.dialog.write && r.row.dialog.write.kind === 'return' ? P.ret : ROW_ICON[(r.row && r.row.kind) || ''] || P.gate);
25
+
26
+ /* ── one row ── */
27
+ function tileHtml(r, o) {
28
+ if (r.kind === 'session') return o.avHtml(r.role || { initial: r.initial || 'C' }, 32, 'hm-tile');
29
+ if (r.kind === 'meeting') return `<span class="hm-tile">${svg(P.cal, 16)}</span>`;
30
+ return `<span class="hm-tile">${svg(r.kind === 'need' || r.kind === 'update' ? iconOfNeed(r) : P.chat, 16)}</span>`;
31
+ }
32
+ /** A row of the list: a next step, a task, a note, a mention, a session or a meeting. o: { sel, kid, flat, avHtml, pinned } */
33
+ export function rowHtml(r, o) {
34
+ const sel = o.sel === r.id;
35
+ const cls = ['hm-r', 'lr', o.kid ? 'kid' : '', sel ? 'sel' : '', 'st-' + (r.state || 'quiet'), r.kind === 'task' ? 'task' : '', r.kind === 'item' ? 'item' : '', r.done ? 'done' : ''].filter(Boolean).join(' ');
36
+ const hint = r.hint || '';
37
+ const quiet = r.kind === 'task' || r.kind === 'item' || r.kind === 'meeting' || r.kind === 'finished' || r.state === 'quiet' || r.state === 'wait';
38
+ let lead = '';
39
+ if (r.check || (r.kind === 'task' && r.mine)) lead = `<button type="button" class="hm-ck" data-hm-check="${esc(r.id)}" aria-label="Mark ${esc(r.name)} done" title="Done"><span class="ut-chk${r.done ? ' on' : ''}">${r.done ? svg(P.check, 12) : ''}</span></button>`;
40
+ else if (r.kind === 'task') lead = '<span class="hm-ck wait" aria-hidden="true"><i></i></span>';
41
+ else if (r.done) lead = `<span class="hm-ck wait" aria-hidden="true"><span class="ut-chk on">${svg(P.check, 12)}</span></span>`;
42
+ const dot = lead ? '' : `<i class="hm-dot ${dotOf(r.state)}" aria-hidden="true"></i>`;
43
+ const tile = lead || o.kid ? '' : tileHtml(r, o);
44
+ const end = r.kind === 'session' && r.sid ? `<button type="button" class="hm-x" data-hm-end="${esc(r.id)}" aria-label="End ${esc(r.name)}" title="End this session">${svg(P.x, 14)}</button>`
45
+ : r.kind === 'need' && r.row && r.row.kind !== 'source' ? `<button type="button" class="hm-x" data-hm-end="${esc(r.id)}" aria-label="Put off ${esc(r.name)} until tomorrow" title="Put off until tomorrow">${svg(P.x, 14)}</button>` : '';
46
+ const right = r.link && r.kind === 'loose-rec' ? '<span class="hm-rr">Link it</span>' : '';
47
+ return `<div class="${cls}" data-id="${esc(r.id)}">${lead}<button type="button" class="hm-rm" data-hm-sel="${esc(r.id)}"${sel ? ' aria-current="true"' : ''}>${dot}${tile}`
48
+ + `<span class="hm-rt"><b>${esc(r.name)}</b>${hint ? `<em${quiet ? ' class="q"' : ''}>${esc(hint)}</em>` : ''}</span>${right}</button>${end}</div>`;
49
+ }
50
+ /** An initiative row: the chevron opens what sits under it, the title opens the initiative. */
51
+ function iniHtml(r, o) {
52
+ const open = o.isOpen(r.id);
53
+ const nest = open ? `<div class="hm-nest" role="group" aria-label="In ${esc(r.name)}">${r.kids.map((k) => rowHtml(k, { ...o, kid: true })).join('') || '<p class="hm-none">Nothing today.</p>'}</div>` : '';
54
+ return `<div class="hm-r lr ini st-${esc(r.state)}${o.sel === r.id ? ' sel' : ''}" data-id="${esc(r.id)}"><button type="button" class="hm-tg" data-hm-kids="${esc(r.id)}" aria-expanded="${open}" aria-label="${open ? 'Hide' : 'Show'} what is in ${esc(r.name)}">${svg(open ? P.chevD : P.chevR, 14)}</button>`
55
+ + `<button type="button" class="hm-rm" data-hm-sel="${esc(r.id)}"><span class="hm-rt"><b>${esc(r.name)}</b><em class="q">${esc(r.hint)}</em></span><span class="hm-rr${r.turn ? '' : ' q'}">${esc(r.right)}</span></button></div>${nest}`;
56
+ }
57
+
58
+ /* ── a group ── */
59
+ function productHtml(g, o) {
60
+ const open = o.pOpen(g);
61
+ const head = open
62
+ ? `<div class="hm-ghr2"><button type="button" class="hm-ghd" data-hm-pg="${esc(g.key)}" aria-expanded="true" aria-label="${esc(g.name)}: ${esc(g.goals ? g.goals.text : g.closedLine)}. Close the group">${esc(g.name)}</button>`
63
+ + (g.goals ? (g.primary ? `<button type="button" class="hm-gn" data-hm-prod aria-label="${esc(g.goals.text)}. Open the product">${esc(g.goals.text)}</button>` : `<span class="hm-gn">${esc(g.goals.text)}</span>`) : `<span class="hm-gn">${esc(g.closedLine)}</span>`) + '</div>'
64
+ : `<button type="button" class="hm-ghd" data-hm-pg="${esc(g.key)}" aria-expanded="false">${svg(P.chevR, 14)}${esc(g.name)}<span class="n">${esc(g.closedLine)}</span></button>`;
65
+ if (!open) return `<section class="hm-pg" aria-label="${esc(g.name)}">${head}</section>`;
66
+ const pinned = (x) => (o.pin.has(x.key) ? 0 : 1);
67
+ const flat = g.flat.slice().sort((a, b) => pinned(a) - pinned(b)).map((r) => rowHtml(r, o)).join('');
68
+ const QUIET = 3;
69
+ const restAll = o.restOpen(g.key);
70
+ const rest = restAll ? g.rest : g.rest.slice(0, Math.max(0, QUIET - g.inis.length));
71
+ const more = g.rest.length - rest.length;
72
+ const body = flat + g.inis.concat(rest).map((r) => iniHtml(r, o)).join('')
73
+ + (more > 0 ? `<button type="button" class="hm-more2" data-hm-rest="${esc(g.key)}">${more} more ${more === 1 ? 'initiative' : 'initiatives'} with nothing today · Show</button>`
74
+ : restAll && g.rest.length > QUIET ? `<button type="button" class="hm-more2" data-hm-rest="${esc(g.key)}">Show fewer</button>` : '');
75
+ return `<section class="hm-pg" aria-label="${esc(g.name)}">${head}${body || `<p class="hm-none">${g.primary ? 'No initiative is open on this board.' : 'Nothing is open here.'}</p>`}</section>`;
76
+ }
77
+ function looseHtml(g, o) {
78
+ if (!g.rows.length) return '';
79
+ return `<section class="hm-pg" aria-label="${esc(g.name)}"><div class="hm-ghd">${esc(g.name)}<span class="n">${g.n}</span></div>${g.rows.map((r) => rowHtml(r, o)).join('')}</section>`;
80
+ }
81
+
82
+ /* ── the Today card ── */
83
+ /** The card's HTML. T is todayCard(); greet the greeting; sub the line under it when the day has no meeting. */
84
+ export function todayHtml(T, o) {
85
+ if (T.mode === 'rec') {
86
+ return `<div class="hm-tc rec" role="group" aria-label="Recording"><span class="ut-rec" aria-hidden="true"></span><div><b>${T.paused ? 'Paused' : 'Recording'}${T.clock ? ' · ' + esc(T.clock) : ''}</b><p>${esc(T.sub)}</p></div>`
87
+ + `<button type="button" class="ut-ib" data-hm-tc="${T.paused ? 'resume' : 'pause'}" aria-label="${T.paused ? 'Go on recording' : 'Pause the recording'}" title="${T.paused ? 'Go on' : 'Pause'}">${svg(T.paused ? P.mic : P.pause, 16)}</button>`
88
+ + `<button type="button" class="ut-ib solid" data-hm-tc="stop" aria-label="Stop the recording" title="Stop">${svg(P.stop, 14, 'fill')}</button></div>`;
89
+ }
90
+ if (T.mode === 'soon') {
91
+ return `<div class="hm-tc soon" role="group" aria-label="${esc(T.time + ' ' + T.title + ', ' + T.in)}"><p class="hm-tch">${svg(P.clock, 18)}<b>${esc(T.time)} ${esc(T.title)}</b><span class="r">${esc(T.in)}</span></p>`
92
+ + (T.sub ? `<p class="sub ut-small">${esc(T.sub)}</p>` : '')
93
+ + `<p class="ut-acts"><button type="button" class="ut-btn sm pri" data-hm-tc="prep">Open prep</button>${T.link ? `<a class="ut-btn sm soft" href="${esc(T.link)}" target="_blank" rel="noopener noreferrer">Join</a>` : ''}</p></div>`;
94
+ }
95
+ if (T.mode === 'live') {
96
+ return `<div class="hm-tc live" role="group" aria-label="${esc(T.title)}, on now"><p class="hm-tch">${T.rec ? '<span class="ut-rec" aria-hidden="true"></span>' : svg(P.clock, 18)}<b>${esc(T.title)} · live</b><span class="r q">${esc(T.mins)}</span></p>`
97
+ + `<p class="sub ut-small">${esc(T.sub)}</p><p class="ut-acts"><button type="button" class="ut-btn sm soft" data-hm-tc="open">Open</button>${T.rec ? '<button type="button" class="ut-btn sm ghost" data-hm-tc="hl">Highlight</button>' : '<button type="button" class="ut-btn sm ghost" data-hm-tc="record">Record</button>'}</p></div>`;
98
+ }
99
+ if (T.mode === 'eod') {
100
+ return `<div class="hm-tc eod" role="group" aria-label="End of day"><p class="hm-tch"><b>End of day</b><span class="r q">${esc(T.time)}</span><button type="button" class="ut-ib" data-hm-tc="hide" aria-label="Hide until tomorrow" title="Hide until tomorrow">${svg(P.x, 14)}</button></p>`
101
+ + `<div class="ut-need"><span class="ut-small"><b>${esc(T.blockLine)}</b>${T.why ? ' ' + esc(T.why) : ''}</span><span class="ut-acts"><button type="button" class="ut-btn sm pri" data-hm-tc="now">Do it now</button>${T.later ? '<button type="button" class="ut-btn sm" data-hm-tc="tomorrow">Tomorrow 09:00</button>' : ''}</span></div>`
102
+ + (T.lines.length ? `<div class="hm-eodl">${T.lines.map(([k, v]) => `<span><b>${esc(k)}</b><span>${esc(v)}</span></span>`).join('')}</div>` : '') + '</div>';
103
+ }
104
+ if (T.mode === 'clear') return `<div class="hm-tc clear" role="status">${esc(T.line)}</div>`;
105
+ if (T.mode === 'review') {
106
+ return `<button type="button" class="hm-tc" data-hm-review aria-label="${esc(T.big)} ${esc(T.sub)}. Open the review"><b class="big">${esc(T.big)}</b><span class="sub">${esc(T.sub)}</span></button>`;
107
+ }
108
+ const L = T.load || { segs: [] };
109
+ const sub = L.n ? L.sub : o.sub;
110
+ const bar = L.segs.length ? `<span class="hm-load" aria-hidden="true">${L.segs.map((s) => `<i class="${s.m ? 'm' : ''}${s.now ? ' n' : ''}" data-f="${Math.max(1, s.flex)}"></i>`).join('')}</span><span class="hm-lx" aria-hidden="true"><span>09</span><span>12</span><span>15</span><span>18</span></span>` : '';
111
+ return `<button type="button" class="hm-tc day" data-hm-tc="cal" aria-label="${esc(o.greet)} ${esc(sub)}. Open the calendar"><b class="big">${esc(o.greet)}</b><span class="sub">${esc(sub)}</span>${bar}</button>`;
112
+ }
113
+
114
+ /* ── the whole column ── */
115
+ /** M is homeList(); T todayCard(); o: { sel, isOpen, pOpen, restOpen, pin, avHtml, ready, err, product (the picked key), review, sub, phone } */
116
+ export function listHtml(M, T, o) {
117
+ const many = M.products.length > 1;
118
+ const picked = o.product ? M.products.find((p) => p.key === o.product) : null;
119
+ const head = `<div class="hm-hd"><h1>Today</h1>`
120
+ + (many ? `<button type="button" class="cz-pick hm-pk" data-hm-pick aria-haspopup="menu" aria-expanded="false">${esc(picked ? picked.name : 'All products')} ${svg(P.chevD, 14)}</button><button type="button" class="ut-ib" data-hm-new aria-haspopup="menu" aria-label="New" title="New">${svg(P.plus, 16)}</button>`
121
+ : `<button type="button" class="hm-new" data-hm-new aria-haspopup="menu">${svg(P.plus, 14)}New</button>`) + '</div>';
122
+ const card = todayHtml(T, { greet: M.greet, sub: o.sub });
123
+ const flt = `<div class="hm-flt" role="group" aria-label="Show">${M.filters.map((f, i) => `<button type="button" class="cz-chip${f.key === M.filter ? ' on' : ' gh'}${i > 1 ? ' dk' : ''}" data-hm-filter="${f.key}" aria-pressed="${f.key === M.filter}">${esc(f.label)}${f.n ? ' ' + f.n : ''}</button>`).join('')}</div>`;
124
+ if (!o.ready) return head + card + '<p class="hm-none" role="status">Reading your work.</p>';
125
+ const errLine = `<p class="hm-none" role="status">Home could not read the repository: ${esc(o.err)}.</p>`;
126
+ if (o.err && !M.groups.some((g) => (g.kind === 'product' && g.count) || (g.rows && g.rows.length))) return head + card + errLine;
127
+ // the repository's read failed but sessions or notes still answered: say so above what did come back, never an empty product as if calm
128
+ let body = o.err && !M.groups.some((g) => g.kind === 'product' && (g.count || g.flat.length)) ? errLine : '';
129
+ if (M.list) {
130
+ body = `<section class="hm-pg" aria-label="${esc(M.list.title)}"><div class="hm-ghd">${esc(M.list.title)}<span class="n">${M.list.rows.length || ''}</span></div>`
131
+ + (M.list.rows.map((r) => rowHtml(r, o)).join('') || `<p class="hm-none">${esc(M.list.empty)}</p>`) + '</section>';
132
+ } else {
133
+ const R = o.review;
134
+ if (R && R.open) body += `<section class="hm-pg" aria-label="This week"><div class="hm-ghd">This week<span class="n">Fri</span></div><div class="hm-r lr${o.sel === 'review' ? ' sel' : ''}" data-id="review"><button type="button" class="hm-rm" data-hm-review><span class="hm-tile wk">${svg(P.check, 16)}</span><span class="hm-rt"><b>Weekly review</b><em>${R.started ? 'Step ' + (R.at + 1) + ' of 4' : 'Four short steps'}</em></span></button></div></section>`;
135
+ body += M.groups.map((g) => (g.kind === 'product' ? productHtml(g, o) : looseHtml(g, o))).join('');
136
+ if (!M.groups.some((g) => (g.kind === 'product' && (g.count || g.flat.length)) || (g.rows && g.rows.length))) body += '<p class="hm-none">Nothing is open. A new initiative or a task you add shows here.</p>';
137
+ body += `<form class="hm-cap" id="hmCapF"><label class="vh" for="hmCap">Add a task</label><input id="hmCap" autocomplete="off" maxlength="250" placeholder="Add a task. PMOS files it under its initiative">`
138
+ + (o.mic ? `<button type="button" class="ut-ib" data-hm-capmic aria-label="Say it instead" title="Say it instead">${svg(P.mic, 16)}</button>` : '') + '</form>';
139
+ if (M.untouched.n) body += `<button type="button" class="hm-un" data-hm-review><b>Untouched 14+ days · ${M.untouched.n}</b><span>Weekly review ${esc(M.untouched.day)}</span></button>`;
140
+ }
141
+ const waiting = (M.filters.find((f) => f.key === 'waiting') || {}).n || 0;
142
+ const all = `<div class="hm-r lr hm-all"><button type="button" class="hm-rm" data-hm-work><span class="hm-tile wk">${svg(P.list, 16)}</span><span class="hm-rt"><b>All of my work</b><em class="q">${esc([waiting + ' waiting', M.untouched.n + ' untouched'].join(' · '))}</em></span>${svg(P.chevR, 16)}</button></div>`;
143
+ return head + card + flt + body + all;
144
+ }