create-pmos 0.402.0 → 0.404.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 -30
- package/payload/AGENTS.md +2 -0
- package/payload/KIT-VERSION +1 -1
- package/payload/mods/pmos-cockpit/hooks/lib/session-facts.mjs +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 +32 -5
- package/workspace/briefing-premium-adddoc-test.js +28 -22
- package/workspace/briefing-premium-board-test.js +91 -73
- package/workspace/briefing-premium-calendar-2-test.js +23 -10
- package/workspace/briefing-premium-calendar-3-test.js +23 -19
- package/workspace/briefing-premium-calendar-test.js +19 -17
- package/workspace/briefing-premium-initiative-test.js +25 -12
- package/workspace/briefing-premium-insights-test.js +31 -18
- package/workspace/briefing-premium-metrics-test.js +8 -8
- package/workspace/briefing-premium-test.js +4 -3
- package/workspace/changelog.json +24 -0
- package/workspace/fixtures/premium-viewer-fixtures.js +24 -2
- package/workspace/guide/jira.md +38 -6
- package/workspace/guide/programs.md +2 -0
- package/workspace/home-rows-test.js +184 -0
- package/workspace/lib/briefing-premium-agent.js +3 -0
- package/workspace/lib/calendar-layers.js +8 -4
- package/workspace/lib/initiative-layout.js +4 -3
- package/workspace/lib/jira-cli.js +17 -12
- package/workspace/lib/jira-status.js +1 -1
- package/workspace/lib/jira-tickets.js +126 -24
- package/workspace/lib/meeting-files.js +58 -0
- package/workspace/lib/meeting-learn.js +139 -0
- package/workspace/lib/meeting-material.js +12 -5
- package/workspace/lib/notes.js +3 -0
- package/workspace/lib/program-chat.js +32 -0
- package/workspace/lib/routes-brief-page.js +8 -1
- package/workspace/lib/routes-calendar-views.js +24 -3
- package/workspace/lib/routes-meeting-material.js +38 -0
- package/workspace/lib/routes-meeting-points.js +23 -3
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-board-actions-test.js +30 -24
- package/workspace/premium-chat-context-test.js +1 -1
- package/workspace/premium-chat-goal-view-test.js +1 -1
- package/workspace/premium-chat-viewer-test.js +1 -1
- package/workspace/premium-core-doc-issue-test.js +13 -7
- package/workspace/premium-discuss-landing-test.js +83 -0
- package/workspace/premium-link-suggest-test.js +103 -0
- package/workspace/premium-report-read-test.js +86 -82
- package/workspace/premium-vw-backlog-test.js +6 -5
- package/workspace/premium-vw-cal-test.js +46 -23
- package/workspace/premium-vw-item-test.js +8 -6
- package/workspace/premium-vw-jira-test.js +3 -2
- package/workspace/premium-vw-meet-test.js +122 -66
- package/workspace/premium-vw-notes-test.js +7 -6
- package/workspace/premium-vw-rec-test.js +14 -13
- package/workspace/premium-vw-slides-test.js +11 -5
- package/workspace/program-panel-test.js +64 -55
- package/workspace/public/pm/bd-acts.js +1 -1
- package/workspace/public/pm/bd-asks.js +22 -7
- package/workspace/public/pm/bd-ini-panel.js +232 -0
- package/workspace/public/pm/bd-pop.js +2 -2
- package/workspace/public/pm/bd-prog-panel.js +176 -191
- package/workspace/public/pm/cozy-board.css +5 -28
- package/workspace/public/pm/cozy-evui.js +4 -2
- package/workspace/public/pm/cozy-home-rows.css +54 -0
- package/workspace/public/pm/cozy-home.css +9 -0
- package/workspace/public/pm/cozy-insights.css +1 -2
- package/workspace/public/pm/cozy-mtg-present.css +160 -0
- package/workspace/public/pm/cozy-panel.css +11 -34
- package/workspace/public/pm/cozy-rec-pill.css +12 -0
- package/workspace/public/pm/cozy-rec-pill.js +46 -0
- package/workspace/public/pm/cozy-viewer.js +307 -43
- package/workspace/public/pm/cozy-vw-mtg.css +96 -94
- package/workspace/public/pm/cozy-vw-rp.css +40 -25
- package/workspace/public/pm/cozy-vw-shell.css +127 -0
- package/workspace/public/pm/cozy-xv.css +51 -0
- package/workspace/public/pm/cozy-xv.js +34 -0
- package/workspace/public/pm/goal-chat.js +1 -1
- package/workspace/public/pm/home-app.js +122 -58
- package/workspace/public/pm/home-chat.js +11 -2
- package/workspace/public/pm/home-day.js +64 -0
- package/workspace/public/pm/home-ini-model.js +1 -1
- package/workspace/public/pm/home-ini.js +197 -54
- package/workspace/public/pm/home-list.js +6 -14
- package/workspace/public/pm/home-mentions.js +187 -0
- package/workspace/public/pm/home-rec-row.js +67 -0
- package/workspace/public/pm/home-review.js +20 -10
- package/workspace/public/pm/home-task.js +19 -18
- package/workspace/public/pm/home-today.js +3 -3
- package/workspace/public/pm/premium-board.js +83 -235
- package/workspace/public/pm/premium-insights.js +118 -82
- package/workspace/public/pm/premium-mtg-present.js +408 -100
- package/workspace/public/pm/premium-mtg-replay.js +70 -10
- package/workspace/public/pm/premium-report-read.js +118 -63
- package/workspace/public/pm/premium-vw-cal.js +62 -34
- package/workspace/public/pm/premium-vw-mtg.js +348 -192
- package/workspace/public/pm/rec-state.js +63 -0
- package/workspace/public/pm/rp-parts.js +33 -8
- package/workspace/public/pm/tk-draft.js +107 -0
- package/workspace/public/pm/tk-model.js +134 -0
- package/workspace/public/pm/tk-send.js +124 -0
- package/workspace/public/pm/tk-tasks.css +120 -0
- package/workspace/public/premium-board.html +0 -1
- package/workspace/server.js +4 -2
- package/workspace/skills/jira-push.skill +3 -3
- package/workspace/test-lists/prd-to-jira.json +6 -0
- package/workspace/test-lists/program-chat.json +6 -0
- package/workspace/test-lists/viewer-home-rows.json +9 -0
- package/workspace/test-lists/viewer-meetings.json +9 -0
- package/workspace/test-lists/viewer-shell-a.json +15 -0
- package/workspace/tk-tasks-test.js +199 -0
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/* pm/premium-vw-cal.js — Calendar | Notes in the Viewer (initiative premium-agreed-design, area viewer; Main.dc.html viewer props cal and
|
|
2
2
|
* notelist), and the pure calendar model of the earlier grid (initiative premium-viewer, R8), kept for its suite.
|
|
3
|
-
* THE VIEW (openCalendar): one
|
|
4
|
-
* Calendar
|
|
5
|
-
*
|
|
6
|
-
*
|
|
3
|
+
* THE VIEW (openCalendar, XvACal): one Viewer item, "Calendar", with a Calendar | Notes switch and + (New note) beside it.
|
|
4
|
+
* Calendar summary first: "Today · 4 meetings · 2 h", "Next: Rail review with Ana at 15:30." and Open the prep (calSummary). Then Mon to
|
|
5
|
+
* Fri, each day with its load bar, and the picked day's meetings and untitled notes in one list: the time, the title, what it is
|
|
6
|
+
* about and its state; a blue dot on the next one, Link it on a note with no initiative, Recording on a live one. Week and
|
|
7
|
+
* Month (the grids below) and the range moves are in ⋯; the week and month views keep their own range head.
|
|
7
8
|
* Notes the meeting notes grouped by initiative, a series as one row; search what was said (GET /api/notes/search).
|
|
8
9
|
* Reads GET /api/calendar-views (view=week, and day|week|month for the list), GET /api/notes, GET /api/notes/search. A meeting or a note opens
|
|
9
10
|
* the meeting card (premium-vw-mtg.js). New note starts an untitled note now (POST /api/notes/new) and records it.
|
|
@@ -18,7 +19,7 @@
|
|
|
18
19
|
* or one tied to no initiative, prep or record) drawn muted. A week is at least 620px wide and scrolls sideways in a narrower pane.
|
|
19
20
|
* calModel(r, view, date, today) pure · calHtml(M, esc) pure · mountCal(el, st, d) · openCalendar(d, st?) */
|
|
20
21
|
import { weekView } from './premium-meeting.js';
|
|
21
|
-
import { open as vOpen, current as vCur } from './cozy-viewer.js';
|
|
22
|
+
import { open as vOpen, current as vCur, czSummary, setWidth, widthOf } from './cozy-viewer.js';
|
|
22
23
|
import { pmGet } from './http.js';
|
|
23
24
|
import { notesCards } from './premium-vw-notes.js';
|
|
24
25
|
import './premium-vw-open.js'; // registers window.czViews
|
|
@@ -206,17 +207,14 @@ export function dayModel(W, notes, picked, today, now = Date.now()) {
|
|
|
206
207
|
const n = N.filter((x) => sameEv(x.meeting, r)).sort((a, b) => String(b.updated_at || '').localeCompare(String(a.updated_at || '')))[0] || null;
|
|
207
208
|
const at = Date.parse(r.at), end = Date.parse(r.end), linked = !!r.about;
|
|
208
209
|
const about = r.level ? (r.level.kind === 'portfolio' ? 'Portfolio' : clip(r.level.name || r.level.id, 50)) : (n && n.initiative && n.initiative.id ? clip(n.initiative.title || n.initiative.id, 50) : '');
|
|
209
|
-
|
|
210
|
+
/* only what asks for a look gets a chip: a live recording; the next meeting gets a dot and its "in 45 min" (XvACal) */
|
|
211
|
+
let chip = '', k = '', next = false, soon = '';
|
|
210
212
|
if (n && (n.state === 'recording' || n.state === 'paused')) { chip = n.state === 'paused' ? 'Paused' : 'Recording'; k = 'rec'; }
|
|
211
|
-
else if (n && n.state === 'ended') {
|
|
212
|
-
|
|
213
|
-
else if (!about) chip = 'Not linked';
|
|
214
|
-
else if (picked > today) chip = DOW[wd(picked)];
|
|
215
|
-
else if (Number.isFinite(end) && end < now) chip = 'Ended';
|
|
216
|
-
else chip = hasTime(r.at) ? 'Today' : 'All day';
|
|
217
|
-
const status = n && n.state === 'ended' ? 'notes ready' : n && (n.state === 'recording' || n.state === 'paused') ? 'recording' : '';
|
|
213
|
+
else if (picked === today && hasTime(r.at) && at > now && !nextDone && !(n && n.state === 'ended')) { nextDone = true; next = true; const m = Math.max(1, Math.round((at - now) / 60000)); soon = 'in ' + (m < 60 ? m + ' min' : Math.floor(m / 60) + ' h' + (m % 60 ? ' ' + (m % 60) + ' min' : '')); }
|
|
214
|
+
const status = n && n.state === 'ended' ? 'notes ready' : '';
|
|
218
215
|
const who = (r.who || []).slice(0, 3).join(', ') + ((r.who || []).length > 3 ? ' and ' + ((r.who || []).length - 3) + ' more' : '');
|
|
219
|
-
|
|
216
|
+
const ended = !n && Number.isFinite(end) && end < now;
|
|
217
|
+
return { kind: 'event', t: Number.isFinite(at) ? at : 0, time: hasTime(r.at) ? hmOf(r.at) : 'All day', title: r.title, sub: [about || 'Not linked', status, soon].filter(Boolean).join(' · '), who, chip, k, next, ended, linked: !!about || linked, row: r, note: n ? n.id : '', mins: hasTime(r.at) && Number.isFinite(end) && end > at ? Math.round((end - at) / 60000) : 0 };
|
|
220
218
|
});
|
|
221
219
|
for (const n of N) {
|
|
222
220
|
const m = n.meeting;
|
|
@@ -225,8 +223,8 @@ export function dayModel(W, notes, picked, today, now = Date.now()) {
|
|
|
225
223
|
const ini = n.initiative && n.initiative.id ? clip(n.initiative.title || n.initiative.id, 50) : '';
|
|
226
224
|
const len = n.meeting_ms >= 60000 ? Math.round(n.meeting_ms / 60000) + ' min' : '';
|
|
227
225
|
const live = n.state === 'recording' || n.state === 'paused';
|
|
228
|
-
ents.push({ kind: 'note', t: Date.parse(s) || 0, time: hmOf(s), title: clip(n.title || 'Untitled note', 120), sub: ['
|
|
229
|
-
chip: live ? (n.state === 'paused' ? 'Paused' : 'Recording') : ini ?
|
|
226
|
+
ents.push({ kind: 'note', t: Date.parse(s) || 0, time: hmOf(s), title: clip(n.title || 'Untitled note', 120), sub: [len, 'no calendar event', ini].filter(Boolean).join(' · '),
|
|
227
|
+
chip: live ? (n.state === 'paused' ? 'Paused' : 'Recording') : ini ? '' : 'Link it', k: live ? 'rec' : '', next: false, linked: !!ini, note: n.id, mins: 0 });
|
|
230
228
|
}
|
|
231
229
|
ents.sort((a, b) => a.t - b.t);
|
|
232
230
|
const [, m, d] = parts(picked);
|
|
@@ -269,14 +267,24 @@ export function weekHtml(M, notes, nowMin, now = Date.now()) {
|
|
|
269
267
|
const gut = `<div class="vzc-col vzc-gut"><div class="vzc-hd"></div><div class="vzc-body" data-tl="${hours.length * H}px">${hours.map((m, i) => `<i data-tl="${i * H}px">${pad(m / 60)}</i>`).join('')}</div></div>`;
|
|
270
268
|
return `<div class="vzc-wk">${gut}${M.days.map(col).join('')}</div>`;
|
|
271
269
|
}
|
|
272
|
-
/**
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
270
|
+
/** Today's summary (XvACal .sum) from today's dayModel: "Today · 4 meetings · 2 h"; "Next: Rail review with Ana at 15:30." and Open the prep;
|
|
271
|
+
* a live recording comes first. Nothing on today says so in the line alone. TD null (today not read yet) → null. */
|
|
272
|
+
export function calSummary(TD) {
|
|
273
|
+
if (!TD || TD.state !== 'ok') return null;
|
|
274
|
+
const ev = TD.rows.filter((r) => r.kind === 'event'), mins = ev.reduce((a, r) => a + (r.mins || 0), 0);
|
|
275
|
+
const line = 'Today · ' + (ev.length ? plural(ev.length, 'meeting') + (mins ? ' · ' + hrsText(mins) : '') : 'no meetings');
|
|
276
|
+
const live = TD.rows.findIndex((r) => r.k === 'rec'), nx = TD.rows.findIndex((r) => r.next);
|
|
277
|
+
if (live >= 0) { const r = TD.rows[live]; return { line, tone: 'live', text: (r.chip === 'Paused' ? 'Paused: ' : 'Recording now: ') + r.title + '.', primary: { label: 'Open the notes', act: 'open:' + live } }; }
|
|
278
|
+
if (nx >= 0) { const r = TD.rows[nx]; return { line, tone: 'you', text: 'Next: ' + r.title + (r.who ? ' with ' + r.who : '') + ' at ' + r.time + '.' + (r.linked ? '' : ' It is not linked to an initiative yet.'), primary: { label: 'Open the prep', act: 'open:' + nx } }; }
|
|
279
|
+
return { line, tone: 'you', text: ev.length ? 'Nothing else today.' : '' };
|
|
280
|
+
}
|
|
281
|
+
/** The day (XvACal): the five weekdays with their load bars, then one list, each entry at its time. A day other than today says its count. */
|
|
282
|
+
export function dayHtml(strip, D, isToday = false) {
|
|
283
|
+
const h = [`<div class="vzc-days" role="group" aria-label="This week">${strip.map((d) => `<button type="button" class="vzc-dy${d.today ? ' now' : ''}" aria-pressed="${d.on}" data-c="day" data-k="${d.key}" aria-label="${esc(d.dow + ' ' + d.n + (d.today ? ', today' : '') + ': ' + plural(d.count, 'meeting'))}"><span>${d.dow}</span><b>${d.n}</b><span class="vzc-lb" data-tl="${Math.round(d.bar * 100)}%"><i></i></span></button>`).join('')}</div>`];
|
|
276
284
|
if (D.state === 'error') return h.join('') + `<p class="vz-empty" role="status">The calendar was not read. ${esc(D.reason || '')}</p>`;
|
|
277
|
-
|
|
278
|
-
h.push(`<p class="vzc-mut">${D.
|
|
279
|
-
|
|
285
|
+
if (!D.rows.length) return h.join('') + '<p class="vz-empty">No meetings on this day.</p>';
|
|
286
|
+
if (!isToday) { const mins = D.rows.reduce((a, r) => a + (r.mins || 0), 0), allEv = D.rows.every((r) => r.kind === 'event'); h.push(`<p class="vzc-mut">${esc(D.title)} · ${allEv ? plural(D.rows.length, 'meeting') : plural(D.rows.length, 'entry', 'entries')}${mins ? ' · ' + hrsText(mins) : ''}</p>`); }
|
|
287
|
+
h.push(`<div class="vzc-list">${D.rows.map((r, i) => `<button type="button" class="vzc-de vz-hv${r.ended ? ' past' : ''}" data-c="open" data-i="${i}"${r.next ? ' data-next' : ''}><span class="vzc-t">${esc(r.time)}</span><span class="vzc-dt"><b>${esc(r.title)}</b><small>${esc(r.sub)}</small></span>${r.chip === 'Link it' ? `<span class="vz-cc vzc-link" data-c="link" data-i="${i}" role="button" tabindex="0" title="Link it to an initiative">Link it</span>` : r.chip ? chipHtml(r.chip, r.k) : r.next ? '<i class="vzc-nx" aria-label="Next"></i>' : ''}</button>`).join('')}</div>`);
|
|
280
288
|
return h.join('');
|
|
281
289
|
}
|
|
282
290
|
/** The month (Day, Week and Month): a grid of weeks, each day with its number, how many meetings, the first three and "+N more". */
|
|
@@ -291,18 +299,19 @@ export function monthHtml(M) {
|
|
|
291
299
|
* strip, day, cards (notesCards), msg, nowMin } */
|
|
292
300
|
export function calViewHtml(st, X) {
|
|
293
301
|
const h = [];
|
|
294
|
-
h.push(`<div class="
|
|
302
|
+
h.push(`<div class="vzc-top"><div class="vzc-seg" role="tablist" aria-label="Meetings">${[['cal', 'Calendar'], ['notes', 'Notes']].map(([k, l]) => `<button type="button" role="tab" aria-selected="${st.tab === k}" data-c="tab" data-k="${k}">${l}</button>`).join('')}</div><button type="button" class="vzm-ib vz-hv" data-c="new" aria-label="New note" title="${esc(NEW_NOTE_TIP)}">${sv('plus', 18)}</button></div>`);
|
|
295
303
|
if (X.msg) h.push(`<p class="vz-msg" role="status" data-tone="${X.msg.tone || ''}">${esc(X.msg.text)}</p>`);
|
|
296
304
|
if (st.tab === 'cal') {
|
|
297
|
-
|
|
298
|
-
|
|
305
|
+
const S = calSummary(X.todayDay);
|
|
306
|
+
if (S) h.push(czSummary(S));
|
|
307
|
+
if (st.view !== 'day') h.push(`<div class="vzc-head"><h2 class="vzm-h2">${esc(rangeTitle(st.view, st.date, X.today))}</h2><button type="button" class="vzm-ib vz-hv" data-c="nav" data-k="-1" aria-label="Previous ${st.view}">${sv('prev')}</button><button type="button" class="vzm-ib vz-hv" data-c="nav" data-k="1" aria-label="Next ${st.view}">${sv('next')}</button><button type="button" class="vzm-btn vzm-soft" data-c="nav" data-k="0">Today</button><span class="vz-sp"></span><button type="button" class="vzm-btn vzm-soft" data-c="view" data-k="day">Day</button></div>`);
|
|
299
308
|
const M = X.M;
|
|
300
309
|
if (!M) h.push('<p class="vz-empty" role="status">Reading the calendar PMOS holds.</p>');
|
|
301
310
|
else if (M.state !== 'ok' && st.view !== 'day') h.push(`<p class="vz-empty" role="status">The calendar was not read. ${esc(M.reason || '')}</p>`);
|
|
302
311
|
else if (st.view === 'week') h.push(weekHtml(M, X.notes, X.nowMin) + (M.empty ? `<p class="vz-empty" role="status">${esc(M.empty)}</p>` : ''));
|
|
303
312
|
else if (st.view === 'month') h.push(monthHtml(M) + (M.empty ? `<p class="vz-empty" role="status">${esc(M.empty)}</p>` : ''));
|
|
304
|
-
else h.push(X.day ? dayHtml(X.strip, X.day) : '<p class="vz-empty" role="status">Reading the calendar PMOS holds.</p>');
|
|
305
|
-
h.push(`<div class="vzc-leg"><span><i class="vzc-sw"></i>Linked</span><span><i class="vzc-sw un"></i>Not linked</span><span class="vz-sp"></span><span title="${esc(CAL_FOOT)}">${esc(CAL_HINT)}</span></div>`);
|
|
313
|
+
else h.push(X.day ? dayHtml(X.strip, X.day, st.date === X.today) : '<p class="vz-empty" role="status">Reading the calendar PMOS holds.</p>');
|
|
314
|
+
if (st.view !== 'day') h.push(`<div class="vzc-leg"><span><i class="vzc-sw"></i>Linked</span><span><i class="vzc-sw un"></i>Not linked</span><span class="vz-sp"></span><span title="${esc(CAL_FOOT)}">${esc(CAL_HINT)}</span></div>`);
|
|
306
315
|
} else {
|
|
307
316
|
const C = X.cards;
|
|
308
317
|
h.push(`<div class="vzm-in vzc-find">${sv('find')}<input type="search" data-c="q" aria-label="${esc(SEARCH_HINT)}" placeholder="${esc(SEARCH_HINT)}" value="${esc(st.q || '')}">${st.q ? `<span class="vzc-mut">${C && C.state === 'ok' ? plural(C.count, 'note') : ''}</span><button type="button" class="vzm-ib vz-hv" data-c="clear" aria-label="Clear the search">${sv('x', 14)}</button>` : ''}</div>`);
|
|
@@ -333,19 +342,29 @@ function entryHtml(e, st) {
|
|
|
333
342
|
/* ── the view (page half) ─────────────────────────────────────────────────────────────────────────────────────── */
|
|
334
343
|
let CV = null;
|
|
335
344
|
export function calendarUrl(tab, ws) { return '/premium-viewer.html?' + ['open=' + (tab === 'notes' ? 'notes' : 'calendar'), ws ? 'ws=' + encodeURIComponent(ws) : ''].filter(Boolean).join('&'); }
|
|
336
|
-
const narrow = () => typeof window !== 'undefined' && window.innerWidth <= 760;
|
|
337
345
|
/** Opens Calendar | Notes in the Viewer. o = { ws, tab: 'cal' | 'notes', date, view, initiative } */
|
|
338
346
|
export function openCalendar(o = {}) {
|
|
339
347
|
if (o && (o.openDlg || o.$)) o = {}; // an old caller passed the shell's deps
|
|
340
348
|
const today = todayKey();
|
|
341
|
-
const view = VIEWS.some(([k]) => k === o.view) ? o.view :
|
|
349
|
+
const view = VIEWS.some(([k]) => k === o.view) ? o.view : 'day'; // XvACal: the day first, in any width; Week and Month are in ⋯
|
|
342
350
|
const me = CV = { ws: o.ws || new URLSearchParams(location.search).get('ws') || '', st: { tab: o.tab === 'notes' ? 'notes' : 'cal', view, date: o.date && /^\d{4}-\d{2}-\d{2}$/.test(o.date) ? o.date : today, q: '', filter: 'all', open: new Set() }, X: { today }, today, initiative: o.initiative || '' };
|
|
343
|
-
import('./premium-vw-mtg.js').then((M) =>
|
|
344
|
-
vOpen({ id: 'calendar', kind: 'Meetings', title: 'Calendar
|
|
351
|
+
import('./premium-vw-mtg.js').then((M) => M.mtgStyle());
|
|
352
|
+
vOpen({ id: 'calendar', kind: 'Meetings', title: 'Calendar', icon: 'cal', url: calendarUrl(me.st.tab, me.ws), more: calMore(me), render: (b) => paintCal(me, b), onClose: () => { if (CV === me) { CV = null; import('./premium-vw-mtg.js').then((M) => { if (!CV) M.widen(''); }); } } });
|
|
345
353
|
readCal(me); readNotes(me);
|
|
346
354
|
return me;
|
|
347
355
|
}
|
|
348
356
|
export const openNotesTab = (o = {}) => openCalendar({ ...o, tab: 'notes' });
|
|
357
|
+
/** ⋯ (XvACal): the three ranges, with the shown one marked; the range moves; New note. Read when the menu opens, so the mark is current. */
|
|
358
|
+
function calMore(me) {
|
|
359
|
+
const go = (k) => () => { if (CV !== me) return; me.st.tab = 'cal'; calPress(me, { target: { closest: () => ({ dataset: { c: 'view', k } }) } }); };
|
|
360
|
+
const nav = (k) => () => { if (CV !== me) return; me.st.tab = 'cal'; calPress(me, { target: { closest: () => ({ dataset: { c: 'nav', k: String(k) } }) } }); };
|
|
361
|
+
const view = (k, l) => ({ label: l, on: go(k), get note() { return me.st.tab === 'cal' && me.st.view === k ? 'shown' : ''; } });
|
|
362
|
+
return [view('day', 'Day'), view('week', 'Week'), view('month', 'Month'), { sep: true },
|
|
363
|
+
{ get label() { return 'Previous ' + (me.st.view === 'month' ? 'month' : 'week'); }, on: () => { if (me.st.view === 'day') { me.st.date = addDays(me.st.date, -7); return readCal(me); } nav(-1)(); } },
|
|
364
|
+
{ get label() { return 'Next ' + (me.st.view === 'month' ? 'month' : 'week'); }, on: () => { if (me.st.view === 'day') { me.st.date = addDays(me.st.date, 7); return readCal(me); } nav(1)(); } },
|
|
365
|
+
{ label: 'Back to today', on: nav(0) }, { sep: true },
|
|
366
|
+
{ label: 'New note', note: 'no calendar event', on: () => { const b = calBody(me); const n = b && b.querySelector('[data-c="new"]'); if (n) n.click(); } }];
|
|
367
|
+
}
|
|
349
368
|
const calBody = (me) => (CV === me && vCur() && vCur().id === 'calendar' ? document.querySelector('#czViewer .cz-vw-body') : null);
|
|
350
369
|
const nowMinOf = () => { const t = new Date(); return t.getHours() * 60 + t.getMinutes(); };
|
|
351
370
|
/** The run-time geometry of the week grid: data-tl on a block is "top height lane lanes"; on a day column and the gutter its height; on a load
|
|
@@ -362,10 +381,18 @@ export function placeWeek(el) {
|
|
|
362
381
|
function paintCal(me, b) {
|
|
363
382
|
const body = b || calBody(me); if (!body) return;
|
|
364
383
|
const keep = document.activeElement && document.activeElement.dataset && document.activeElement.dataset.c === 'q' ? document.activeElement.selectionStart : null;
|
|
365
|
-
if (me.W) {
|
|
384
|
+
if (me.W) {
|
|
385
|
+
me.X.strip = stripModel(me.W, me.st.date, me.today, me.st.date); me.X.day = dayModel(me.W, me.notes, me.st.date, me.today);
|
|
386
|
+
if (me.W.state === 'ok' && me.W.days.some((d) => d.key === me.today)) me.X.todayDay = dayModel(me.W, me.notes, me.today, me.today); // kept while another week shows
|
|
387
|
+
}
|
|
366
388
|
me.X.notes = me.notes; me.X.nowMin = nowMinOf();
|
|
367
389
|
me.X.cards = notesCards(me.notesAnswer, { q: me.st.q, found: me.found, hits: me.hits, filter: me.st.filter, initiative: me.initiative });
|
|
368
390
|
body.innerHTML = calViewHtml(me.st, me.X);
|
|
391
|
+
const wide = me.st.tab === 'cal' && me.st.view !== 'day' ? 'cal' : ''; // the week and the month need room; the day sits at the side's width (XvACal)
|
|
392
|
+
if (me.wide !== wide && (me.wide !== undefined || wide)) { // the shell sets the width inline, so the week asks it for room and the day gives it back
|
|
393
|
+
try { setWidth(wide ? 920 : widthOf('Meetings') || 0, false); } catch { /* no Viewer mounted (a unit test) */ }
|
|
394
|
+
}
|
|
395
|
+
if (me.wide !== wide) { me.wide = wide; mtg().then((M) => { if (CV === me) M.widen(me.wide); }); }
|
|
369
396
|
placeWeek(body);
|
|
370
397
|
if (keep != null) { const i = body.querySelector('[data-c="q"]'); if (i) { i.focus(); i.setSelectionRange(keep, keep); } }
|
|
371
398
|
body.onclick = (e) => calPress(me, e);
|
|
@@ -406,8 +433,9 @@ function search(me, v) {
|
|
|
406
433
|
const mtg = () => import('./premium-vw-mtg.js');
|
|
407
434
|
const blockAt = (me, ref) => { const M = me.X.M; if (!M || !ref) return null; const [k] = ref.split('|'); const d = M.days.find((x) => x.key === k); return d ? [...d.timed, ...d.allday].find((x) => x.ref === ref) || null : null; };
|
|
408
435
|
async function calPress(me, e) {
|
|
409
|
-
const t = e.target.closest('[data-c]'); if (!t) return;
|
|
436
|
+
const t = e.target.closest('[data-c],[data-czs-act]'); if (!t) return;
|
|
410
437
|
const c = t.dataset.c, D = me.X.day;
|
|
438
|
+
if (t.dataset.czsAct) { const TD = me.X.todayDay, r = TD && TD.rows[+String(t.dataset.czsAct).split(':')[1]]; if (!r) return; const M = await mtg(); return M.openMeeting(r.note && r.kind === 'note' ? { note: r.note } : r.row, { ws: me.ws }); }
|
|
411
439
|
if (c === 'tab') { me.st.tab = t.dataset.k; return paintCal(me); }
|
|
412
440
|
if (c === 'view') { // Day and Week draw from the same week answer: switching between them reads nothing
|
|
413
441
|
const was = me.st.view; me.st.view = t.dataset.k;
|