create-pmos 0.401.0 → 0.402.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 +13 -18
- package/payload/KIT-VERSION +2 -2
- 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/payload/state/log.md +1 -1
- package/workspace/board-programs-test.js +226 -0
- package/workspace/board-shot.js +54 -0
- package/workspace/briefing-premium-board-test.js +22 -15
- package/workspace/briefing-premium-calendar-test.js +6 -3
- package/workspace/briefing-premium-sources-test.js +15 -10
- package/workspace/briefing-premium-test.js +38 -16
- package/workspace/changelog.json +12 -0
- package/workspace/fixtures/board-premium-facts.js +20 -3
- package/workspace/fixtures/briefing-premium-facts.js +18 -2
- package/workspace/fixtures/program-ascent.js +101 -0
- package/workspace/guide/home.md +11 -7
- package/workspace/guide/index.md +1 -0
- package/workspace/guide/programs.md +37 -0
- package/workspace/lib/briefing-premium-products.js +4 -4
- package/workspace/lib/briefing-premium.js +2 -2
- package/workspace/lib/programs.js +129 -0
- package/workspace/lib/route-modules.js +1 -0
- package/workspace/lib/routes-briefing-premium.js +1 -1
- package/workspace/lib/routes-programs.js +122 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-board-actions-test.js +1 -1
- package/workspace/premium-vw-cal-test.js +6 -3
- package/workspace/program-panel-test.js +143 -0
- package/workspace/public/pm/bd-acts.js +23 -14
- package/workspace/public/pm/bd-asks.js +89 -23
- package/workspace/public/pm/bd-prog-panel.js +451 -0
- package/workspace/public/pm/bd-prog.js +191 -0
- package/workspace/public/pm/bd-span.js +98 -15
- package/workspace/public/pm/bd-views.js +93 -29
- package/workspace/public/pm/cozy-board.css +226 -9
- package/workspace/public/pm/cozy-home.css +26 -0
- package/workspace/public/pm/cozy-panel.css +178 -0
- package/workspace/public/pm/cozy-today.css +189 -0
- package/workspace/public/pm/home-app.js +75 -19
- package/workspace/public/pm/home-chat.js +8 -4
- package/workspace/public/pm/home-data.js +1 -1
- package/workspace/public/pm/home-list.js +98 -17
- package/workspace/public/pm/home-today.js +137 -59
- package/workspace/public/pm/premium-board.js +225 -57
- package/workspace/public/pm/program-model.js +192 -0
- package/workspace/public/premium-board.html +4 -1
- package/workspace/test-lists/board-programs.json +9 -0
- package/workspace/test-lists/program-hierarchy.json +11 -0
- package/workspace/test-lists/program-panel.json +9 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* pm/home-chat.js — Home's chat column (initiative premium-agreed-design, Home; mockup Main.dc.html section "Conversation", AgChat*).
|
|
2
2
|
*
|
|
3
|
-
*
|
|
3
|
+
* On a desktop a header line names what is open: its mark, its title and the chip of where it sits (HvACDesk; host.head(t) draws it).
|
|
4
|
+
* Home's own chat has none. The stream: the role's avatar and name over each agent message with Copy, Retry and Make a work-item; the
|
|
4
5
|
* PM's bubbles with "You · HH:MM"; "Worked …" folds (under the message that asks, while it asks); a Today divider; "New since you left"; "N earlier messages · show"; the agent's step
|
|
5
6
|
* checklist while it works (from its own TodoWrite list); a permission card with the change before → after, Allow and Deny. Over the box: the
|
|
6
7
|
* run strip with Stop, and "Also waiting on you". One box for every conversation (+, /, @ in an initiative, the In:/To: chip, the key hint,
|
|
@@ -15,7 +16,7 @@
|
|
|
15
16
|
* target: { key?, sid?, title, scope: { text, icon, loose }, role: { name, initial }, intro?: { role, text, at, pills: [{ label, primary, go }] },
|
|
16
17
|
* ini?, rich, also?: { text, go } }
|
|
17
18
|
* host: { esc, toast, pmGet, pmPost, roles(), seen(key), markSeen(key), onScope(btn), onLink(btn), onTo(btn), workItem(text, target),
|
|
18
|
-
* viewerClosed(), reopenViewer() } */
|
|
19
|
+
* viewerClosed(), reopenViewer(), head(target) } */
|
|
19
20
|
import { mdHtml, userHtml, toolLine, webKind } from './chat-md.js';
|
|
20
21
|
import { streamOf, runOf, roleOf, tintOf, hm } from './home-data.js';
|
|
21
22
|
import { splitGoal, shownUser, goalBlockHtml, goalProgressHtml, goalChipHtml, goalViewHtml, goalNow, slashMatches, loadSlash } from './goal-chat.js';
|
|
@@ -48,8 +49,8 @@ export function mountChat(el, host) {
|
|
|
48
49
|
const esc = host.esc;
|
|
49
50
|
const C = { t: null, th: null, conv: null, timer: null, show: 12, open: new Set(), seq: 0, sending: false, files: [], seenAt: null, lastKey: null, picked: {}, auto: { key: null, ctx: new Set(), rep: null, goal: null }, slashAt: 0 };
|
|
50
51
|
el.innerHTML = `<button type="button" class="hm-reopen" id="hmReopen" aria-label="Open the Viewer" title="Open the Viewer" hidden>${PANE}</button>`
|
|
51
|
-
+ '<div class="hm-log" id="hmLog" role="log" aria-live="polite"></div><div class="hm-foot" id="hmFoot"></div>';
|
|
52
|
-
const log = el.querySelector('#hmLog'), foot = el.querySelector('#hmFoot'), reopen = el.querySelector('#hmReopen');
|
|
52
|
+
+ '<div class="hm-chd" id="hmCh" hidden></div><div class="hm-log" id="hmLog" role="log" aria-live="polite"></div><div class="hm-foot" id="hmFoot"></div>';
|
|
53
|
+
const log = el.querySelector('#hmLog'), foot = el.querySelector('#hmFoot'), reopen = el.querySelector('#hmReopen'), head = el.querySelector('#hmCh');
|
|
53
54
|
loadSlash(host.pmGet).then(() => { if (el.querySelector('#hmSlash:not([hidden])')) drawSlash(); });
|
|
54
55
|
// when a hidden log is shown (the phone's chat over the list), a jump still owed is made then
|
|
55
56
|
// On a phone the chat is the page: the log grows and the page scrolls, so "the end" is the page's end (testing fixes: a chat opened at its oldest message)
|
|
@@ -188,6 +189,9 @@ export function mountChat(el, host) {
|
|
|
188
189
|
if (atEnd || C.jump) { toEnd(); if (C.conv && log.clientHeight) C.jump = false; }
|
|
189
190
|
drawFoot(R);
|
|
190
191
|
reopen.hidden = !host.viewerClosed();
|
|
192
|
+
// the header line over the conversation on a desktop (HvACDesk): what is open and where it sits; Home's own chat has none
|
|
193
|
+
const hh = host.head ? host.head(t) : '';
|
|
194
|
+
put(head, hh); head.hidden = !hh; el.classList.toggle('hm-has-ch', !!hh);
|
|
191
195
|
// the PM has seen what is here now
|
|
192
196
|
const lastAt = msgs.length ? msgs[msgs.length - 1].at : null;
|
|
193
197
|
if (t.key && lastAt && (!C.marked || C.marked < lastAt)) { C.marked = lastAt; host.markSeen(t.key); }
|
|
@@ -87,7 +87,7 @@ export function needsOf(D) {
|
|
|
87
87
|
const P = (D.desk && D.desk.product) || {}, wk = weekOf(D.now || Date.now());
|
|
88
88
|
if (!(P.sent || []).some((x) => x.week === wk.iso)) {
|
|
89
89
|
const rt = nextRoutine(D, D.now || Date.now(), /comm|update|weekly|status|stakeholder/i);
|
|
90
|
-
rows.push({ id: 'n:update', kind: 'update', key: UPDATE_KEY, ini: 'product', name: 'Weekly update
|
|
90
|
+
rows.push({ id: 'n:update', kind: 'update', key: UPDATE_KEY, ini: 'product', name: 'Weekly update is ready to send', hint: 'Communicator · ' + (rt ? 'goes out ' + rt.when : 'send it when it reads right'), state: 'needs', icon: 'doc', initialRole: 'Co' });
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
return rows;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
/* pm/home-list.js — Home's one list, pure (initiative premium-uncovered-features, H1 and H2; canvas HmMyWork, HmReview, HmProducts, HmDay,
|
|
2
|
-
* HmDecide, HmMic, HmPhone, HmPhone2)
|
|
2
|
+
* HmDecide, HmMic, HmPhone, HmPhone2), in the Home A + C design with programs (initiative program-hierarchy, H1 to H4; canvas HvAC, HvAOpen,
|
|
3
|
+
* HvACDesk, PgHomePhone, PgHomeDesk).
|
|
3
4
|
*
|
|
4
5
|
* There is no Needs you group and no Your list (PM, canvas review 2026-10-22/23): every next step sits under its initiative, and the list is
|
|
5
6
|
* grouped by product. This file turns what the routes answer into what the list draws, and touches no page, so a node test imports it:
|
|
6
7
|
* productsOf(D) the products the list shows: the board's own first, then every product Home reads (GET /api/briefing-premium products)
|
|
7
8
|
* and every product a next step names; each with its goals line ("2 of 4 goals on track")
|
|
8
|
-
* homeList(D, o) { greet, yours, filters, groups, untouched, filter } for the list column
|
|
9
|
+
* homeList(D, o) { greet, yours, move, filters, groups, untouched, filter } for the list column; move is Your move (HvAOpen):
|
|
10
|
+
* every row that waits on the PM, the late ones of the PM's own tasks and items first. yours is its length
|
|
9
11
|
* todayCard(D, o) the Today card through the day: day (greeting and the day's load), soon (a meeting in 15 minutes or less), live
|
|
10
12
|
* (a meeting on now), rec (a recording that is no calendar meeting), eod (the end of a day with something open), clear
|
|
11
13
|
* staleInis(D, now, days) open initiatives with no change for `days` days or more, the longest first
|
|
@@ -14,6 +16,8 @@
|
|
|
14
16
|
* D is home-data.js's D plus { work (GET /api/my-work-premium model), items (GET /api/boards/items), others ([{ ws, name, model }], the boards of
|
|
15
17
|
* the other products), phoneDay (GET /api/phone-day), review (GET /api/home-review) }. A part that did not answer is left out, never guessed. */
|
|
16
18
|
import { needsOf, boardRows, productCard, productName, sessionRow, iniOfSession, todayOf, live, OPEN, hm } from './home-data.js';
|
|
19
|
+
import { programState, groupRows } from './program-model.js';
|
|
20
|
+
import { STEPS, stageKey } from './premium-initiative-head.js';
|
|
17
21
|
|
|
18
22
|
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
19
23
|
const DOW = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
|
@@ -35,11 +39,17 @@ export function greeting(n, now = Date.now()) {
|
|
|
35
39
|
}
|
|
36
40
|
|
|
37
41
|
/* ── products ── */
|
|
42
|
+
/** The product tiles' tints (HvAC .tl.a, .tl.b, .tl.c): a product keeps its tint by its place in the list, in its group and in a program. */
|
|
43
|
+
export const TONES = 3;
|
|
44
|
+
// a product's tile: the workspace's own abbreviation when it has one (Settings, the rail's initials: "MS"), else two letters of its name
|
|
45
|
+
const codeOf = (p) => { const c = String((p && p.code) || '').replace(/[^A-Za-z0-9]/g, '').slice(0, 3).toUpperCase(); return c || initialsOf(p && p.name); };
|
|
38
46
|
const initialsOf = (name) => { const w = String(name || '').trim().split(/[\s_-]+/).filter(Boolean); return (w.length > 1 ? w[0][0] + w[1][0] : String(name || '?').slice(0, 2)).toUpperCase(); };
|
|
39
|
-
|
|
47
|
+
/** A product's goals line and dots from its Board model (the Board's product groups draw the same dots, pm/bd-prog.js). */
|
|
48
|
+
export function goalsOf(model) {
|
|
40
49
|
const C = productCard({ board: model });
|
|
41
50
|
const n = C.items.length, ok = C.items.filter((x) => x.kind === 'ok').length;
|
|
42
|
-
|
|
51
|
+
// the header's goal dots (HvAC .gd): one per KR or budget, green on track, amber at risk
|
|
52
|
+
return { ok, n, text: n ? ok + ' of ' + n + ' goals on track' : 'No goal anchored yet', dots: C.items.map((x) => x.kind === 'ok') };
|
|
43
53
|
}
|
|
44
54
|
/* A row the brief tags "Across products" names no product: it is not a group of its own, it sits with the rows that name none. */
|
|
45
55
|
const ACROSS = 'Across products';
|
|
@@ -47,13 +57,13 @@ const prodOf = (x) => (x && x.product && x.product !== ACROSS ? x.product : '');
|
|
|
47
57
|
/** The products the list shows, the board's own product first. Each: { key, ws, name, initials, primary, model, goals, on }. */
|
|
48
58
|
export function productsOf(D) {
|
|
49
59
|
const out = [];
|
|
50
|
-
const add = (p) => { const k = p.ws || 'n:' + String(p.name).toLowerCase(); if (out.some((x) => x.key === k || x.name.toLowerCase() === String(p.name).toLowerCase())) return; out.push({ ...p, key: k, initials:
|
|
60
|
+
const add = (p) => { const k = p.ws || 'n:' + String(p.name).toLowerCase(); if (out.some((x) => x.key === k || x.name.toLowerCase() === String(p.name).toLowerCase())) return; out.push({ ...p, key: k, initials: codeOf(p) }); };
|
|
51
61
|
const b = D.board && D.board.board;
|
|
52
62
|
const av = (D.brief && D.brief.products && D.brief.products.available) || [];
|
|
53
|
-
const
|
|
54
|
-
if (D.board) add({ ws: (b && b.ws) || '', name: (b && b.product) || named(b && b.ws) || productName(D), primary: true, model: D.board, goals: goalsOf(D.board) });
|
|
55
|
-
for (const o of D.others || []) if (o && o.model) add({ ws: o.ws, name: o.name || productName({ board: o.model }), primary: false, model: o.model, goals: goalsOf(o.model) });
|
|
56
|
-
for (const a of av) if (a.on) add({ ws: a.ws, name: a.name, primary: false, model: null, goals: null });
|
|
63
|
+
const avOf = (ws) => (ws && av.find((a) => a.ws === ws)) || {}, named = (ws) => avOf(ws).name || '';
|
|
64
|
+
if (D.board) add({ ws: (b && b.ws) || '', name: (b && b.product) || named(b && b.ws) || productName(D), code: avOf(b && b.ws).initials, primary: true, model: D.board, goals: goalsOf(D.board) });
|
|
65
|
+
for (const o of D.others || []) if (o && o.model) add({ ws: o.ws, name: o.name || productName({ board: o.model }), code: avOf(o.ws).initials, primary: false, model: o.model, goals: goalsOf(o.model) });
|
|
66
|
+
for (const a of av) if (a.on) add({ ws: a.ws, name: a.name, code: a.initials, primary: false, model: null, goals: null });
|
|
57
67
|
for (const r of needsOf(D)) if (prodOf(r)) add({ ws: '', name: r.product, primary: false, model: null, goals: null });
|
|
58
68
|
return out;
|
|
59
69
|
}
|
|
@@ -96,6 +106,11 @@ function mentionRow(m, ini) {
|
|
|
96
106
|
const meetIni = (m) => (m && (m.initiative || (m.level && m.level.kind === 'initiative' && m.level.id) || (m.about && m.about.kind === 'initiative' && m.about.id))) || null;
|
|
97
107
|
/** A next step's hint without its product's name: the product is the group's header. */
|
|
98
108
|
const bareHint = (x) => { const h = String(x.hint || ''), p = prodOf(x); return p && h.startsWith(p + ' · ') ? h.slice(p.length + 3) : p && h === p ? '' : h; }; // the group names the product; "Across products" stays
|
|
109
|
+
/** Where an initiative is on the eight stages (the row's stage track, HvAC .mt): 0 Triage … 7 Evaluate, or -1 when its stage is not one of them. */
|
|
110
|
+
export const stageAt = (stage) => { const k = stageKey(stage); return k ? STEPS.findIndex((s) => s.key === k) : -1; };
|
|
111
|
+
/** A row under an initiative that is the PM's move now (Your move, and the initiative's count badge): a next step, a mention, a session
|
|
112
|
+
* that waits on the PM, or a task of the PM's own that is late. */
|
|
113
|
+
const isMove = (k) => k.step || k.kind === 'mention' || (k.kind === 'session' && (k.state === 'needs' || k.state === 'blocked')) || (k.kind === 'task' && k.mine && k.late);
|
|
99
114
|
function iniRowOf(D, r, needs, now) {
|
|
100
115
|
const steps = needs.filter((x) => x.ini === r.id && !x.needSession).map((x) => ({ ...x, step: true, hint: 'Next step' + (bareHint(x) ? ' · ' + bareHint(x) : '') }))
|
|
101
116
|
.concat(mentionsOf(D).filter((m) => m.initiative === r.id).map((m) => mentionRow(m, r.id)));
|
|
@@ -109,7 +124,49 @@ function iniRowOf(D, r, needs, now) {
|
|
|
109
124
|
// next steps, sessions and today's meetings always show; tasks show the TASKS_SHOWN most urgent, the rest behind "Show N more tasks"
|
|
110
125
|
const kids = [...steps, ...ses.sort((a, b) => (RANK[b.state] || 0) - (RANK[a.state] || 0)), ...tasks.map((t, i) => (i < TASKS_SHOWN ? t : { ...t, extra: true })), ...meet];
|
|
111
126
|
const hint = r.made ? [cap1(r.lane), r.stage].filter(Boolean).join(' · ') : [cap1(r.lane || 'feature'), r.stage].filter(Boolean).join(' · ');
|
|
112
|
-
return { id: 'i:' + r.id, kind: 'ini', ini: r.id, name: r.title, hint, right, turn, busy: kids.length > 0, state: turn ? 'needs' : run ? 'working' : 'quiet', kids, board: r, updated: r.updated || ''
|
|
127
|
+
return { id: 'i:' + r.id, kind: 'ini', ini: r.id, name: r.title, hint, right, turn, busy: kids.length > 0, state: turn ? 'needs' : run ? 'working' : 'quiet', kids, board: r, updated: r.updated || '',
|
|
128
|
+
stage: r.stage || '', at: stageAt(r.stage), yours: kids.filter(isMove).length, late: kids.some((k) => k.kind === 'task' && k.mine && k.late) };
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/* ── programs (initiative program-hierarchy, H4; canvas PgHomePhone, PgHomeDesk) ── */
|
|
132
|
+
const closedOf = (n, turnN) => [n ? plural(n, 'initiative', 'initiatives') : '', turnN ? turnN + ' your turn' : ''].filter(Boolean).join(' · ') || 'Nothing open';
|
|
133
|
+
const isMe = (D, who) => { const me = String((D.today && D.today.me) || '').toLowerCase(), w = String(who || '').toLowerCase(); return !w || /^(pm|you)(:|$)/.test(w) || (!!me && (w === me || w.startsWith(me + ' '))); };
|
|
134
|
+
/** One group per program that has an initiative or an open task in the products shown, placed above the products. The grouping is
|
|
135
|
+
* groupRows (program-model.js), the one Board and Kanban use: a program's initiatives leave their product's group, so each initiative shows
|
|
136
|
+
* once, and sit under one sub-heading per product, in the order the products first appear. The program's own open tasks come first.
|
|
137
|
+
* With one product picked, only that product's initiatives and tasks show. D.programs is GET /api/programs' programs. */
|
|
138
|
+
export function programGroups(D, groups, products, o, now) {
|
|
139
|
+
const rowsOf = (ws) => { const p = products.find((x) => x.ws === ws); return p ? { name: p.name, rows: (p.model && p.model.initiatives && p.model.initiatives.list && p.model.initiatives.list.rows) || (p.primary ? boardRows(D) : []) } : null; };
|
|
140
|
+
const pgs = groups.filter((g) => g.kind === 'product');
|
|
141
|
+
const items = pgs.flatMap((g) => g.inis.concat(g.rest).map((r) => ({ id: r.ini, ws: g.product.ws, product: g.name, r, g })));
|
|
142
|
+
const grouped = groupRows(items, D.programs, { productOf: (x) => x.product, wsOf: (x) => x.ws });
|
|
143
|
+
const out = [];
|
|
144
|
+
for (const pr of (D.programs || []).filter((p) => p && !p.archived)) {
|
|
145
|
+
const G = grouped.find((x) => x.kind === 'program' && x.program.id === pr.id);
|
|
146
|
+
for (const x of (G && G.rows) || []) {
|
|
147
|
+
const g = x.g;
|
|
148
|
+
for (const k of ['inis', 'rest']) { const i = g[k].indexOf(x.r); if (i >= 0) g[k].splice(i, 1); }
|
|
149
|
+
g.count -= 1;
|
|
150
|
+
if (x.r.turn) g.turnN -= 1;
|
|
151
|
+
g.yours -= x.r.yours;
|
|
152
|
+
g.late = g.inis.concat(g.rest).some((i) => i.late);
|
|
153
|
+
g.closedLine = closedOf(g.count, g.turnN);
|
|
154
|
+
}
|
|
155
|
+
const tasks = (pr.tasks || []).filter((t) => !t.done && (!o.product || !t.ws || products.some((p) => p.key === o.product && p.ws === t.ws))).map((t) => {
|
|
156
|
+
const d = t.due ? dayDiff(t.due, now) : null;
|
|
157
|
+
return { id: 'pt:' + pr.id + ':' + t.key, kind: 'ptask', program: pr.id, key: t.key, ws: t.ws, name: t.title, check: true, state: 'quiet', mine: isMe(D, t.owner), late: d != null && d < 0, due: t.due || '',
|
|
158
|
+
hint: [t.owner, d == null ? '' : d < 0 ? plural(-d, 'day', 'days') + ' late' : d === 0 ? 'due today' : 'due ' + shortDay(t.due)].filter(Boolean).join(' · ') };
|
|
159
|
+
});
|
|
160
|
+
const subs = ((G && G.products) || []).map((sp) => { const at = products.findIndex((p) => p.name === sp.name); return { name: sp.name, initials: at >= 0 ? products[at].initials : initialsOf(sp.name), tone: Math.max(0, at) % TONES, inis: sp.rows.map((x) => x.r) }; });
|
|
161
|
+
const inis = subs.flatMap((x) => x.inis);
|
|
162
|
+
if (!inis.length && !tasks.length) continue;
|
|
163
|
+
const st = programState(pr, rowsOf, now);
|
|
164
|
+
const turnN = inis.filter((x) => x.turn).length;
|
|
165
|
+
out.push({ key: 'g:' + pr.id, kind: 'program', program: pr, st, name: pr.title, subs, inis, rest: [], tasks, count: inis.length, turnN,
|
|
166
|
+
yours: inis.reduce((n, x) => n + x.yours, 0) + tasks.filter((t) => t.mine && t.late).length, late: inis.some((x) => x.late) || tasks.some((t) => t.late),
|
|
167
|
+
products: st.products, closedLine: closedOf(inis.length, turnN) });
|
|
168
|
+
}
|
|
169
|
+
return out;
|
|
113
170
|
}
|
|
114
171
|
|
|
115
172
|
/* ── the list ── */
|
|
@@ -148,19 +205,23 @@ export function homeList(D, o = {}) {
|
|
|
148
205
|
const flat = mineNeeds.filter((x) => !x.ini || !ids.has(x.ini)).filter((x) => !x.needSession).map((x) => ({ ...x, flat: true, hint: bareHint(x) }));
|
|
149
206
|
const turnN = inis.filter((x) => x.turn).length + flat.length;
|
|
150
207
|
const shown = inis.filter((x) => x.turn || x.busy);
|
|
151
|
-
groups.push({ key: 'p:' + p.key, kind: 'product', product: p, name: p.name, primary: !!p.primary, goals: p.goals, flat, inis: shown, rest: inis.filter((x) => !shown.includes(x)),
|
|
152
|
-
count: inis.length, turnN, closedLine: [inis.length ? plural(inis.length, 'initiative', 'initiatives') : '', turnN ? turnN + ' your turn' : ''].filter(Boolean).join(' · ') || 'Nothing open' });
|
|
208
|
+
groups.push({ key: 'p:' + p.key, kind: 'product', product: p, name: p.name, initials: p.initials, tone: products.indexOf(p) % TONES, primary: !!p.primary, goals: p.goals, flat, inis: shown, rest: inis.filter((x) => !shown.includes(x)),
|
|
209
|
+
count: inis.length, turnN, yours: inis.reduce((n, x) => n + x.yours, 0) + flat.length, late: inis.some((x) => x.late), closedLine: [inis.length ? plural(inis.length, 'initiative', 'initiatives') : '', turnN ? turnN + ' your turn' : ''].filter(Boolean).join(' · ') || 'Nothing open' });
|
|
153
210
|
}
|
|
211
|
+
// programs first (program-hierarchy P3): each program takes its initiatives out of their product groups, so an initiative shows once
|
|
212
|
+
groups.unshift(...programGroups(D, groups, products, o, now));
|
|
154
213
|
// sessions that wait on the PM and belong to no initiative of a product: they are next steps too, under "Not in an initiative"
|
|
155
214
|
const looseNeeds = needs.filter((x) => !used.has(x.id) && !(x.ini && groups.some((g) => g.inis.concat(g.rest).some((i) => i.ini === x.ini))));
|
|
156
215
|
const loose = [];
|
|
157
216
|
for (const x of looseNeeds) loose.push({ ...x, flat: true });
|
|
158
|
-
for (const r of tabRows('today')) loose.push({ id: 'w:' + r.key, kind: 'item', key: r.key, name: r.title, hint: [r.overdue ? 'late' : '', String(r.sub || '').replace(/^Yours\b\s*(·\s*)?/, '')].filter(Boolean).join(' · '), check: true, item: r }); // the check box says it is the PM's own: no "your own note" on every row (testing fixes)
|
|
217
|
+
for (const r of tabRows('today')) loose.push({ id: 'w:' + r.key, kind: 'item', key: r.key, name: r.title, hint: [r.overdue ? 'late' : '', String(r.sub || '').replace(/^Yours\b\s*(·\s*)?/, '')].filter(Boolean).join(' · '), check: true, mine: true, late: !!r.overdue, item: r }); // the check box says it is the PM's own: no "your own note" on every row (testing fixes)
|
|
159
218
|
const inIni = new Set(groups.flatMap((g) => g.inis.concat(g.rest)).map((i) => i.ini));
|
|
160
219
|
for (const m of mentionsOf(D).filter((x) => !(x.initiative && inIni.has(x.initiative)))) loose.push(mentionRow(m, null));
|
|
161
220
|
for (const m of todayOf(D).filter((x) => !meetIni(x) && x.state !== 'past')) loose.push(meetRow(m, null));
|
|
162
221
|
for (const s of (D.sessions || []).filter((s) => live(s) && !iniOfSession(s) && s.shown !== 'needs' && s.shown !== 'blocked')) loose.push({ ...sessionRow(s, D.desk && D.desk.roles), loose: true });
|
|
163
|
-
|
|
222
|
+
// the folded line's signals (HvAC .lh): a blue dot when a row waits on the PM, an amber square when one of the PM's own is late
|
|
223
|
+
const lsig = { needs: loose.filter((r) => r.state === 'needs' || r.state === 'blocked').length, sessions: loose.filter((r) => r.kind === 'session' || r.needSession).length, tasks: loose.filter((r) => r.check).length, late: loose.filter((r) => r.check && r.late).length };
|
|
224
|
+
if (!o.product || o.product === 'loose') groups.push({ key: 'loose', kind: 'loose', name: 'Not in an initiative', rows: loose, n: loose.length, sig: lsig });
|
|
164
225
|
const stale = staleInis(D, now);
|
|
165
226
|
const untouched = { n: stale.length + ((W && W.review && W.review.n) || 0), inis: stale.length, items: (W && W.review && W.review.n) || 0, day: new Date(now).getDay() === REVIEW_DAY ? 'today' : 'Fri' };
|
|
166
227
|
// a filter other than Today shows one plain list from the PM's own list (the items carry no initiative)
|
|
@@ -172,12 +233,32 @@ export function homeList(D, o = {}) {
|
|
|
172
233
|
for (const f of fin) done.push({ id: 'fin:' + (f.id || f.title), kind: 'finished', name: f.title, hint: f.status === 'review' ? 'Finished · waits for your review' : 'Finished', done: true, finished: f });
|
|
173
234
|
list = { title: 'Done today', rows: done, empty: 'Nothing is done yet today.' };
|
|
174
235
|
}
|
|
175
|
-
const
|
|
176
|
-
const
|
|
177
|
-
|
|
236
|
+
const move = moveOf(groups, needs);
|
|
237
|
+
const yours = move.length;
|
|
238
|
+
const nIni = groups.filter((g) => g.kind === 'product' || g.kind === 'program').reduce((n, g) => n + g.count, 0);
|
|
239
|
+
return { yours, move, greet: greeting(yours, now), word: greetWord(now), products, primary, filters, filter: o.filter || 'today', groups, list, untouched,
|
|
178
240
|
counts: { products: products.length, initiatives: nIni } };
|
|
179
241
|
}
|
|
180
242
|
|
|
243
|
+
/* ── Your move (HvAOpen) ── */
|
|
244
|
+
/** Every row that is the PM's move, in one list for the Your day sheet: the PM's own late tasks and items first, then each next step,
|
|
245
|
+
* mention and waiting session in the list's order. A row keeps its list id, so a press opens what the list row opens. Each row:
|
|
246
|
+
* { id, name, sub (its initiative, or the hint of a row with none), late, state, when (the weekly update's send time) }. */
|
|
247
|
+
function moveOf(groups, needs) {
|
|
248
|
+
const late = [], rest = [], seen = new Set();
|
|
249
|
+
const put = (L, r, sub) => { if (!r || seen.has(r.id)) return; seen.add(r.id); L.push({ id: r.id, name: r.name, sub: sub || '', late: !!r.late, state: r.state || 'needs', check: !!(r.check || r.kind === 'task'), when: whenOf(r) }); };
|
|
250
|
+
for (const g of groups) {
|
|
251
|
+
if (g.kind === 'loose') { for (const r of g.rows) if (r.check && r.late) put(late, r); else if (r.state === 'needs' || r.state === 'blocked') put(rest, r, r.kind === 'session' ? '' : bareHint(r)); continue; }
|
|
252
|
+
for (const t of g.tasks || []) if (t.mine && t.late) put(late, t, g.name);
|
|
253
|
+
for (const r of g.flat || []) put(rest, r, '');
|
|
254
|
+
for (const i of (g.inis || []).concat(g.rest || [])) for (const k of i.kids) if (isMove(k)) put(k.kind === 'task' ? late : rest, k, i.name);
|
|
255
|
+
}
|
|
256
|
+
for (const r of needs) if (!seen.has(r.id) && !r.needSession) put(rest, r, r.kind === 'session' ? '' : bareHint(r));
|
|
257
|
+
return late.concat(rest);
|
|
258
|
+
}
|
|
259
|
+
/** "Wed 09:00" from the weekly update's "goes out Wed 09:00"; '' for any other row. */
|
|
260
|
+
export const whenOf = (r) => { const m = /goes out (.+)$/.exec(String((r && r.hint) || '')); return m ? m[1] : ''; };
|
|
261
|
+
|
|
181
262
|
/* ── the Today card through the day ── */
|
|
182
263
|
const DAY_FROM = 9, DAY_TO = 18;
|
|
183
264
|
/** The day's load bar from 09 to 18: free and meeting stretches, the meeting on now marked. { segs: [{ flex, m, now }], sub } */
|
|
@@ -1,71 +1,101 @@
|
|
|
1
|
-
/* pm/home-today.js — draws Home's one list (initiative
|
|
2
|
-
*
|
|
1
|
+
/* pm/home-today.js — draws Home's one list in the Home A + C design with programs (initiative program-hierarchy, H1 to H4; canvas HvAC,
|
|
2
|
+
* HvAOpen, HvACDesk, PgHomePhone, PgHomeDesk), over the one list of premium-uncovered-features (HmMyWork, HmDay, HmMic, HmReview).
|
|
3
3
|
*
|
|
4
|
-
* The list column, top to bottom:
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
4
|
+
* The list column, top to bottom: one header line ("Good morning" with a chevron that opens Your day, the product picker when Home reads
|
|
5
|
+
* more than one product, on a desktop the filter icon for Kept and Done, New), the "N are yours" line, the Today card only while the day has
|
|
6
|
+
* a moment (a recording, a meeting soon or on now, the end of the day, the weekly review open), each program's group, then each product's
|
|
7
|
+
* group (an initials tile, the name, the goal dots, a chevron; one-line rows with the stage track on the right; sessions, next steps and
|
|
8
|
+
* tasks indented under their initiative), and "Not in an initiative" as a folded line. Your day (dayHtml) is a sheet over the list: the date
|
|
9
|
+
* and the day's meetings, Your move with its count, and This week with the Weekly review. Every group folds; home-app.js keeps the folds.
|
|
9
10
|
* 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
11
|
* press that home-app.js handles. Text from the records goes through esc(). */
|
|
11
12
|
|
|
13
|
+
import { STEPS } from './premium-initiative-head.js';
|
|
14
|
+
import { whenOf } from './home-list.js';
|
|
15
|
+
|
|
12
16
|
export const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
13
17
|
export const P = {
|
|
14
|
-
chevR: 'M10 7l5 5-5 5', chevD: 'M7 10l5 5 5-5',
|
|
18
|
+
chevR: 'M10 7l5 5-5 5', chevD: 'M7 10l5 5 5-5', chevU: 'M7 14l5-5 5 5', layers: 'M12 3l9 5-9 5-9-5zM3 13l9 5 9-5M3 17.5l9 5 9-5', filter: 'M4 6h16M7 12h10M10 18h4',
|
|
19
|
+
calendar: 'M4 5h16v15H4zM8 3v4M16 3v4M4 10h16', plus: 'M12 5v14M5 12h14', x: 'M6 6l12 12M18 6L6 18', check: 'M5 12l5 5 9-10',
|
|
15
20
|
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
21
|
pause: 'M8 5v14M16 5v14', stop: 'M7 7h10v10H7z', list: 'M9 6h11M9 12h11M9 18h11', doc: 'M7 3h7l5 5v13H7zM14 3v5h5',
|
|
17
22
|
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
23
|
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',
|
|
24
|
+
chat: 'M4 5h16v11H9l-5 4z', prog: 'M4 5h7v5H4zM13 5h7v5h-7zM8.5 14h7v5h-7zM7.5 10v2h9v-2M12 12v2', dots: 'M5 12h.01M12 12h.01M19 12h.01', send: 'M5 12h14M13 6l6 6-6 6', ticket: 'M3 5h18v4H3zM3 11h18v4H3z',
|
|
20
25
|
};
|
|
21
26
|
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
27
|
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
28
|
const dotOf = (st) => ({ needs: 'you', blocked: 'late', working: 'ok', wait: 'none' }[st] || 'none');
|
|
24
29
|
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
30
|
|
|
26
|
-
/* ── one row ── */
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
/* ── one row (HvAC .row, .kid) ── */
|
|
32
|
+
/* The mark says what a row is, by shape (Wawan on the canvas, 2026-10-23): a check box is a task (amber when late), a dot is a session or a
|
|
33
|
+
* next step (blue: it waits on you; amber: it is blocked; a ring: it runs), a clock is a meeting. A row is one line: the words are in the
|
|
34
|
+
* mark's and the row's accessible names, and the detail opens on a press (summary first). */
|
|
35
|
+
const RING = { needs: 'Waits on you', blocked: 'Blocked, waits on you', working: 'Running' };
|
|
36
|
+
function markHtml(r) {
|
|
37
|
+
if (r.kind === 'meeting') return `<span class="hv-mk" role="img" aria-label="Meeting">${svg(P.clock, 15)}</span>`;
|
|
38
|
+
const st = r.state === 'needs' || r.state === 'blocked' || r.state === 'working' ? r.state : '';
|
|
39
|
+
return st ? `<span class="hv-mk"><span class="hv-d${st === 'blocked' ? ' am' : st === 'working' ? ' run' : ''}" role="img" aria-label="${RING[st]}"></span></span>` : '<span class="hv-mk"></span>';
|
|
40
|
+
}
|
|
41
|
+
function checkHtml(r) {
|
|
42
|
+
const what = (r.mine === false ? 'Task, waits on someone else' : 'Your task') + (r.late ? ', late' : r.hint ? ', ' + r.hint : '');
|
|
43
|
+
if (r.done) return `<span class="hv-mk"><span class="hv-ck on" role="img" aria-label="Done">${svg(P.check, 11)}</span></span>`;
|
|
44
|
+
if (r.mine === false && r.kind === 'task') return `<span class="hv-mk"><span class="hv-ck wait" role="img" aria-label="${esc(what)}"></span></span>`;
|
|
45
|
+
return `<button type="button" class="hv-mk hm-ck" data-hm-check="${esc(r.id)}" aria-label="${esc(what)}. Mark ${esc(r.name)} done" title="Mark done"><span class="hv-ck${r.late ? ' late' : ''}"></span></button>`;
|
|
31
46
|
}
|
|
32
|
-
|
|
47
|
+
const isCheck = (r) => r.check || r.kind === 'task' || r.done;
|
|
48
|
+
const track = (at, label) => (at < 0 ? '' : `<span class="hv-mt" role="img" aria-label="${esc(label)}">${STEPS.map((x, i) => `<i class="${[i < at ? 'on' : i === at ? 'now' : '', x.ms ? 'ms' : ''].filter(Boolean).join(' ')}"></i>`).join('')}</span>`);
|
|
49
|
+
const clock = (when) => (when ? `<span class="hv-st">${svg(P.clock, 13)}${esc(String(when).split(' ')[0])}</span>` : '');
|
|
50
|
+
/** A row of the list: a next step, a task, a note, a mention, a session or a meeting. o: { sel, kid } */
|
|
33
51
|
export function rowHtml(r, o) {
|
|
34
52
|
const sel = o.sel === r.id;
|
|
35
|
-
const cls = ['hm-r', '
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
53
|
+
const cls = ['hm-r', 'hv-r', o.kid ? 'kid' : '', sel ? 'sel' : '', 'st-' + (r.state || 'quiet'), r.kind === 'task' ? 'task' : '', r.kind === 'item' ? 'item' : '', r.done ? 'done' : ''].filter(Boolean).join(' ');
|
|
54
|
+
const lead = isCheck(r) ? checkHtml(r) : '';
|
|
55
|
+
// ending a session and putting a next step off stay on the row, shown on the row that is open (the frame draws neither)
|
|
56
|
+
const end = !sel ? '' : r.kind === 'session' && r.sid ? `<button type="button" class="ut-ib hm-x" data-hm-end="${esc(r.id)}" aria-label="End ${esc(r.name)}" title="End this session">${svg(P.x, 14)}</button>`
|
|
57
|
+
: r.kind === 'need' && r.row && r.row.kind !== 'source' ? `<button type="button" class="ut-ib 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>` : '';
|
|
58
|
+
const link = r.link && r.kind === 'loose-rec' ? '<span class="hv-st">Link it</span>' : '';
|
|
59
|
+
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"' : ''}${r.hint ? ` title="${esc(r.hint)}"` : ''}>${lead ? '' : markHtml(r)}`
|
|
60
|
+
+ `<span class="hm-rt"><b>${esc(r.name)}</b></span>${clock(r.when || whenOf(r))}${link}</button>${end}</div>`;
|
|
61
|
+
}
|
|
62
|
+
/** The chat's header line on a desktop (HvACDesk .ch): the open row's mark, its title and the chip of where it sits (the initiative's stage
|
|
63
|
+
* track and name, or the program's tile and name). h: { row, title, scope, at, stage, prog }. A chip that repeats the title is left out, and
|
|
64
|
+
* the initiative's own chat shows its track after the title instead (say it once). */
|
|
65
|
+
export function chatHeadHtml(h) {
|
|
66
|
+
if (!h || !h.title) return '';
|
|
67
|
+
const r = h.row;
|
|
68
|
+
const mk = !r ? '' : isCheck(r) ? `<span class="hv-mk"><span class="hv-ck${r.late ? ' late' : ''}" role="img" aria-label="${r.late ? 'Task, late' : 'Task'}"></span></span>` : markHtml(r.kind === 'ini' && r.yours && r.state !== 'blocked' ? { state: 'needs' } : r);
|
|
69
|
+
const lead = h.prog ? `<span class="hv-tl tp sm" aria-hidden="true">${svg(P.layers, 13)}</span>` : '';
|
|
70
|
+
const same = !h.scope || h.scope === h.title;
|
|
71
|
+
const chip = same ? '' : `<span class="hm-chs" title="In ${esc(h.scope)}">${h.prog ? svg(P.layers, 13) : track(h.at == null ? -1 : h.at, h.stage || '')}<span>${esc(h.scope)}</span></span>`;
|
|
72
|
+
return `${mk}${same ? lead : ''}<b class="hm-chb">${esc(h.title)}</b>${same && !h.prog ? track(h.at == null ? -1 : h.at, h.stage || '') : ''}${chip}`;
|
|
49
73
|
}
|
|
50
|
-
/** An initiative row: the
|
|
74
|
+
/** An initiative row: its mark, its title, the count of what is yours while it is folded, the stage track, and a chevron when something
|
|
75
|
+
* sits under it. The title opens the initiative; the chevron shows or hides its sessions, next steps, tasks and meetings. */
|
|
51
76
|
function iniHtml(r, o) {
|
|
52
77
|
const open = o.isOpen(r.id);
|
|
53
78
|
const all = o.tasksOpen ? o.tasksOpen(r.id) : false, hid = r.kids.filter((k) => k.extra).length;
|
|
54
79
|
const kids = all ? r.kids : r.kids.filter((k) => !k.extra);
|
|
55
|
-
const more = hid ? `<button type="button" class="
|
|
56
|
-
const nest = open ? `<div class="hm-nest" role="group" aria-label="In ${esc(r.name)}">${kids.map((k) => rowHtml(k, { ...o, kid: true })).join('')
|
|
57
|
-
|
|
58
|
-
|
|
80
|
+
const more = hid ? `<button type="button" class="hv-fold kid" data-hm-tasks="${esc(r.id)}" aria-expanded="${all}"><span class="hv-mk"></span>${all ? 'Fewer' : hid + ' more'}${svg(all ? P.chevU : P.chevD, 15)}</button>` : '';
|
|
81
|
+
const nest = open ? `<div class="hm-nest" role="group" aria-label="In ${esc(r.name)}">${kids.map((k) => rowHtml(k, { ...o, kid: true })).join('')}${more}</div>` : '';
|
|
82
|
+
const badge = !open && r.yours ? `<span class="hv-c" role="img" aria-label="${r.yours === 1 ? '1 is yours' : r.yours + ' are yours'}">${r.yours}</span>` : '';
|
|
83
|
+
const chev = r.kids.length ? `<button type="button" class="hv-xc" 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, 15)}</button>` : '<span class="hv-xc" aria-hidden="true"></span>';
|
|
84
|
+
return `<div class="hm-r hv-r ini st-${esc(r.state)}${o.sel === r.id ? ' sel' : ''}" data-id="${esc(r.id)}"><button type="button" class="hm-rm" data-hm-sel="${esc(r.id)}" title="${esc(r.hint)}">${markHtml(r.yours && r.state !== 'blocked' ? { state: 'needs' } : r)}`
|
|
85
|
+
+ `<span class="hm-rt"><b>${esc(r.name)}</b></span>${badge}${track(r.at, r.stage)}</button>${chev}</div>${nest}`;
|
|
59
86
|
}
|
|
60
87
|
|
|
61
|
-
/* ── a group ── */
|
|
88
|
+
/* ── a group (HvAC .pg, .card; PgHomePhone .psub) ── */
|
|
89
|
+
const dots = (g) => (g.goals && g.goals.n ? `<span class="hv-gd" role="img" aria-label="${esc(g.goals.text)}">${g.goals.dots.map((ok) => `<i${ok ? '' : ' class="off"'}></i>`).join('')}</span>` : '');
|
|
90
|
+
const nd = (g) => (g.yours ? '<span class="hv-nd"></span>' : g.late ? '<span class="hv-nd am"></span>' : '');
|
|
91
|
+
const yoursWords = (g) => (g.yours ? (g.yours === 1 ? '1 is yours' : g.yours + ' are yours') : '');
|
|
62
92
|
function productHtml(g, o) {
|
|
63
93
|
const open = o.pOpen(g);
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
if (!open) return `<section class="hm-pg" aria-label="${esc(g.name)}">${head}</section>`;
|
|
94
|
+
// open: the goal dots; folded: the tile's dot says something in it is yours (blue) or late (amber). No counts in words (HvAC)
|
|
95
|
+
const say = [g.name, open ? (g.goals && g.goals.n ? g.goals.text : '') : [plural(g.count, 'initiative', 'initiatives'), yoursWords(g)].filter(Boolean).join(', ')].filter(Boolean).join(', ');
|
|
96
|
+
const head = `<button type="button" class="hv-gh${open ? '' : ' closed'}" data-hm-pg="${esc(g.key)}" aria-expanded="${open}" aria-label="${esc(say)}. ${open ? 'Close' : 'Open'} the group">`
|
|
97
|
+
+ `<span class="hv-tl t${g.tone}" aria-hidden="true">${esc(g.initials)}${open ? '' : nd(g)}</span><b>${esc(g.name)}</b>${open ? dots(g) : ''}<span class="hv-cv">${svg(open ? P.chevD : P.chevR, 16)}</span></button>`;
|
|
98
|
+
if (!open) return `<section class="hm-pg hv-g" aria-label="${esc(g.name)}">${head}</section>`;
|
|
69
99
|
const pinned = (x) => (o.pin.has(x.key) ? 0 : 1);
|
|
70
100
|
const flat = g.flat.slice().sort((a, b) => pinned(a) - pinned(b)).map((r) => rowHtml(r, o)).join('');
|
|
71
101
|
const QUIET = 3;
|
|
@@ -73,14 +103,38 @@ function productHtml(g, o) {
|
|
|
73
103
|
const rest = restAll ? g.rest : g.rest.slice(0, Math.max(0, QUIET - g.inis.length));
|
|
74
104
|
const more = g.rest.length - rest.length;
|
|
75
105
|
const body = flat + g.inis.concat(rest).map((r) => iniHtml(r, o)).join('')
|
|
76
|
-
+ (more > 0 ? `<button type="button" class="
|
|
77
|
-
: restAll && g.rest.length > QUIET ? `<button type="button" class="
|
|
78
|
-
return `<section class="hm-pg" aria-label="${esc(g.name)}">${head}
|
|
106
|
+
+ (more > 0 ? `<button type="button" class="hv-fold" data-hm-rest="${esc(g.key)}" aria-expanded="false" aria-label="${more} more ${more === 1 ? 'initiative' : 'initiatives'} with nothing today. Show"><span class="hv-mk"></span>${more} more${svg(P.chevD, 16)}</button>`
|
|
107
|
+
: restAll && g.rest.length > QUIET ? `<button type="button" class="hv-fold" data-hm-rest="${esc(g.key)}" aria-expanded="true"><span class="hv-mk"></span>Fewer${svg(P.chevU, 16)}</button>` : '');
|
|
108
|
+
return `<section class="hm-pg hv-g" aria-label="${esc(g.name)}">${head}<div class="hv-card">${body || `<p class="hm-none">${g.primary ? 'No initiative is open on this board.' : 'Nothing is open here.'}</p>`}</div></section>`;
|
|
79
109
|
}
|
|
110
|
+
/** A program's group (canvas PgHomePhone, PgHomeDesk): above the products. Its header: the program tile, the name, the next milestone's
|
|
111
|
+
* diamond with its date and one small diamond per initiative it waits on (filled when that initiative is past the Deliver milestone), a chevron.
|
|
112
|
+
* The title opens the program panel on the Board; the chevron folds the group. Inside: the program's own tasks first, then a sub-heading
|
|
113
|
+
* per product with that product's initiatives. */
|
|
114
|
+
function programHtml(g, o) {
|
|
115
|
+
const open = o.pOpen(g);
|
|
116
|
+
const nx = g.st && g.st.next;
|
|
117
|
+
const ms = nx ? `<span class="hv-msd${nx.late ? ' late' : ''}"><span class="hv-dm"></span>${esc(nx.day || nx.name)}${nx.n ? `<span class="hv-rd">${Array.from({ length: nx.n }, (_, i) => `<i${i < nx.ready ? ' class="on"' : ''}></i>`).join('')}</span>` : ''}</span>` : '';
|
|
118
|
+
const line = nx ? 'Next milestone ' + nx.name + (nx.day ? ', ' + nx.day : '') + (nx.late ? ', late' : '') + (nx.n ? ', ' + nx.ready + ' of ' + nx.n + (nx.n === 1 ? ' initiative' : ' initiatives') + ' ready' : '') : 'No open milestone';
|
|
119
|
+
const head = `<div class="hv-gh hv-prg${open ? '' : ' closed'}"><button type="button" class="hv-pt" data-hm-prog="${esc(g.program.id)}" aria-label="Open ${esc(g.name)}, a program">`
|
|
120
|
+
+ `<span class="hv-tl tp" aria-hidden="true">${svg(P.layers, 16)}${open ? '' : nd(g)}</span><b>${esc(g.name)}</b></button>`
|
|
121
|
+
+ `<button type="button" class="hv-pf" data-hm-pg="${esc(g.key)}" aria-expanded="${open}" aria-label="${esc(g.name)}. ${esc(line)}${g.yours ? '. ' + yoursWords(g) : ''}. ${open ? 'Close' : 'Open'} the group">${ms}<span class="hv-cv">${svg(open ? P.chevD : P.chevR, 16)}</span></button></div>`;
|
|
122
|
+
if (!open) return `<section class="hm-pg hv-g prg" aria-label="${esc(g.name)}">${head}</section>`;
|
|
123
|
+
const body = g.tasks.map((t) => rowHtml(t, o)).join('')
|
|
124
|
+
+ g.subs.map((x) => `<div class="hv-psub" role="heading" aria-level="3"><span class="hv-st2 t${x.tone}" aria-hidden="true">${esc(x.initials)}</span>${esc(x.name)}</div>${x.inis.map((r) => iniHtml(r, o)).join('')}`).join('');
|
|
125
|
+
return `<section class="hm-pg hv-g prg" aria-label="${esc(g.name)}">${head}<div class="hv-card">${body}</div></section>`;
|
|
126
|
+
}
|
|
127
|
+
/** "Not in an initiative" (HvAC .lh): a line under the groups. Folded it shows a blue dot when a row waits on you, an amber square when one
|
|
128
|
+
* of your own is late, and the count; open, the rows in a card. */
|
|
80
129
|
function looseHtml(g, o) {
|
|
81
130
|
if (!g.rows.length) return '';
|
|
82
|
-
|
|
131
|
+
const open = o.pOpen(g), S2 = g.sig || {};
|
|
132
|
+
const say = [S2.sessions ? plural(S2.sessions, 'session', 'sessions') + (S2.needs ? ', ' + S2.needs + ' waits on you' : '') : S2.needs ? S2.needs + ' waits on you' : '', S2.tasks ? plural(S2.tasks, 'task', 'tasks') + (S2.late ? ', ' + S2.late + ' late' : '') : ''].filter(Boolean).join('; ') || String(g.n);
|
|
133
|
+
const sig = open ? '' : (S2.needs ? '<span class="hv-d sm" aria-hidden="true"></span>' : '') + (S2.late ? '<span class="hv-lt" aria-hidden="true"></span>' : '') + g.n;
|
|
134
|
+
return `<section class="hm-pg hv-g loose" aria-label="${esc(g.name)}"><button type="button" class="hv-lh" data-hm-pg="${esc(g.key)}" aria-expanded="${open}" aria-label="${esc(g.name)}: ${esc(say)}. ${open ? 'Close' : 'Open'}">${esc(g.name)}<span class="n">${sig}${svg(open ? P.chevD : P.chevR, 15)}</span></button>`
|
|
135
|
+
+ (open ? `<div class="hv-card">${g.rows.map((r) => rowHtml(r, o)).join('')}</div>` : '') + '</section>';
|
|
83
136
|
}
|
|
137
|
+
const plural = (n, one, many) => n + ' ' + (n === 1 ? one : many);
|
|
84
138
|
|
|
85
139
|
/* ── the Today card ── */
|
|
86
140
|
/** The card's HTML. T is todayCard(); greet the greeting; sub the line under it when the day has no meeting. */
|
|
@@ -115,33 +169,57 @@ export function todayHtml(T, o) {
|
|
|
115
169
|
}
|
|
116
170
|
|
|
117
171
|
/* ── the whole column ── */
|
|
118
|
-
|
|
172
|
+
const MONTH = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
|
|
173
|
+
const WEEKDAY = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
|
|
174
|
+
const MOMENT = new Set(['rec', 'soon', 'live', 'eod', 'review']);
|
|
175
|
+
/** M is homeList(); T todayCard(); o: { sel, isOpen, pOpen, restOpen, pin, avHtml, ready, err, product (the picked key), review, phone, day (Your day is open) } */
|
|
119
176
|
export function listHtml(M, T, o) {
|
|
120
177
|
const many = M.products.length > 1;
|
|
121
178
|
const picked = o.product ? M.products.find((p) => p.key === o.product) : null;
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
179
|
+
const flt = M.filter !== 'today' ? M.filters.find((f) => f.key === M.filter) : null;
|
|
180
|
+
const head = `<div class="hm-hd hv-bar"><button type="button" class="hv-hi" data-hm-day aria-expanded="${!!o.day}" aria-label="${esc(M.word || 'Today')}. Open your day"><b>${esc(M.word || 'Today')}</b>${svg(P.chevD, 18)}</button>`
|
|
181
|
+
+ (many ? `<button type="button" class="hv-pk" data-hm-pick aria-haspopup="menu" aria-expanded="false" aria-label="Switch product">${esc(picked ? picked.name : 'All')}${svg(P.chevD, 14)}</button>` : '')
|
|
182
|
+
+ (o.phone ? '' : `<button type="button" class="ut-ib hv-ib${flt ? ' on' : ''}" data-hm-flt aria-haspopup="menu" aria-label="Show: Today, Kept or Done${flt ? '. Now ' + esc(flt.label) : ''}" title="Show: Today, Kept or Done">${svg(P.filter, 18)}</button>`)
|
|
183
|
+
+ `<button type="button" class="ut-ib hv-ib" data-hm-new aria-haspopup="menu" aria-label="New" title="New">${svg(P.plus, 20)}</button></div>`
|
|
184
|
+
+ (M.yours ? `<p class="hv-sub">${M.yours} ${M.yours === 1 ? 'is' : 'are'} yours</p>` : '');
|
|
185
|
+
// the Today card only while the day has a moment; the plain day (its meetings and load) is in Your day
|
|
186
|
+
const card = MOMENT.has(T.mode) ? todayHtml(T, { greet: M.greet, sub: '', phone: o.phone }) : '';
|
|
128
187
|
if (!o.ready) return head + card + '<p class="hm-none" role="status">Reading your work.</p>';
|
|
129
188
|
const errLine = `<p class="hm-none" role="status">Home could not read the repository: ${esc(o.err)}.</p>`;
|
|
130
189
|
if (o.err && !M.groups.some((g) => (g.kind === 'product' && g.count) || (g.rows && g.rows.length))) return head + card + errLine;
|
|
131
190
|
// 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
|
|
132
191
|
let body = o.err && !M.groups.some((g) => g.kind === 'product' && (g.count || g.flat.length)) ? errLine : '';
|
|
133
192
|
if (M.list) {
|
|
134
|
-
body = `<section class="hm-pg" aria-label="${esc(M.list.title)}"><div class="
|
|
135
|
-
+
|
|
193
|
+
body = `<section class="hm-pg hv-g" aria-label="${esc(M.list.title)}"><div class="hv-lh">${esc(M.list.title)}<span class="n">${M.list.rows.length || ''}</span></div>`
|
|
194
|
+
+ `<div class="hv-card">${M.list.rows.map((r) => rowHtml(r, o)).join('') || `<p class="hm-none">${esc(M.list.empty)}</p>`}</div></section>`;
|
|
136
195
|
} else {
|
|
137
|
-
|
|
138
|
-
if (
|
|
139
|
-
body += M.groups.map((g) => (g.kind === 'product' ? productHtml(g, o) : looseHtml(g, o))).join('');
|
|
140
|
-
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>';
|
|
196
|
+
body += M.groups.map((g) => (g.kind === 'product' ? productHtml(g, o) : g.kind === 'program' ? programHtml(g, o) : looseHtml(g, o))).join('');
|
|
197
|
+
if (!M.groups.some((g) => (g.kind === 'product' && (g.count || g.flat.length)) || g.kind === 'program' || (g.rows && g.rows.length))) body += '<p class="hm-none">Nothing is open. A new initiative or a task you add shows here.</p>';
|
|
141
198
|
// the capture box shows only after New → A task → Not in an initiative (o.cap); an initiative's task is added in its Tasks view
|
|
142
199
|
if (o.cap) body += `<form class="hm-cap" id="hmCapF"><label class="vh" for="hmCap">Add a task to your own list</label><input id="hmCap" autocomplete="off" maxlength="250" placeholder="A task for your own list. Esc to cancel">`
|
|
143
200
|
+ (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>';
|
|
144
|
-
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>`;
|
|
145
201
|
}
|
|
146
|
-
return head + card +
|
|
202
|
+
return head + card + `<div class="hv-body">${body}</div>`;
|
|
203
|
+
}
|
|
204
|
+
/** Your day (HvAOpen): a sheet over the list from "Good morning". The date, the day's meetings and their load (a press opens the calendar,
|
|
205
|
+
* or the day's moment card on a phone), Your move with its count, This week with the Weekly review (and the untouched work it looks at).
|
|
206
|
+
* M is homeList(); T todayCard(); R reviewModel(); o: { sel, now } */
|
|
207
|
+
export function dayHtml(M, T, R, o) {
|
|
208
|
+
const d = new Date(o.now || Date.now());
|
|
209
|
+
const date = WEEKDAY[d.getDay()] + ' ' + d.getDate() + ' ' + MONTH[d.getMonth()];
|
|
210
|
+
const Ld = T.load || null;
|
|
211
|
+
const load = Ld && Ld.n ? `<button type="button" class="hv-day" data-hm-tc="cal" aria-label="${esc(Ld.sub)}. ${o.phone ? 'Open your day' : 'Open the calendar'}"><span class="sub">${esc(Ld.sub)}</span>`
|
|
212
|
+
+ `<span class="hm-load" aria-hidden="true">${Ld.segs.map((x) => `<i class="${x.m ? 'm' : ''}${x.now ? ' n' : ''}" data-f="${Math.max(1, x.flex)}"></i>`).join('')}</span><span class="hm-lx" aria-hidden="true"><span>09</span><span>12</span><span>15</span><span>18</span></span></button>` : '';
|
|
213
|
+
const clear = T.mode === 'clear' ? `<p class="hv-clear" role="status">${esc(T.line)}</p>` : '';
|
|
214
|
+
const row = (r) => `<div class="hm-r hv-r two${o.sel === r.id ? ' sel' : ''}" data-id="${esc(r.id)}"><button type="button" class="hm-rm" data-hm-sel="${esc(r.id)}">`
|
|
215
|
+
+ `<span class="hv-mk">${r.check ? `<span class="hv-ck${r.late ? ' late' : ''}" role="img" aria-label="Your task${r.late ? ', late' : ''}"></span>` : `<span class="hv-d${r.state === 'blocked' ? ' am' : ''}" role="img" aria-label="${r.state === 'blocked' ? 'Blocked, waits on you' : 'Waits on you'}"></span>`}</span>`
|
|
216
|
+
+ `<span class="hm-rt"><b>${esc(r.name)}</b>${r.when ? `<em>${svg(P.clock, 13)} ${esc(r.when)}</em>` : r.sub ? `<em>${esc(r.sub)}</em>` : ''}</span></button></div>`;
|
|
217
|
+
const move = M.move.length ? `<div class="hv-sh">Your move<span class="r">${M.move.length}</span></div><div class="hv-card">${M.move.map(row).join('')}</div>` : '';
|
|
218
|
+
const un = M.untouched && M.untouched.n;
|
|
219
|
+
const rsub = R && R.started && !R.done ? 'Step ' + (R.at + 1) + ' of 4' : [un ? 'Untouched 14+ days' : '', M.untouched ? M.untouched.day : 'Fri'].filter(Boolean).join(' · ');
|
|
220
|
+
const week = `<div class="hv-sh">This week</div><div class="hv-card"><div class="hm-r hv-r two${o.sel === 'review' ? ' sel' : ''}" data-id="review"><button type="button" class="hm-rm" data-hm-review aria-label="Weekly review: ${esc(rsub)}. Open">`
|
|
221
|
+
+ `<span class="hv-mk">${svg(P.calendar, 16)}</span><span class="hm-rt"><b>Weekly review</b><em>${esc(rsub)}</em></span><span class="hv-cv">${svg(P.chevR, 16)}</span></button></div></div>`;
|
|
222
|
+
return `<button type="button" class="hv-scrim" data-hm-dayx tabindex="-1" aria-label="Close your day"></button><section class="hv-sheet" role="dialog" aria-label="Your day" tabindex="-1"><div class="hv-grab" aria-hidden="true"></div>`
|
|
223
|
+
+ `<div class="hv-sbar"><b>Your day</b><button type="button" class="ut-ib hv-ib" data-hm-dayx aria-label="Close" title="Close">${svg(P.x, 20)}</button></div>`
|
|
224
|
+
+ `<div class="hv-sc"><div class="hv-sh">${esc(date)}</div>${load}${clear}${move}${week}</div></section>`;
|
|
147
225
|
}
|