create-pmos 0.430.0 → 0.432.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 +27 -18
- package/workspace/guide/initiative-boards.md +6 -6
- package/workspace/guide/programs.md +4 -4
- 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/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/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 +17 -14
- 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 +7 -5
- package/workspace/public/premium.html +0 -1
- package/workspace/stage-card-test.js +10 -1
- package/workspace/test-lists/milestone-label.json +5 -0
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* questions, usual(track) the usual days in the step, rowOf(key), pageHref(r), askHref(r, q), refreshJira(), send(r) the
|
|
6
6
|
* Send to Jira sheet, moreAct(r, k, btn) a stage press of ⋯ (bd-acts.js), grillOpen(r, btn), onShow(key, from) / onHide() so the page
|
|
7
7
|
* marks the row the item came from, programOf(r) the program it is in or null, openProgram(id, btn), turnProgram(r)
|
|
8
|
-
* "
|
|
8
|
+
* "Make it a program", moveItems(r) the one Program item of ⋯ (pm/prog-move.js programItem), smItems(r) and
|
|
9
9
|
* smPress(r, act, btn) Split into a new initiative and Merge into (pm/split-merge.js), openIniId(id) a row by its record id, setTask(r, uid, state) a task's state, setDates(r, uid, { start?, due? }) its days (the Tasks
|
|
10
10
|
* views' quick changes, batch 9 item 5b), removeTask(r, uid) the status picker's trash (batch 11 item 16), addTask(r, title) a new task (POST /api/boards/tasks/add),
|
|
11
11
|
* openTask(r, task) the task's own editor, hold(r, i, btn) a hold's menu (the stage card's ⏸, batch 11 item 21), viewDoc(path), reload() a new read of the Board and toast(text, undo?) (planned
|
|
@@ -16,9 +16,10 @@
|
|
|
16
16
|
* openTicket(r, k) the ticket as a drill-in, in the one ticket Viewer (tk-view.js): ← goes back to the initiative; the summary says what blocks it and what that delays
|
|
17
17
|
* refresh() draws the shown item again after a new read, in place · close() · shown() → the key of the initiative shown, or null
|
|
18
18
|
*
|
|
19
|
-
* What has no place on the view is under ⋯: the ONE initiative menu (pm/ini-more.js, feedback batch 14 item 5
|
|
20
|
-
* Home's initiative page
|
|
21
|
-
* bd-acts.js); Change workflow, Won't do and Archive are Home's
|
|
19
|
+
* What has no place on the view is under ⋯: the ONE initiative menu (pm/ini-more.js, feedback batch 14 item 5; seven entries since batch 16
|
|
20
|
+
* item 5c), the same words and order as Home's initiative page, with Delete last (5d). The rest sits on the thing it changes: the stage chip's
|
|
21
|
+
* picker moves the stage with the row menu's own presses (moreAct(r, k, btn), bd-acts.js); Change workflow, Won't do and Archive are Home's
|
|
22
|
+
* (ini-wf.js). Discuss in chat takes the question to Home. */
|
|
22
23
|
import * as VW from './cozy-viewer.js';
|
|
23
24
|
import { esc } from './premium-shell.js';
|
|
24
25
|
import { lr, copyText } from './cozy-xv.js';
|
|
@@ -30,7 +31,8 @@ import { pmGet, pmPost } from './http.js';
|
|
|
30
31
|
import * as MD from './home-ini-model.js'; // the stage move's rules, as Home reads them (Moves on by itself, Move back a stage)
|
|
31
32
|
import * as WF from './ini-wf.js'; // D99: Change workflow, Won't do, Back to Triage, Archive, the same popovers as Home's
|
|
32
33
|
import { openPop, closePop, undoToast, ensureCss as ensurePopCss } from './hi-pop.js';
|
|
33
|
-
import {
|
|
34
|
+
import { readyOf } from './bd-acts.js'; // how much of the step is ready, beside the next stage in the stage picker
|
|
35
|
+
import { iniMore as iniMoreOf, iniText, stagePick, deleteSaid, DELETE_MS } from './ini-more.js'; // the one initiative ⋯ menu and stage picker (batch 14 item 5, batch 16 item 5c)
|
|
34
36
|
|
|
35
37
|
let O = null;
|
|
36
38
|
let cur = null; // { key, tk } the initiative shown, and its ticket while the drill-in is shown
|
|
@@ -114,36 +116,61 @@ function addPerson(r) {
|
|
|
114
116
|
};
|
|
115
117
|
}
|
|
116
118
|
function iniMore(r) {
|
|
117
|
-
const
|
|
118
|
-
const live = a && !a.life && !r.ended && !a.archived;
|
|
119
|
+
const id = r.id;
|
|
119
120
|
return iniMoreOf({
|
|
120
|
-
|
|
121
|
-
rename: O.rename && id ? () => { const t = document.querySelector('#czViewer [data-cz-vw-rn]'); if (t) t.click(); } : null,
|
|
122
|
-
auto: id && !mv.why ? { on: mv.auto, press: () => setAuto(r, !mv.auto) } : null,
|
|
123
|
-
back: id && a && mv.canBack ? { prev: mv.prev, on: (b) => O.moreAct(r, 'back:' + mv.prev, b) } : null,
|
|
124
|
-
toStage: id && live && !self && (a.stages || []).length > 1 ? (b) => O.moreAct(r, 'stage', b) : null,
|
|
125
|
-
dates: id ? () => location.assign(O.askHref(r, 'Propose new start and end dates for ' + r.title)) : null,
|
|
126
|
-
person: id ? () => addPerson(r) : null,
|
|
127
|
-
// split or merge, then the program moves (batch 11 items 2 and 14; pm/split-merge.js, pm/prog-move.js)
|
|
121
|
+
// split or merge, then the one Program picker (batch 11 items 2 and 14; batch 16 item 5c; pm/split-merge.js, pm/prog-move.js)
|
|
128
122
|
sm: id && O.smItems && !r.ended ? O.smItems(r) : [],
|
|
129
123
|
pm: id && O.moveItems ? O.moveItems(r) : [],
|
|
130
|
-
turnProgram: id && O.turnProgram && !(O.programOf && O.programOf(r)) ? () => O.turnProgram(r) : null,
|
|
131
|
-
jira: M.jira ? () => O.refreshJira() : null,
|
|
132
|
-
record: id ? async () => { VW.drill(); (await import('./premium-vw-item.js')).openWorkItem({ kind: 'initiative', id, title: r.title, ...where(r) }); } : null,
|
|
133
124
|
link: id ? () => copyText(new URL(O.pageHref(r), location.href).href, 'Link copied.') : null,
|
|
134
125
|
text: () => copyText(iniText(r.title, viewOf(r), (r.track && r.track.tickets) || []), 'Copied as text.'),
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
126
|
+
record: id ? async () => { VW.drill(); (await import('./premium-vw-item.js')).openWorkItem({ kind: 'initiative', id, title: r.title, ...where(r) }); } : null,
|
|
127
|
+
del: id ? () => deleteIni(r) : null,
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
/** Delete (batch 16 item 5d, FmI3Deleted): no confirm; the panel closes, the row and its tasks leave the Board, and Undo in the toast for
|
|
131
|
+
* 8 s brings them back (POST /api/boards/ini-delete, ini-restore). Jira is never written. */
|
|
132
|
+
async function deleteIni(r) {
|
|
133
|
+
const at = where(r);
|
|
134
|
+
const res = await pmPost('/api/boards/ini-delete', { ...at, id: r.id }).catch(() => null);
|
|
135
|
+
if (!res || res.ok === false) { O.toast((res && res.error) || 'It was not deleted.'); return; }
|
|
136
|
+
close();
|
|
137
|
+
if (O.reload) await O.reload();
|
|
138
|
+
undoToast(deleteSaid(res.title || r.title, res.tasks || 0), async () => {
|
|
139
|
+
const u = await pmPost('/api/boards/ini-restore', { ...at, id: r.id }).catch(() => null);
|
|
140
|
+
if (!u || u.ok === false) { O.toast((u && u.error) || 'The undo did not land.'); return; }
|
|
141
|
+
if (O.reload) await O.reload();
|
|
142
|
+
if (O.openIniId) O.openIniId(r.id);
|
|
143
|
+
}, DELETE_MS);
|
|
144
|
+
}
|
|
145
|
+
/** The stage chip (batch 16 item 5c, FmI2Stage): the same picker as Home's. A move forward is the row's own (Undo in the toast); a move back
|
|
146
|
+
* asks why in a card under the chip (bd-acts.js moreAct). */
|
|
147
|
+
function stageChip(btn, r) {
|
|
148
|
+
const M = O.M() || {}, a = r.acts || {}, self = !!(M.board || {}).self, mv = moveOf(r), id = r.id;
|
|
149
|
+
const live = !a.life && !r.ended && !a.archived;
|
|
150
|
+
const own = ownWf(r) ? r.wfStages.filter((s) => s.status !== 'skipped' || s.key === r.wfStage.key) : null;
|
|
151
|
+
const stages = own ? own.map((s) => ({ name: s.name, ms: !!s.milestone })) : (a.stages || []).map((name) => ({ name, ms: MD.isMilestone(name) }));
|
|
152
|
+
const nx = stages.findIndex((x) => x.name === mv.cur) + 1;
|
|
153
|
+
if (nx > 0 && stages[nx]) stages[nx].note = readyOf(r);
|
|
154
|
+
stagePick(btn, {
|
|
155
|
+
title: r.title, stages, cur: mv.cur,
|
|
156
|
+
go: id && live && !self && O.moreAct ? (name, b) => {
|
|
157
|
+
const i = stages.findIndex((x) => x.name === name), at = stages.findIndex((x) => x.name === mv.cur);
|
|
158
|
+
O.moreAct(r, (i < at ? 'back:' : 'fwd:') + name, b);
|
|
159
|
+
} : null,
|
|
160
|
+
auto: id && !mv.why ? { on: mv.auto, press: (on) => setAuto(r, on) } : null,
|
|
139
161
|
hold: id && live && O.moreAct ? (b) => O.moreAct(r, 'hold', b) : null,
|
|
140
|
-
resume: id && a
|
|
141
|
-
|
|
162
|
+
resume: id && a.life === 'hold' && !r.ended && O.moreAct ? (b) => O.moreAct(r, 'resume', b) : null,
|
|
163
|
+
wontDo: id && !self && !r.ended ? (b) => WF.openWontDo(b, wfUi(), id) : null,
|
|
164
|
+
backToTriage: id && !self && r.ended ? () => WF.backToTriage(wfUi(), id) : null,
|
|
165
|
+
archive: id && !self && !a.archived ? () => WF.archive(wfUi(), id) : null,
|
|
142
166
|
});
|
|
143
167
|
}
|
|
144
168
|
function iniBody(r) {
|
|
145
169
|
const md = (v) => ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][+v.slice(5, 7) - 1] + ' ' + +v.slice(8, 10);
|
|
146
|
-
|
|
170
|
+
const self = !!((O.M() || {}).board || {}).self, M = O.M() || {};
|
|
171
|
+
// what left the ⋯ for the thing it changes (batch 16 item 5c): the workflow chip, the dashed +, the stage chip, the dates chip, Jira's ↻
|
|
172
|
+
return viewHtml(viewOf(r), { add: !!(r.id && O.addTask), adding: adding === r.key, addHint: adding === r.key && addDates ? md(addDates.start) + ' to ' + md(addDates.due) : '', openTask: !!O.openTask, quick: !!(O.setTask && O.setDates), hold: !!O.hold, tail: VW.czSections(boardSections(r), { key: 'board' }),
|
|
173
|
+
wf: !!r.id && !self && !r.ended, person: !!r.id, stagePick: !!r.id, planDates: !!r.id, jira: !!M.jira });
|
|
147
174
|
}
|
|
148
175
|
/** Presses inside the shown item: the view's own (pm/ini-view.js), a ticket's drill-in, the PRD-change question. A [data-doc] goes to the page's handler. */
|
|
149
176
|
function wire(body, key) {
|
|
@@ -177,6 +204,11 @@ function wire(body, key) {
|
|
|
177
204
|
else if (act === 'page' && r.id) location.assign(O.pageHref(r));
|
|
178
205
|
},
|
|
179
206
|
program: (id, b) => { if (O.openProgram) O.openProgram(id, b); },
|
|
207
|
+
wf: (b) => { const r = O.rowOf(key); if (r && r.id) WF.openPicker(b, wfUi(), r.id); },
|
|
208
|
+
person: () => { const r = O.rowOf(key); if (r) addPerson(r); },
|
|
209
|
+
stagePick: (b) => { const r = O.rowOf(key); if (r) stageChip(b, r); },
|
|
210
|
+
planDates: () => { const r = O.rowOf(key); if (r) location.assign(O.askHref(r, 'Propose new start and end dates for ' + r.title)); },
|
|
211
|
+
jira: () => O.refreshJira(),
|
|
180
212
|
// Claude's split or merge card (batch 11 item 14): ✕ Not now, ✎ Change it first, ✓ as suggested; the merged summary's link opens the one that stays
|
|
181
213
|
sm: (act, b) => { const r = O.rowOf(key); if (r && O.smPress) O.smPress(r, act, b); },
|
|
182
214
|
openIni: (id) => { if (O.openIniId) O.openIniId(id); },
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
* the hairline and » only; its row sheet lists them. A gap never changes the row's dot or risk.
|
|
29
29
|
* Calmer timeline (feedback batch 13 item 4, A: XcalmA1Desk, A4Dark, A3Phone, A2Folded, A5Milestones): say it once, few marks, quiet rows.
|
|
30
30
|
* · One label per bar end: what lands, then when ("Tender award Nov 3"; the year only when it is not this year). The name is the end milestone's,
|
|
31
|
-
* else Deliver or Evaluate. The date turns amber at risk and orange late; the rest (days over, the forecast, a slip, a clash) is its hover.
|
|
31
|
+
* else a milestone close enough to merge with the end ◇, else Deliver or Evaluate. The date turns amber at risk and orange late; the rest (days over, the forecast, a slip, a clash) is its hover.
|
|
32
32
|
* With no room at the right edge the label sits before the ◇, on a card chip. No date under a ◇ and no second date.
|
|
33
33
|
* · Marks: the bar (done dark, to do light), a 2 px hairline for any gap or hold (a hold's hairline opens the hold card), one ◇ (filled done,
|
|
34
34
|
* orange late), the dashed Jira forecast, Today. The dotted hold, ⏸, the amber tint, the blue ◆ and the hatched out-of-window band are gone.
|
|
@@ -200,7 +200,7 @@ function qBar(r, X, now, phone, fmt, pxPct, ms = {}) {
|
|
|
200
200
|
const risk = r.status === 'at risk' ? 'risk' : r.status === 'on hold' ? 'q' : '';
|
|
201
201
|
let out = tm.html + depHtml(r, X, phone), clash = null;
|
|
202
202
|
if (s && e) {
|
|
203
|
-
const g = gapsHtml(r, X, now, phone, fmt, pxPct || 0, s, e, tone, note);
|
|
203
|
+
const g = gapsHtml(r, X, now, phone, fmt, pxPct || 0, s, e, tone, note, et ? { name: et.name, d: day(et.date) } : null);
|
|
204
204
|
out += g.html; clash = g.clash;
|
|
205
205
|
const over = r.over && now > e, late = fc && fc > e, hover = [];
|
|
206
206
|
if (over) hover.push(r.overDays + ' ' + (r.overDays === 1 ? 'day' : 'days') + ' over');
|
|
@@ -260,7 +260,7 @@ export function holdWords(x, now) {
|
|
|
260
260
|
}
|
|
261
261
|
/** The plan bar cut by its holds and its plain gaps: the pieces (the done part fills them in order and skips the gaps), each hold's dotted line and ⏸,
|
|
262
262
|
* and the return date where the bar starts again. → { html, clash } — clash: the words when the return date falls after the end ◇. */
|
|
263
|
-
function gapsHtml(r, X, now, phone, fmt, pxPct, s, e, tone, note = '') {
|
|
263
|
+
function gapsHtml(r, X, now, phone, fmt, pxPct, s, e, tone, note = '', lands = null) {
|
|
264
264
|
const wide = (a, b) => !pxPct || (X(b) - X(a)) * pxPct >= MIN_PX;
|
|
265
265
|
// a resumed hold narrower than 8 px closes up; a hold still running always shows, so its ⏸ is there to press
|
|
266
266
|
const H = holdSpans(r, now), shown = H.filter((x) => x.kind !== 'past' || wide(x.a, x.b));
|
|
@@ -317,8 +317,9 @@ function gapsHtml(r, X, now, phone, fmt, pxPct, s, e, tone, note = '') {
|
|
|
317
317
|
const late = x.kind === 'over' ? ' late' : '', l = X(x.a), w = X(x.b) - l, words = holdWords(x, now) + (x.kind === 'none' ? '. Set a return date' : '. Open the hold');
|
|
318
318
|
html += `<button type="button" class="tg-ng ho${late}" data-hold="${esc(r.key)}" data-i="${x.i}" style="left:${P(l)};width:${P(w)}" aria-label="${esc(words)}" title="${esc(holdWords(x, now))}" aria-haspopup="dialog"></button>`;
|
|
319
319
|
}
|
|
320
|
-
|
|
321
|
-
const
|
|
320
|
+
// the end ◇'s own name and date when a milestone task is it (the timeline-label hotfix: never a stage name for a milestone)
|
|
321
|
+
const ob = H.find((x) => x.kind === 'open' && x.b > (lands ? lands.d : e));
|
|
322
|
+
const clash = ob ? (lands ? lands.name : r.track && r.track.k >= 6 ? 'Evaluate' : 'Deliver') + ' is before the return, ' + md(ob.b) : null;
|
|
322
323
|
return { html, clash };
|
|
323
324
|
}
|
|
324
325
|
const iso = (d) => d.getFullYear() + '-' + String(d.getMonth() + 1).padStart(2, '0') + '-' + String(d.getDate()).padStart(2, '0');
|
|
@@ -329,14 +330,16 @@ const lastMs = (r) => { const S = (r.wfStages || []).filter((x) => x && x.milest
|
|
|
329
330
|
const msStage = (r, m) => { if (!m.sec) return ''; const st = (r.wfStages || []).find((x) => x.key === m.sec); return st ? (st.milestone ? st.name : '') : /^(deliver|evaluate)$/i.test(m.sec) ? m.sec.replace(/^./, (c) => c.toUpperCase()) : ''; };
|
|
330
331
|
/** The milestone task the bar's end ◇ stands for, or null. The end ◇ is the workflow's last ◆ stage (Evaluate on Product feature): the latest
|
|
331
332
|
* milestone task in that stage IS it, else one on the end's own day, else the latest task in any ◆ stage (Deliver: batch 14 item 1, so a
|
|
332
|
-
* "rolled out" task in Deliver names the row's end)
|
|
333
|
-
*
|
|
334
|
-
|
|
333
|
+
* "rolled out" task in Deliver names the row's end), else the latest one close enough to the end to merge with its ◇ (`reach` days, the
|
|
334
|
+
* zoom's ~40 px: the timeline-label hotfix, "[Tender] 12.0 Award contract" on Nov 2 sat under the end ◇ labelled "Deliver Nov 4"; one mark says
|
|
335
|
+
* the milestone's own name and date). It takes that task's name, date and done, and is not drawn twice. A task outside the ◆ stages and
|
|
336
|
+
* away from the end keeps its own ◇, and the plain end ◇ says Deliver or Evaluate. M: the row's dated milestones. */
|
|
337
|
+
function endTask(r, M, reach = 0) {
|
|
335
338
|
const e = day(r.end); if (!e || !M.length) return null;
|
|
336
339
|
const S = M.slice().sort((a, b) => day(a.date) - day(b.date));
|
|
337
340
|
const last = lastMs(r), inLast = S.filter((m) => m.sec && m.sec.toLowerCase() === last);
|
|
338
341
|
const inMs = S.filter((m) => msStage(r, m));
|
|
339
|
-
const end = inLast.length ? inLast[inLast.length - 1] : S.find((m) => +day(m.date) === +e) || inMs[inMs.length - 1];
|
|
342
|
+
const end = inLast.length ? inLast[inLast.length - 1] : S.find((m) => +day(m.date) === +e) || inMs[inMs.length - 1] || S.filter((m) => Math.abs(day(m.date) - e) <= reach * 864e5).pop();
|
|
340
343
|
return end ? { ...end, stage: msStage(r, end) } : null;
|
|
341
344
|
}
|
|
342
345
|
/** One ◇ per milestone task the Filter shows (batch 13 item 4, XcalmA5Milestones; pm/bd-pins.js shownMs: the pinned ones, by default the last),
|
|
@@ -346,7 +349,7 @@ function endTask(r, M) {
|
|
|
346
349
|
function taskMarks(r, X, now, phone, pxPct, ms) {
|
|
347
350
|
const M = (r.milestones || []).filter((m) => day(m.date));
|
|
348
351
|
if (!M.length) return { html: '', end: null };
|
|
349
|
-
const end = endTask(r, M), show = new Set(shownMs(r, ms.mode || 'pinned').map((m) => m.id));
|
|
352
|
+
const end = endTask(r, M, ms.reach || 0), show = new Set(shownMs(r, ms.mode || 'pinned').map((m) => m.id));
|
|
350
353
|
const L = M.filter((m) => (!end || m.id !== end.id) && show.has(m.id)).map((m) => ({ ...m, late: msLate(m, now), stage: msStage(r, m) }))
|
|
351
354
|
.filter((m) => { const x = X(day(m.date)); return x > 0 && x < 100; });
|
|
352
355
|
const C = mergeClose(L, Math.max(1, ms.reach || 7));
|
|
@@ -366,10 +369,10 @@ function taskMarks(r, X, now, phone, pxPct, ms) {
|
|
|
366
369
|
* late. Close ◇s merge into one counted ◇ (the rows' reach, about 40 px) with the date range under it; pressing it lists them, each line opening
|
|
367
370
|
* its initiative. A thin line runs from the first start to the last end. A phone draws the ◇s alone; a tap on the lane lists them in a sheet. */
|
|
368
371
|
/** A product's milestones, by date: [{ id, name, date, done, late, row }]. */
|
|
369
|
-
export function laneMilestones(rows, now) {
|
|
372
|
+
export function laneMilestones(rows, now, reach = 0) {
|
|
370
373
|
const out = [];
|
|
371
374
|
for (const r of rows || []) {
|
|
372
|
-
const M = (r.milestones || []).filter((m) => day(m.date)), s = day(r.start), e = day(r.end), et = endTask(r, M);
|
|
375
|
+
const M = (r.milestones || []).filter((m) => day(m.date)), s = day(r.start), e = day(r.end), et = endTask(r, M, reach);
|
|
373
376
|
for (const m of M) if (!et || m.id !== et.id) out.push({ id: m.id, name: m.name, date: m.date, done: !!m.done, late: msLate(m, now), row: r });
|
|
374
377
|
if (!s || !e) continue;
|
|
375
378
|
const ob = openBack(r, now), late = (r.over && now > e) || (ob && ob > e) || (et && msLate(et, now));
|
|
@@ -401,14 +404,14 @@ function offDots(rows, now) {
|
|
|
401
404
|
/** A folded group's track (XcalmA2Folded): the roll-up line, the counted ◇s and the end date. Open, a group draws nothing (its rows say it). */
|
|
402
405
|
function rollUp(rows, sp, X, W, o, ms, pxPct, now) {
|
|
403
406
|
if (!sp || sp.hi <= W.from || sp.lo >= W.to) return '';
|
|
404
|
-
const L = laneMilestones(rows, now);
|
|
407
|
+
const L = laneMilestones(rows, now, ms.reach);
|
|
405
408
|
const end = o.phone ? '' : `<span class="tg-endl" style="left:${P(X(sp.hi))}" title="${esc('Last end ' + md(sp.hi) + ', ' + sp.hi.getFullYear())}"><b>${esc(my(sp.hi))}</b></span>`;
|
|
406
409
|
return progLine({ rows }, sp, X, now) + laneMarks(L, X, o.phone, pxPct, ms) + end;
|
|
407
410
|
}
|
|
408
411
|
/** The product's head row on the timeline: the name cell (tile, name, goal dots, count when folded, the fold) and the lane. Open or folded it
|
|
409
412
|
* looks the same: folded, it is the product's summary. */
|
|
410
413
|
function laneRow(g, X, W, ov, o, ms, pxPct, now) {
|
|
411
|
-
const shut = o.folded(g.key), sp = progSpan(g), L = shut ? laneMilestones(g.rows, now) : [];
|
|
414
|
+
const shut = o.folded(g.key), sp = progSpan(g), L = shut ? laneMilestones(g.rows, now, ms.reach) : [];
|
|
412
415
|
const tr = shut ? rollUp(g.rows, sp, X, W, o, ms, pxPct, now) : '', cell = o.prodCell(g, shut ? offDots(g.rows, now) : '');
|
|
413
416
|
if (o.phone) return `<div class="tgq-r tg-lane${shut ? ' closed' : ''}" data-lane="${esc(g.key)}"><div class="tgq-n tg-lnn">${cell}</div><div class="tg-p"${L.length ? ` data-lane-ms="${laneData(L)}" data-lane-name="${esc(g.name)}"` : ''}>${ov}${tr}</div></div>`;
|
|
414
417
|
return `<div class="tg-r tg-lane${shut ? ' closed' : ''}" role="row" data-lane="${esc(g.key)}"><div class="tg-n tg-lnn" role="rowheader">${cell}</div><div class="tg-p" role="cell">${ov}${tr}</div></div>`;
|
|
@@ -54,17 +54,22 @@
|
|
|
54
54
|
.cz .ev-tile svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
|
|
55
55
|
.cz .ev-vh { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
|
|
56
56
|
|
|
57
|
-
/* ── the place menu (
|
|
58
|
-
.cz-fabm.ev-menu { width:
|
|
57
|
+
/* ── the place menu (FmA1Menu, FmA4Desk): Home, Board, Intelligence, then Search and Settings as icons ── */
|
|
58
|
+
.cz-fabm.ev-menu { width: 250px; padding: 10px; gap: 2px; border-radius: 20px; border: 0; box-shadow: 0 24px 60px -24px rgba(42,46,53,.45), 0 0 0 1px var(--cz-hair); }
|
|
59
59
|
.cz-fabm.ev-menu a, .cz-fabm.ev-menu button.ev-mi, .cz-fabm.ev-menu .ev-mi { min-height: 40px; padding: 0 12px; gap: 10px; border-radius: 12px; font-size: var(--fs-3); font-weight: 600; color: var(--cz-ink); width: 100%; box-sizing: border-box; border-top: 0; margin: 0; }
|
|
60
60
|
.cz-fabm.ev-menu svg { width: 18px; height: 18px; color: var(--cz-ink2); stroke-width: 1.8; }
|
|
61
61
|
.cz-fabm.ev-menu [aria-current="page"] { background: var(--cz-well); color: var(--cz-ink); font-weight: 800; }
|
|
62
62
|
.cz-fabm.ev-menu a:hover, .cz-fabm.ev-menu button.ev-mi:hover { background: var(--cz-well); }
|
|
63
63
|
.cz-fabm.ev-menu .ev-k { margin-left: auto; font-size: var(--fs-2); color: var(--cz-ink3); font-weight: 600; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
|
|
64
|
-
|
|
65
|
-
.cz-fabm.ev-menu .ev-
|
|
66
|
-
.cz-fabm.ev-menu .ev-
|
|
67
|
-
.cz-fabm.ev-menu .ev-
|
|
64
|
+
/* the tray under the places: Search and Settings as icons (feedback batch 16 item 5, canvas FmA1Menu); the dots sit where they lead */
|
|
65
|
+
.cz-fabm.ev-menu .ev-tray { display: flex; gap: 8px; border-top: 1px solid var(--cz-hair); margin-top: 6px; padding: 8px 4px 0; }
|
|
66
|
+
.cz-fabm.ev-menu .ev-tb { position: relative; width: 46px; height: 46px; border-radius: 14px; border: 0; background: var(--cz-well); color: var(--cz-ink); display: inline-flex; align-items: center; justify-content: center; padding: 0; cursor: pointer; }
|
|
67
|
+
.cz-fabm.ev-menu .ev-tb:hover { background: var(--cz-hair); }
|
|
68
|
+
.cz-fabm.ev-menu .ev-tb svg { width: 20px; height: 20px; color: var(--cz-ink); }
|
|
69
|
+
.cz-fabm.ev-menu .ev-md { display: block; width: 9px; height: 9px; border-radius: 50%; flex: none; }
|
|
70
|
+
.cz-fabm.ev-menu a .ev-md { margin-left: auto; }
|
|
71
|
+
.cz-fabm.ev-menu .ev-md.you { background: var(--cz-blue); }
|
|
72
|
+
.cz-fabm.ev-menu .ev-md.risk { background: var(--cz-dot-risk); position: absolute; top: 9px; right: 9px; border: 2px solid var(--cz-well); box-sizing: content-box; width: 8px; height: 8px; }
|
|
68
73
|
.ev-scrim { position: fixed; inset: 0; z-index: 0; background: rgba(42,46,53,.08); }
|
|
69
74
|
.ev-scrim[hidden] { display: none; }
|
|
70
75
|
/* the closed menu's dots: blue, something new for you (top left); amber, a source is stale (top right). They appear; they never move. */
|
|
@@ -77,7 +82,8 @@
|
|
|
77
82
|
.ev-fd.risk { right: 2px; background: var(--cz-dot-risk); }
|
|
78
83
|
@media (max-width: 760px) {
|
|
79
84
|
.cz-fabm.ev-menu a, .cz-fabm.ev-menu button.ev-mi, .cz-fabm.ev-menu .ev-mi { min-height: 46px; }
|
|
80
|
-
.cz-fabm.ev-menu .ev-
|
|
85
|
+
.cz-fabm.ev-menu .ev-tray { justify-content: space-between; padding: 8px 6px 0; }
|
|
86
|
+
.cz-fabm.ev-menu .ev-tb { width: 52px; height: 52px; border-radius: 16px; }
|
|
81
87
|
}
|
|
82
88
|
|
|
83
89
|
/* ── Search (EvSearch, EvPhone right) ── */
|
|
@@ -229,3 +235,12 @@
|
|
|
229
235
|
.cz .ev-ad-hd { display: flex; align-items: center; gap: 12px; padding: 4px 4px 10px; }
|
|
230
236
|
.cz .ev-sp-ad { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
|
|
231
237
|
.cz .ev-sp-ad p { margin: 0; }
|
|
238
|
+
/* Settings › Connectors: each source's last read (feedback batch 16 item 5, FmA3Settings; was the Sources card), and the amber box on top */
|
|
239
|
+
.ev-st-main > .ev-st-warn { margin-bottom: 12px; color: var(--cz-ink); }
|
|
240
|
+
.ev-st-warn .ev-ib-card { background: var(--cz-card); }
|
|
241
|
+
.ev-st .ev-reads { margin-bottom: 12px; }
|
|
242
|
+
.ev-st .ev-fr { align-items: center; gap: 10px; }
|
|
243
|
+
.ev-st .ev-fr .ev-late { color: var(--cz-risk); font-weight: 700; }
|
|
244
|
+
.ev-st .ev-ib-sp { width: 32px; flex: none; }
|
|
245
|
+
.ev-st-nav .ev-mi .ev-dot.risk { margin-left: 6px; }
|
|
246
|
+
.ev-st .ev-rl { margin: 4px 0; }
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* staleOf(sources, now) → { id, name, text: 'Jira 5 days old', ago, state } | null the source furthest behind (failed, then the oldest)
|
|
7
7
|
* sourceRows(sources, now) → [{ id, name, sub, when, risk, act: 'read' | 'connect' | '' }] the Sources table (EvSources)
|
|
8
8
|
* partsOf(id) → what may be out of date when that source is old ('Board and the Jira-linked initiatives')
|
|
9
|
-
* fabLabel(here, open, stale)
|
|
9
|
+
* fabLabel(here, open, stale, news) → 'Open the menu. You are in Home. 3 new for you. Jira 5 days old' (the button says both dots, FmGrill 13)
|
|
10
10
|
* SEARCH_KINDS · searchGroups(results, { phone }) → [{ key, label, rows }] EvSearch's groups, in its order
|
|
11
11
|
* resultSub(r) · resultTag(r) → the grey line after a result's title, and the word at its right
|
|
12
12
|
* wtChip(worktrees) → 'main + 3 worktrees'
|
|
@@ -54,9 +54,9 @@ export function sourceRows(sources, now = Date.now()) {
|
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
export function fabLabel(here, open, stale) {
|
|
57
|
+
export function fabLabel(here, open, stale, news) {
|
|
58
58
|
if (open) return 'Close the menu';
|
|
59
|
-
return 'Open the menu. You are in ' + (PLACE[here] || 'PMOS') + (stale ? '. A source is stale' : '');
|
|
59
|
+
return 'Open the menu. You are in ' + (PLACE[here] || 'PMOS') + (news > 0 ? '. ' + news + ' new for you' : '') + (stale ? '. ' + (stale.text || 'A source is stale') : '');
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
/* ── Search ── */
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* cozy-nav.js — the floating menu (initiative premium-agreed-design; redrawn by premium-uncovered-features E1,
|
|
2
|
+
* cozy-nav.js — the floating menu (initiative premium-agreed-design; redrawn by premium-uncovered-features E1, then by feedback batch 16
|
|
3
|
+
* item 5, canvas FmA1Menu and FmA4Desk: fewer menus).
|
|
3
4
|
*
|
|
4
|
-
* One button, bottom left on desktop and bottom right on a phone, opens the menu: Home, Board
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* One button, bottom left on desktop and bottom right on a phone, opens the menu: the three places, Home, Board and Intelligence; then a
|
|
6
|
+
* tray of two icons, Search (⌘K on a desk) and Settings. It is the one way between places, and it holds nothing else: New for you is a fold
|
|
7
|
+
* in Your day, Sources are Settings › Connectors, Theme is Settings › General, and More is gone (feedback batch 16 item 5).
|
|
8
|
+
* The button keeps its two dots on every page: blue when something is new for you, amber when a source is stale. Open, the blue dot sits on
|
|
9
|
+
* the Home row (where Your day is) and the amber dot on the Settings icon; the button's own name says both ("Open the menu. 3 new for you.
|
|
10
|
+
* Jira is stale.").
|
|
7
11
|
* Search pm/cozy-search.js: across the repository and every worktree; Ctrl K (Cmd K) or "/" opens it from any page
|
|
8
|
-
*
|
|
9
|
-
* Sources pm/cozy-sources.js: what PMOS reads and how old each reading is, in the Viewer
|
|
10
|
-
* Settings pm/cozy-settings.js: General, Connectors, Workspaces, Updates, What's new
|
|
11
|
-
* A page with features the design does not draw yet passes opts.more (Home): a quiet "More" row then follows Settings.
|
|
12
|
+
* Settings pm/cozy-settings.js; it opens at Connectors while a source is stale, so the stale one is the first thing there
|
|
12
13
|
* A page that passes opts.here() runs it when its own place is pressed, in place of a reload (Home: Menu > Home closes the page that is open).
|
|
13
|
-
* The counts come from GET /api/news-for-you and GET /api/sources, read when the page opens and every two minutes while it is shown
|
|
14
|
-
*
|
|
14
|
+
* The counts come from GET /api/news-for-you and GET /api/sources, read when the page opens and every two minutes while it is shown; each
|
|
15
|
+
* read of New for you is passed on as the event 'cz:news-for-you' (detail: the answer), so Home's Your day and Good morning follow it.
|
|
16
|
+
* Nothing here leads to the console, and nothing here writes.
|
|
15
17
|
*/
|
|
16
18
|
import { esc, svg, ICON, wsQ } from './cozy-evui.js';
|
|
17
19
|
import { fabLabel, staleOf } from './cozy-evmodel.js';
|
|
@@ -24,7 +26,6 @@ export const PLACES = [
|
|
|
24
26
|
];
|
|
25
27
|
export { fabLabel };
|
|
26
28
|
const THEME_KEY = 'pmos.c3.theme';
|
|
27
|
-
const THEMES = [['light', 'Light'], ['dark', 'Dark'], ['auto', 'Auto']];
|
|
28
29
|
const CSS = new URL('./cozy-ev.css', import.meta.url).href;
|
|
29
30
|
const N = { news: 0, stale: null, here: 'home' };
|
|
30
31
|
|
|
@@ -41,19 +42,18 @@ export function setTheme(pick, doc = document, { keep = true } = {}) {
|
|
|
41
42
|
doc.dispatchEvent(new CustomEvent('cz:theme', { detail: { pick: p, dark } }));
|
|
42
43
|
}
|
|
43
44
|
|
|
44
|
-
/** The menu's markup; pure, so a unit test can read it. here: home | board | insights. o: { news, stale: { text } | null
|
|
45
|
+
/** The menu's markup; pure, so a unit test can read it. here: home | board | insights. o: { news, stale: { text } | null } */
|
|
45
46
|
export function menuHtml(here, o = {}) {
|
|
46
|
-
const news = o.news > 0
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
+
|
|
53
|
-
+ `<button type="button" class="ev-
|
|
54
|
-
+ `<button type="button" class="ev-
|
|
55
|
-
+
|
|
56
|
-
+ `<div class="ev-mi ev-theme">${svg(ICON.theme, 18)}<span>Theme</span><span class="ev-seg sm" role="group" aria-label="Theme">${THEMES.map(([k, w]) => `<button type="button" data-ev-theme="${k}" aria-pressed="${k === th}">${w}</button>`).join('')}</span></div>`;
|
|
47
|
+
const news = o.news > 0, dot = (c) => `<i class="ev-md ${c}" aria-hidden="true"></i>`;
|
|
48
|
+
return PLACES.map((p) => {
|
|
49
|
+
const you = p.key === 'home' && news;
|
|
50
|
+
const lab = you ? ` aria-label="${p.label}. ${o.news} new for you in Your day"` : '';
|
|
51
|
+
return `<a href="${p.href}"${p.key === here ? ' aria-current="page"' : ''}${lab}>${svg(p.d, 18)}${p.key === here ? `<b>${p.label}</b>` : `<span>${p.label}</span>`}${you ? dot('you') : ''}</a>`;
|
|
52
|
+
}).join('')
|
|
53
|
+
+ '<div class="ev-tray">'
|
|
54
|
+
+ `<button type="button" class="ev-tb" data-cz-search aria-label="Search (⌘K)" title="Search ⌘K">${svg(ICON.search, 20)}</button>`
|
|
55
|
+
+ `<button type="button" class="ev-tb" data-cz-settings aria-label="Settings${o.stale ? '. ' + esc(o.stale.text) : ''}" title="Settings">${svg(ICON.settings, 20)}${o.stale ? dot('risk') : ''}</button>`
|
|
56
|
+
+ '</div>';
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
function addCss(doc) {
|
|
@@ -80,14 +80,14 @@ export function mountNav(here, doc = document, opts = {}) {
|
|
|
80
80
|
mountToastFaces(doc); loadPrefs();
|
|
81
81
|
const fab = w.querySelector('#czFab'), menu = w.querySelector('#czMenu'), scrim = w.querySelector('#czScrim');
|
|
82
82
|
const draw = () => {
|
|
83
|
-
menu.innerHTML = menuHtml(here, { news: N.news, stale: N.stale
|
|
83
|
+
menu.innerHTML = menuHtml(here, { news: N.news, stale: N.stale });
|
|
84
84
|
w.querySelector('#czFdYou').hidden = !(N.news > 0) || !menu.hidden;
|
|
85
85
|
w.querySelector('#czFdRisk').hidden = !N.stale || !menu.hidden;
|
|
86
|
-
if (menu.hidden) fab.setAttribute('aria-label', fabLabel(here, false,
|
|
86
|
+
if (menu.hidden) fab.setAttribute('aria-label', fabLabel(here, false, N.stale, N.news));
|
|
87
87
|
};
|
|
88
88
|
const set = (open) => {
|
|
89
89
|
menu.hidden = !open; scrim.hidden = !open; fab.setAttribute('aria-expanded', String(open));
|
|
90
|
-
fab.setAttribute('aria-label', fabLabel(here, open,
|
|
90
|
+
fab.setAttribute('aria-label', fabLabel(here, open, N.stale, N.news)); fab.innerHTML = svg(open ? ICON.close : ICON.menu, 22);
|
|
91
91
|
draw();
|
|
92
92
|
if (open) { const f = menu.querySelector('a, button'); if (f) f.focus(); }
|
|
93
93
|
};
|
|
@@ -102,13 +102,10 @@ export function mountNav(here, doc = document, opts = {}) {
|
|
|
102
102
|
const a = e.target.closest('a[aria-current="page"]');
|
|
103
103
|
if (a && opts.here && !e.metaKey && !e.ctrlKey && !e.shiftKey) { e.preventDefault(); set(false); opts.here(); return; }
|
|
104
104
|
const b = e.target.closest('button'); if (!b) return;
|
|
105
|
-
if (b.dataset.evTheme) { setTheme(b.dataset.evTheme, doc); return; }
|
|
106
105
|
set(false);
|
|
107
106
|
if ('czSearch' in b.dataset) import('./cozy-search.js').then((M) => M.openSearch(opts.search ? { go: opts.search() } : {}));
|
|
108
|
-
|
|
109
|
-
else if ('
|
|
110
|
-
else if ('czSettings' in b.dataset) import('./cozy-settings.js').then((M) => M.openSettings());
|
|
111
|
-
else if ('czMore' in b.dataset && opts.more) opts.more()(fab);
|
|
107
|
+
// a stale source opens Settings at Connectors, the stale one first (FmA3Settings: open where it matters)
|
|
108
|
+
else if ('czSettings' in b.dataset) import('./cozy-settings.js').then((M) => M.openSettings(N.stale ? 'connectors' : undefined));
|
|
112
109
|
});
|
|
113
110
|
// Ctrl K (Cmd K) and "/" open Search from any page; a second press focuses it
|
|
114
111
|
doc.addEventListener('keydown', (e) => {
|
|
@@ -122,7 +119,7 @@ export function mountNav(here, doc = document, opts = {}) {
|
|
|
122
119
|
const read = async () => {
|
|
123
120
|
if (doc.hidden) return;
|
|
124
121
|
const [n, s] = await Promise.all([getj('/api/news-for-you' + wsQ()), getj('/api/sources' + wsQ())]);
|
|
125
|
-
if (n && n.ok) N.news = n.count || 0;
|
|
122
|
+
if (n && n.ok) { N.news = n.count || 0; doc.dispatchEvent(new CustomEvent('cz:news-for-you', { detail: n })); }
|
|
126
123
|
if (s && s.ok) N.stale = staleOf(s.sources);
|
|
127
124
|
if (menu.hidden || !menu.contains(doc.activeElement)) draw();
|
|
128
125
|
};
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
/* pm/cozy-news.js — New for you, in the Viewer (initiative premium-uncovered-features, E2; canvas EvInbox, HmAround
|
|
2
|
-
*
|
|
1
|
+
/* pm/cozy-news.js — New for you, the whole list in the Viewer (initiative premium-uncovered-features, E2; canvas EvInbox, HmAround; since
|
|
2
|
+
* feedback batch 16 item 5b, canvas FmA2Day, it opens from the New for you fold of Your day: "N more", or one of its rows).
|
|
3
3
|
*
|
|
4
4
|
* For your information only: Mentions, Given to you, Finished while you were away (GET /api/news-for-you), and today's digests from the
|
|
5
5
|
* morning brief (GET /api/briefing-premium). An item leaves once it is seen: the items shown are marked seen when the card closes, and
|
|
6
6
|
* Mark all seen marks them at once (POST /api/news-for-you/seen). Open on a row shows the item: a mention with Make it a task, Mark read and
|
|
7
|
-
* Open in its source; a task with its source; finished work opens where it waits.
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* openNews({ go? }) → the body element */
|
|
7
|
+
* Open in its source; a task with its source; finished work opens where it waits. The page's meetings ring, its two legend cards, "Where
|
|
8
|
+
* the rest went" and the "Not here" note are gone (FmAudit: Your day holds the meetings, and a page that explains itself is chrome).
|
|
9
|
+
* openNews({ go?, view? }) → the body element; view: an item's id opens straight on that item */
|
|
11
10
|
import { pmGet, pmPost } from './http.js';
|
|
12
11
|
import { open as vwOpen, current as vwCurrent } from './cozy-viewer.js';
|
|
13
12
|
import { esc, svg, ICON, toast, wsParam, wsQ, skelRows, cantRead, allClear } from './cozy-evui.js';
|
|
14
13
|
import { initials, ago } from './cozy-evmodel.js';
|
|
15
14
|
|
|
16
15
|
const SRC = { slack: 'Slack', jira: 'Jira', confluence: 'Confluence', mail: 'Mail' };
|
|
17
|
-
const N = { r: null, dig: null,
|
|
16
|
+
const N = { r: null, dig: null, view: '', body: null, shown: new Set(), madd: new Set(), mread: new Set(), busy: false };
|
|
18
17
|
const homeUrl = (params) => { const q = new URLSearchParams(params); if (wsParam()) q.set('ws', wsParam()); return '/premium.html?' + q.toString(); };
|
|
19
18
|
const https = (u) => (/^https:\/\/\S+$/i.test(String(u || '')) ? u : '');
|
|
20
19
|
/** The deep link of a finished item, as the bell's was: a My work item opens its dialog; anything else opens on Home. */
|
|
@@ -31,12 +30,6 @@ function rowHtml(it) {
|
|
|
31
30
|
return `<div class="ev-trow" data-ev-id="${esc(it.id)}"><i class="ev-dot you" aria-hidden="true"></i>${av}<div class="ev-tx"><p><b>${esc(it.title)}</b></p><p class="ev-small ev-mut">${esc(sub)}</p></div>`
|
|
32
31
|
+ `<button type="button" class="ev-ib" data-ev-open="${esc(it.id)}" aria-label="Open: ${esc(it.title)}" title="Open">${svg(ICON.open, 16)}</button></div>`;
|
|
33
32
|
}
|
|
34
|
-
const REST = [
|
|
35
|
-
['pulse', 'Portfolio pulse', 'Intelligence, at the top. Home does not repeat it.'],
|
|
36
|
-
['rep', 'Found in your work', 'Intelligence · Reports and dashboards, at the top.'],
|
|
37
|
-
['prop', 'Proposals', 'the initiative’s next step, because they need an answer.'],
|
|
38
|
-
['scan', 'Scan now', 'Ask in chat: “scan for billing news”.'],
|
|
39
|
-
];
|
|
40
33
|
function digHtml() {
|
|
41
34
|
const d = N.dig; if (!d || !d.length) return '';
|
|
42
35
|
return `<section id="aroundDig" class="ev-dig"><p class="ev-lbl">Digests ${d.length}</p>${d.map((e) => { const x = e.dialog || {}, p = x.pane || {}, l = https(x.link);
|
|
@@ -44,17 +37,14 @@ function digHtml() {
|
|
|
44
37
|
}
|
|
45
38
|
function listHtml() {
|
|
46
39
|
const r = N.r;
|
|
47
|
-
const head = `<div class="ev-head"><h2 class="ev-h2">New
|
|
48
|
-
const two = '<div class="ev-two"><div class="ev-box"><b>Initiatives</b> (left)<br><span class="ev-mut">Each shows its next step. It stays until you act.</span></div><div class="ev-box blue"><b>New for you</b> (here)<br><span class="ev-mut">For your information. It goes once you have seen it.</span></div></div>';
|
|
40
|
+
const head = `<div class="ev-head"><h2 class="ev-h2">New for you</h2>${r && r.ok && r.count ? '<button type="button" class="ev-btn sm ghost" data-ev-all>Mark all seen</button>' : ''}</div>`;
|
|
49
41
|
let body;
|
|
50
42
|
if (!r) body = skelRows(3) + '<p class="ev-small ev-mut">Reading what is new for you</p>';
|
|
51
43
|
else if (!r.ok) body = cantRead({ what: 'New for you', why: r.error || '' });
|
|
52
44
|
else if (!r.count) body = allClear('Nothing new since you last looked');
|
|
53
45
|
else body = r.groups.map((g) => `<p class="ev-lbl">${esc(g.label)}</p>` + g.items.map(rowHtml).join('')).join('');
|
|
54
46
|
const notRead = r && r.ok && r.read ? [['mentions', 'Mentions'], ['inbox', 'The agents\' results'], ['work', 'Your tasks']].filter(([k]) => r.read[k] === false).map(([, l]) => l) : [];
|
|
55
|
-
|
|
56
|
-
const foot = '<div class="ev-foot"><div class="ev-box ev-small"><b>Not here, so nothing shows twice</b><br>A mention that asks you something, a passed review or a proposal becomes the next step of its initiative. A task given to you shows here once, then sits under its initiative. Goal trends live in Insights.</div></div>';
|
|
57
|
-
return head + (N.prep || '') + two + body + (notRead.length ? `<p class="ev-small ev-mut" role="status">Not read: ${esc(notRead.join(', '))}.</p>` : '') + digHtml() + rest + foot;
|
|
47
|
+
return head + body + (notRead.length ? `<p class="ev-small ev-mut" role="status">Not read: ${esc(notRead.join(', '))}.</p>` : '') + digHtml();
|
|
58
48
|
}
|
|
59
49
|
function detailHtml(it) {
|
|
60
50
|
const back = '<div class="ev-head"><button type="button" class="ev-btn sm ghost" data-ev-back>' + svg(ICON.back, 16) + 'New for you</button></div>';
|
|
@@ -78,8 +68,7 @@ function draw() {
|
|
|
78
68
|
if (!it) for (const x of items()) N.shown.add(x.id);
|
|
79
69
|
}
|
|
80
70
|
async function read() {
|
|
81
|
-
const [r, d
|
|
82
|
-
N.prep = bp && bp.ok !== false ? await import('./home-around.js').then((M) => M.prepHtmlOf(bp)).catch(() => '') : '';
|
|
71
|
+
const [r, d] = await Promise.all([pmGet('/api/news-for-you' + wsQ()), N.dig ? Promise.resolve(null) : pmGet('/api/briefing-premium' + wsQ())]);
|
|
83
72
|
N.r = r && r.ok ? r : { ok: false, error: (r && r.error) || 'the server did not answer' };
|
|
84
73
|
if (d && d.ok && d.model) { const T = d.model.today || {}; N.dig = [].concat(T.earlier || [], T.ahead || []).filter((e) => e && e.kind === 'digest'); }
|
|
85
74
|
draw();
|
|
@@ -95,7 +84,7 @@ async function seen(ids) {
|
|
|
95
84
|
}
|
|
96
85
|
|
|
97
86
|
export function openNews(o = {}) {
|
|
98
|
-
N.view = ''; N.shown = new Set();
|
|
87
|
+
N.view = o.view || ''; N.shown = new Set(o.view ? [o.view] : []);
|
|
99
88
|
N.body = vwOpen({ id: 'news', kind: 'For your information', title: 'New for you', icon: ICON.news, render: (b) => { b.classList.add('ev-card-b', 'ev-news'); N.body = b; draw(); wire(b, o); },
|
|
100
89
|
onClose: () => { const ids = [...N.shown]; N.shown = new Set(); seen(ids); } }); // an item leaves once seen: what the card showed is seen when it closes
|
|
101
90
|
read();
|
|
@@ -105,7 +94,7 @@ function wire(b, o) {
|
|
|
105
94
|
b.onclick = async (e) => {
|
|
106
95
|
const t = e.target.closest('button'); if (!t || N.busy) return;
|
|
107
96
|
if ('evRetry' in t.dataset) { N.r = null; draw(); read(); return; }
|
|
108
|
-
if ('evSources' in t.dataset) { import('./cozy-
|
|
97
|
+
if ('evSources' in t.dataset) { import('./cozy-settings.js').then((M) => M.openSettings('connectors')); return; }
|
|
109
98
|
if ('evBack' in t.dataset) { N.view = ''; draw(); const f = b.querySelector('[data-ev-open]'); if (f) f.focus(); return; }
|
|
110
99
|
if ('evAll' in t.dataset) {
|
|
111
100
|
N.busy = true; const ids = items().map((x) => x.id);
|
|
@@ -113,11 +102,6 @@ function wire(b, o) {
|
|
|
113
102
|
if (!ok) { toast('It was not marked seen. The server did not answer.'); return; }
|
|
114
103
|
N.shown = new Set(); toast('Marked seen.'); N.r = null; draw(); read(); return;
|
|
115
104
|
}
|
|
116
|
-
if (t.dataset.evRest) {
|
|
117
|
-
const k = t.dataset.evRest;
|
|
118
|
-
// each opens its view, so every press the old Around you held (keep, dismiss, Scan now, set up) is still one press away
|
|
119
|
-
import('./home-around.js').then((M) => M.openAround(k)); return;
|
|
120
|
-
}
|
|
121
105
|
if (t.dataset.evOpen) {
|
|
122
106
|
const it = items().find((x) => x.id === t.dataset.evOpen); if (!it) return;
|
|
123
107
|
N.shown.add(it.id);
|