create-pmos 0.431.0 → 0.433.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 +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/board-programs-test.js +10 -4
- package/workspace/briefing-premium-board-test.js +24 -22
- package/workspace/briefing-premium-initiative-test.js +10 -5
- package/workspace/briefing-premium-products-test.js +2 -0
- package/workspace/briefing-premium-sources-test.js +15 -8
- package/workspace/briefing-premium-work-test.js +6 -3
- package/workspace/changelog.json +24 -0
- package/workspace/ev-everywhere-test.js +40 -33
- package/workspace/guide/briefing-premium.md +1 -1
- package/workspace/guide/data-freshness.md +3 -1
- package/workspace/guide/home.md +26 -17
- package/workspace/guide/initiative-boards.md +6 -6
- package/workspace/guide/programs.md +3 -3
- package/workspace/ini-workflow-test.js +13 -8
- package/workspace/lib/briefing-premium.js +6 -3
- package/workspace/lib/engine/boards.js +13 -2
- package/workspace/lib/ini-deleted.js +58 -0
- package/workspace/lib/initiative-rows.js +4 -1
- package/workspace/lib/routes-boards.js +48 -0
- package/workspace/lib/search-index.js +3 -1
- package/workspace/milestone-pins-test.js +8 -3
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-board-actions-test.js +50 -32
- package/workspace/premium-briefing-depth-test.js +33 -34
- package/workspace/premium-core-doc-issue-test.js +1 -1
- package/workspace/premium-vw-backlog-test.js +1 -1
- package/workspace/premium-vw-item-test.js +1 -1
- package/workspace/premium-vw-jira-test.js +1 -1
- package/workspace/product-lane-test.js +5 -5
- package/workspace/program-leave-test.js +20 -19
- package/workspace/public/pm/bd-acts.js +7 -5
- package/workspace/public/pm/bd-ini-panel.js +57 -25
- package/workspace/public/pm/bd-span.js +5 -4
- package/workspace/public/pm/cozy-ev.css +22 -7
- package/workspace/public/pm/cozy-evmodel.js +3 -3
- package/workspace/public/pm/cozy-nav.js +29 -32
- package/workspace/public/pm/cozy-news.js +11 -27
- package/workspace/public/pm/cozy-settings.js +68 -11
- package/workspace/public/pm/cozy-sources.js +5 -89
- package/workspace/public/pm/cozy-today.css +19 -1
- package/workspace/public/pm/hi-pop.css +21 -0
- package/workspace/public/pm/hi-pop.js +5 -5
- package/workspace/public/pm/home-app.js +62 -25
- package/workspace/public/pm/home-day.js +60 -2
- package/workspace/public/pm/home-ini.js +66 -27
- package/workspace/public/pm/home-more.js +9 -50
- package/workspace/public/pm/home-today.js +4 -2
- package/workspace/public/pm/ini-more.js +78 -42
- package/workspace/public/pm/ini-view-model.js +1 -1
- package/workspace/public/pm/ini-view.css +17 -0
- package/workspace/public/pm/ini-view.js +25 -7
- package/workspace/public/pm/premium-board.js +4 -3
- package/workspace/public/pm/prog-move.js +26 -0
- package/workspace/public/pm/stage-line.js +4 -3
- package/workspace/public/premium.html +0 -1
- package/workspace/stage-card-test.js +10 -1
- package/workspace/task-milestones-test.js +4 -3
|
@@ -1,23 +1,30 @@
|
|
|
1
1
|
/* pm/cozy-settings.js — Settings (initiative premium-uncovered-features, E3; canvas EvSettings). A dialog over the page, its sections on the left:
|
|
2
|
-
* General Theme (this device
|
|
3
|
-
* Your day (when the end-of-day card shows:
|
|
2
|
+
* General Theme (this device; the place menu's Theme row moved here, feedback batch 16 item 5), Viewer opens as a column or a popup
|
|
3
|
+
* (this device), Product (which products Home reads: the Products card), Your day (when the end-of-day card shows:
|
|
4
|
+
* time.workEnd, POST /api/settings), Agents write to Jira (fixed: only after Commit)
|
|
4
5
|
* Adler how much of Claude's face shows, Motion, Celebrations, Quiet after (adler.*, POST /api/settings; canvas AdM5, batch 16 item 2)
|
|
5
|
-
* Connectors
|
|
6
|
+
* Connectors each source's last read (GET /api/sources; was the Sources card, feedback batch 16 item 5, canvas FmA3Settings): the amber dot
|
|
7
|
+
* and ↻ Read again on a stale or failed one (POST /api/sources/refresh), ↻ in the header reads every source
|
|
8
|
+
* (POST /api/sources/refresh-all); then what PMOS reads on its own, and the connectors your sessions have (GET and POST
|
|
9
|
+
* /api/proactive/settings)
|
|
6
10
|
* Workspaces the repositories PMOS works in (GET and POST /api/workspaces, POST /api/workspaces/forget; the folder is never touched)
|
|
7
11
|
* Workflows a link to its own page, /premium-workflows.html (pm/wf-page.js, D99): the stages each kind of initiative goes through
|
|
8
12
|
* Updates the versions and Check now, Update, Restart to update (GET /api/kit/status, POST /api/kit/check | update | upgrade-app)
|
|
9
13
|
* What's new what each published kit changed, newest first (the kit status's changelog lines)
|
|
10
|
-
* The card at the bottom of General says when an update is ready.
|
|
14
|
+
* The card at the bottom of General says when an update is ready. While a source is stale, an amber box at the top of every section names
|
|
15
|
+
* it with ↻ Read again, and the place menu opens Settings at Connectors. Every write is the PM's press (pmPost carries the launch nonce).
|
|
16
|
+
* PMOS reads the sources and never posts to them.
|
|
11
17
|
* openSettings(section?) */
|
|
12
18
|
import { pmGet, pmPost } from './http.js';
|
|
13
|
-
import { esc, svg, ICON, toast } from './cozy-evui.js';
|
|
19
|
+
import { esc, svg, ICON, toast, wsParam, wsQ } from './cozy-evui.js';
|
|
20
|
+
import { sourceRows, staleOf, partsOf } from './cozy-evmodel.js';
|
|
14
21
|
import * as AD from './cozy-adler.js';
|
|
15
22
|
|
|
16
23
|
const SECTIONS = [['general', 'General'], ['adler', 'Adler'], ['connectors', 'Connectors'], ['workspaces', 'Workspaces'], ['workflows', 'Workflows'], ['updates', 'Updates'], ['whatsnew', "What's new"]];
|
|
17
24
|
const PAGE_LINKS = { workflows: '/premium-workflows.html' }; // a section that is a page of its own: the row goes there
|
|
18
25
|
const SRC = { calendar: 'Calendar', wispr: 'Wispr Flow', mail: 'Mail', slack: 'Slack', jira: 'Jira', confluence: 'Confluence', github: 'GitHub', drive: 'Google Drive', figma: 'Figma', website: 'Your websites' };
|
|
19
26
|
const VIEWER_KEY = 'pmos.cz.viewer';
|
|
20
|
-
const T = { el: null, sec: 'general', ws: null, st: {}, src: null, con: {}, conn: [], set: null, prods: null, msg: '', busy: false, phase: '', say: '', back: null };
|
|
27
|
+
const T = { el: null, sec: 'general', ws: null, st: {}, src: null, con: {}, conn: [], set: null, prods: null, msg: '', busy: false, phase: '', say: '', back: null, fresh: null, reading: '', note: {}, lines: null };
|
|
21
28
|
const cmpVer = (a, b) => { const x = String(a || '0').split('-')[0].split('.').map(Number), y = String(b || '0').split('-')[0].split('.').map(Number); for (let i = 0; i < 3; i++) if ((x[i] || 0) !== (y[i] || 0)) return (x[i] || 0) < (y[i] || 0) ? -1 : 1; return 0; };
|
|
22
29
|
const home = () => (T.ws && T.ws[0] ? T.st[T.ws[0].id] : null);
|
|
23
30
|
const latest = () => { const s = home(); return (s && (s.latest || (s.lastCheck && s.lastCheck.latest))) || null; };
|
|
@@ -63,11 +70,36 @@ function adlerSec() {
|
|
|
63
70
|
+ trow('Quiet after', 'After this time, opening PMOS shows Adler asleep and nothing urgent.', seg('Quiet after', 'adler.quiet', P['adler.quiet'], [['22', '22:00'], ['never', 'Never']]));
|
|
64
71
|
}
|
|
65
72
|
const firstLine = () => { const c = changes().find((e) => e.v === latest()); const p = c && c.prs && c.prs[0]; return p ? (p.t || p.s || '') : ''; };
|
|
73
|
+
/* each source's last read (FmA3Settings): the name, "read 09:41", the amber dot and ↻ on a stale or failed one */
|
|
74
|
+
const RD = 'M20 12a8 8 0 1 1-2.3-5.7M20 4v5h-5';
|
|
75
|
+
const readBtn = (id, label, cls = 'ev-ib') => `<button type="button" class="${cls}" data-ev-read="${esc(id)}" aria-label="${esc(label)}" title="${esc(label)}"${T.reading ? ' disabled' : ''}>${svg(RD, 18)}</button>`;
|
|
76
|
+
function readsHtml() {
|
|
77
|
+
const s = T.fresh;
|
|
78
|
+
if (!s) return '<p class="ev-small ev-mut">Reading when each source was last read.</p>';
|
|
79
|
+
if (!s.ok) return `<p class="ev-small ev-mut">When each source was last read could not be read${s.error ? ': ' + esc(s.error) : ''}.</p>`;
|
|
80
|
+
const rows = sourceRows(s.sources).map((x) => `<div class="ev-trow ev-fr" data-src="${esc(x.id)}"><div class="ev-tx"><b>${esc(x.name)}</b>${T.note[x.id] ? `<p class="ev-small" role="status">${esc(T.note[x.id])}</p>` : ''}</div>`
|
|
81
|
+
+ `${x.risk ? '<i class="ev-dot risk" aria-hidden="true"></i>' : ''}<span class="ev-small ${x.risk ? 'ev-late' : 'ev-mut'}">${esc(/^(Watching|Never read|Not connected|Reading now|Could not be read)$/.test(x.when) ? x.when : 'read ' + x.when)}</span>`
|
|
82
|
+
+ `${x.act === 'read' ? readBtn(x.id, 'Read ' + x.name + ' again') : '<span class="ev-ib-sp" aria-hidden="true"></span>'}</div>`).join('');
|
|
83
|
+
// the background line (harness-health): quiet when all is well, a box when something needs a look
|
|
84
|
+
const hl = s.health && s.health.level;
|
|
85
|
+
const health = !s.health ? '' : hl === 'warn' || hl === 'bad'
|
|
86
|
+
? `<div class="ev-box ev-small ev-line" id="srcHealth" data-level="${esc(hl)}" role="status"><i class="ev-dot risk" aria-hidden="true"></i><p class="ev-grow"><b>${esc(s.health.line)}</b>${(s.health.issues || []).slice(1, 4).map((i) => `<br>${esc(i.text)}`).join('')}</p></div>`
|
|
87
|
+
: `<p class="ev-small ev-mut ev-line" id="srcHealth" data-level="ok"><i class="ev-dot ok" aria-hidden="true"></i>${esc(s.health.line || '')}</p>`;
|
|
88
|
+
// which reads each part of Home shows (briefing-source-flow slice 5), in home-more.js readLine words
|
|
89
|
+
const L = T.lines ? [['Today', T.lines.readLine(s, ['calendar'])], ['Needs you', T.lines.readLine(s, ['initiatives', 'my-work', 'd:brief'])]].filter((x) => x[1]) : [];
|
|
90
|
+
return `${health}<div class="ev-reads">${rows}</div>${L.map(([k, v]) => `<p class="ev-small ev-mut ev-rl" data-reads="${esc(k)}"><b>${esc(k)}:</b> ${esc(v)}</p>`).join('')}`;
|
|
91
|
+
}
|
|
92
|
+
/** The amber box at the top of Settings while a source is stale (FmA3Settings): what is old, what it makes old, and ↻ Read again. */
|
|
93
|
+
function staleHtml() {
|
|
94
|
+
const st = T.fresh && T.fresh.ok ? staleOf(T.fresh.sources) : null;
|
|
95
|
+
if (!st) return '';
|
|
96
|
+
return `<div class="ev-warn ev-line ev-st-warn" id="srcWarn"><i class="ev-dot risk" aria-hidden="true"></i><p class="ev-grow"><b>${esc(st.state === 'stale' ? st.name + ' was last read ' + st.ago + '.' : st.text + '.')}</b> ${esc(partsOf(st.id))} may be out of date.</p>${readBtn(st.id, 'Read ' + st.name + ' again', 'ev-ib ev-ib-card')}</div>`;
|
|
97
|
+
}
|
|
66
98
|
function connectors() {
|
|
67
|
-
if (T.src === null) return '<p class="ev-small ev-mut">Reading the connectors.</p>';
|
|
99
|
+
if (T.src === null) return readsHtml() + '<p class="ev-small ev-mut">Reading the connectors.</p>';
|
|
68
100
|
const brief = Object.keys(SRC).filter((k) => k in T.src).map((k) => trow(SRC[k], T.src[k] ? 'PMOS reads it on its own' : 'PMOS does not read it on its own', sw(T.src[k], `data-ev-src="${k}"`, SRC[k])));
|
|
69
101
|
const more = T.conn.filter((c) => !c.source).map((c) => trow(c.label, T.con[c.name] ? 'On. Your sessions can use it' : 'Your sessions can use it', sw(T.con[c.name], `data-ev-conn="${esc(c.name)}"`, c.label)));
|
|
70
|
-
return '<p class="ev-small ev-mut">Every connector your Claude session has. A switch chooses only what PMOS reads on its own. PMOS reads and never posts.</p>' + brief.join('') + more.join('');
|
|
102
|
+
return readsHtml() + '<p class="ev-small ev-mut">Every connector your Claude session has. A switch chooses only what PMOS reads on its own. PMOS reads and never posts.</p>' + brief.join('') + more.join('');
|
|
71
103
|
}
|
|
72
104
|
function workspaces() {
|
|
73
105
|
if (T.ws === null) return '<p class="ev-small ev-mut">Reading the repositories.</p>';
|
|
@@ -100,9 +132,11 @@ function draw() {
|
|
|
100
132
|
// a redraw replaces the nodes: keep focus on the same control (by its data-ev-* key), else on the open section, never on the body
|
|
101
133
|
const ae = document.activeElement, had = ae && el.contains(ae), key = had ? [...ae.attributes].find((a) => a.name.startsWith('data-ev-')) : null;
|
|
102
134
|
const n = { connectors: T.src === null ? '' : Object.keys(SRC).filter((k) => T.src[k]).length + T.conn.filter((c) => !c.source && T.con[c.name]).length, workspaces: T.ws ? T.ws.length : '', updates: ready() ? '<span class="ev-pill y">1</span>' : '' };
|
|
103
|
-
|
|
135
|
+
const stale = T.fresh && T.fresh.ok ? staleOf(T.fresh.sources) : null;
|
|
136
|
+
el.querySelector('.ev-st-nav').innerHTML = '<h2 class="ev-h2">Settings</h2>' + SECTIONS.map(([k, l]) => PAGE_LINKS[k] ? `<a href="${PAGE_LINKS[k]}" class="ev-mi">${esc(l)}</a>` : `<a href="#${k}" class="ev-mi" data-ev-sec="${k}"${T.sec === k ? ' aria-current="page"' : ''}>${esc(l)}${k === 'connectors' && stale ? '<i class="ev-dot risk" aria-label="A source is stale" role="img"></i>' : ''}${n[k] !== undefined && n[k] !== '' ? `<span class="ev-k">${typeof n[k] === 'number' ? n[k] : n[k]}</span>` : ''}</a>`).join('');
|
|
104
137
|
const label = (SECTIONS.find((x) => x[0] === T.sec) || SECTIONS[0])[1];
|
|
105
|
-
|
|
138
|
+
const all = T.sec === 'connectors' ? `<button type="button" class="ev-ib" data-ev-readall aria-label="Read every source again" title="Read all again"${T.reading ? ' disabled' : ''}>${svg(RD, 18)}</button>` : '';
|
|
139
|
+
el.querySelector('.ev-st-main').innerHTML = staleHtml() + `<div class="ev-top"><h3 class="ev-h2" id="evStTitle">${esc(label)}</h3>${all}<button type="button" class="ev-ib" data-ev-close aria-label="Close settings" title="Close settings">${svg(ICON.close, 18)}</button></div>`
|
|
106
140
|
+ BODY[T.sec]() + `<p role="status">${esc(T.msg)}</p>`;
|
|
107
141
|
if (had && !ae.isConnected) { const f = (key && el.querySelector(`[${key.name}="${CSS.escape(key.value)}"]`)) || el.querySelector('[aria-current="page"]'); if (f) f.focus(); }
|
|
108
142
|
}
|
|
@@ -141,6 +175,7 @@ async function press(e) {
|
|
|
141
175
|
PP.openPicker(t, { P, label: 'Products', onApply: async (on) => { const r = await PP.savePick(on); if (!r.ok) { T.msg = r.error; draw(); return; } T.prods = r.products; draw(); } });
|
|
142
176
|
return;
|
|
143
177
|
}
|
|
178
|
+
if (t.dataset.evRead || 'evReadall' in t.dataset) { readAgain(t.dataset.evRead || ''); return; }
|
|
144
179
|
if (T.busy) return;
|
|
145
180
|
T.busy = true; T.msg = '';
|
|
146
181
|
try {
|
|
@@ -189,7 +224,29 @@ async function waitRestart(from, log) {
|
|
|
189
224
|
}
|
|
190
225
|
T.phase = ''; T.msg = 'PMOS did not come back on this address. Type pmos in a terminal to open it. The update log is ' + log + '.'; draw();
|
|
191
226
|
}
|
|
227
|
+
/** GET /api/sources: when each source was last read. The place menu's amber dot follows (the event pm:sources). */
|
|
228
|
+
async function readFresh() {
|
|
229
|
+
if (!T.lines) T.lines = await import('./home-more.js').catch(() => null);
|
|
230
|
+
const r = await pmGet('/api/sources' + wsQ());
|
|
231
|
+
T.fresh = r && r.ok !== false ? r : { ok: false, error: (r && r.error) || 'the server did not answer' };
|
|
232
|
+
if (T.fresh.ok) window.dispatchEvent(new CustomEvent('pm:sources', { detail: T.fresh }));
|
|
233
|
+
draw();
|
|
234
|
+
}
|
|
235
|
+
/** ↻ on a source reads it again (POST /api/sources/refresh); ↻ in the Connectors header reads every source (POST /api/sources/refresh-all). */
|
|
236
|
+
async function readAgain(id) {
|
|
237
|
+
if (T.reading) return;
|
|
238
|
+
const ws = (T.fresh && T.fresh.ws) || wsParam() || '';
|
|
239
|
+
T.reading = id || 'all'; draw();
|
|
240
|
+
const r = await pmPost(id ? '/api/sources/refresh' : '/api/sources/refresh-all', id ? { ws, source: id } : { ws });
|
|
241
|
+
T.reading = '';
|
|
242
|
+
if (id) {
|
|
243
|
+
T.note[id] = r && r.ok ? (r.started === 'session' ? 'An agent session started to read it, with your own connection.' : 'Reading it again on this machine.') : 'It did not start: ' + ((r && r.error) || 'the server did not answer') + '.';
|
|
244
|
+
toast(r && r.ok ? 'Reading again.' : T.note[id]);
|
|
245
|
+
} else toast(r && r.ok ? (r.joined ? 'Every source is already being read.' : 'Reading every source, then Home\'s list.') : 'Read all again did not start: ' + ((r && r.error) || 'the server did not answer') + '.');
|
|
246
|
+
await readFresh(); setTimeout(readFresh, 4000);
|
|
247
|
+
}
|
|
192
248
|
async function load() {
|
|
249
|
+
readFresh();
|
|
193
250
|
const [w, p, s, b] = await Promise.all([pmGet('/api/workspaces'), pmGet('/api/proactive/settings'), pmGet('/api/settings'), pmGet('/api/briefing-premium')]);
|
|
194
251
|
T.ws = w && Array.isArray(w.workspaces) ? w.workspaces : [];
|
|
195
252
|
T.src = p && p.ok && p.settings ? { ...p.settings.briefSources } : {}; T.con = p && p.ok && p.settings ? { ...p.settings.connectors } : {};
|
|
@@ -205,7 +262,7 @@ async function load() {
|
|
|
205
262
|
export function openSettings(section) {
|
|
206
263
|
const el = mount();
|
|
207
264
|
if (section && BODY[section]) T.sec = section;
|
|
208
|
-
if (el.hidden) { const ae = document.activeElement; T.back = ae && ae !== document.body ? ae : null; T.ws = null; T.src = null; T.msg = ''; T.phase = ''; }
|
|
265
|
+
if (el.hidden) { const ae = document.activeElement; T.back = ae && ae !== document.body ? ae : null; T.ws = null; T.src = null; T.msg = ''; T.phase = ''; T.fresh = null; T.note = {}; }
|
|
209
266
|
el.hidden = false; document.getElementById('evStScrim').hidden = false; el.setAttribute('data-esc-layer', '');
|
|
210
267
|
draw();
|
|
211
268
|
const f = el.querySelector('[aria-current="page"]'); if (f) f.focus();
|
|
@@ -1,89 +1,5 @@
|
|
|
1
|
-
/* pm/cozy-sources.js — Sources
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
-
* writes Home's list from those reads (POST /api/sources/refresh-all). The read lines say which reads Home shows. Every press is the PM's
|
|
7
|
-
* (pmPost carries the launch nonce); PMOS reads these sources and never posts to them.
|
|
8
|
-
* openSources() → the body element */
|
|
9
|
-
import { pmGet, pmPost } from './http.js';
|
|
10
|
-
import { open as vwOpen, current as vwCurrent } from './cozy-viewer.js';
|
|
11
|
-
import { esc, svg, ICON, toast, wsParam, wsQ, skelRows, cantRead } from './cozy-evui.js';
|
|
12
|
-
import { sourceRows, staleOf, partsOf } from './cozy-evmodel.js';
|
|
13
|
-
|
|
14
|
-
const TILE = { repository: ICON.repo, initiatives: ICON.flag, calendar: ICON.cal, jira: ICON.jira, 'my-work': ICON.check, tracker: ICON.board, tools: ICON.tools };
|
|
15
|
-
const two = (n) => String(n).padStart(2, '0');
|
|
16
|
-
const hm = (d) => two(d.getHours()) + ':' + two(d.getMinutes());
|
|
17
|
-
const M = { r: null, at: null, busy: '', note: {}, body: null };
|
|
18
|
-
|
|
19
|
-
/** The read line of each part of Home (briefing-source-flow slice 5), from one GET /api/sources answer; home-more.js readLine words. */
|
|
20
|
-
function readsHtml(s) {
|
|
21
|
-
return import('./home-more.js').then((H) => {
|
|
22
|
-
const L = [['Today', H.readLine(s, ['calendar'])], ['Needs you', H.readLine(s, ['initiatives', 'my-work', 'd:brief'])]].filter((x) => x[1]);
|
|
23
|
-
return L.map(([k, v]) => `<p class="ev-small ev-mut ev-reads" data-reads="${esc(k)}"><b>${esc(k)}:</b> ${esc(v)}</p>`).join('');
|
|
24
|
-
}).catch(() => '');
|
|
25
|
-
}
|
|
26
|
-
async function draw() {
|
|
27
|
-
const b = M.body; if (!b || !b.isConnected) return;
|
|
28
|
-
{ const c = vwCurrent(); if (!c || c.id !== 'sources') return; } // the Viewer moved on to another item: a late read draws nothing
|
|
29
|
-
const s = M.r;
|
|
30
|
-
const head = `<div><h2 class="ev-h2">Sources</h2><p class="ev-sub">What PMOS reads, and how old each reading is. All real data${M.at ? ', as of ' + hm(M.at) : ''}.</p></div>`;
|
|
31
|
-
if (!s) { b.innerHTML = head + skelRows(4); return; }
|
|
32
|
-
if (!s.ok) { b.innerHTML = head + cantRead({ what: 'The sources', why: s.error || '', sources: false }); return; }
|
|
33
|
-
const st = staleOf(s.sources);
|
|
34
|
-
const warn = st ? `<div class="ev-warn ev-line" id="srcWarn"><i class="ev-dot risk" aria-hidden="true"></i><p class="ev-grow"><b>${esc(st.state === 'stale' ? st.name + ' was last read ' + st.ago + '.' : st.text + '.')}</b> ${esc(partsOf(st.id))} may be out of date.</p><button type="button" class="ev-btn sm" data-ev-read="${esc(st.id)}"${M.busy ? ' disabled' : ''}>${svg(ICON.refresh, 16)}Read again</button></div>` : '';
|
|
35
|
-
// the background line (harness-health): quiet when all is well, a box when something needs a look
|
|
36
|
-
const hl = s.health && s.health.level;
|
|
37
|
-
const health = !s.health ? '' : hl === 'warn' || hl === 'bad'
|
|
38
|
-
? `<div class="ev-box ev-small ev-line" id="srcHealth" data-level="${esc(hl)}" role="status"><i class="ev-dot risk" aria-hidden="true"></i><p class="ev-grow"><b>${esc(s.health.line)}</b>${(s.health.issues || []).slice(1, 4).map((i) => `<br>${esc(i.text)}`).join('')}</p></div>`
|
|
39
|
-
: `<p class="ev-small ev-mut ev-line" id="srcHealth" data-level="ok"><i class="ev-dot ok" aria-hidden="true"></i>${esc(s.health.line || '')}</p>`;
|
|
40
|
-
const rows = sourceRows(s.sources).map((x) => {
|
|
41
|
-
const name = x.id === 'repository' ? (s.ws || 'This product') + ' · main' : x.sub;
|
|
42
|
-
const act = x.act === 'read' ? `<button type="button" class="ev-btn sm soft" data-ev-read="${esc(x.id)}" aria-label="Read ${esc(x.name)} again"${M.busy ? ' disabled' : ''}>Read again</button>`
|
|
43
|
-
: x.act === 'connect' ? `<button type="button" class="ev-btn sm" data-ev-connect="${esc(x.id)}">Connect</button>` : '';
|
|
44
|
-
return `<div class="ev-trow" data-src="${esc(x.id)}"><span class="ev-tile" aria-hidden="true">${svg(TILE[x.id] || ICON.sources, 16)}</span><div class="ev-tx"><b>${esc(x.name)}</b><p class="ev-small ev-mut">${esc(name)}</p>${M.note[x.id] ? `<p class="ev-small" role="status">${esc(M.note[x.id])}</p>` : ''}</div><span class="ev-w-140 ev-small ${x.risk ? 'ev-late' : 'ev-mut'}">${esc(x.when)}</span><span class="ev-w-96">${act}</span></div>`;
|
|
45
|
-
}).join('');
|
|
46
|
-
const all = s.all && !s.all.done;
|
|
47
|
-
b.innerHTML = head + warn + health
|
|
48
|
-
+ `<div><div class="ev-th"><span class="ev-grow">Source</span><span class="ev-w-140">Last read</span><span class="ev-w-96"></span></div>${rows}</div>`
|
|
49
|
-
+ `<div class="ev-acts"><button type="button" class="ev-btn sm" data-ev-all${M.busy || all ? ' disabled' : ''}>${svg(ICON.refresh, 16)}${all ? 'Reading every source' : 'Read all again'}</button></div>`
|
|
50
|
-
+ '<div id="srcReads"></div>'
|
|
51
|
-
+ '<p class="ev-small ev-mut">PMOS reads these sources and never posts to them. To send anything, you press Send.</p>';
|
|
52
|
-
const reads = await readsHtml(s);
|
|
53
|
-
const box = b.querySelector('#srcReads'); if (box) box.innerHTML = reads;
|
|
54
|
-
}
|
|
55
|
-
async function read() {
|
|
56
|
-
M.r = await pmGet('/api/sources' + wsQ());
|
|
57
|
-
if (!M.r || M.r.ok === false) M.r = { ok: false, error: (M.r && M.r.error) || 'the server did not answer' };
|
|
58
|
-
M.at = new Date();
|
|
59
|
-
draw();
|
|
60
|
-
if (M.r.ok) window.dispatchEvent(new CustomEvent('pm:sources', { detail: M.r }));
|
|
61
|
-
}
|
|
62
|
-
export function openSources() {
|
|
63
|
-
M.r = null; M.note = {};
|
|
64
|
-
M.body = vwOpen({ id: 'sources', kind: 'What PMOS reads', title: 'Sources', icon: 'source', render: (b) => { b.classList.add('ev-card-b', 'ev-src'); M.body = b; draw(); } });
|
|
65
|
-
M.body.onclick = async (e) => {
|
|
66
|
-
const t = e.target.closest('button'); if (!t || M.busy) return;
|
|
67
|
-
if ('evRetry' in t.dataset) { M.r = null; draw(); read(); return; }
|
|
68
|
-
if (t.dataset.evConnect) { import('./cozy-settings.js').then((S) => S.openSettings('connectors')); return; }
|
|
69
|
-
const ws = (M.r && M.r.ws) || wsParam() || '';
|
|
70
|
-
if ('evAll' in t.dataset) {
|
|
71
|
-
M.busy = 'all'; draw();
|
|
72
|
-
const r = await pmPost('/api/sources/refresh-all', { ws });
|
|
73
|
-
M.busy = '';
|
|
74
|
-
toast(r && r.ok ? (r.joined ? 'Every source is already being read.' : 'Reading every source, then Home\'s list.') : 'Read all again did not start: ' + ((r && r.error) || 'the server did not answer') + '.');
|
|
75
|
-
await read(); setTimeout(read, 4000); return;
|
|
76
|
-
}
|
|
77
|
-
if (t.dataset.evRead) {
|
|
78
|
-
const id = t.dataset.evRead;
|
|
79
|
-
M.busy = id; draw();
|
|
80
|
-
const r = await pmPost('/api/sources/refresh', { ws, source: id });
|
|
81
|
-
M.busy = '';
|
|
82
|
-
M.note[id] = r && r.ok ? (r.started === 'session' ? 'An agent session started to read it, with your own connection.' : 'Reading it again on this machine.') : 'It did not start: ' + ((r && r.error) || 'the server did not answer') + '.';
|
|
83
|
-
toast(r && r.ok ? 'Reading again.' : M.note[id]);
|
|
84
|
-
await read(); setTimeout(read, 4000);
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
read();
|
|
88
|
-
return M.body;
|
|
89
|
-
}
|
|
1
|
+
/* pm/cozy-sources.js — Sources (initiative premium-uncovered-features, E3; canvas EvSources) is no longer a card of its own: since feedback
|
|
2
|
+
* batch 16 item 5 (canvas FmA3Settings) each source's last read, the amber box and Read again live in Settings › Connectors
|
|
3
|
+
* (pm/cozy-settings.js). This module stays so the old openers (premium-shell.js, home-around.js) still land in the right place.
|
|
4
|
+
* openSources() → Settings, open at Connectors */
|
|
5
|
+
export function openSources() { return import('./cozy-settings.js').then((M) => M.openSettings('connectors')); }
|
|
@@ -211,7 +211,7 @@ body.cz-home .hm-r.lr .hm-tile { width: 32px; height: 32px; }
|
|
|
211
211
|
body.cz-home.hm-plist .hm-lsc { margin: 0; padding: 0; overflow: visible; }
|
|
212
212
|
body.cz-home.hm-plist .hm-chat, body.cz-home.hm-plist:not(.hm-vw-open) .hm-vw { display: none; }
|
|
213
213
|
body.cz-home.hm-plist .cz-fabw { bottom: 24px; }
|
|
214
|
-
body.cz-home .hm-needs
|
|
214
|
+
body.cz-home .hm-needs { display: none; }
|
|
215
215
|
body.cz-home .hm-top .hm-back { display: grid; }
|
|
216
216
|
body.cz-home .hm-top { background: var(--cz-card); padding: 8px 12px 4px 8px; }
|
|
217
217
|
body.cz-home:not(.hm-plist) { background: var(--cz-card); }
|
|
@@ -245,6 +245,7 @@ body.cz-home .hm-lsc { margin: 0 -12px; padding: 0 12px 4px; }
|
|
|
245
245
|
.hv-hi { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; height: 44px; padding: 0 0 0 6px; border: 0; background: none; color: var(--cz-ink); cursor: pointer; text-align: left; font-family: var(--cz-sans); border-radius: 14px; }
|
|
246
246
|
.hv-hi b { font-size: var(--fs-5); font-weight: 800; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
247
247
|
.hv-hi svg { color: var(--cz-ink3); flex: none; width: 16px; height: 16px; }
|
|
248
|
+
.hv-hi .hv-nd { width: 8px; height: 8px; border-radius: 4px; background: var(--cz-blue); flex: none; display: block; }
|
|
248
249
|
.hv-hi[aria-expanded="true"] svg { transform: rotate(180deg); }
|
|
249
250
|
.hv-pk { height: 32px; padding: 0 10px 0 12px; border-radius: 999px; border: 0; background: var(--cz-card); font-family: var(--cz-sans); font-size: var(--fs-2); font-weight: 700; color: var(--cz-ink2); display: inline-flex; align-items: center; gap: 4px; cursor: pointer; flex: none; max-width: 140px; }
|
|
250
251
|
.hv-pk svg { width: 13px; height: 13px; flex: none; }
|
|
@@ -489,6 +490,23 @@ body.cz-home .hm-hd.hv-bar { padding: 0; }
|
|
|
489
490
|
.yd-tick { width: 22px; height: 22px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; background: var(--cz-bluebg); color: var(--cz-blue); }
|
|
490
491
|
.yd-fin .hm-rm { cursor: default; }
|
|
491
492
|
.yd .hv-r.two .hm-rt em { white-space: normal; }
|
|
493
|
+
/* New for you, a fold of Your day (feedback batch 16 item 5b, FmA2Day): 3 newest rows, "N more", ✓✓ in the fold's header marks all seen */
|
|
494
|
+
.yd-news { display: flex; flex-direction: column; }
|
|
495
|
+
.yd-nw { display: flex; align-items: flex-start; gap: 12px; width: 100%; padding: 10px 6px; border: 0; background: none; border-radius: 14px; text-align: left; cursor: pointer; font: inherit; color: inherit; }
|
|
496
|
+
.yd-nw:hover { background: var(--cz-well); }
|
|
497
|
+
.yd-nw:focus-visible, .yd-more:focus-visible, .yd-all:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 2px; }
|
|
498
|
+
.yd-nd { width: 8px; height: 8px; border-radius: 4px; background: var(--cz-blue); flex: none; margin-top: 12px; }
|
|
499
|
+
.yd-av { width: 32px; height: 32px; border-radius: 16px; flex: none; display: inline-flex; align-items: center; justify-content: center; background: var(--cz-well); color: var(--cz-ink2); font-size: var(--fs-1); font-weight: 800; }
|
|
500
|
+
.yd-av.b { background: var(--cz-bluebg); color: var(--cz-blueink); }
|
|
501
|
+
.yd-nw .yd-mt b { font-weight: 600; }
|
|
502
|
+
.yd-more { align-self: flex-start; border: 0; background: none; padding: 6px 6px 8px 58px; min-height: 36px; font: inherit; font-size: var(--fs-3); font-weight: 700; color: var(--cz-blueink); cursor: pointer; }
|
|
503
|
+
.yd-all { width: 40px; height: 40px; border-radius: 20px; border: 0; background: none; color: var(--cz-ink2); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
|
|
504
|
+
.yd-all:hover { background: var(--cz-well); }
|
|
505
|
+
.yd-all:disabled { opacity: .5; cursor: default; }
|
|
506
|
+
/* Tomorrow, a fold of Your day after 17:00 (FmA5Evening, was More › End of the day): time, title */
|
|
507
|
+
.yd-tmr { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 6px; font-size: var(--fs-4); color: var(--cz-ink); }
|
|
508
|
+
.yd-tt { width: 48px; flex: none; font-size: var(--fs-3); font-weight: 700; color: var(--cz-ink3); font-variant-numeric: tabular-nums; }
|
|
509
|
+
.yd-tn { flex: 1; min-width: 0; }
|
|
492
510
|
/* the moment card inside Your day: the morning's meetings (time, title) and a real thank-you in the evening recap (YdE1Ready, YdE3Evening) */
|
|
493
511
|
.hm-phc .phrow { display: flex; align-items: center; gap: 10px; min-height: 40px; margin: 0; font-size: var(--fs-4); color: var(--cz-ink); }
|
|
494
512
|
.hm-phc .phrow b { width: 48px; flex: none; font-size: var(--fs-3); font-weight: 700; color: var(--cz-ink3); }
|
|
@@ -80,3 +80,24 @@
|
|
|
80
80
|
.hi-pop .wfi svg { width: 70%; height: 70%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
|
|
81
81
|
/* a small form in the Viewer (the Board's Add a stakeholder) */
|
|
82
82
|
.hi-form { display: flex; flex-direction: column; gap: 12px; padding: 16px 20px 24px; font-size: var(--fs-3); color: var(--cz-ink); }
|
|
83
|
+
/* the stage chip's picker (pm/ini-more.js stagePick; batch 16 item 5c, FmI2Stage): every stage, the current one marked, the switch, then the endings */
|
|
84
|
+
.hi-sp.on { background: var(--cz-bluebg); font-weight: 800; }
|
|
85
|
+
.hi-spn { flex: none; width: 22px; height: 22px; border-radius: 7px; background: var(--cz-well); font-style: normal; font-size: var(--fs-1); font-weight: 800; display: inline-flex; align-items: center; justify-content: center; color: var(--cz-ink2); }
|
|
86
|
+
.hi-spn.ms { transform: rotate(45deg) scale(.7); border-radius: 3px; background: var(--cz-ink3); }
|
|
87
|
+
.hi-sp.on .hi-spn { background: var(--cz-blue); color: var(--cz-card); }
|
|
88
|
+
.hi-spm span { color: var(--cz-ink3); font-size: var(--fs-2); }
|
|
89
|
+
.hi-spw { cursor: default; }
|
|
90
|
+
.hi-spw:hover { background: none; }
|
|
91
|
+
.hi-spw span { flex: 1; }
|
|
92
|
+
.hi-spw .hi-sw { position: relative; flex: none; width: 32px; height: 20px; border-radius: 999px; background: var(--cz-c-d9dce1); border: 0; padding: 0; cursor: pointer; }
|
|
93
|
+
.hi-spw .hi-sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--cz-card); transition: left .15s; }
|
|
94
|
+
.hi-spw .hi-sw[aria-checked="true"] { background: var(--cz-blue); }
|
|
95
|
+
.hi-spw .hi-sw[aria-checked="true"]::after { left: 15px; }
|
|
96
|
+
:root[data-theme="dark"] .hi-spw .hi-sw { background: var(--cz-c-4a4f58); }
|
|
97
|
+
:root[data-theme="dark"] .hi-spw .hi-sw[aria-checked="true"] { background: var(--cz-blue); }
|
|
98
|
+
@media (max-width: 760px) {
|
|
99
|
+
.hi-pop .hi-mi { min-height: 44px; }
|
|
100
|
+
.hi-spw .hi-sw { width: 44px; height: 28px; }
|
|
101
|
+
.hi-spw .hi-sw::after { top: 4px; left: 4px; width: 20px; height: 20px; }
|
|
102
|
+
.hi-spw .hi-sw[aria-checked="true"]::after { left: 20px; }
|
|
103
|
+
}
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
*
|
|
4
4
|
* ensureCss() adds hi-pop.css once, before home-ini.css, so Home's phone rules still win
|
|
5
5
|
* openPop(anchor, kind, html, onClick, o?) a dialog (or o.menu: a menu) under the button that opened it; a sheet on a phone.
|
|
6
|
-
* o: { menu, wide, role, label, focus, sheetFocus }. → the popover element
|
|
6
|
+
* o: { menu, sheet (a menu that is still a sheet on a phone), wide, role, label, focus, sheetFocus }. → the popover element
|
|
7
7
|
* closePop() · popEl() the open popover, or null
|
|
8
|
-
* undoToast(text, undo)
|
|
8
|
+
* undoToast(text, undo, ms?) the dark toast with Undo, for 9 seconds (ms: another time, the initiative's Delete's 8) */
|
|
9
9
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
10
10
|
const PHONE = 760;
|
|
11
11
|
const isPhone = () => innerWidth <= PHONE;
|
|
@@ -27,7 +27,7 @@ export function openPop(anchor, kind, html, onClick, o = {}) {
|
|
|
27
27
|
ensureCss();
|
|
28
28
|
closePop();
|
|
29
29
|
const el = document.createElement('div');
|
|
30
|
-
const sheet = isPhone() && !o.menu;
|
|
30
|
+
const sheet = isPhone() && (!o.menu || o.sheet);
|
|
31
31
|
el.className = 'cz hi-pop' + (sheet ? ' sheet' : '') + (o.menu ? ' menu' : '') + (o.wide ? ' wide' : '');
|
|
32
32
|
el.setAttribute('role', o.role || (o.menu ? 'menu' : 'dialog')); el.setAttribute('aria-label', o.label || ''); el.setAttribute('data-esc-layer', '');
|
|
33
33
|
el.innerHTML = (sheet ? '<div class="hi-grab" aria-hidden="true"></div>' : '') + html;
|
|
@@ -50,7 +50,7 @@ export function openPop(anchor, kind, html, onClick, o = {}) {
|
|
|
50
50
|
const f = el.querySelector((sheet && o.sheetFocus) || o.focus || 'input, textarea, button:not([disabled])'); if (f) setTimeout(() => f.focus(), 0);
|
|
51
51
|
return el;
|
|
52
52
|
}
|
|
53
|
-
export function undoToast(text, undo) {
|
|
53
|
+
export function undoToast(text, undo, ms = 9000) {
|
|
54
54
|
ensureCss();
|
|
55
55
|
let el = document.getElementById('hiToast');
|
|
56
56
|
if (!el) { el = document.createElement('div'); el.id = 'hiToast'; el.className = 'hi-toast'; el.setAttribute('role', 'status'); el.setAttribute('aria-live', 'polite'); document.body.appendChild(el); }
|
|
@@ -58,7 +58,7 @@ export function undoToast(text, undo) {
|
|
|
58
58
|
el.hidden = false; el.classList.add('on');
|
|
59
59
|
el.querySelector('[data-hi-undo]').onclick = () => { hide(); undo(); };
|
|
60
60
|
const hide = () => { el.classList.remove('on'); el.hidden = true; };
|
|
61
|
-
clearTimeout(P.toastT); P.toastT = setTimeout(hide,
|
|
61
|
+
clearTimeout(P.toastT); P.toastT = setTimeout(hide, ms);
|
|
62
62
|
}
|
|
63
63
|
// Escape closes the popover first: on window in the capture phase, so the page's own Escape (the phone's list sheet, the Viewer) waits for the next press
|
|
64
64
|
if (typeof window !== 'undefined' && typeof window.addEventListener === 'function') window.addEventListener('keydown', (e) => { if (e.key === 'Escape' && P.pop) { e.stopPropagation(); e.preventDefault(); closePop(); } }, true);
|
|
@@ -37,7 +37,7 @@ import { mountFirst } from './premium-first.js';
|
|
|
37
37
|
import * as L from './home-list.js';
|
|
38
38
|
import * as TD from './home-today.js';
|
|
39
39
|
import * as YD from './home-day.js';
|
|
40
|
-
import * as AD from './cozy-adler.js'; // Adler, Claude's face (batch 16 item 2)
|
|
40
|
+
import * as AD from './cozy-adler.js'; // Adler, Claude's face (batch 16 item 2)
|
|
41
41
|
import { canDictate, dictate } from './home-dictate.js';
|
|
42
42
|
import { mountIni, iniList, iniOverview, iniPage, iniAddTask } from './home-ini.js'; // the initiative's page, its stage move, Tasks and Core documents (premium-uncovered-features, HbC)
|
|
43
43
|
import * as MEN from './home-mentions.js'; // @Mentions, the permanent row at the top of Home and its Viewer (Viewer kit, XvANew)
|
|
@@ -158,7 +158,9 @@ async function getRetry(path, tries = 20) {
|
|
|
158
158
|
}
|
|
159
159
|
return { ok: false, error: 'still reading' };
|
|
160
160
|
}
|
|
161
|
+
let pickGen = 0; // bumped by every saved pick, so a read that started before the save does not put the old pick back
|
|
161
162
|
async function load() {
|
|
163
|
+
const gen = pickGen;
|
|
162
164
|
const [brief, board, ses, desk, today, sch, work, day, rev, progs, , pick] = await Promise.all([
|
|
163
165
|
getRetry('/api/briefing-premium' + wsQ()), getRetry('/api/board-premium' + wsQ() + boardQ(WS ? '&' : '?')), pmGet('/api/sessions'), pmGet('/api/home-desk' + wsQ()),
|
|
164
166
|
pmGet('/api/brief-page' + wsQ()), pmGet('/api/schedules' + wsQ()), pmGet('/api/my-work-premium' + wsQ()), pmGet('/api/phone-day'), pmGet('/api/home-review' + wsQ()),
|
|
@@ -176,7 +178,7 @@ async function load() {
|
|
|
176
178
|
D.review = rev && rev.ok ? rev : null; // this week's review (GET /api/home-review)
|
|
177
179
|
D.programs = progs && progs.ok ? progs.programs : []; // programs above initiatives, across products (GET /api/programs)
|
|
178
180
|
D.order = SO.layout(); // the PM's sort and own order, shared with the Board (batch 14 item 8)
|
|
179
|
-
D.pick = pick || D.pick || null;
|
|
181
|
+
D.pick = (gen === pickGen && pick) || D.pick || null; // the one product pick (the chip): which products are on Home and read
|
|
180
182
|
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
|
|
181
183
|
D.now = Date.now();
|
|
182
184
|
D.err = [brief, board].filter((x) => !x || !x.ok).map((x) => (x && x.error) || 'the server did not answer');
|
|
@@ -292,33 +294,75 @@ function homeListHtml() {
|
|
|
292
294
|
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);
|
|
293
295
|
return TD.listHtml(M, todayModel(), {
|
|
294
296
|
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] : '',
|
|
295
|
-
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 }) : '',
|
|
297
|
+
pick: S.D.pick, tones: pickTones(), review: R, mic: canDictate(), phone: isPhone(), day: S.day, news: S.news && S.news.ok ? S.news.count : 0, top: S.ready ? RECROW.html() + MEN.rowHtml(S.D, { sel: S.sel }) : '',
|
|
296
298
|
});
|
|
297
299
|
}
|
|
298
|
-
/** Your day (XvAPhDay
|
|
299
|
-
*
|
|
300
|
+
/** Your day (XvAPhDay): "Good morning" opens it in the Viewer on a phone and a desktop alike (batch 16, Wawan: the same press must lead to
|
|
301
|
+
* the same place). The calendar is an icon in its header (batch 16 item 5, FmA2Day). A phone also draws the moment card (TfPhone) as its
|
|
302
|
+
* Now section. New for you is a fold of it (FmA2Day): S.news is the latest GET /api/news-for-you answer, read by the place menu every two
|
|
303
|
+
* minutes (the event 'cz:news-for-you') and again when Your day opens; a row opens the item in the Viewer, "N more" the whole list, ✓✓
|
|
304
|
+
* marks all seen. An item leaves once it is opened or marked seen. */
|
|
300
305
|
function dayHtml() { return ''; }
|
|
306
|
+
function dayParts() {
|
|
307
|
+
const Y = YD.dayModel(S.M, S.D, L.reviewModel(S.D, NOW()), NOW(), { delightOk: !!S.joyOk, news: S.news });
|
|
308
|
+
return { Y, P: YD.dayParts(Y, { moment: !!(isPhone() && PHC), now: NOW(), first: !!S.first }) };
|
|
309
|
+
}
|
|
310
|
+
function drawDayBody(body, P) {
|
|
311
|
+
const ph = isPhone() && PHC;
|
|
312
|
+
YD.drawDay(body, P, VW, ph ? (el) => { el.append(PHC.el); PHC.read(true); } : null);
|
|
313
|
+
}
|
|
301
314
|
function day(on) {
|
|
302
315
|
S.day = !!on;
|
|
303
316
|
if (!on) { const c = VW.current(); if (c && c.id === 'day') VW.close(); return; }
|
|
304
317
|
if (!S.M) return;
|
|
305
|
-
|
|
318
|
+
// the week's one celebration and the morning scene are read once per open, so a redraw (a new read of New for you) keeps the same day
|
|
319
|
+
S.joyOk = delightOk() && AD.mayCelebrate(NOW()); S.first = YD.firstOpenToday('day', NOW());
|
|
320
|
+
const { Y, P } = dayParts();
|
|
321
|
+
S.Y = Y;
|
|
306
322
|
if (Y.mood === 'delighted') { try { localStorage.setItem(DELIGHT_KEY, new Date(NOW()).toDateString()); } catch { /* the face still shows */ } AD.celebrated(NOW()); }
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
VW.open({ id: 'day', kind: 'Your day', title: 'Your day', icon: YD.DAY_ICON, more: [{ label: 'Open the calendar', on: () => openCalendar() }],
|
|
323
|
+
VW.open({ id: 'day', kind: 'Your day', title: 'Your day', icon: YD.DAY_ICON,
|
|
324
|
+
presses: [{ act: 'cal', label: 'Open the calendar', icon: 'cal' }], onPress: (act) => { if (act === 'cal') openCalendar(); },
|
|
310
325
|
onClose: () => { S.day = false; },
|
|
311
326
|
render: (body) => {
|
|
312
|
-
|
|
327
|
+
drawDayBody(body, P);
|
|
313
328
|
body.onclick = (e) => { // the rows are the list's own rows: the same presses open them
|
|
314
329
|
const b = e.target.closest('button'); if (!b) return;
|
|
315
330
|
if (b.dataset.hmSel) { select(b.dataset.hmSel); return; }
|
|
316
331
|
if (b.dataset.yd === 'sel') { const c = b.closest('.yd-call'); if (c) select(c.dataset.id); return; }
|
|
317
332
|
if (b.dataset.yd === 'retry' || b.dataset.yd === 'prep') { dayAct(b); return; }
|
|
333
|
+
if (b.dataset.yd === 'news' || b.dataset.yd === 'news-all') { VW.drill(); MORE.openInbox(searchGo, b.dataset.yd === 'news' ? b.dataset.id : ''); return; }
|
|
334
|
+
if (b.dataset.yd === 'seen') { daySeen(b); return; }
|
|
318
335
|
if ('hmReview' in b.dataset) { openReviewVw(); return; }
|
|
319
|
-
if ('hdMeet' in b.dataset && Y.next) openMeeting(Y.next.meeting);
|
|
336
|
+
if ('hdMeet' in b.dataset && S.Y && S.Y.next) openMeeting(S.Y.next.meeting);
|
|
320
337
|
};
|
|
321
338
|
} });
|
|
339
|
+
readNews();
|
|
340
|
+
}
|
|
341
|
+
/** Your day drawn again in place (a new read of New for you, a seen item), when it is the item shown. */
|
|
342
|
+
function redrawDay() {
|
|
343
|
+
const c = VW.current(), body = VW.body(); if (!S.day || !c || c.id !== 'day' || !body || !S.M) return;
|
|
344
|
+
const { Y, P } = dayParts(); S.Y = Y; drawDayBody(body, P);
|
|
345
|
+
}
|
|
346
|
+
async function readNews() {
|
|
347
|
+
const r = await pmGet('/api/news-for-you' + wsQ()).catch(() => null);
|
|
348
|
+
if (!r || !r.ok) return;
|
|
349
|
+
document.dispatchEvent(new CustomEvent('cz:news', { detail: { count: r.count } })); // the place menu's dots follow
|
|
350
|
+
newsIn(r);
|
|
351
|
+
}
|
|
352
|
+
function newsIn(r) {
|
|
353
|
+
const was = S.news ? S.news.count : -1; S.news = r;
|
|
354
|
+
if (r.count !== was) { drawList(); redrawDay(); }
|
|
355
|
+
}
|
|
356
|
+
document.addEventListener('cz:news-for-you', (e) => { if (e.detail && e.detail.ok) newsIn(e.detail); });
|
|
357
|
+
/** ✓✓ in the New for you fold: every item is marked seen (POST /api/news-for-you/seen), so the fold goes. */
|
|
358
|
+
async function daySeen(b) {
|
|
359
|
+
const ids = YD.newsOf(S.news).map((x) => x.id); if (!ids.length || b.disabled) return;
|
|
360
|
+
b.disabled = true;
|
|
361
|
+
let ok = true;
|
|
362
|
+
for (let i = 0; i < ids.length; i += 300) { const r = await pmPost('/api/news-for-you/seen', { ids: ids.slice(i, i + 300) }).catch(() => null); if (!r || !r.ok) ok = false; }
|
|
363
|
+
if (!ok) { b.disabled = false; toast('It was not marked seen. The server did not answer.'); return; }
|
|
364
|
+
toast(ids.length === 1 ? 'Marked seen.' : 'Marked all ' + ids.length + ' seen.');
|
|
365
|
+
await readNews();
|
|
322
366
|
}
|
|
323
367
|
/* Delighted shows at most once a week (canvas note ydEBuild): the day it last showed, kept in this browser. Another day of this week says no. */
|
|
324
368
|
const DELIGHT_KEY = 'pmos-yd-delight';
|
|
@@ -341,7 +385,7 @@ async function dayAct(b) {
|
|
|
341
385
|
toast(prep ? 'I’m on it. Your day fills in as I finish.' : 'Running it again.');
|
|
342
386
|
const pd = await pmGet('/api/phone-day').catch(() => null);
|
|
343
387
|
if (pd && pd.ok) S.D.phoneDay = pd;
|
|
344
|
-
|
|
388
|
+
redrawDay();
|
|
345
389
|
}
|
|
346
390
|
/* the list's filter (HvACDesk): Today, Kept or Done, behind the icon in the list's top bar */
|
|
347
391
|
function filterMenu(b) {
|
|
@@ -773,15 +817,15 @@ async function turnProgram(id) {
|
|
|
773
817
|
toast('Now a program · ' + iniTitle(id) + '.');
|
|
774
818
|
await load(); goProgram(res.program.id);
|
|
775
819
|
}
|
|
776
|
-
/** The page's ⋯
|
|
820
|
+
/** The page's ⋯ "Program" entry (pm/prog-move.js programItem, batch 16 item 5c): one picker to move, leave, join or make a program. openList is home-ini.js's menu. */
|
|
777
821
|
function moveItems(id, openList) {
|
|
778
822
|
const row = iniRowOf(id) || {}, o = otherIni(id), B = S.D.board || {};
|
|
779
823
|
const other = o ? ((S.D.others || []).find((x) => x && x.ws === o.ws) || {}).model || {} : null;
|
|
780
824
|
const product = other ? (o.row && o.row.product) || (other.board || {}).product || (other.board || {}).name || '' : H.productName(S.D);
|
|
781
|
-
return PM.
|
|
825
|
+
return [PM.programItem({ programs: () => S.D.programs || [], ws: row.ws || (o && o.ws) || (B.board || {}).ws || '', id, product, pmPost, phone: isPhone, openList, turn: () => turnProgram(id),
|
|
782
826
|
say: (m, undo) => (undo ? toastUndo(m, undo) : toast(m)),
|
|
783
827
|
stateOf: (p) => (((S.M && S.M.groups) || []).find((g) => g.kind === 'program' && g.program.id === p.id) || {}).st || null,
|
|
784
|
-
reload: async () => { await load(); if (S.ini === id && VW.isOpen()) iniPage(); } });
|
|
828
|
+
reload: async () => { await load(); if (S.ini === id && VW.isOpen()) iniPage(); } })].filter(Boolean);
|
|
785
829
|
}
|
|
786
830
|
/** Split or merge (pm/split-merge.js; canvas XsmA1Menu, XsmA1Suggest): the context of one initiative on Home. Only this board's rows: a
|
|
787
831
|
* merge stays on one board. After the write Home reads again and opens the one the PM lands on. openList is home-ini.js's menu. */
|
|
@@ -1011,7 +1055,7 @@ function pickProduct(chip) {
|
|
|
1011
1055
|
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); } });
|
|
1012
1056
|
}
|
|
1013
1057
|
// a saved pick (from this chip or Settings): Home shows and reads the ticked products
|
|
1014
|
-
addEventListener('pp:changed', (e) => { if (WS) { location.assign('/premium.html'); return; } S.D.pick = e.detail; drawList(); toast('Saved. Home, Board and Intelligence show the products you picked.'); load(); });
|
|
1058
|
+
addEventListener('pp:changed', (e) => { if (WS) { location.assign('/premium.html'); return; } pickGen++; S.D.pick = e.detail; drawList(); toast('Saved. Home, Board and Intelligence show the products you picked.'); load(); });
|
|
1015
1059
|
|
|
1016
1060
|
/* ── the Viewer: needs rows, the weekly update, the overview, files, people, routines ── */
|
|
1017
1061
|
let lastViewer = null;
|
|
@@ -1476,13 +1520,6 @@ menuEl.onclick = (e) => { // delegated: every item is a <button role=menuitem>
|
|
|
1476
1520
|
};
|
|
1477
1521
|
document.addEventListener('click', (e) => { if (!menuEl.hidden && !menuEl.contains(e.target) && !(menu.anchor && menu.anchor.contains(e.target))) closeMenu(); }, true);
|
|
1478
1522
|
document.addEventListener('keydown', (e) => { if (e.key === 'Escape' && !menuEl.hidden) { e.stopPropagation(); closeMenu(); } else if (e.key === 'Escape' && S.sheet) sheet(false); }, true);
|
|
1479
|
-
function moreMenu(anchor) {
|
|
1480
|
-
const go = {
|
|
1481
|
-
around: () => MORE.openAround(), inbox: () => MORE.openInbox(searchGo), eod: () => MORE.openEndOfDay(), cal: () => openCalendar(),
|
|
1482
|
-
rec: () => MORE.openRecorder(), search: () => MORE.openSearch(searchGo), sources: () => MORE.openSources(), settings: () => MORE.openSettings(),
|
|
1483
|
-
};
|
|
1484
|
-
menu(anchor, MORE.moreItems.map(([k, l]) => ({ label: l, go: go[k] })), 'Waiting for design');
|
|
1485
|
-
}
|
|
1486
1523
|
function searchGo(d) {
|
|
1487
1524
|
if (d.ini) goIni(d.ini);
|
|
1488
1525
|
else if (d.doc) openFile({ path: d.doc, name: d.doc.split('/').pop() });
|
|
@@ -1504,7 +1541,6 @@ addEventListener('hm:review', (e) => { e.preventDefault(); openReviewVw(); });
|
|
|
1504
1541
|
// a phone: the day's moment card opens on the greeting's press, and on this event from any other place that asks for the day
|
|
1505
1542
|
addEventListener('hm:day', () => day(true));
|
|
1506
1543
|
$('#hmBack').onclick = () => { S.phoneChat = false; S.sel = null; drawList(); syncUrl(); const f = $('#hmList .hm-rm'); if (f) f.focus(); };
|
|
1507
|
-
$('#hmMoreP').onclick = (e) => moreMenu(e.currentTarget);
|
|
1508
1544
|
$('#hmDesk').onclick = (e) => { if (S.sheet && e.target === $('#hmDesk')) sheet(false); }; // a press beside the sheet closes it; Escape and the N need you button do too
|
|
1509
1545
|
|
|
1510
1546
|
/* ── presses on the list ── */
|
|
@@ -1638,6 +1674,7 @@ function cta() {
|
|
|
1638
1674
|
mountIni({ S, VW, pmGet, pmPost, toast, rowOf: (id) => iniRowOf(id), renameIni: (id, pre) => iniRenameOf(id, pre), renameTask: (t) => taskRenameOf(t), load: () => load(), loadIni: () => loadIni(), openFile: (f) => openFile(f), iniTitle: (id) => iniTitle(id), drawList: () => drawList(), wait: MORE.WAIT,
|
|
1639
1675
|
// the initiative's page (HbCDesk): its card, its header and its ⋯
|
|
1640
1676
|
openBoardTask: (t) => openBoardTask(t),
|
|
1677
|
+
goHome: () => { VW.close(); goHome(); }, // after the initiative's Delete (batch 16 item 5d): it is gone, so Home shows the list again
|
|
1641
1678
|
cardHtml: (id, o) => cardHtml(id, o), kindOf: (id) => kindOf(id), cta: () => cta(), overviewAsk: (id) => overviewAsk(id), newIn: (id) => newIn(id), askIn: (id, q) => askIn(id, q), addPerson: () => addPerson(), turnProgram: (id) => turnProgram(id), moveItems: (id, openList) => moveItems(id, openList), smItems: (id, openList) => smItems(id, openList), smPress: (id, act) => SM.press(smCtx(id), act), goIni: (id) => goIni(id), talk: () => talk(), view: (id) => iniViewOf(id), head: (id) => (S.H = headOf(id)), goProgram: (id) => goProgram(id),
|
|
1642
1679
|
foldCard: () => { S.cardFold = !S.cardFold; store.set('pmos.home.cardfold', S.cardFold ? '1' : null); } });
|
|
1643
1680
|
/* The program panel in Home's Viewer (HbCProg): Home's board model and programs; an initiative of it opens here, with ← back to the program.
|
|
@@ -1648,7 +1685,7 @@ PO.mount({ programs: () => S.D.programs || [], stateOf: (p) => (((S.M && S.M.gro
|
|
|
1648
1685
|
saved: (p) => { const L2 = S.D.programs || [], i = L2.findIndex((x) => x.id === p.id); if (i >= 0) L2[i] = { ...L2[i], ...p }; drawList(); },
|
|
1649
1686
|
say: (m, undo) => (undo ? toastUndo(m, undo) : toast(m)), openIni: (id) => goIni(id) });
|
|
1650
1687
|
SO.mount({ redraw: () => { S.D.order = SO.layout(); drawList(); }, say: (m, undo) => (undo ? toastUndo(m, undo) : toast(m)) });
|
|
1651
|
-
mountNav('home', document, {
|
|
1688
|
+
mountNav('home', document, { here: () => { if (VW.isOpen()) VW.close(); goHome(); } });
|
|
1652
1689
|
// the Live pill (batch 6 item 2): on Home a row opens in place, the session's chat (with its Viewer page) or the meeting; the open one is tinted
|
|
1653
1690
|
mountLivePill(document, {
|
|
1654
1691
|
open: () => (S.cur && S.cur.ses) || null,
|