create-pmos 0.415.0 → 0.417.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +25 -25
- package/payload/KIT-VERSION +2 -2
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/payload/state/log.md +1 -1
- package/workspace/briefing-premium-adddoc-test.js +3 -3
- package/workspace/briefing-premium-board-test.js +72 -43
- package/workspace/briefing-premium-doc-edit-test.js +2 -2
- package/workspace/briefing-premium-initiative-test.js +19 -22
- package/workspace/briefing-premium-insights-test.js +28 -17
- package/workspace/changelog.json +24 -0
- package/workspace/core-docs-workflow-test.js +1 -1
- package/workspace/guide/workflows.md +4 -3
- package/workspace/ini-workflow-test.js +11 -11
- package/workspace/lib/board-premium.js +7 -2
- package/workspace/lib/board-trail.js +6 -1
- package/workspace/lib/engine/boards.js +8 -2
- package/workspace/lib/initiative-chat.js +4 -3
- package/workspace/lib/initiative-premium.js +5 -3
- package/workspace/lib/insights-premium.js +9 -1
- package/workspace/lib/pmos-verbs.js +1 -1
- package/workspace/lib/route-modules.js +1 -0
- package/workspace/lib/routes-boards.js +73 -6
- package/workspace/lib/routes-live.js +53 -0
- package/workspace/lib/task-cli.js +88 -24
- package/workspace/lib/task-items.js +3 -1
- package/workspace/lib/workflow-cli.js +10 -4
- package/workspace/milestone-suggest-test.js +2 -1
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-board-actions-test.js +12 -8
- package/workspace/premium-chat-report-tab-test.js +13 -5
- package/workspace/premium-core-doc-issue-test.js +1 -1
- package/workspace/premium-report-read-test.js +66 -51
- package/workspace/premium-vw-backlog-test.js +3 -3
- package/workspace/premium-vw-doc-test.js +3 -3
- package/workspace/premium-vw-item-test.js +4 -4
- package/workspace/premium-vw-jira-test.js +14 -13
- package/workspace/premium-vw-slides-test.js +7 -5
- package/workspace/program-panel-test.js +1 -1
- package/workspace/public/pm/bd-ini-panel.js +68 -230
- package/workspace/public/pm/cozy-insights.css +15 -0
- package/workspace/public/pm/cozy-live-pill.css +48 -0
- package/workspace/public/pm/cozy-live-pill.js +141 -0
- package/workspace/public/pm/cozy-viewer.js +4 -3
- package/workspace/public/pm/cozy-vw-rp.css +48 -0
- package/workspace/public/pm/home-app.js +45 -8
- package/workspace/public/pm/home-chat.js +5 -2
- package/workspace/public/pm/home-ini.js +57 -22
- package/workspace/public/pm/home-task.js +16 -5
- package/workspace/public/pm/ini-view-model.js +277 -0
- package/workspace/public/pm/ini-view.css +122 -0
- package/workspace/public/pm/ini-view.js +180 -0
- package/workspace/public/pm/live-model.js +104 -0
- package/workspace/public/pm/ov-view.css +44 -0
- package/workspace/public/pm/premium-board.js +15 -16
- package/workspace/public/pm/premium-insights.js +61 -35
- package/workspace/public/pm/premium-report-read.js +74 -50
- package/workspace/public/pm/premium-report-tab.js +36 -15
- package/workspace/public/pm/premium-shell.js +1 -1
- package/workspace/public/pm/premium-vw-item-model.js +6 -3
- package/workspace/public/pm/premium-vw-item.js +25 -6
- package/workspace/public/pm/premium-vw-jira.js +17 -15
- package/workspace/public/pm/rp-parts.js +75 -12
- package/workspace/public/pm/task-card.css +24 -49
- package/workspace/public/pm/task-card.js +90 -64
- package/workspace/public/pm/tk-view.css +21 -0
- package/workspace/public/pm/tk-view.js +216 -0
- package/workspace/public/pm/wf-page.js +2 -0
- package/workspace/server.js +24 -1
- package/workspace/stage-card-test.js +49 -41
- package/workspace/task-card-test.js +83 -38
- package/workspace/test-files.json +3 -1
- package/workspace/test-lists/bd-ini-panel.json +3 -3
- package/workspace/tk-tasks-test.js +3 -3
- package/workspace/public/pm/bd-ini-model.js +0 -81
- package/workspace/public/pm/cozy-rec-pill.css +0 -12
- package/workspace/public/pm/cozy-rec-pill.js +0 -46
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
* cycleGroups(cycles, cur) the cycle menu: [{ k: 'draft'|'issued'|'archived', t, rows: [{ path, name, when, cur }] }] (RpStates)
|
|
6
6
|
* confirmKey(item) the key a Confirm is kept under: the check and a hash of its words, so new words ask again
|
|
7
7
|
* briefModel(x) the Brief tab: { glance, confirm, why, earlier, count } (RpBrief) from the records the reader read
|
|
8
|
-
* briefHtml(B, o) the Brief
|
|
8
|
+
* briefHtml(B, o) the Brief as html; briefGlanceHtml, briefConfirmHtml, briefWhyHtml, briefLooksHtml are its parts,
|
|
9
|
+
* each a fold of the report Viewer (canvas OvReport)
|
|
10
|
+
* rpSumHtml(o, a) · rpBarHtml(o, a) the report Viewer's summary card and its Slides | Document | Live page bar (OvReport)
|
|
9
11
|
* paperModel(W, o) · paperHtml(P) the report as a paper document, cut into pages (RpDoc)
|
|
10
12
|
* liveModel(m, o) · liveHtml(L, s) the report as a live page, from GET /api/insights-premium (RpLive)
|
|
11
13
|
* presentHtml(o) the full-screen presenting view (RpPhone Present, MtPresent's strip)
|
|
@@ -104,22 +106,82 @@ export function briefModel(x = {}) {
|
|
|
104
106
|
}
|
|
105
107
|
const clip = (s, n) => { const t = String(s || '').replace(/\s+/g, ' ').trim(); return t.length > n ? t.slice(0, n - 1).trimEnd() + '…' : t; };
|
|
106
108
|
const NS = '<span class="rp-ns">not said</span>';
|
|
107
|
-
/** The Brief
|
|
108
|
-
|
|
109
|
-
|
|
109
|
+
/** The Brief's parts as html, each one a fold of the report Viewer (canvas OvReport): At a glance, Please confirm, and the look
|
|
110
|
+
* (Why it looks like this, Earlier looks). o = { issued, busy } */
|
|
111
|
+
export function briefGlanceHtml(B) {
|
|
110
112
|
const g = B.glance;
|
|
111
|
-
|
|
113
|
+
return `<dl class="rp-kv"><dt>For</dt><dd>${g.for ? esc(g.for) : NS}</dd><dt>Read by</dt><dd>${g.readBy ? esc(g.readBy) : NS}</dd><dt>Goes out</dt><dd>${g.goesOut ? esc(g.goesOut) : NS}</dd>`
|
|
112
114
|
+ `<dt>Built from</dt><dd class="rp-chips">${g.built.length ? g.built.map((s) => `<span class="rp-chip">${esc(s)}</span>`).join('') : NS}</dd></dl>`;
|
|
113
|
-
|
|
115
|
+
}
|
|
116
|
+
export function briefConfirmHtml(B, o = {}) {
|
|
117
|
+
return B.confirm.length ? B.confirm.map((c) => `<div class="rp-card" data-key="${esc(c.key)}"><i class="rp-dot" aria-hidden="true"></i><p><b>${esc(c.where)}:</b> ${esc(c.text)}</p>`
|
|
114
118
|
+ c.acts.map(([a, l], i) => `<button type="button" class="rp-btn${i === 0 ? ' dark' : ''}" data-r="bf|${a}|${esc(c.key)}"${o.busy ? ' disabled' : ''}>${esc(l)}</button>`).join('') + '</div>').join('')
|
|
115
119
|
: `<p class="rp-mut">${o.issued ? 'Issued, so nothing is left to confirm. Changes go into the next cycle.' : 'Nothing to confirm. Every check passed.'}</p>`;
|
|
116
|
-
|
|
117
|
-
|
|
120
|
+
}
|
|
121
|
+
export function briefWhyHtml(B) {
|
|
122
|
+
return B.why.length ? `<ul class="rp-ul">${B.why.map((t) => `<li>${esc(t)}</li>`).join('')}</ul>` : '<p class="rp-mut">No look is saved yet, so it uses the standard PMOS look. Say in the chat how it should look, or attach a sample.</p>';
|
|
123
|
+
}
|
|
124
|
+
export function briefLooksHtml(B, o = {}) {
|
|
125
|
+
return B.earlier.length ? `<p class="rp-lbl">Earlier looks</p><div class="rp-looks">${B.earlier.map((v) => `<div class="rp-box rp-look"><span class="rp-sw" aria-hidden="true"></span><span><b>${esc(v.name)}</b><br><span class="rp-mut">D${v.n}${v.at ? ' · ' + esc(v.at) : ''}</span></span>`
|
|
118
126
|
+ (o.issued ? '' : `<button type="button" class="rp-btn" data-r="bf|back|${v.n}"${o.busy ? ' disabled' : ''}>Go back to it</button>`) + '</div>').join('')}</div>` : '';
|
|
119
|
-
|
|
127
|
+
}
|
|
128
|
+
/** The whole Brief as html, its four groups in order. o = { issued, busy, msg } */
|
|
129
|
+
export function briefHtml(B, o = {}) {
|
|
130
|
+
if (!B) return '<p class="vz-empty" role="status">Reading how this report is made.</p>';
|
|
131
|
+
return `<div class="rp-brief"><p class="rp-lbl">At a glance</p>${briefGlanceHtml(B)}<p class="rp-lbl">Please confirm</p>${briefConfirmHtml(B, o)}<p class="rp-lbl">Why it looks like this</p>${briefWhyHtml(B)}${briefLooksHtml(B, o)}`
|
|
120
132
|
+ (o.msg ? `<p class="vz-msg" role="status">${esc(o.msg)}</p>` : '') + '</div>';
|
|
121
133
|
}
|
|
122
134
|
|
|
135
|
+
/* ── the report Viewer's head (canvas OvReport), shared by a cycle (premium-report-read.js) and a new report (premium-report-tab.js) ── */
|
|
136
|
+
const SVG = (d, n = 16) => `<svg viewBox="0 0 24 24" width="${n}" height="${n}" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="${d}"/></svg>`;
|
|
137
|
+
export const RP_ICONS = {
|
|
138
|
+
send: 'M21 3 10 14M21 3l-7 18-4-7-7-4z', check: 'M5 12.5l4.5 4.5L19 7.5', back: 'M9 14 4 9l5-5M4 9h11a5 5 0 0 1 0 10h-3',
|
|
139
|
+
share: 'M12 15V4M8 8l4-4 4 4M5 13v6h14v-6', repeat: 'M17 2l3 3-3 3M4 11V9a4 4 0 0 1 4-4h12M7 22l-3-3 3-3M20 13v2a4 4 0 0 1-4 4H4',
|
|
140
|
+
people: 'M9 11a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7M2.5 20a6.5 6.5 0 0 1 13 0M16 4.5a3.5 3.5 0 0 1 0 6.5M18.5 14a6 6 0 0 1 3 6',
|
|
141
|
+
file: 'M7 3h7l5 5v13H7zM14 3v5h5', pen: 'M4 20h4L19 9l-4-4L4 16z', present: 'M3 4h18v12H3zM8 20h8M12 16v4',
|
|
142
|
+
dl: 'M12 4v11M7 10l5 5 5-5M5 20h14', prev: 'M15 6l-6 6 6 6', next: 'M9 6l6 6-6 6',
|
|
143
|
+
};
|
|
144
|
+
/** A template's output, said as its format. */
|
|
145
|
+
export const FORMATS = { 'google-slides': 'Google Slides', 'google-doc': 'Google Doc', 'google-sheets': 'Google Sheets', confluence: 'Confluence page', pdf: 'PDF' };
|
|
146
|
+
/** The schedule chip's short words: "Every week", "Every 2 weeks", "Every month", "Every day", or "Once" when nothing repeats it. */
|
|
147
|
+
export function cadenceWords(s) {
|
|
148
|
+
const c = s && s !== 'off' ? s.cadence : '';
|
|
149
|
+
return c === 'weekly' ? 'Every week' : c === 'bi-weekly' ? 'Every 2 weeks' : c === 'monthly' ? 'Every month' : c === 'daily' ? 'Every day' : 'Once';
|
|
150
|
+
}
|
|
151
|
+
/** "Goes out Mon 9:00" (the summary's right), from a schedule, or '' when none repeats it. */
|
|
152
|
+
export function goesOutWords(s) {
|
|
153
|
+
if (!s || s === 'off' || !s.cadence || s.cadence === 'off') return '';
|
|
154
|
+
const t = String(s.time || '09:00').replace(/^0(\d)/, '$1');
|
|
155
|
+
if (s.cadence === 'daily') return 'Goes out daily ' + t;
|
|
156
|
+
if (s.cadence === 'monthly') { const d = s.dayOfMonth || 1; return 'Goes out the ' + d + (d === 1 ? 'st' : d === 2 ? 'nd' : d === 3 ? 'rd' : 'th') + ' ' + t; }
|
|
157
|
+
return 'Goes out ' + (s.day || 'Mon') + ' ' + t;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* The summary card (OvReport): what waits on you, the one primary as an icon, and the meta chips. a = the attribute the presses carry
|
|
161
|
+
* (data-r in a cycle, data-rt in a new report). o = { line, tone, right, text, chips: [{ icon, label, act, exp }], primary: { act, label, icon, disabled } }
|
|
162
|
+
* A chip with no act is words only. Nothing to say draws nothing.
|
|
163
|
+
*/
|
|
164
|
+
export function rpSumHtml(o = {}, a = 'data-r') {
|
|
165
|
+
const p = o.primary;
|
|
166
|
+
const pri = p && p.act ? `<button type="button" class="rp-pri" ${a}="${esc(p.act)}" aria-label="${esc(p.label)}" title="${esc(p.label)}"${p.disabled ? ' disabled' : ''}>${SVG(RP_ICONS[p.icon] || RP_ICONS.check, 17)}</button>` : '';
|
|
167
|
+
const tone = o.tone ? ' ' + o.tone : '';
|
|
168
|
+
const line = o.line ? `<div class="czs-line${tone}">${o.tone ? '<span class="czs-dot" aria-hidden="true"></span>' : ''}<span class="rp-ln">${esc(o.line)}</span>${o.right ? `<span class="czs-r">${esc(o.right)}</span>` : ''}${pri}</div>` : '';
|
|
169
|
+
const chips = (o.chips || []).filter((c) => c && c.label).map((c) => (c.act
|
|
170
|
+
? `<button type="button" class="rp-mc" ${a}="${esc(c.act)}"${c.exp != null ? ` aria-haspopup="dialog" aria-expanded="${c.exp}"` : ''}>${c.icon ? SVG(RP_ICONS[c.icon], 14) : ''}${esc(c.label)}</button>`
|
|
171
|
+
: `<span class="rp-mc">${c.icon ? SVG(RP_ICONS[c.icon], 14) : ''}${esc(c.label)}</span>`)).join('');
|
|
172
|
+
if (!line && !o.text && !chips) return '';
|
|
173
|
+
return `<div class="czs-sum rp-sum">${line}${o.text ? `<p class="czs-p">${esc(o.text)}</p>` : ''}${chips ? `<div class="rp-mcs">${chips}</div>` : ''}</div>`;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* The bar under the summary (OvReport): the Slides | Document | Live page switch, then the tools as icons. a as rpSumHtml.
|
|
177
|
+
* o = { view, views: [[key, label]], tools: [{ act, label, icon, exp }] }
|
|
178
|
+
*/
|
|
179
|
+
export function rpBarHtml(o = {}, a = 'data-r') {
|
|
180
|
+
const seg = `<div class="rp-seg" role="group" aria-label="Read as">${(o.views || []).map(([k, l]) => `<button type="button" ${a}="view|${k}" aria-pressed="${o.view === k}">${esc(l)}</button>`).join('')}</div>`;
|
|
181
|
+
const tools = (o.tools || []).filter(Boolean).map((t) => `<button type="button" class="rp-tl vz-hv" ${a}="${esc(t.act)}" aria-label="${esc(t.label)}" title="${esc(t.label)}"${t.exp != null ? ` aria-haspopup="${t.pop || 'menu'}" aria-expanded="${t.exp}"` : ''}>${SVG(RP_ICONS[t.icon], 18)}</button>`).join('');
|
|
182
|
+
return `<div class="rp-bar">${seg}${tools ? `<div class="rp-tls">${tools}</div>` : ''}</div>`;
|
|
183
|
+
}
|
|
184
|
+
|
|
123
185
|
/* ── the paper document (RpDoc) ── */
|
|
124
186
|
/** A section's lines as blocks: paragraphs, lists, sub-headings and tables. Each block carries its weight in lines for the page cut. */
|
|
125
187
|
export function blocksOf(lines) {
|
|
@@ -185,8 +247,8 @@ export function paperHtml(P) {
|
|
|
185
247
|
* a part with no source is left out (zero is silence). o = {
|
|
186
248
|
* state 'draft'|'issued'|'archived' · slot 'YYYY-MM-DD' · purpose (the template's) · sub (the file's subtitle) · schedule (schedLabel, or '')
|
|
187
249
|
* dataFrom ('19 Oct', the headline figure's as-of) · shares ({ links, views } of the open links, or null when not read) · nextDraft ('YYYY-MM-DD')
|
|
188
|
-
* view 'deck'|'doc'|'live' · slides (count) · pages (count) · foot (true when the sources are footnotes) · path (for Bring back) }
|
|
189
|
-
* draft "Draft · Oct 21
|
|
250
|
+
* confirm (how many wait for the PM's confirm) · view 'deck'|'doc'|'live' · slides (count) · pages (count) · foot (true when the sources are footnotes) · path (for Bring back) }
|
|
251
|
+
* draft "Draft · Oct 21 · 1 to confirm" in the blue tone (confirm = what waits), the purpose and "Data from 19 Oct.", Issue it
|
|
190
252
|
* issued "Issued 19 Oct", "Not shared yet." (or the open links) and the next cycle's day, the form it is read in, Share
|
|
191
253
|
* archived "Archived · issued 19 Oct", "It stays as sent.", Bring back
|
|
192
254
|
*/
|
|
@@ -201,7 +263,8 @@ export function reportSummary(o = {}) {
|
|
|
201
263
|
const next = o.nextDraft && dayMon(o.nextDraft) ? 'The next cycle starts ' + dayMon(o.nextDraft) + '.' : '';
|
|
202
264
|
return { line: 'Issued' + (on ? ' ' + on : ''), tone: '', text: [shared, next].filter(Boolean).join(' '), meta: [form, data].filter(Boolean).join(' · '), primary: { r: 'share', label: 'Share' } };
|
|
203
265
|
}
|
|
204
|
-
|
|
266
|
+
const text = [String(o.purpose || o.sub || '').trim().replace(/([^.!?])$/, '$1.'), o.dataFrom ? 'Data from ' + o.dataFrom + '.' : ''].filter((x) => x && x !== '.').join(' ');
|
|
267
|
+
return { line: 'Draft' + (short ? ' · ' + short : '') + (o.confirm ? ' · ' + o.confirm + ' to confirm' : ''), tone: 'you', text, meta: [o.schedule, data].filter(Boolean).join(' · '), primary: { r: 'issue', label: 'Issue it' } };
|
|
205
268
|
}
|
|
206
269
|
/* ── the live page (RpLive) ── */
|
|
207
270
|
const DAY = 86400000;
|
|
@@ -1,65 +1,39 @@
|
|
|
1
|
-
/* pm/task-card.css — one task, edited where it opens (task-card.js; canvas
|
|
2
|
-
* Over cozy.css's tokens, so the dark theme follows.
|
|
3
|
-
* the initiative in place. Popovers open right under the control that opened them. */
|
|
1
|
+
/* pm/task-card.css — one task, edited where it opens (task-card.js; canvas OvViewers "Task", over ov-view.css's facts card and where row).
|
|
2
|
+
* Over cozy.css's tokens, so the dark theme follows. Popovers open right under the control that opened them. */
|
|
4
3
|
.tkc { display: flex; flex-direction: column; gap: 16px; padding: 6px 2px 18px; font-size: 14px; color: var(--cz-ink); }
|
|
5
4
|
.tkc button { font: inherit; color: inherit; background: transparent; border: 0; padding: 0; margin: 0; cursor: pointer; text-align: left; }
|
|
6
5
|
.tkc button:disabled { cursor: default; }
|
|
7
6
|
.tkc svg { flex: none; }
|
|
8
7
|
.tkc .anc { position: relative; display: inline-flex; }
|
|
9
8
|
|
|
10
|
-
/* the card: status
|
|
11
|
-
.tkc .
|
|
12
|
-
.tkc .seg {
|
|
13
|
-
.tkc .seg button {
|
|
14
|
-
.tkc .seg button
|
|
15
|
-
.tkc .seg button.on { width: auto; padding: 0 14px 0 12px; background: var(--cz-bluebg); color: var(--cz-blueink); font-weight: 800; font-size: 13.5px; box-shadow: inset 0 0 0 1.5px var(--cz-blue); }
|
|
9
|
+
/* the facts card: status, due, owner */
|
|
10
|
+
.tkc .seg { display: flex; flex-wrap: wrap; gap: 2px; align-items: center; }
|
|
11
|
+
.tkc .seg button { width: 32px; height: 32px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; color: var(--cz-ink3); }
|
|
12
|
+
.tkc .seg button:hover { color: var(--cz-ink); background: var(--cz-well); }
|
|
13
|
+
.tkc .seg button.on { width: auto; padding: 0 12px 0 9px; background: var(--cz-bluebg); color: var(--cz-blueink); font-weight: 800; font-size: 13px; box-shadow: inset 0 0 0 1.5px var(--cz-blue); }
|
|
16
14
|
.tkc .seg button.on.i-done { background: var(--cz-okbg); color: var(--cz-ok); box-shadow: inset 0 0 0 1.5px var(--cz-ok); }
|
|
17
15
|
.tkc .seg button.on.i-wont, .tkc .seg button.on.i-arch { background: var(--cz-well2); color: var(--cz-ink2); box-shadow: inset 0 0 0 1.5px var(--cz-hair); }
|
|
18
|
-
.tkc .
|
|
19
|
-
.tkc .due-b { height:
|
|
20
|
-
.tkc .due-b:hover, .tkc .due-b.open { background: var(--cz-
|
|
21
|
-
.tkc .due-b.
|
|
22
|
-
.tkc .due-b.
|
|
23
|
-
.tkc .
|
|
24
|
-
.tkc .
|
|
25
|
-
.tkc .
|
|
26
|
-
.tkc .
|
|
27
|
-
|
|
28
|
-
.tkc .rost { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 800; color: var(--cz-blueink); padding: 4px; cursor: default; }
|
|
29
|
-
.tkc .jl { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--cz-ink3); font-weight: 600; padding: 0 4px; }
|
|
30
|
-
.tkc .jl .jt { width: 18px; height: 18px; border-radius: 5px; display: inline-flex; align-items: center; justify-content: center; background: var(--cz-bluebg); color: var(--cz-blueink); font-size: 10px; font-weight: 800; }
|
|
31
|
-
.tkc .jl .jk { font-weight: 700; color: var(--cz-blueink); }
|
|
32
|
-
.tkc .jl .jk:hover { text-decoration: underline; }
|
|
33
|
-
|
|
34
|
-
/* chips: owner and group */
|
|
35
|
-
.tkc .chips { display: flex; flex-wrap: wrap; gap: 8px; padding-left: 44px; }
|
|
36
|
-
.tkc .chip { height: 34px; padding: 0 12px 0 10px; border-radius: 999px; background: var(--cz-well); display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 700; color: var(--cz-ink2); white-space: nowrap; }
|
|
37
|
-
.tkc .chip:hover, .tkc .chip.open { background: var(--cz-well2); }
|
|
38
|
-
.tkc .chip.open { box-shadow: 0 0 0 1.5px var(--cz-blue); }
|
|
39
|
-
.tkc .chip.ghost { background: transparent; box-shadow: inset 0 0 0 1.5px var(--cz-hair); color: var(--cz-ink3); width: 34px; padding: 0; justify-content: center; }
|
|
40
|
-
.tkc .chip.ro { background: transparent; padding: 0 6px; cursor: default; }
|
|
41
|
-
.tkc .av2 { width: 22px; height: 22px; border-radius: 50%; background: var(--cz-bluebg); color: var(--cz-blueink); font-size: 10.5px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; flex: none; }
|
|
42
|
-
.tkc .av2.j { background: var(--cz-riskbg); color: var(--cz-risk); }
|
|
43
|
-
.tkc .av2.no { background: transparent; border: 1.5px dashed var(--cz-ink3); }
|
|
16
|
+
.tkc .ovf .anc { margin-left: -8px; }
|
|
17
|
+
.tkc .due-b, .tkc .own-b { min-height: 30px; padding: 0 8px; border-radius: 999px; display: inline-flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 700; color: var(--cz-ink); }
|
|
18
|
+
.tkc .due-b:hover, .tkc .due-b.open, .tkc .own-b:hover, .tkc .own-b.open { background: var(--cz-well); }
|
|
19
|
+
.tkc .due-b.open, .tkc .own-b.open { box-shadow: 0 0 0 1.5px var(--cz-blue); }
|
|
20
|
+
.tkc .due-b.none, .tkc .own-b.ghost { width: 30px; padding: 0; justify-content: center; color: var(--cz-ink3); }
|
|
21
|
+
.tkc .ovf .r { font-size: 14px; font-weight: 700; color: var(--cz-ink3); }
|
|
22
|
+
.tkc .ovf .r.late { color: var(--cz-risk); }
|
|
23
|
+
.tkc .tkc-pop .av, .tkc .own-b .av { width: 22px; height: 22px; border-radius: 7px; background: var(--cz-well); color: var(--cz-ink2); font-size: 10.5px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; flex: none; }
|
|
24
|
+
.tkc .own-b:hover .av, .tkc .own-b.open .av { background: var(--cz-card); }
|
|
25
|
+
.tkc .own-b .av.no { background: transparent; border: 1.5px dashed var(--cz-ink3); box-sizing: border-box; }
|
|
44
26
|
|
|
45
27
|
/* notes, edited in place */
|
|
46
|
-
.tkc .nt {
|
|
28
|
+
.tkc .nt { border: 0; outline: 0; resize: none; field-sizing: content; min-height: 48px; border-radius: 12px; padding: 6px 8px; margin: 0 -8px; font: inherit; font-size: 14px; line-height: 1.55; color: var(--cz-ink); background: transparent; }
|
|
47
29
|
.tkc .nt::placeholder { color: var(--cz-ink3); }
|
|
48
30
|
.tkc .nt:hover { background: var(--cz-well); }
|
|
49
31
|
.tkc .nt:focus { background: var(--cz-card); box-shadow: 0 0 0 1.5px var(--cz-blue), 0 0 0 5px var(--cz-bluebg); }
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
.tkc .tk-ini { margin-left: 44px; display: flex; align-items: center; gap: 6px; border-top: 1px solid var(--cz-hair); padding-top: 12px; }
|
|
53
|
-
.tkc .tk-ini .go { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 10px; border-radius: 14px; }
|
|
54
|
-
.tkc .tk-ini .go:hover { background: var(--cz-well); }
|
|
55
|
-
.tkc .tk-ini .go b { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
56
|
-
.tkc .tk-ini .cv { margin-left: auto; color: var(--cz-ink3); display: inline-flex; }
|
|
57
|
-
.tkc .tl2 { width: 28px; height: 28px; border-radius: 9px; background: var(--cz-bluebg); color: var(--cz-blueink); font-size: 11px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; flex: none; }
|
|
32
|
+
.tkc .tkc-msg { margin: 0; font-size: 13px; color: var(--cz-red); }
|
|
33
|
+
.tkc .tkc-msg:empty { display: none; }
|
|
58
34
|
.tkc .tkc-ib { width: 40px; height: 40px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; color: var(--cz-ink2); }
|
|
59
35
|
.tkc .tkc-ib:hover, .tkc .tkc-ib.open { background: var(--cz-well); }
|
|
60
36
|
.tkc .tkc-ib.s { width: 32px; height: 32px; }
|
|
61
|
-
.tkc .tkc-msg { margin: 0 0 0 44px; font-size: 13px; color: var(--cz-red); }
|
|
62
|
-
.tkc .tkc-msg:empty { display: none; }
|
|
63
37
|
|
|
64
38
|
/* popovers: right under the control */
|
|
65
39
|
.tkc .tkc-pop { position: absolute; left: 0; top: calc(100% + 6px); z-index: 8; background: var(--cz-card); border-radius: 16px; box-shadow: 0 24px 50px -20px rgba(42,46,53,.4), 0 0 0 1px var(--cz-hair); padding: 6px; display: flex; flex-direction: column; min-width: 220px; max-height: 320px; overflow: auto; }
|
|
@@ -67,6 +41,7 @@
|
|
|
67
41
|
.tkc .tkc-pop .o { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 10px; border-radius: 10px; font-size: 13.5px; font-weight: 600; width: 100%; }
|
|
68
42
|
.tkc .tkc-pop .o:hover, .tkc .tkc-pop .o.hl { background: var(--cz-well); }
|
|
69
43
|
.tkc .tkc-pop .o .k { margin-left: auto; color: var(--cz-blueink); }
|
|
44
|
+
.tkc .tkc-pop .h { margin: 6px 10px 2px; font-size: 11.5px; font-weight: 800; color: var(--cz-ink3); text-transform: uppercase; letter-spacing: .04em; }
|
|
70
45
|
.tkc .tkc-pop hr { border: 0; border-top: 1px solid var(--cz-hair); margin: 4px 6px; }
|
|
71
46
|
.tkc .tkc-new input { width: 100%; box-sizing: border-box; height: 38px; border: 0; border-radius: 10px; padding: 0 10px; margin-bottom: 4px; font: inherit; font-size: 13.5px; background: var(--cz-well); color: var(--cz-ink); outline: 0; }
|
|
72
47
|
.tkc .tkc-new input:focus { box-shadow: 0 0 0 1.5px var(--cz-blue); }
|
|
@@ -100,9 +75,9 @@
|
|
|
100
75
|
/* Done, Won't do and Archived: the title goes quiet (canvas XetX1Done) */
|
|
101
76
|
#czViewer:has(.cz-vw-chk.s-done) .cz-vw-title, #czViewer:has(.cz-vw-chk.s-done) .cz-vw-rn { color: var(--cz-ink3); text-decoration: line-through; text-decoration-color: var(--cz-ink3); }
|
|
102
77
|
|
|
103
|
-
/* phone: the same card
|
|
78
|
+
/* phone: the same card, full screen (canvas OvViewers "Phone") */
|
|
104
79
|
@media (max-width: 760px) {
|
|
105
|
-
.tkc .chips, .tkc .nt, .tkc .tk-ini, .tkc .tkc-msg { margin-left: 0; padding-left: 0; }
|
|
106
|
-
.tkc .nt { padding: 10px 12px; }
|
|
107
80
|
.tkc .tkc-dp { width: min(300px, calc(100vw - 48px)); }
|
|
81
|
+
.tkc .ovf { column-gap: 12px; padding: 12px 14px; }
|
|
82
|
+
.tkc .ovf .tkc-dp { left: -64px; } /* the picker starts at the card's edge, so it stays on the screen */
|
|
108
83
|
}
|
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
/* pm/task-card.js — one task, edited where it opens (third feedback batch item 7;
|
|
1
|
+
/* pm/task-card.js — one task, edited where it opens (third feedback batch item 7; laid out as the one task Viewer of batch 6 item 1b, canvas
|
|
2
|
+
* OvViewers "Task").
|
|
2
3
|
*
|
|
3
|
-
* The same
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
4
|
+
* The same Viewer wherever a task opens: Home's list (home-task.js), the initiative's Tasks (premium-vw-item.js), Board and Search. The
|
|
5
|
+
* header carries the check box (the quick Done, checkOf) and the title (tap it to rename, rename-press.js). Under it:
|
|
6
|
+
* one facts card Status (the five icons, only the current one named), Due (the late text in amber; a tap opens the start and due
|
|
7
|
+
* picker under it) and Owner (a tap opens the owner list), the same shape as the Jira ticket's facts card;
|
|
8
|
+
* Notes the PM's words, edited in place;
|
|
9
|
+
* where it sits one row: initiative › section › breakdown item. The row opens the initiative; the move icon beside it changes the
|
|
10
|
+
* section (the workflow stage the task sits in), the PM's group, or the initiative.
|
|
11
|
+
* Every change saves at once and says so in a toast with Undo. A Jira ticket is not drawn here: it opens the ticket Viewer (tk-view.js).
|
|
10
12
|
* cardHtml(t, o) → markup pure, for a node test: t is a task (taskOf), o the open picker and its lists
|
|
11
13
|
* taskOf(row, extra) → t a row of /api/boards/items or of the initiative model, in one shape
|
|
12
14
|
* checkOf(t) → { state, label, title, disabled } the header's check box (cozy-viewer.js `check`)
|
|
13
|
-
* dueLine(t, now) → { text, late, lateText, none } the due
|
|
15
|
+
* dueLine(t, now) → { text, late, lateText, none } the due row's words and the late text
|
|
14
16
|
* mountCard(el, t, h) → { draw } wires the card; h: { save(patch) → Promise<{ ok, error?, from? }>, toast(msg, undo?),
|
|
15
17
|
* openIni(id), inis() → [{ id, title }], owners() → [names], groups() → [names] | null,
|
|
16
|
-
*
|
|
17
|
-
* boardSaver({ ws, board, t, post, layout }) → save the board's routes behind h.save: status → tasks/state, owner, notes, dates
|
|
18
|
-
* initiative → tasks/edit, the group → /api/initiative-layout place,
|
|
19
|
-
* notes → tickets/note. Each answers { ok, from } so Undo is save(from). */
|
|
18
|
+
* sections() → [{ key, name, milestone }] | null, now?(), changed?(t) }
|
|
19
|
+
* boardSaver({ ws, board, t, post, layout }) → save the board's routes behind h.save: status → tasks/state, owner, notes, dates, the
|
|
20
|
+
* section and the initiative → tasks/edit, the group → /api/initiative-layout place,
|
|
21
|
+
* a Jira ticket's notes → tickets/note. Each answers { ok, from } so Undo is save(from). */
|
|
20
22
|
|
|
21
23
|
export const STATES = ['To do', 'In progress', 'Done', "Won't do", 'Archived']; // a task's only stage is its state (scripts/boards.js TASK_STATES)
|
|
22
24
|
const SKEY = { 'To do': 'todo', 'In progress': 'prog', Done: 'done', "Won't do": 'wont', Archived: 'arch' };
|
|
@@ -32,6 +34,8 @@ const I = {
|
|
|
32
34
|
folder: '<path d="M4 7a2 2 0 0 1 2-2h4l2 2h6a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2z"/>',
|
|
33
35
|
move: '<path d="M7 7h11l-3-3M17 17H6l3 3"/>', chev: '<path d="M10 7l5 5-5 5"/>', prev: '<path d="M14 6l-6 6 6 6"/>', next: '<path d="M10 6l6 6-6 6"/>',
|
|
34
36
|
clear: '<path d="M6 6l12 12M18 6L6 18"/>', tick: '<path d="M20 6 9 17l-5-5"/>', user: '<circle cx="12" cy="8.5" r="3.5"/><path d="M5 20a7 7 0 0 1 14 0"/>',
|
|
37
|
+
flag: '<path d="M6 21V4M6 4h11l-2 4 2 4H6"/>', drag: '<path d="M12 3v18M3 12h18M12 3l-3 3M12 3l3 3M12 21l-3-3M12 21l3-3M3 12l3-3M3 12l3 3M21 12l-3-3M21 12l-3 3"/>',
|
|
38
|
+
dia: '<path d="M12 4l8 8-8 8-8-8z"/>',
|
|
35
39
|
};
|
|
36
40
|
const ico = (d, w = 16) => `<svg width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${d}</svg>`;
|
|
37
41
|
export const esc = (s) => String(s == null ? '' : s).replace(/[&<>"]/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"' }[c]));
|
|
@@ -41,7 +45,7 @@ const DAY = /^(\d{4})-(\d{2})-(\d{2})/;
|
|
|
41
45
|
const pad = (n) => String(n).padStart(2, '0');
|
|
42
46
|
export const isoOf = (d) => d.getFullYear() + '-' + pad(d.getMonth() + 1) + '-' + pad(d.getDate());
|
|
43
47
|
const dayOf = (iso) => { const m = DAY.exec(String(iso || '')); return m ? new Date(+m[1], +m[2] - 1, +m[3]) : null; };
|
|
44
|
-
const short = (iso) => { const m = DAY.exec(String(iso || '')); return m ? +m[
|
|
48
|
+
const short = (iso) => { const m = DAY.exec(String(iso || '')); return m ? MON[+m[2] - 1] + ' ' + +m[3] : ''; }; // "Oct 8", as the Viewers say a day
|
|
45
49
|
const todayOf = (now) => { const t = new Date(now); t.setHours(0, 0, 0, 0); return t; };
|
|
46
50
|
const initials = (name) => String(name || '').trim().split(/\s+/).slice(0, 2).map((w) => w[0] || '').join('').toUpperCase() || '?';
|
|
47
51
|
const closed = (s) => s === 'Done' || s === "Won't do" || s === 'Archived';
|
|
@@ -53,16 +57,34 @@ export function taskOf(row, extra = {}) {
|
|
|
53
57
|
uid: r.uid || '', key: r.key && /^task:/.test(r.key) ? r.key : 'task:' + (r.uid || r.key || ''), title: r.title || '', status: r.status || r.state || 'To do',
|
|
54
58
|
start: r.start || '', due: r.end || r.due || '', owner: r.owner || '', notes: r.notes || '', ini: r.ini || extra.ini || '',
|
|
55
59
|
iniTitle: extra.iniTitle || '', group: extra.group != null ? extra.group : '', board: r.board || extra.board || '',
|
|
60
|
+
section: typeof r.section === 'string' ? r.section : '', wbs: r.wbs && (r.wbs.title || r.wbs.id) ? { id: r.wbs.id || '', title: r.wbs.title || r.wbs.id } : null,
|
|
56
61
|
jira: jira ? { key: r.ref || r.key || r.uid || '', readAt: r.readAt || extra.readAt || '' } : null,
|
|
57
62
|
};
|
|
58
63
|
}
|
|
59
64
|
|
|
60
|
-
/**
|
|
65
|
+
/** Where a task sits: { section, wbs }. The initiative view's model (ini-view-model.js, batch 6 item 1) owns the rules: sectionOf(task, stages)
|
|
66
|
+
* resolves the PM's placement, then the stage that made the task, then its plan-tree stage; wbsOf(title) reads the breakdown code from the
|
|
67
|
+
* title ("10.5 TC to review" sits under 10). Before that model is on the page, the same rules in their simplest form: the row's section by
|
|
68
|
+
* key or name, and a numeric code's head among the initiative's other tasks. rows: the initiative's tasks, to name the breakdown item. */
|
|
69
|
+
export async function placeOf(row, stages = [], rows = []) {
|
|
70
|
+
const r = row || {}, S = stages || [];
|
|
71
|
+
let IV = null; try { IV = await import('./ini-view-model.js'); } catch { IV = null; }
|
|
72
|
+
const byRef = (v) => { const x = String(v || '').trim().toLowerCase(); if (!x) return ''; const st = S.find((y) => y.key.toLowerCase() === x || String(y.name || '').toLowerCase() === x); return st ? st.key : ''; };
|
|
73
|
+
const section = IV && typeof IV.sectionOf === 'function' ? IV.sectionOf(r, S) || '' : byRef(r.section) || byRef(r.from && r.from.stage) || byRef(r.itemStage);
|
|
74
|
+
const code = (title) => { if (IV && typeof IV.wbsOf === 'function') return IV.wbsOf(title); const m = /^(\d+(?:\.\d+)*)\s/.exec(String(title || '')); return m ? { code: m[1], top: m[1].split('.')[0] } : null; };
|
|
75
|
+
const c = code(r.title);
|
|
76
|
+
let wbs = null;
|
|
77
|
+
if (c && c.top && c.top !== c.code) { const head = (rows || []).find((x) => x !== r && (x.title || '') !== r.title && (() => { const h = code(x.title); return h && h.code === c.top; })()); if (head) wbs = { id: head.uid || head.key || '', title: head.title }; }
|
|
78
|
+
return { section: section || '', wbs };
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** The due row's words: "Oct 8", "Oct 8 → 10" when the start is another day, the late text beside it while the task is open. The row's
|
|
82
|
+
* label says Due, so the words do not (say it once). */
|
|
61
83
|
export function dueLine(t, now = Date.now()) {
|
|
62
84
|
const d = dayOf(t.due), s = dayOf(t.start);
|
|
63
85
|
if (!d) return { text: s ? 'Starts ' + short(t.start) : '', late: false, lateText: '', none: !s };
|
|
64
86
|
const same = s && s.getMonth() === d.getMonth() && s.getFullYear() === d.getFullYear();
|
|
65
|
-
const text = s && +s !== +d ? (same ?
|
|
87
|
+
const text = s && +s !== +d ? (same ? short(t.start) + ' → ' + d.getDate() : short(t.start) + ' → ' + short(t.due)) : short(t.due);
|
|
66
88
|
const diff = Math.round((d - todayOf(now)) / 86400000);
|
|
67
89
|
const late = diff < 0 && !closed(t.status);
|
|
68
90
|
return { text, late, lateText: late ? -diff + (diff === -1 ? ' day late' : ' days late') : !closed(t.status) && diff === 0 ? 'Today' : '', none: false };
|
|
@@ -110,63 +132,67 @@ function listPop(label, items, extra = '') {
|
|
|
110
132
|
return `<div class="tkc-pop" role="menu" aria-label="${esc(label)}">${extra}${items.map((x) => x.sep ? '<hr>' : `<button type="button" role="menuitemradio" class="o${x.on ? ' hl' : ''}" aria-checked="${x.on ? 'true' : 'false'}" ${x.attr}>${x.icon || ''}<span>${esc(x.label)}</span>${x.on ? `<span class="k" aria-hidden="true">${ico(I.tick, 14)}</span>` : ''}</button>`).join('')}</div>`;
|
|
111
133
|
}
|
|
112
134
|
|
|
113
|
-
/** The
|
|
135
|
+
/** The section's name: the initiative's own stage, or the key as words when the page does not know the stages. */
|
|
136
|
+
const sectionName = (t, sections) => { if (!t.section) return ''; const x = (sections || []).find((y) => y.key === t.section); return x ? x.name : t.section.replace(/[-_]+/g, ' ').replace(/^./, (c) => c.toUpperCase()); };
|
|
137
|
+
/** The move icon's list: the sections first (the workflow's stages, then "Not in a stage"), the PM's groups, the other initiatives. */
|
|
138
|
+
function movePop(t, o) {
|
|
139
|
+
const secs = o.sections || [], groups = Array.isArray(o.groups) ? o.groups : [], others = (o.inis || []).filter((x) => x && x.id && x.id !== t.ini);
|
|
140
|
+
const head = (w) => `<p class="h">${w}</p>`;
|
|
141
|
+
const item = (label, on, attr, icon = '') => `<button type="button" role="menuitemradio" class="o${on ? ' hl' : ''}" aria-checked="${on ? 'true' : 'false'}" ${attr}>${icon}<span>${esc(label)}</span>${on ? `<span class="k" aria-hidden="true">${ico(I.tick, 14)}</span>` : ''}</button>`;
|
|
142
|
+
let h = '';
|
|
143
|
+
if (secs.length) h += head('Section') + secs.map((x) => item(x.name, x.key === t.section, `data-tkc-section="${esc(x.key)}"`, x.milestone ? ico(I.dia, 14) : '')).join('') + item('Not in a stage', !t.section, 'data-tkc-section=""');
|
|
144
|
+
if (groups.length) h += (h ? '<hr>' : '') + head('Group') + groups.map((n) => item(n, n === t.group, `data-tkc-group="${esc(n)}"`, ico(I.folder, 14))).join('') + (t.group ? item('Not in a group', false, 'data-tkc-group=""') : '');
|
|
145
|
+
if (others.length) h += (h ? '<hr>' : '') + head('Initiative') + others.map((x) => item(x.title || x.id, false, `data-tkc-move="${esc(x.id)}"`)).join('');
|
|
146
|
+
return h ? `<div class="tkc-pop r" role="menu" aria-label="Move it">${h}</div>` : '';
|
|
147
|
+
}
|
|
148
|
+
/** Can the move icon do anything here: a section to pick, a group, or another initiative. */
|
|
149
|
+
const canMove = (t, o) => !!((o.sections || []).length || (Array.isArray(o.groups) && o.groups.length) || (o.inis || []).some((x) => x && x.id && x.id !== t.ini));
|
|
150
|
+
|
|
151
|
+
/** The card's markup. o: { open: null | 'dates' | 'owner' | 'move', field, month, owners, groups, sections, inis, now, msg } */
|
|
114
152
|
export function cardHtml(t, o = {}) {
|
|
115
|
-
const now = o.now || Date.now(), sk = SKEY[t.status] || 'todo'
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
chips += `<span class="anc">${t.owner
|
|
140
|
-
? `<button type="button" class="chip${oOpen ? ' open' : ''}" data-tkc="owner" aria-label="Owner: ${esc(t.owner)}. Change" title="Owner" aria-expanded="${oOpen}"><span class="av2">${esc(initials(t.owner))}</span>${esc(t.owner)}</button>`
|
|
141
|
-
: `<button type="button" class="chip ghost${oOpen ? ' open' : ''}" data-tkc="owner" aria-label="Add an owner" title="Owner" aria-expanded="${oOpen}"><span class="av2 no"></span></button>`}${ownerPop}</span>`;
|
|
142
|
-
if (Array.isArray(o.groups)) { // the PM's groups of the initiative (initiative-layout); a page that does not know them draws no group chip
|
|
143
|
-
const groupPop = gOpen ? listPop('Group', o.groups.map((n) => ({ label: n, on: n === t.group, attr: `data-tkc-group="${esc(n)}"`, icon: ico(I.folder) }))
|
|
144
|
-
.concat(t.group ? [{ sep: true }, { label: 'Not in a group', attr: 'data-tkc-group=""' }] : []),
|
|
145
|
-
`<form class="tkc-new" data-tkc-form="group"><input type="text" maxlength="60" placeholder="New group" aria-label="New group's name" autocomplete="off"></form>`) : '';
|
|
146
|
-
chips += `<span class="anc">${t.group
|
|
147
|
-
? `<button type="button" class="chip${gOpen ? ' open' : ''}" data-tkc="group" aria-label="Group: ${esc(t.group)}. Change" title="Group" aria-expanded="${gOpen}">${ico(I.folder)}${esc(t.group)}</button>`
|
|
148
|
-
: `<button type="button" class="chip ghost${gOpen ? ' open' : ''}" data-tkc="group" aria-label="Put it in a group" title="Group" aria-expanded="${gOpen}">${ico(I.folder)}</button>`}${groupPop}</span>`;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
const notes = `<textarea class="nt" data-tkc-notes rows="3" maxlength="4000" aria-label="Notes" placeholder="Add notes">${esc(t.notes)}</textarea>`;
|
|
153
|
+
const now = o.now || Date.now(), sk = SKEY[t.status] || 'todo';
|
|
154
|
+
// the facts card: Status, Due, Owner (canvas OvViewers "Task": the same shape as the Jira ticket's)
|
|
155
|
+
const seg = STATES.map((s) => { const k = SKEY[s], on = s === t.status;
|
|
156
|
+
return `<button type="button" class="i-${k}${on ? ' on' : ''}" role="radio" aria-checked="${on}" data-tkc-state="${esc(s)}"${on ? '' : ` aria-label="${esc(s)}"`} title="${esc(s)}">${ico(SICON[k])}${on ? esc(s) : ''}</button>`; }).join('');
|
|
157
|
+
const dl = dueLine(t, now), dOpen = o.open === 'dates';
|
|
158
|
+
const dueBtn = dl.none
|
|
159
|
+
? `<button type="button" class="due-b none${dOpen ? ' open' : ''}" data-tkc="dates" aria-label="Add dates" title="Start and due" aria-expanded="${dOpen}">${ico(I.cal)}</button>`
|
|
160
|
+
: `<button type="button" class="due-b${dOpen ? ' open' : ''}" data-tkc="dates" aria-label="${esc(dl.text)}. Change the dates" title="Start and due" aria-expanded="${dOpen}">${esc(dl.text)}</button>`;
|
|
161
|
+
const late = dl.lateText ? `<span class="r${dl.late ? ' late' : ''}">· ${esc(dl.lateText)}</span>` : '';
|
|
162
|
+
const oOpen = o.open === 'owner';
|
|
163
|
+
const owners = [...new Set((o.owners || []).concat(t.owner ? [t.owner] : []).filter(Boolean))];
|
|
164
|
+
const ownerPop = oOpen ? listPop('Owner', owners.map((n) => ({ label: n, on: n === t.owner, attr: `data-tkc-owner="${esc(n)}"`, icon: `<span class="av">${esc(initials(n))}</span>` }))
|
|
165
|
+
.concat(t.owner ? [{ sep: true }, { label: 'No owner', attr: 'data-tkc-owner=""' }] : []),
|
|
166
|
+
`<form class="tkc-new" data-tkc-form="owner"><input type="text" maxlength="80" placeholder="Someone else" aria-label="Owner's name" autocomplete="off"></form>`) : '';
|
|
167
|
+
const ownerBtn = t.owner
|
|
168
|
+
? `<button type="button" class="own-b${oOpen ? ' open' : ''}" data-tkc="owner" aria-label="Owner: ${esc(t.owner)}. Change" title="Owner" aria-expanded="${oOpen}"><span class="av">${esc(initials(t.owner))}</span>${esc(t.owner)}</button>`
|
|
169
|
+
: `<button type="button" class="own-b ghost${oOpen ? ' open' : ''}" data-tkc="owner" aria-label="Add an owner" title="Owner" aria-expanded="${oOpen}"><span class="av no"></span></button>`;
|
|
170
|
+
const facts = `<div class="ovf tkc-f"><span class="k">Status</span><div class="v"><div class="seg" role="radiogroup" aria-label="Status">${seg}</div></div>`
|
|
171
|
+
+ `<span class="k">Due</span><div class="v"><span class="anc">${dueBtn}${dOpen ? picker(t, o, now) : ''}</span>${late}</div>`
|
|
172
|
+
+ `<span class="k">Owner</span><div class="v"><span class="anc">${ownerBtn}${ownerPop}</span></div></div>`;
|
|
173
|
+
const notes = `<div class="ovb"><label class="ovl" for="tkcNotes">Notes</label><textarea class="nt" id="tkcNotes" data-tkc-notes rows="2" maxlength="4000" placeholder="Add notes">${esc(t.notes)}</textarea></div>`;
|
|
174
|
+
// where it sits: initiative › section › breakdown item; the move icon changes the section (or the group, or the initiative)
|
|
175
|
+
const secName = sectionName(t, o.sections), ms = !!((o.sections || []).find((x) => x.key === t.section) || {}).milestone;
|
|
176
|
+
const path = [secName ? (ms ? ico(I.dia, 11) : '') + esc(secName) : (o.sections || []).length ? 'Not in a stage' : '', t.wbs ? esc(t.wbs.title) : '', t.group ? ico(I.folder, 11) + esc(t.group) : ''].filter(Boolean);
|
|
152
177
|
const mOpen = o.open === 'move';
|
|
153
|
-
const
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
return `<div class="tkc s-${sk}
|
|
178
|
+
const move = canMove(t, o) ? `<span class="anc"><button type="button" class="ovmv${mOpen ? ' open' : ''}" data-tkc="move" aria-label="Move it: section, group or initiative" title="Move it" aria-expanded="${mOpen}" aria-haspopup="menu">${ico(I.drag, 17)}</button>${mOpen ? movePop(t, o) : ''}</span>` : '';
|
|
179
|
+
const where = t.ini ? `<div class="ovw tk-ini"><button type="button" class="go" data-tkc="ini" aria-label="Open ${esc(t.iniTitle || t.ini)}"><span class="tl" aria-hidden="true">${ico(I.flag, 15)}</span>`
|
|
180
|
+
+ `<span class="tx"><b>${esc(t.iniTitle || t.ini)}</b>${path.length ? `<small>${path.join('<span class="sep" aria-hidden="true">›</span>')}</small>` : ''}</span><span class="cv">${ico(I.chev, 15)}</span></button>${move}</div>` : '';
|
|
181
|
+
return `<div class="tkc s-${sk}">${facts}${notes}${where}<p class="tkc-msg" role="status">${esc(o.msg || '')}</p></div>`;
|
|
157
182
|
}
|
|
158
183
|
|
|
159
184
|
/* ── the page: one card, every change saved at once with Undo ── */
|
|
160
185
|
let cssOn = false;
|
|
161
186
|
export function cardStyle() {
|
|
162
187
|
if (cssOn || typeof document === 'undefined') return; cssOn = true;
|
|
163
|
-
const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = new URL(
|
|
188
|
+
for (const f of ['./ov-view.css', './task-card.css']) { const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = new URL(f, import.meta.url).href; document.head.append(l); }
|
|
164
189
|
}
|
|
165
190
|
|
|
166
191
|
const WORDS = {
|
|
167
192
|
status: (t) => (t.status === 'Done' ? 'Done' : 'Now ' + t.status.toLowerCase()),
|
|
168
193
|
owner: (t) => (t.owner ? 'Owner: ' + t.owner : 'No owner'),
|
|
169
194
|
group: (t) => (t.group ? 'In ' + t.group : 'Not in a group'),
|
|
195
|
+
section: (t, h) => (t.section ? 'In ' + sectionName(t, h.sections ? h.sections() : null) : 'Not in a stage'),
|
|
170
196
|
notes: () => 'Notes saved',
|
|
171
197
|
dates: (t) => (dueLine(t).text || 'No dates'),
|
|
172
198
|
initiative: (t) => 'Moved to ' + (t.iniTitle || t.ini),
|
|
@@ -175,14 +201,14 @@ const WORDS = {
|
|
|
175
201
|
export function mountCard(el, t, h) {
|
|
176
202
|
cardStyle();
|
|
177
203
|
const st = { open: null, field: 'due', month: '', msg: '' };
|
|
178
|
-
const lists = () => ({ owners: h.owners ? h.owners() : [], groups: h.groups ? h.groups() : null, inis: h.inis ? h.inis() : [] });
|
|
204
|
+
const lists = () => ({ owners: h.owners ? h.owners() : [], groups: h.groups ? h.groups() : null, sections: h.sections ? h.sections() : null, inis: h.inis ? h.inis() : [] });
|
|
179
205
|
const draw = () => {
|
|
180
206
|
const keep = document.activeElement && el.contains(document.activeElement) && document.activeElement.matches('[data-tkc-notes]');
|
|
181
207
|
if (keep) return; // never redraw under the PM's typing
|
|
182
208
|
el.innerHTML = cardHtml(t, { ...st, ...lists(), now: h.now ? h.now() : Date.now() });
|
|
183
209
|
const f = el.querySelector('.tkc-new input'); if (f && (st.open === 'owner' || st.open === 'group')) f.focus();
|
|
184
210
|
};
|
|
185
|
-
const word = (kind) => (WORDS[kind] || (() => 'Saved'))(t);
|
|
211
|
+
const word = (kind) => (WORDS[kind] || (() => 'Saved'))(t, h);
|
|
186
212
|
// one change: write it, show it, then "… · Undo" puts back what was there
|
|
187
213
|
const change = async (kind, patch) => {
|
|
188
214
|
const before = { ...t };
|
|
@@ -213,11 +239,11 @@ export function mountCard(el, t, h) {
|
|
|
213
239
|
if (d.tkcMonth) { st.month = d.tkcMonth; draw(); return; }
|
|
214
240
|
if (d.tkcOwner != null) { st.open = null; if (d.tkcOwner !== t.owner) change('owner', { owner: d.tkcOwner }); else draw(); return; }
|
|
215
241
|
if (d.tkcGroup != null) { st.open = null; if (d.tkcGroup !== t.group) change('group', { group: d.tkcGroup }); else draw(); return; }
|
|
242
|
+
if (d.tkcSection != null) { st.open = null; if (d.tkcSection !== t.section) change('section', { section: d.tkcSection }); else draw(); return; }
|
|
216
243
|
if (d.tkcMove) { st.open = null; change('initiative', { initiative: d.tkcMove }); return; }
|
|
217
244
|
const k = d.tkc;
|
|
218
245
|
if (k === 'ini') { if (h.openIni) h.openIni(t.ini); return; }
|
|
219
|
-
if (k === '
|
|
220
|
-
if (k === 'dates' || k === 'owner' || k === 'group' || k === 'move') { st.open = st.open === k ? null : k; st.field = 'due'; st.month = ''; draw(); }
|
|
246
|
+
if (k === 'dates' || k === 'owner' || k === 'move') { st.open = st.open === k ? null : k; st.field = 'due'; st.month = ''; draw(); }
|
|
221
247
|
};
|
|
222
248
|
el.onsubmit = (e) => {
|
|
223
249
|
const f = e.target.closest('[data-tkc-form]'); if (!f) return;
|
|
@@ -265,7 +291,7 @@ export function boardSaver(o) {
|
|
|
265
291
|
if (patch.status != null) return post('/api/boards/tasks/state', { ws, board, task: t.uid, state: patch.status });
|
|
266
292
|
if (patch.group != null) return post('/api/initiative-layout', { ws, kind: 'place', initiative: t.ini, task: t.key, group: patch.group });
|
|
267
293
|
const body = {};
|
|
268
|
-
for (const k of ['owner', 'notes', 'start', 'due', 'initiative']) if (patch[k] != null) body[k] = patch[k];
|
|
294
|
+
for (const k of ['owner', 'notes', 'start', 'due', 'section', 'initiative']) if (patch[k] != null) body[k] = patch[k];
|
|
269
295
|
return post('/api/boards/tasks/edit', { ws, board, task: t.uid, ...body });
|
|
270
296
|
};
|
|
271
297
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/* pm/tk-view.css — the one Jira ticket Viewer (tk-view.js; canvas OvViewers "Jira ticket"), over ov-view.css and cozy.css's tokens. */
|
|
2
|
+
.tkv { display: flex; flex-direction: column; gap: 16px; padding: 6px 2px 18px; font-size: 14px; color: var(--cz-ink); }
|
|
3
|
+
.tkv .czs-sum { margin: 0; }
|
|
4
|
+
.tkv .nt { border: 0; outline: 0; resize: none; field-sizing: content; min-height: 44px; border-radius: 12px; padding: 6px 8px; margin: 0 -8px; font: inherit; font-size: 14px; line-height: 1.55; color: var(--cz-ink); background: transparent; }
|
|
5
|
+
.tkv .nt::placeholder { color: var(--cz-ink3); }
|
|
6
|
+
.tkv .nt:hover { background: var(--cz-well); }
|
|
7
|
+
.tkv .nt:focus { background: var(--cz-card); box-shadow: 0 0 0 1.5px var(--cz-blue), 0 0 0 5px var(--cz-bluebg); }
|
|
8
|
+
.tkv .czs-secs { margin: 0; }
|
|
9
|
+
.tkv-ac, .tkv-sub, .tkv-ln { list-style: none; margin: 0; padding: 0 0 4px; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; line-height: 1.5; }
|
|
10
|
+
.tkv-ac li { position: relative; padding-left: 16px; }
|
|
11
|
+
.tkv-ac li::before { content: ""; position: absolute; left: 4px; top: .62em; width: 5px; height: 5px; border-radius: 50%; background: var(--cz-ink3); }
|
|
12
|
+
.tkv-sub li { display: flex; align-items: center; gap: 8px; color: var(--cz-ink2); }
|
|
13
|
+
.tkv-sub li.d { color: var(--cz-ink3); }
|
|
14
|
+
.tkv-sub li.d span { text-decoration: line-through; }
|
|
15
|
+
.tkv-ln li { display: flex; align-items: baseline; gap: 8px; }
|
|
16
|
+
.tkv-ln em { font-style: normal; color: var(--cz-ink3); font-size: 12.5px; min-width: 72px; }
|
|
17
|
+
.tkv-ln button { border: 0; background: transparent; padding: 0; font: inherit; color: var(--cz-blueink); cursor: pointer; text-align: left; }
|
|
18
|
+
.tkv-ln button:hover { text-decoration: underline; }
|
|
19
|
+
.tkv-q { margin: 0 0 4px; font-size: 13px; color: var(--cz-ink3); }
|
|
20
|
+
.tkv-msg { margin: 0; font-size: 13px; color: var(--cz-red); }
|
|
21
|
+
.tkv-msg:empty { display: none; }
|