create-pmos 0.423.0 → 0.425.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 +25 -25
- 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 +41 -26
- package/workspace/briefing-premium-board-test.js +7 -4
- package/workspace/briefing-premium-insights-test.js +31 -15
- package/workspace/briefing-premium-products-test.js +62 -46
- package/workspace/changelog.json +24 -0
- package/workspace/guide/briefing-premium.md +3 -2
- package/workspace/guide/claude-proposes.md +37 -0
- package/workspace/guide/home.md +2 -2
- package/workspace/guide/index.md +2 -0
- package/workspace/guide/notes.md +39 -1
- package/workspace/guide/present-in-a-meeting.md +57 -0
- package/workspace/guide/programs.md +2 -2
- package/workspace/home-pill-test.js +138 -0
- package/workspace/lib/briefing-premium-products.js +18 -4
- package/workspace/lib/headless.js +14 -1
- package/workspace/lib/meeting-focus.js +64 -14
- package/workspace/lib/pmos-verbs.js +3 -0
- package/workspace/lib/proposal-runs.js +148 -0
- package/workspace/lib/proposals.js +370 -0
- package/workspace/lib/propose-cli.js +96 -0
- package/workspace/lib/route-modules.js +1 -0
- package/workspace/lib/routes-board-premium.js +11 -0
- package/workspace/lib/routes-boards.js +1 -1
- package/workspace/lib/routes-briefing-premium.js +19 -0
- package/workspace/lib/routes-meeting-focus.js +28 -6
- package/workspace/lib/routes-proposals.js +325 -0
- package/workspace/lib/routes-task-links.js +35 -28
- package/workspace/lib/settings-store.js +2 -1
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-board-actions-test.js +2 -2
- package/workspace/premium-briefing-depth-test.js +1 -1
- package/workspace/premium-rec-now-test.js +153 -0
- package/workspace/premium-rec-tab-test.js +167 -0
- package/workspace/public/pm/bd-asks.js +3 -0
- package/workspace/public/pm/cozy-aud.css +9 -0
- package/workspace/public/pm/cozy-aud.js +80 -0
- package/workspace/public/pm/cozy-live-pill.js +3 -0
- package/workspace/public/pm/cozy-pick.css +41 -0
- package/workspace/public/pm/cozy-pick.js +134 -0
- package/workspace/public/pm/cozy-rec-bridge.js +32 -0
- package/workspace/public/pm/cozy-rec-now.css +104 -0
- package/workspace/public/pm/cozy-rec-now.js +330 -0
- package/workspace/public/pm/cozy-rec-present.css +69 -0
- package/workspace/public/pm/cozy-rec-present.js +467 -0
- package/workspace/public/pm/cozy-rec-tab.css +90 -0
- package/workspace/public/pm/cozy-rec-tab.js +219 -0
- package/workspace/public/pm/cozy-settings.js +8 -2
- package/workspace/public/pm/cozy-today.css +23 -0
- package/workspace/public/pm/cozy-viewer.js +14 -3
- package/workspace/public/pm/cozy-vw-shell.css +8 -0
- package/workspace/public/pm/home-app.js +56 -27
- package/workspace/public/pm/home-list.js +17 -10
- package/workspace/public/pm/home-more.js +2 -31
- package/workspace/public/pm/home-task.js +2 -1
- package/workspace/public/pm/home-today.js +69 -19
- package/workspace/public/pm/ini-groups.js +30 -5
- package/workspace/public/pm/ini-links.js +6 -48
- package/workspace/public/pm/ini-props.js +218 -0
- package/workspace/public/pm/ini-view-model.js +6 -1
- package/workspace/public/pm/ini-view.css +47 -0
- package/workspace/public/pm/ini-view.js +23 -6
- package/workspace/public/pm/live-model.js +1 -1
- package/workspace/public/pm/premium-board.js +56 -25
- package/workspace/public/pm/premium-insights.js +42 -24
- package/workspace/public/pm/premium-meeting.js +17 -4
- package/workspace/public/pm/premium-mtg-present.js +4 -3
- package/workspace/public/pm/premium-report-read.js +2 -0
- package/workspace/public/pm/premium-vw-item.js +2 -1
- package/workspace/public/pm/premium-vw-mtg.js +15 -7
- package/workspace/public/pm/rec-state.js +13 -5
- package/workspace/public/pm/rec-tab-core.js +92 -0
- package/workspace/public/pm/task-card.css +13 -0
- package/workspace/public/pm/task-card.js +37 -2
- package/workspace/public/pm/view-notes.js +9 -0
- package/workspace/public/premium-aud.html +22 -0
- package/workspace/public/premium-board.html +1 -0
- package/workspace/public/premium-insights.html +2 -1
- package/workspace/public/premium-rec.html +30 -0
- package/workspace/public/premium.html +1 -0
- package/workspace/rec-present-test.js +229 -0
- package/workspace/server.js +46 -3
- package/workspace/skills/initiative-propose.skill +45 -0
- package/workspace/stage-card-test.js +1 -1
- package/workspace/task-links-test.js +26 -14
- package/workspace/test-lists/claude-proposes.json +5 -0
- package/workspace/test-lists/home-sessions-pill.json +6 -0
- package/workspace/test-lists/rec-now.json +6 -0
- package/workspace/test-lists/rec-present.json +13 -0
- package/workspace/test-lists/recording-tab.json +13 -0
- package/workspace/tk-tasks-test.js +13 -0
|
@@ -16,11 +16,13 @@
|
|
|
16
16
|
* press (pmPost). Nothing here opens the old dialog or links to the console. */
|
|
17
17
|
import { mountNav } from './cozy-nav.js';
|
|
18
18
|
import { mountLivePill } from './cozy-live-pill.js';
|
|
19
|
+
import { ownTab, bring, tabUrl } from './rec-tab-core.js';
|
|
19
20
|
import * as VW from './cozy-viewer.js';
|
|
20
21
|
import { pmGet, pmPost, pmHeaders } from './http.js';
|
|
21
22
|
import * as H from './home-data.js';
|
|
22
23
|
import { mountChat, avHtml } from './home-chat.js';
|
|
23
24
|
import * as MORE from './home-more.js';
|
|
25
|
+
import * as PP from './cozy-pick.js'; // the one product picker Home, Board and Insights share (batch 12 item 5)
|
|
24
26
|
import { headModel, STEPS } from './premium-initiative-head.js';
|
|
25
27
|
import * as SC from './home-stage-card.js'; // the initiative's stage card D
|
|
26
28
|
import * as WFM from './ini-wf-model.js'; // D99: the workflow an initiative runs (kind line, usual days)
|
|
@@ -93,8 +95,9 @@ const S = {
|
|
|
93
95
|
iniWs: {}, // another product's initiative found by a read (loadIni), by id: the workspace it was found in
|
|
94
96
|
doneOpen: false, stepsMore: false, sheet: false, rec: {}, pin: new Set(JSON.parse(store.get('pmos.home.pin') || '[]')),
|
|
95
97
|
cardFold: store.get('pmos.home.cardfold') === '1', // the card's checklist folded to one line (AgInitSpec), kept in this browser
|
|
96
|
-
// the one list (premium-uncovered-features): the filter,
|
|
97
|
-
|
|
98
|
+
// the one list (premium-uncovered-features): the filter, which groups and initiatives are open, kept in this browser. The products shown are
|
|
99
|
+
// the one saved pick (S.D.pick, GET /api/briefing-premium/products), never kept here (batch 12 item 5)
|
|
100
|
+
filter: 'today', kidsOff: new Set(), rest: new Set(), cap: false, day: false, ses: null,
|
|
98
101
|
pg: (() => { try { return JSON.parse(store.get('pmos.home.pg') || '{}') || {}; } catch { return {}; } })(),
|
|
99
102
|
eodHidden: store.get('pmos.home.eod') === L.dayOf(), phoneChat: false,
|
|
100
103
|
};
|
|
@@ -144,10 +147,10 @@ async function getRetry(path, tries = 20) {
|
|
|
144
147
|
return { ok: false, error: 'still reading' };
|
|
145
148
|
}
|
|
146
149
|
async function load() {
|
|
147
|
-
const [brief, board, ses, desk, today, sch, work, day, rev, progs] = await Promise.all([
|
|
150
|
+
const [brief, board, ses, desk, today, sch, work, day, rev, progs, , pick] = await Promise.all([
|
|
148
151
|
getRetry('/api/briefing-premium' + wsQ()), getRetry('/api/board-premium' + wsQ() + boardQ(WS ? '&' : '?')), pmGet('/api/sessions'), pmGet('/api/home-desk' + wsQ()),
|
|
149
152
|
pmGet('/api/brief-page' + wsQ()), pmGet('/api/schedules' + wsQ()), pmGet('/api/my-work-premium' + wsQ()), pmGet('/api/phone-day'), pmGet('/api/home-review' + wsQ()),
|
|
150
|
-
pmGet('/api/programs'), MEN.load(menCtx()),
|
|
153
|
+
pmGet('/api/programs'), MEN.load(menCtx()), PP.readPick(),
|
|
151
154
|
]);
|
|
152
155
|
const D = S.D;
|
|
153
156
|
D.brief = brief && brief.ok && brief.model ? brief.model : null;
|
|
@@ -160,6 +163,8 @@ async function load() {
|
|
|
160
163
|
D.phoneDay = day && day.ok ? day : null; // what finished today, the recap and tomorrow (the end-of-day card, the Done filter)
|
|
161
164
|
D.review = rev && rev.ok ? rev : null; // this week's review (GET /api/home-review)
|
|
162
165
|
D.programs = progs && progs.ok ? progs.programs : []; // programs above initiatives, across products (GET /api/programs)
|
|
166
|
+
D.pick = pick || D.pick || null; // the one product pick (the chip): which products are on Home and read
|
|
167
|
+
if (D.pick && WS) D.pick = { ...D.pick, products: D.pick.products.map((p) => ({ ...p, on: p.ws === WS })) }; // ?ws= is a one-off view of that product
|
|
163
168
|
D.now = Date.now();
|
|
164
169
|
D.err = [brief, board].filter((x) => !x || !x.ok).map((x) => (x && x.error) || 'the server did not answer');
|
|
165
170
|
const rows = H.boardRows(D);
|
|
@@ -264,17 +269,14 @@ function todayModel() {
|
|
|
264
269
|
return T;
|
|
265
270
|
}
|
|
266
271
|
function homeListHtml() {
|
|
267
|
-
const M = L.homeList(S.D, { now: NOW(), filter: S.filter
|
|
272
|
+
const M = L.homeList(S.D, { now: NOW(), filter: S.filter });
|
|
268
273
|
S.M = M;
|
|
269
274
|
const R = L.reviewModel(S.D, NOW());
|
|
270
|
-
// the first initiative where it is your turn shows what is under it, until the PM closes it
|
|
271
|
-
const firstTurn = M.groups.filter((g) => g.kind === 'product' || g.kind === 'program').flatMap((g) => g.inis).find((x) => x.turn);
|
|
272
|
-
const open = (id) => S.kids.has(id) || (!!firstTurn && firstTurn.id === id && !S.kidsOff.has(id));
|
|
273
275
|
// a group is open until the PM folds it; another product starts folded; "Not in an initiative" starts folded on a phone (HvAC, HvACDesk)
|
|
274
|
-
const pOpen = (g) => (g.key in S.pg ? !!S.pg[g.key] : g.kind === 'loose' ? !isPhone() : g.kind === 'program' || g.primary || M.products.length === 1
|
|
276
|
+
const pOpen = (g) => (g.key in S.pg ? !!S.pg[g.key] : g.kind === 'loose' ? !isPhone() : g.kind === 'program' || g.primary || M.products.length === 1);
|
|
275
277
|
return TD.listHtml(M, todayModel(), {
|
|
276
|
-
sel: S.sel || (S.ini && S.ini !== 'product' ? 'i:' + S.ini : null), selHead: S.head,
|
|
277
|
-
|
|
278
|
+
sel: S.sel || (S.ini && S.ini !== 'product' ? 'i:' + S.ini : null), selHead: S.head, ses: S.ses, pOpen, restOpen: (k) => S.rest.has(k), cap: S.cap, pin: S.pin, avHtml, ready: S.ready, err: S.D.err.length ? S.D.err[0] : '',
|
|
279
|
+
pick: S.D.pick, tones: pickTones(), review: R, mic: canDictate(), phone: isPhone(), day: S.day, top: S.ready ? RECROW.html() + MEN.rowHtml(S.D, { sel: S.sel }) : '',
|
|
278
280
|
});
|
|
279
281
|
}
|
|
280
282
|
/** Your day (XvAPhDay, was the HvAOpen sheet): "Good morning" opens it in the Viewer, shell A. Full screen on a phone, beside the chat on a
|
|
@@ -930,19 +932,28 @@ async function checkRow(id) {
|
|
|
930
932
|
toast('Done.');
|
|
931
933
|
await load();
|
|
932
934
|
}
|
|
933
|
-
/* the
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
const
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
935
|
+
/* the product picker (batch 12 item 5, canvas XhpA1Desk): the one list Home, Board and Insights share (pm/cozy-pick.js). Every registered
|
|
936
|
+
* product with its tile, name and one quiet line; the ticks apply when the list closes, and are saved for every page */
|
|
937
|
+
function pickTones() {
|
|
938
|
+
const P = S.D.pick; if (!P) return null;
|
|
939
|
+
// the tints Home's groups use: the board's own product first, then the registered order (home-list.js productsOf)
|
|
940
|
+
const own = ((S.D.board && S.D.board.board) || {}).ws || '';
|
|
941
|
+
return PP.tonesOf(P.products.map((p) => ({ ...p, primary: own ? p.ws === own : p.primary })));
|
|
942
|
+
}
|
|
943
|
+
function pickLine(ws) {
|
|
944
|
+
const M = S.M; if (!M) return '';
|
|
945
|
+
const p = M.products.find((x) => x.ws === ws); if (!p) return '';
|
|
946
|
+
const g = M.groups.find((x) => x.product && x.product.key === p.key);
|
|
947
|
+
const n = g ? g.count : ((p.model && p.model.initiatives && p.model.initiatives.list && p.model.initiatives.list.rows) || []).filter(H.OPEN).length;
|
|
948
|
+
// zero is silence: a part that is zero is left out
|
|
949
|
+
return [n ? n + (n === 1 ? ' initiative' : ' initiatives') : '', p.goals && p.goals.n ? p.goals.ok + ' of ' + p.goals.n + ' goals' : ''].filter(Boolean).join(' · ');
|
|
950
|
+
}
|
|
951
|
+
function pickProduct(chip) {
|
|
952
|
+
if (!S.D.pick) return;
|
|
953
|
+
PP.openPicker(chip, { P: S.D.pick, label: 'Products on Home', tones: pickTones(), lines: pickLine, onApply: async (on) => { const r = await PP.savePick(on); if (!r.ok) toast(r.error); } });
|
|
954
|
+
}
|
|
955
|
+
// a saved pick (from this chip or Settings): Home shows and reads the ticked products
|
|
956
|
+
addEventListener('pp:changed', (e) => { if (WS) { location.assign('/premium.html'); return; } S.D.pick = e.detail; drawList(); toast('Saved. Home, Board and Insights show the products you picked.'); load(); });
|
|
946
957
|
|
|
947
958
|
/* ── the Viewer: needs rows, the weekly update, the overview, files, people, routines ── */
|
|
948
959
|
let lastViewer = null;
|
|
@@ -1399,7 +1410,7 @@ document.addEventListener('keydown', (e) => { if (e.key === 'Escape' && !menuEl.
|
|
|
1399
1410
|
function moreMenu(anchor) {
|
|
1400
1411
|
const go = {
|
|
1401
1412
|
around: () => MORE.openAround(), inbox: () => MORE.openInbox(searchGo), eod: () => MORE.openEndOfDay(), cal: () => openCalendar(),
|
|
1402
|
-
rec: () => MORE.openRecorder(), search: () => MORE.openSearch(searchGo),
|
|
1413
|
+
rec: () => MORE.openRecorder(), search: () => MORE.openSearch(searchGo), sources: () => MORE.openSources(), settings: () => MORE.openSettings(),
|
|
1403
1414
|
};
|
|
1404
1415
|
menu(anchor, MORE.moreItems.map(([k, l]) => ({ label: l, go: go[k] })), 'Waiting for design');
|
|
1405
1416
|
}
|
|
@@ -1431,7 +1442,11 @@ $('#hmDesk').onclick = (e) => { if (S.sheet && e.target === $('#hmDesk')) sheet(
|
|
|
1431
1442
|
$('#hmList').onclick = (e) => { // delegated: every press on the list is a <button>
|
|
1432
1443
|
const b = e.target.closest('button'); if (!b) return;
|
|
1433
1444
|
const d = b.dataset;
|
|
1434
|
-
if (d.
|
|
1445
|
+
if (d.hmSes) { sesPill(d.hmSes === S.ses ? null : d.hmSes); return; } // an initiative's pill: what sits in it, under it (a sheet on a phone)
|
|
1446
|
+
if ('hmSesx' in d) { sesPill(null); return; }
|
|
1447
|
+
if (d.hmSesnew) { sesPill(null, false); newIn(d.hmSesnew); return; }
|
|
1448
|
+
if (S.ses && !b.closest('.hv-spp, .hv-sps')) sesPill(null, false); // a press anywhere else in the list closes it
|
|
1449
|
+
if (d.hmSel) { if (S.ses) sesPill(null, false); if (S.day) S.day = false; select(d.hmSel); return; }
|
|
1435
1450
|
if ('hrMentions' in d) { if (S.day) S.day = false; S.sel = 'mentions'; drawList(); MEN.openMentions(menCtx()); return; }
|
|
1436
1451
|
if ('hmDay' in d) { day(!S.day); return; }
|
|
1437
1452
|
if ('hmDayx' in d) { day(false); return; }
|
|
@@ -1459,9 +1474,23 @@ $('#hmList').onclick = (e) => { // delegated: every press on the list is a <bu
|
|
|
1459
1474
|
if ('hmMeet' in d) { const m = H.meetLineOf(S.D.today); if (m) openMeeting(m.meeting); return; }
|
|
1460
1475
|
if ('hmCal' in d) { openCalendar(); return; }
|
|
1461
1476
|
if ('hmRec' in d) { MORE.openRecorder().then(() => drawList()); return; }
|
|
1462
|
-
|
|
1477
|
+
// the pinned row is a snippet: a press brings the recording tab forward (rec-tab-core.js); where it cannot open, the meeting opens here
|
|
1478
|
+
if (d.hmRecopen) { if (!(ownTab() && bring(tabUrl(d.hmRecopen, { ws: WS || '' })))) openMeeting({ note: d.hmRecopen }); return; }
|
|
1463
1479
|
};
|
|
1464
1480
|
$('#hmList').addEventListener('keydown', (e) => { if (e.key === 'Escape' && e.target.id === 'hmCap' && S.cap) { e.stopPropagation(); S.cap = false; drawList(); } else if (e.key === 'Escape' && S.day) { e.stopPropagation(); day(false); } });
|
|
1481
|
+
/** Open (id) or close (null) the list behind an initiative's pill (batch 12 item 6). Closing gives the focus back to the pill, unless the
|
|
1482
|
+
* press that closed it goes somewhere else (back false). */
|
|
1483
|
+
function sesPill(id, back = true) {
|
|
1484
|
+
const was = S.ses;
|
|
1485
|
+
S.ses = id || null;
|
|
1486
|
+
drawList();
|
|
1487
|
+
const f = id ? $('#hmList .hv-spp .hm-rm, #hmList .hv-sps .hm-rm') : back && was ? $(`#hmList [data-hm-ses="${CSS.escape(was)}"]`) : null;
|
|
1488
|
+
if (f) f.focus();
|
|
1489
|
+
}
|
|
1490
|
+
// Escape closes it wherever the focus is (a redraw of the list can drop the focus to the page); a press outside the list closes it too
|
|
1491
|
+
window.addEventListener('keydown', (e) => { if (e.key === 'Escape' && S.ses && menuEl.hidden) { e.preventDefault(); e.stopPropagation(); sesPill(null); } }, true); // before the Viewer's own Escape
|
|
1492
|
+
// a press outside the list (the chat, the Viewer) closes an open pill list too
|
|
1493
|
+
document.addEventListener('pointerdown', (e) => { if (S.ses && !e.target.closest('#hmList')) sesPill(null, false); });
|
|
1465
1494
|
$('#hmList').addEventListener('submit', async (e) => { // the capture box: Enter adds the task
|
|
1466
1495
|
if (e.target.id !== 'hmCapF') return;
|
|
1467
1496
|
e.preventDefault();
|
|
@@ -54,13 +54,20 @@ export function goalsOf(model) {
|
|
|
54
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. */
|
|
55
55
|
const ACROSS = 'Across products';
|
|
56
56
|
const prodOf = (x) => (x && x.product && x.product !== ACROSS ? x.product : '');
|
|
57
|
-
/** The products the list shows, the board's own product first
|
|
57
|
+
/** The products the list shows, the board's own product first: only the ticked ones (the one product pick, batch 12 item 5: a registered
|
|
58
|
+
* product that is not ticked is not on Home). Each: { key, ws, name, initials, primary, model, goals, tone }. tone: the tile's tint, by the
|
|
59
|
+
* product's place with the board's own first, then the registered order (pm/cozy-pick.js tonesOf), so the chip and the group agree. */
|
|
60
|
+
/** The pick's unticked test: true for a registered product that is not ticked; a product the pick does not list is never hidden. */
|
|
61
|
+
const unticked = (D) => { const P = (D.pick && D.pick.products) || (D.brief && D.brief.products && D.brief.products.available) || []; return (ws) => !!ws && P.some((a) => a.ws === ws && !a.on); };
|
|
58
62
|
export function productsOf(D) {
|
|
59
63
|
const out = [];
|
|
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) }); };
|
|
61
64
|
const b = D.board && D.board.board;
|
|
62
65
|
const av = (D.brief && D.brief.products && D.brief.products.available) || [];
|
|
63
66
|
const avOf = (ws) => (ws && av.find((a) => a.ws === ws)) || {}, named = (ws) => avOf(ws).name || '';
|
|
67
|
+
// D.pick is the pick (GET /api/briefing-premium/products; with none saved, the board's own product stays ticked)
|
|
68
|
+
const off = unticked(D);
|
|
69
|
+
const order = [(b && b.ws) || ''].concat(av.map((a) => a.ws).filter((w) => w !== (b && b.ws)));
|
|
70
|
+
const add = (p) => { const k = p.ws || 'n:' + String(p.name).toLowerCase(); if (off(p.ws) || out.some((x) => x.key === k || x.name.toLowerCase() === String(p.name).toLowerCase())) return; const at = p.ws ? order.indexOf(p.ws) : -1; out.push({ ...p, key: k, initials: codeOf(p), tone: (at >= 0 ? at : order.length + out.length) % TONES }); };
|
|
64
71
|
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
72
|
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
73
|
for (const a of av) if (a.on) add({ ws: a.ws, name: a.name, code: a.initials, primary: false, model: null, goals: null });
|
|
@@ -136,6 +143,7 @@ const isMe = (D, who) => { const me = String((D.today && D.today.me) || '').toLo
|
|
|
136
143
|
export function programGroups(D, groups, products, o, now) {
|
|
137
144
|
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; };
|
|
138
145
|
const pgs = groups.filter((g) => g.kind === 'product');
|
|
146
|
+
const off = unticked(D);
|
|
139
147
|
const items = pgs.flatMap((g) => g.inis.concat(g.rest).map((r) => ({ id: r.ini, ws: g.product.ws, product: g.name, r, g })));
|
|
140
148
|
const grouped = groupRows(items, D.programs, { productOf: (x) => x.product, wsOf: (x) => x.ws });
|
|
141
149
|
const out = [];
|
|
@@ -150,16 +158,16 @@ export function programGroups(D, groups, products, o, now) {
|
|
|
150
158
|
g.late = g.inis.concat(g.rest).some((i) => i.late);
|
|
151
159
|
g.closedLine = closedOf(g.count, g.turnN);
|
|
152
160
|
}
|
|
153
|
-
const tasks = (pr.tasks || []).filter((t) => !t.done &&
|
|
161
|
+
const tasks = (pr.tasks || []).filter((t) => !t.done && !off(t.ws)).map((t) => {
|
|
154
162
|
const d = t.due ? dayDiff(t.due, now) : null;
|
|
155
163
|
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 || '',
|
|
156
164
|
hint: [t.owner, d == null ? '' : d < 0 ? plural(-d, 'day', 'days') + ' late' : d === 0 ? 'due today' : 'due ' + shortDay(t.due)].filter(Boolean).join(' · ') };
|
|
157
165
|
});
|
|
158
|
-
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:
|
|
166
|
+
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: at >= 0 ? products[at].tone : 0, inis: sp.rows.map((x) => x.r) }; });
|
|
159
167
|
const inis = subs.flatMap((x) => x.inis);
|
|
160
168
|
// a program with no open initiative here (just made, or its initiatives all cancelled or archived) still shows, under all products or its
|
|
161
|
-
// home product, so the PM finds it and can move initiatives in
|
|
162
|
-
const fresh = !
|
|
169
|
+
// home product, so the PM finds it and can move initiatives in; an unticked home product takes it off Home (batch 12 item 5)
|
|
170
|
+
const fresh = !off(pr.home);
|
|
163
171
|
if (!inis.length && !tasks.length && !fresh) continue;
|
|
164
172
|
const st = programState(pr, rowsOf, now);
|
|
165
173
|
const turnN = inis.filter((x) => x.turn).length;
|
|
@@ -175,7 +183,7 @@ export function programGroups(D, groups, products, o, now) {
|
|
|
175
183
|
|
|
176
184
|
/* ── the list ── */
|
|
177
185
|
const sameName = (a, b) => String(a || '').toLowerCase() === String(b || '').toLowerCase();
|
|
178
|
-
/** o: { filter ('today' | 'kept' | 'done'),
|
|
186
|
+
/** o: { filter ('today' | 'kept' | 'done'), now }. The products are the ticked ones (productsOf). */
|
|
179
187
|
export function homeList(D, o = {}) {
|
|
180
188
|
const now = o.now || D.now || Date.now();
|
|
181
189
|
const needs = needsOf(D);
|
|
@@ -192,7 +200,6 @@ export function homeList(D, o = {}) {
|
|
|
192
200
|
];
|
|
193
201
|
const groups = [];
|
|
194
202
|
for (const p of products) {
|
|
195
|
-
if (o.product && o.product !== p.key) continue;
|
|
196
203
|
const rows = (p.model && p.model.initiatives && p.model.initiatives.list && p.model.initiatives.list.rows) || (p.primary ? boardRows(D) : []);
|
|
197
204
|
const open = rows.filter(OPEN);
|
|
198
205
|
const ids = new Set(open.map((r) => r.id));
|
|
@@ -209,7 +216,7 @@ export function homeList(D, o = {}) {
|
|
|
209
216
|
const flat = mineNeeds.filter((x) => !x.ini || !ids.has(x.ini)).filter((x) => !x.needSession).map((x) => ({ ...x, flat: true, hint: bareHint(x) }));
|
|
210
217
|
const turnN = inis.filter((x) => x.turn).length + flat.length;
|
|
211
218
|
const shown = inis.filter((x) => x.turn || x.busy);
|
|
212
|
-
groups.push({ key: 'p:' + p.key, kind: 'product', product: p, name: p.name, initials: p.initials, tone:
|
|
219
|
+
groups.push({ key: 'p:' + p.key, kind: 'product', product: p, name: p.name, initials: p.initials, tone: p.tone, primary: !!p.primary, goals: p.goals, flat, inis: shown, rest: inis.filter((x) => !shown.includes(x)),
|
|
213
220
|
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' });
|
|
214
221
|
}
|
|
215
222
|
// programs first (program-hierarchy P3): each program takes its initiatives out of their product groups, so an initiative shows once
|
|
@@ -223,7 +230,7 @@ export function homeList(D, o = {}) {
|
|
|
223
230
|
for (const s of (D.sessions || []).filter((s) => listed(s) && !iniOfSession(s) && s.shown !== 'needs' && s.shown !== 'blocked')) loose.push({ ...sessionRow(s, D.desk && D.desk.roles), loose: true });
|
|
224
231
|
// 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
|
|
225
232
|
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 };
|
|
226
|
-
|
|
233
|
+
groups.push({ key: 'loose', kind: 'loose', name: 'Not in an initiative', rows: loose, n: loose.length, sig: lsig });
|
|
227
234
|
const stale = staleInis(D, now);
|
|
228
235
|
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' };
|
|
229
236
|
// a filter other than Today shows one plain list from the PM's own list (the items carry no initiative)
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
* keys and swipe on the rows (GET /api/my-work-premium; the /api/pm-items, /api/pm-jobs and /api/my-work presses)
|
|
9
9
|
* openAround(key?) home-around.js: Around you is gone (premium-uncovered-features, HmAround); its views stay, opened from New for you
|
|
10
10
|
* openEndOfDay() GET /api/phone-day: what finished today, the recap and tomorrow's meetings
|
|
11
|
-
* openProducts() which products Home reads (GET /api/briefing-premium products, POST /api/settings ws.briefing.include)
|
|
12
11
|
* openSearch(go) the designed Search (pm/cozy-search.js, E1): the repository and every worktree
|
|
13
12
|
* openInbox(go) New for you (pm/cozy-news.js, E2), which replaces the agents' results
|
|
14
13
|
* openRecorder() a note recorded now with no calendar event (the Viewer's newNote, else POST /api/notes/new)
|
|
@@ -32,7 +31,7 @@ function card(o, draw) {
|
|
|
32
31
|
}
|
|
33
32
|
|
|
34
33
|
export const moreItems = [
|
|
35
|
-
['eod', 'End of the day', 'cal'], ['cal', 'Calendar', 'cal'], ['rec', 'Record a note', 'mic'],
|
|
34
|
+
['eod', 'End of the day', 'cal'], ['cal', 'Calendar', 'cal'], ['rec', 'Record a note', 'mic'],
|
|
36
35
|
];
|
|
37
36
|
|
|
38
37
|
/** The ⋯ list itself in the Viewer, for a page with no menu of its own: items are [label, open]. */
|
|
@@ -86,35 +85,7 @@ export function openEndOfDay() {
|
|
|
86
85
|
return body;
|
|
87
86
|
}
|
|
88
87
|
|
|
89
|
-
/* ── Products ── */
|
|
90
|
-
export function openProducts() {
|
|
91
|
-
const M = { P: null, head: '', msg: '' };
|
|
92
|
-
const one = new URLSearchParams(location.search).get('ws'); // Home narrowed to one workspace (?ws=): a way back to the picked products
|
|
93
|
-
const draw = (b) => {
|
|
94
|
-
const P = M.P, on = P ? P.available.filter((x) => x.on).length : 0;
|
|
95
|
-
b.innerHTML = WAIT + (M.head ? `<p class="hx-n" id="hxSnap">${esc(M.head)}</p>` : '')
|
|
96
|
-
+ (one ? '<p class="hx-n">Home shows one workspace now. <a id="pickAll" href="/premium.html">All picked products</a></p>' : '')
|
|
97
|
-
+ (!P ? '<p class="hx-n">Reading the products.</p>' : !P.available.length ? '<p class="hx-n">No product workspace is registered.</p>'
|
|
98
|
-
: sec('Home reads', `<p class="hx-n" id="hxCount">Products ${on} of ${P.available.length}</p>` + P.available.map((x) => row(x.name, x.home ? 'home' : '', `<button type="button" class="hx-sw" role="switch" aria-checked="${!!x.on}" aria-label="${esc(x.name)}${x.home ? ' (home)' : ''}" data-ws="${esc(x.ws)}">${x.on ? 'On' : 'Off'}</button>`)).join('') + btn('Back to the default', 'data-reset="1"')))
|
|
99
|
-
+ `<p class="hx-n" role="status">${esc(M.msg)}</p>`;
|
|
100
|
-
};
|
|
101
|
-
const body = card({ id: 'products', kind: 'Products', title: 'Which products Home reads', icon: 'chart' }, draw);
|
|
102
|
-
const read = async () => {
|
|
103
|
-
const r = await pmGet('/api/briefing-premium');
|
|
104
|
-
M.P = r && r.ok && r.model ? r.model.products || { available: [] } : { available: [] };
|
|
105
|
-
M.head = r && r.ok && r.model && r.model.header ? r.model.header.text : ''; // what is read and what is not, from the records
|
|
106
|
-
if (body.isConnected) draw(body);
|
|
107
|
-
};
|
|
108
|
-
body.onclick = async (e) => {
|
|
109
|
-
const t = e.target.closest('button'); if (!t || !M.P) return;
|
|
110
|
-
const on = M.P.available.filter((x) => x.on).map((x) => x.ws);
|
|
111
|
-
const r = await pmPost('/api/settings', t.dataset.reset ? { key: 'ws.briefing.include', reset: true } : { key: 'ws.briefing.include', value: on.includes(t.dataset.ws) ? on.filter((x) => x !== t.dataset.ws) : on.concat(t.dataset.ws) });
|
|
112
|
-
M.msg = r && r.ok ? 'Saved. Home reads the products you picked.' : (r && r.error) || 'Not saved.';
|
|
113
|
-
read(); window.dispatchEvent(new CustomEvent('hm:reload'));
|
|
114
|
-
};
|
|
115
|
-
read();
|
|
116
|
-
return body;
|
|
117
|
-
}
|
|
88
|
+
/* ── Products ── gone (batch 12 item 5): the product chip on Home, Board and Insights is the one picker (pm/cozy-pick.js) */
|
|
118
89
|
|
|
119
90
|
/* ── Search ── the designed palette (pm/cozy-search.js); go is the page's own opener for an initiative ({ ini }), a session ({ ses }) or a file ({ doc }) */
|
|
120
91
|
export function openSearch(go) { return import('./cozy-search.js').then((M) => M.openSearch({ go })); }
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* status, the dates, the owner and the notes, and its move icon the section, the group or the initiative. Every write is the board's own route and is the PM's press; each says so
|
|
7
7
|
* in a toast with Undo, and a refusal shows the route's reason and changes nothing. Talk it through in chat is under ⋯ (the chat is beside
|
|
8
8
|
* the Viewer on Home). The PM's own items (a note, a mention made into a task) open in My work's item view (home-work.js). */
|
|
9
|
-
import { taskOf, checkOf, mountCard, boardSaver, cardStyle, placeOf } from './task-card.js';
|
|
9
|
+
import { taskOf, checkOf, mountCard, boardSaver, cardStyle, placeOf, historyFor } from './task-card.js';
|
|
10
10
|
|
|
11
11
|
/** h: { VW, pmPost, toast, toastUndo?, now, ws, board, iniTitle(id), openIni(id), askInChat(task), onChange(), rename?(task),
|
|
12
12
|
* owners?() → [names], inis?() → [{ id, title }] } */
|
|
@@ -41,6 +41,7 @@ export function openTask(task, h) {
|
|
|
41
41
|
inis: () => (h.inis ? h.inis() : []),
|
|
42
42
|
groups: () => (layout ? layout.names || [] : null),
|
|
43
43
|
sections: () => sections,
|
|
44
|
+
history: historyFor({ ws, board, t, post: (p, b) => h.pmPost(p, b) }), // what Claude changed with your ✓ (batch 12, TpA6)
|
|
44
45
|
});
|
|
45
46
|
},
|
|
46
47
|
});
|
|
@@ -4,14 +4,15 @@
|
|
|
4
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
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
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,
|
|
8
|
-
* meetings
|
|
7
|
+
* group (an initials tile, the name, the goal dots, a chevron; one-line rows with the stage track on the right; an initiative's sessions,
|
|
8
|
+
* next steps and meetings sit in a pill on its row that lists them on a press; its tasks are on its page in the Viewer, not here), and "Not in an initiative" as a folded line. Your day (dayHtml) is a sheet over the list: the date
|
|
9
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.
|
|
10
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-*
|
|
11
11
|
* press that home-app.js handles. Text from the records goes through esc(). */
|
|
12
12
|
|
|
13
13
|
import { STEPS } from './premium-initiative-head.js';
|
|
14
14
|
import { whenOf } from './home-list.js';
|
|
15
|
+
import { chipHtml } from './cozy-pick.js'; // the one product picker Home, Board and Insights share (batch 12 item 5)
|
|
15
16
|
import { ringHtml } from './home-line.js';
|
|
16
17
|
import { gripHtml, sugHtml } from './prog-order.js'; // a program's order: the grip and ✦ (canvas RoADrag, RoAPhone)
|
|
17
18
|
|
|
@@ -56,14 +57,14 @@ const MS = '<span class="hv-ms" role="img" aria-label="Milestone" title="Milesto
|
|
|
56
57
|
/** A row of the list: a next step, a task, a note, a mention, a session or a meeting. o: { sel, kid } */
|
|
57
58
|
export function rowHtml(r, o) {
|
|
58
59
|
const sel = o.sel === r.id;
|
|
59
|
-
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(' ');
|
|
60
|
+
const cls = ['hm-r', 'hv-r', o.kid ? 'kid' : '', o.sub ? 'two' : '', sel ? 'sel' : '', 'st-' + (r.state || 'quiet'), r.kind === 'task' ? 'task' : '', r.kind === 'item' ? 'item' : '', r.done ? 'done' : ''].filter(Boolean).join(' ');
|
|
60
61
|
const lead = isCheck(r) ? checkHtml(r) : '';
|
|
61
62
|
// ending a session and putting a next step off stay on the row, shown on the row that is open (the frame draws neither)
|
|
62
63
|
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>`
|
|
63
64
|
: 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>` : '';
|
|
64
65
|
const link = r.link && r.kind === 'loose-rec' ? '<span class="hv-st">Link it</span>' : '';
|
|
65
66
|
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)}`
|
|
66
|
-
+ `<span class="hm-rt${r.ms ? ' ms' : ''}"><b>${esc(r.name)}</b>${r.ms ? MS : ''}</span>${clock(r.when || whenOf(r))}${link}</button>${end}</div>`;
|
|
67
|
+
+ `<span class="hm-rt${r.ms ? ' ms' : ''}"><b>${esc(r.name)}</b>${r.ms ? MS : ''}${o.sub ? `<em>${esc(o.sub)}</em>` : ''}</span>${o.sub ? '' : clock(r.when || whenOf(r))}${link}</button>${end}</div>`;
|
|
67
68
|
}
|
|
68
69
|
/** 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
|
|
69
70
|
* 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
|
|
@@ -79,15 +80,62 @@ export function chatHeadHtml(h) {
|
|
|
79
80
|
const name = h.titleHtml ? `<span class="hm-chn">${h.titleHtml}</span>` : `<b class="hm-chb">${esc(h.title)}</b>`;
|
|
80
81
|
return `${mk}${same ? lead : ''}${name}${same && !h.prog ? track(h.at == null ? -1 : h.at, h.stage || '', h.steps) : ''}${chip}`;
|
|
81
82
|
}
|
|
82
|
-
|
|
83
|
-
*
|
|
83
|
+
/* ── what sits in an initiative: the pill on its row (batch 12 item 6, canvas HsA1Desk, HsA2Phone, HsA3Sheet) ──
|
|
84
|
+
* Sessions, next steps and today's meetings no longer nest under the initiative (Wawan, 2026-10-26: Home grew too long). The row keeps one
|
|
85
|
+
* line; a pill on it shows the most urgent mark of what sits in it and how many: a blue dot (and a blue number) when one waits on you, amber
|
|
86
|
+
* when one is blocked, a ring when one runs, a clock for a meeting today, else a grey dot. A press lists them right under the pill (a sheet on
|
|
87
|
+
* a phone), each with its mark and one quiet line; a press on one opens it as the nested row did; + starts a new session in the initiative. */
|
|
88
|
+
const RANKED = ['needs', 'blocked', 'working', 'meeting', 'quiet'];
|
|
89
|
+
const kidState = (k) => (k.kind === 'meeting' && k.state !== 'working' ? 'meeting' : k.step ? 'needs' : RANKED.includes(k.state) ? k.state : 'quiet');
|
|
90
|
+
const KID_WORD = { needs: 'Asks you', blocked: 'Blocked, asks you', working: 'Running', quiet: 'Open' };
|
|
91
|
+
/** The quiet line under one row of the list: what it is and where it stands, in words (the mark says it again by shape). */
|
|
92
|
+
export function kidSub(k) {
|
|
93
|
+
if (k.kind === 'meeting') return k.hint || 'Meeting';
|
|
94
|
+
if (k.step) return k.hint || 'Next step';
|
|
95
|
+
return [KID_WORD[kidState(k)] || 'Open', k.kind === 'session' && k.hint ? k.hint : ''].filter(Boolean).join(' · ');
|
|
96
|
+
}
|
|
97
|
+
/** The pill's model: the most urgent state, the count and its accessible words. Nothing in the initiative: null (zero is silence). */
|
|
98
|
+
export function pillOf(r) {
|
|
99
|
+
const kids = (r && r.kids) || [];
|
|
100
|
+
if (!kids.length) return null;
|
|
101
|
+
const st = kids.map(kidState);
|
|
102
|
+
const top = RANKED.find((x) => st.includes(x));
|
|
103
|
+
const n = (x) => st.filter((y) => y === x).length;
|
|
104
|
+
const words = [n('needs') + n('blocked') ? (n('needs') + n('blocked')) + ' waits on you' : '', n('working') ? n('working') + ' running' : '', n('meeting') ? plural(n('meeting'), 'meeting today', 'meetings today') : '', n('quiet') ? n('quiet') + ' open' : ''].filter(Boolean).join(', ');
|
|
105
|
+
return { top, n: kids.length, say: plural(kids.length, 'thing', 'things') + ' in ' + r.name + ': ' + words };
|
|
106
|
+
}
|
|
107
|
+
/** The pill's key: the group and the row, since two products can hold an initiative with the same id. */
|
|
108
|
+
const sesKey = (r, o) => (o.gk || '') + '|' + r.id;
|
|
109
|
+
const pillMark = (top) => (top === 'meeting' ? svg(P.clock, 13) : `<i class="hv-pm ${top}" aria-hidden="true"></i>`);
|
|
110
|
+
function pillHtml(r, o) {
|
|
111
|
+
const m = pillOf(r);
|
|
112
|
+
if (!m) return '';
|
|
113
|
+
const on = o.ses === sesKey(r, o);
|
|
114
|
+
return `<button type="button" class="hv-sp ${m.top}${on ? ' on' : ''}" data-hm-ses="${esc(sesKey(r, o))}" aria-haspopup="dialog" aria-expanded="${on}" aria-label="${esc(m.say)}. ${on ? 'Hide' : 'Show'}" title="${esc(m.say)}">${pillMark(m.top)}<span class="n">${m.n}</span></button>`;
|
|
115
|
+
}
|
|
116
|
+
/** The list behind the pill: the rows that used to nest, waiting first, then + for a new session here. */
|
|
117
|
+
function sesListHtml(r, o) {
|
|
118
|
+
const kids = r.kids.slice().sort((a, b) => RANKED.indexOf(kidState(a)) - RANKED.indexOf(kidState(b)));
|
|
119
|
+
return kids.map((k) => rowHtml(k, { ...o, kid: false, sub: kidSub(k) })).join('')
|
|
120
|
+
+ `<div class="hv-spf"><button type="button" class="ut-ib hv-ib" data-hm-sesnew="${esc(r.ini || '')}" aria-label="New session in ${esc(r.name)}" title="New session here">${svg(P.plus, 18)}</button></div>`;
|
|
121
|
+
}
|
|
122
|
+
/** On a phone the list is a sheet over Home (as Your day was): the initiative's name and stage track on top. M is homeList(). */
|
|
123
|
+
export function sesSheetHtml(M, o) {
|
|
124
|
+
const g = o.ses && M.groups.find((x) => o.ses.startsWith(x.key + '|'));
|
|
125
|
+
const r = g && (g.inis || []).concat(g.rest || []).find((x) => o.ses === g.key + '|' + x.id);
|
|
126
|
+
if (!r || !r.kids.length) return '';
|
|
127
|
+
return `<button type="button" class="hv-scrim" data-hm-sesx tabindex="-1" aria-label="Close"></button><section class="hv-sheet hv-sps" data-esc-layer role="dialog" aria-label="In ${esc(r.name)}" tabindex="-1"><div class="hv-grab" aria-hidden="true"></div>`
|
|
128
|
+
+ `<div class="hv-sbar"><b>${esc(r.name)}</b>${track(r.at, r.stage, r.steps)}<button type="button" class="ut-ib hv-ib" data-hm-sesx aria-label="Close" title="Close">${svg(P.x, 20)}</button></div>`
|
|
129
|
+
+ `<div class="hv-sc">${sesListHtml(r, o)}</div></section>`;
|
|
130
|
+
}
|
|
131
|
+
/** An initiative row: its mark, its title, the pill of what sits in it, and the stage track. The title (and the track) open the initiative;
|
|
132
|
+
* the pill lists what is in it. On a desktop the list opens right under the pill; on a phone it is a sheet (sesSheetHtml). */
|
|
84
133
|
function iniHtml(r, o, po) {
|
|
85
|
-
const
|
|
86
|
-
const
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
+ `<span class="hm-rt"><b>${esc(r.name)}</b></span>${badge}${track(r.at, r.stage, r.steps)}</button>${chev}</div>${nest}`;
|
|
134
|
+
const on = o.ses === sesKey(r, o) && !o.phone && r.kids.length;
|
|
135
|
+
const pop = on ? `<div class="hv-spp" data-esc-layer role="dialog" aria-label="In ${esc(r.name)}">${sesListHtml(r, o)}</div>` : '';
|
|
136
|
+
const t = track(r.at, r.stage, r.steps);
|
|
137
|
+
return `<div class="hm-r hv-r ini st-${esc(r.state)}${o.sel === r.id ? ' sel' : ''}${on ? ' sp-on' : ''}" data-id="${esc(r.id)}"${po ? ` data-po-id="${esc(r.ini || r.id)}"` : ''}>${po ? gripHtml(r.name) : ''}<button type="button" class="hm-rm" data-hm-sel="${esc(r.id)}"${o.sel === r.id ? ' aria-current="true"' : ''} title="${esc(r.hint)}">${markHtml(r.yours && r.state !== 'blocked' ? { state: 'needs' } : r)}`
|
|
138
|
+
+ `<span class="hm-rt"><b>${esc(r.name)}</b></span></button>${pillHtml(r, o)}${t ? `<button type="button" class="hv-tk" data-hm-sel="${esc(r.id)}" tabindex="-1" aria-hidden="true">${t}</button>` : ''}${pop}</div>`;
|
|
91
139
|
}
|
|
92
140
|
|
|
93
141
|
/* ── a group (HvAC .pg, .card; PgHomePhone .psub) ── */
|
|
@@ -109,7 +157,7 @@ function productHtml(g, o) {
|
|
|
109
157
|
const restAll = o.restOpen(g.key);
|
|
110
158
|
const rest = restAll ? g.rest : g.rest.slice(0, Math.max(0, QUIET - g.inis.length));
|
|
111
159
|
const more = g.rest.length - rest.length;
|
|
112
|
-
const body = flat + g.inis.concat(rest).map((r) => iniHtml(r, o)).join('')
|
|
160
|
+
const body = flat + g.inis.concat(rest).map((r) => iniHtml(r, { ...o, gk: g.key })).join('')
|
|
113
161
|
+ (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>`
|
|
114
162
|
: 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>` : '');
|
|
115
163
|
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>`;
|
|
@@ -129,7 +177,10 @@ function programHtml(g, o) {
|
|
|
129
177
|
+ `<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>`;
|
|
130
178
|
if (!open) return `<section class="hm-pg hv-g prg" aria-label="${esc(g.name)}">${head}</section>`;
|
|
131
179
|
// the program's tasks are on its panel (On the program), not on Home: Home lists no tasks (Wawan, 2026-10-25)
|
|
132
|
-
|
|
180
|
+
// a product's sub-heading only when the program's rows on Home come from two or more products (batch 12 item 6): one product repeated
|
|
181
|
+
// under every program said nothing
|
|
182
|
+
const many = g.subs.length > 1;
|
|
183
|
+
const body = g.subs.map((x) => `${many ? `<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>` : ''}<div class="po-list" data-po-list="${esc(g.program.id)}">${x.inis.map((r) => iniHtml(r, { ...o, gk: g.key }, true)).join('')}</div>`).join('');
|
|
133
184
|
return `<section class="hm-pg hv-g prg" aria-label="${esc(g.name)}">${head}<div class="hv-card">${body || `<p class="hm-none">${(g.program.members || []).length ? 'No open initiatives' : 'No initiatives yet'}. Open the program to move some in.</p>`}</div></section>`;
|
|
134
185
|
}
|
|
135
186
|
/** "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
|
|
@@ -191,13 +242,12 @@ export function todayHtml(T, o) {
|
|
|
191
242
|
const MONTH = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
|
|
192
243
|
const WEEKDAY = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
|
|
193
244
|
const MOMENT = new Set(['rec', 'soon', 'live', 'eod', 'review']);
|
|
194
|
-
/** M is homeList(); T todayCard(); o: { sel,
|
|
245
|
+
/** M is homeList(); T todayCard(); o: { sel, ses (the initiative row whose pill is open), pOpen, restOpen, pin, avHtml, ready, err, pick (GET /api/briefing-premium/products), tones, review, phone, day (Your day is open) } */
|
|
195
246
|
export function listHtml(M, T, o) {
|
|
196
|
-
const many = M.products.length > 1;
|
|
197
|
-
const picked = o.product ? M.products.find((p) => p.key === o.product) : null;
|
|
198
247
|
const flt = M.filter !== 'today' ? M.filters.find((f) => f.key === M.filter) : null;
|
|
199
248
|
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>`
|
|
200
|
-
|
|
249
|
+
// the product chip, always (it is also the way to add one): the ticked products' tiles, or All (canvas XhpA2States)
|
|
250
|
+
+ (o.pick ? chipHtml(o.pick, { id: 'hmPick', attrs: 'data-hm-pick', label: 'Products on Home', tones: o.tones }) : '')
|
|
201
251
|
+ (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>`)
|
|
202
252
|
+ `<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>`
|
|
203
253
|
+ (M.yours ? `<p class="hv-sub">${M.yours} ${M.yours === 1 ? 'is' : 'are'} yours</p>` : '');
|
|
@@ -218,7 +268,7 @@ export function listHtml(M, T, o) {
|
|
|
218
268
|
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">`
|
|
219
269
|
+ (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>';
|
|
220
270
|
}
|
|
221
|
-
return head + card + `<div class="hv-body">${o.top || ''}${body}</div
|
|
271
|
+
return head + card + `<div class="hv-body">${o.top || ''}${body}</div>` + (o.phone && o.ses && !M.list ? sesSheetHtml(M, o) : ''); // o.top: the pinned recording row and Mentions (home-rec-row.js, home-mentions.js)
|
|
222
272
|
}
|
|
223
273
|
/** 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,
|
|
224
274
|
* 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).
|
|
@@ -24,14 +24,26 @@ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&':
|
|
|
24
24
|
const SVG = (d, w = 16, sw = 1.8) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${sw}" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
|
|
25
25
|
const P = {
|
|
26
26
|
layers: 'M3 7l9-4 9 4-9 4zM3 12l9 4 9-4M3 17l9 4 9-4', send: 'M4 12l16-8-6 16-3-7zM11 13l9-9', more: 'M5 12h.01M12 12h.01M19 12h.01',
|
|
27
|
-
check: 'M5 12l5 5 9-10', plus: 'M12 5v14M5 12h14', tk: 'M12 3l9 9-9 9-9-9z', draft: 'M12 3v4M12 17v4M3 12h4M17 12h4M5.6 5.6l2.8 2.8M15.6 15.6l2.8 2.8M5.6 18.4l2.8-2.8M15.6 8.4l2.8-2.8',
|
|
27
|
+
check: 'M5 12l5 5 9-10', x: 'M6 6l12 12M18 6L6 18', plus: 'M12 5v14M5 12h14', tk: 'M12 3l9 9-9 9-9-9z', draft: 'M12 3v4M12 17v4M3 12h4M17 12h4M5.6 5.6l2.8 2.8M15.6 15.6l2.8 2.8M5.6 18.4l2.8-2.8M15.6 8.4l2.8-2.8',
|
|
28
28
|
};
|
|
29
29
|
const plural = (n, one, many) => n + ' ' + (n === 1 ? one : many);
|
|
30
30
|
const LAY = new Map(); // initiative id → its layout (GET /api/initiative-layout), as the last read or write answered
|
|
31
31
|
const TK = new Map(); // initiative id → its drafted tickets (GET /api/jira/tickets)
|
|
32
32
|
const READING = new Set(); // 'L|id', 'T|id' while a read is on its way
|
|
33
|
+
const ONLY = new Map(); // initiative id → { key, name }: the stage the stage card showed while Tasks is grouped another way (batch 12 item 0)
|
|
33
34
|
/** For the tests: forget every read. */
|
|
34
|
-
export const resetGroups = () => { LAY.clear(); TK.clear(); READING.clear(); };
|
|
35
|
+
export const resetGroups = () => { LAY.clear(); TK.clear(); READING.clear(); ONLY.clear(); };
|
|
36
|
+
/** The stage card pressed while Tasks is grouped another way: Tasks keeps its grouping and shows that stage's tasks only. true when that
|
|
37
|
+
* applies (the grouping is not Stage); with Stage the caller opens the stage's own section as before. */
|
|
38
|
+
export function onlyStage(id, key) {
|
|
39
|
+
if (!idOk(id) || byOf(id) === 'stage') return false;
|
|
40
|
+
ONLY.set(id, { key: key == null ? '' : String(key), name: '' });
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
/** The stage sections whose key is `key`, from the WBS (a folded line's stages included). */
|
|
44
|
+
const stagesOf = (S, key) => S.flatMap((s) => (s.stages ? s.stages : [s])).filter((s) => (s.key || '') === key);
|
|
45
|
+
/** A section left with nothing to show under the filter. */
|
|
46
|
+
const bare = (s) => !(s.top && s.top.length) && !(s.groups && s.groups.length) && !(s.done && s.done.length) && !(s.archived && s.archived.length) && !s.tk && !s.jira && !s.tkEmpty;
|
|
35
47
|
|
|
36
48
|
const idOk = (id) => /^[A-Za-z0-9][A-Za-z0-9._-]{0,80}$/.test(String(id || ''));
|
|
37
49
|
const atOf = (H) => (H && H.where ? H.where() || {} : {});
|
|
@@ -67,13 +79,25 @@ export function view(v) {
|
|
|
67
79
|
if (!idOk(id) || !v.tasks || v.tasks.empty) return v;
|
|
68
80
|
const by = byOf(id);
|
|
69
81
|
if (by === 'stage') return { ...v, tasks: { ...v.tasks, by } };
|
|
70
|
-
const
|
|
71
|
-
|
|
82
|
+
const f = ONLY.get(id), keep = f ? stagesOf(v.tasks.sections || [], f.key) : null;
|
|
83
|
+
if (f && !keep.length) ONLY.delete(id); // the stage is gone from the view: show every task again
|
|
84
|
+
if (!f || !keep.length) {
|
|
85
|
+
const { sections, sum } = groupSections(v.tasks, by, LAY.get(id), TK.get(id));
|
|
86
|
+
return { ...v, tasks: { ...v.tasks, by, sections, gsum: sum } };
|
|
87
|
+
}
|
|
88
|
+
f.name = keep[0].name || keep[0].label || 'Not in a stage';
|
|
89
|
+
// the Jira tickets (By epic's groups) are the work of the stage that carries them; another stage shows its own tasks only
|
|
90
|
+
const withJira = keep.some((s) => s.jira);
|
|
91
|
+
const { sections, sum } = groupSections({ ...v.tasks, sections: keep }, by, LAY.get(id), withJira ? TK.get(id) : null);
|
|
92
|
+
const shown = sections.filter((s) => (s.kind === 'epic' ? withJira : !bare(s)));
|
|
93
|
+
return { ...v, tasks: { ...v.tasks, by, sections: shown, gsum: withJira ? sum : null, only: f.name } };
|
|
72
94
|
}
|
|
73
95
|
export function headHtml(v) {
|
|
74
96
|
if (!v || !idOk(v.id) || !v.tasks || v.tasks.empty) return '';
|
|
75
97
|
const by = v.tasks.by || 'stage';
|
|
76
|
-
|
|
98
|
+
// the stage the card showed: its name and a ✕ that shows every stage again (filters earn space: only while one is on)
|
|
99
|
+
const only = v.tasks.only ? `<button type="button" class="ig-only" data-ig-all aria-label="${esc('Showing ' + v.tasks.only + ' only. Show every stage')}" title="Show every stage">${esc(v.tasks.only)}${SVG(P.x, 14, 2)}</button>` : '';
|
|
100
|
+
return only + `<button type="button" class="iv-ib ig-by${by !== 'stage' ? ' on' : ''}" data-ig-by aria-haspopup="menu" aria-label="Group tasks by" title="${esc('Group tasks by · ' + GROUP_BY[by])}">${SVG(P.layers, 18)}</button>`;
|
|
77
101
|
}
|
|
78
102
|
export function sumHtml(v) {
|
|
79
103
|
const s = v && v.tasks && v.tasks.gsum; if (!s) return '';
|
|
@@ -191,6 +215,7 @@ export function press(b, d, root, H) {
|
|
|
191
215
|
const id = root && root.dataset.iv; if (!idOk(id)) return false;
|
|
192
216
|
if ('igBy' in d) { if (POP && POP.anchor === b) closePop(); else groupMenu(b, id, H); return true; }
|
|
193
217
|
if (d.igGmore) { groupMore(b, id, H, d.igGmore); return true; }
|
|
218
|
+
if ('igAll' in d) { ONLY.delete(id); if (H.redraw) H.redraw(); return true; }
|
|
194
219
|
if (d.igSend != null) { send(id, H, { group: d.igSend }); return true; }
|
|
195
220
|
if ('igSendall' in d) { send(id, H); return true; }
|
|
196
221
|
if (d.igTk) { openTk(id, H, d.igTk); return true; }
|