jt-workspace-dashboard 0.1.19 → 0.1.22
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/dist/dashboard.js +13 -6
- package/package.json +1 -1
package/dist/dashboard.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
const BASE_LABELS = Object.assign({today: "In progress", ready: "Paused", waiting: "Waiting", later: "Later", handoff: "Handoff", meeting: "Ask", question: "Question"}, CFG.labels || {});
|
|
9
9
|
let LABELS = BASE_LABELS; // per workspace: BASE_LABELS + workspace.labels
|
|
10
10
|
const OWNER_NAME = String(CFG.ownerName || "").slice(0, 40);
|
|
11
|
-
const VERSION = "0.1.
|
|
11
|
+
const VERSION = "0.1.22";
|
|
12
12
|
|
|
13
13
|
/* ---------- page skeleton ---------- */
|
|
14
14
|
document.title = CFG.title || "Dashboard";
|
|
@@ -180,6 +180,7 @@
|
|
|
180
180
|
waitingOn: keys["Waiting on"] || "", url: safeUrl(keys.Link) || "https://app.todoist.com/app/task/" + t.id, todoistUrl: "https://app.todoist.com/app/task/" + t.id,
|
|
181
181
|
figma: safeUrl(keys.Figma), notion: safeUrl(keys.Notion), airtable: safeUrl(keys.Airtable), chat: safeUrl(keys.Chat), meeting: keys.Meeting || "", due, overdue, newAt: Date.parse(t.addedAt) || 0, seenAt: seenMap[t.id] || 0};
|
|
182
182
|
}
|
|
183
|
+
function ymd(days){ const d = new Date(Date.now() + days * 864e5); return d.getFullYear() + "-" + String(d.getMonth() + 1).padStart(2, "0") + "-" + String(d.getDate()).padStart(2, "0"); }
|
|
183
184
|
function projectIds(){ const t = WS.todoist || {}; return [].concat(t.projectIds || [], t.projectId || []).filter(Boolean); }
|
|
184
185
|
let loadSeq = 0;
|
|
185
186
|
let lastLoad = 0;
|
|
@@ -191,15 +192,21 @@
|
|
|
191
192
|
try {
|
|
192
193
|
const results = await Promise.all(pids.map(pid => Promise.all([
|
|
193
194
|
td("find-tasks", {projectId: pid, limit: 100}),
|
|
194
|
-
|
|
195
|
+
// Completed subtasks aren't in find-tasks, so fetch ~3 months of completions (the API's max window)
|
|
196
|
+
// to show them under their open parent's "Show N completed" toggle.
|
|
197
|
+
td("find-completed-tasks", {projectId: pid, since: ymd(-89), until: ymd(0), limit: 200}).catch(() => null)
|
|
195
198
|
])));
|
|
196
199
|
if(seq !== loadSeq || w !== WS) return;
|
|
197
|
-
const next = [];
|
|
200
|
+
const next = [], weekAgo = Date.now() - 7 * 864e5;
|
|
198
201
|
results.forEach(([act, comp]) => {
|
|
199
202
|
const all = parse(act).tasks || [], ids = new Set(all.map(t => t.id));
|
|
200
|
-
const
|
|
203
|
+
const compAll = comp ? (parse(comp).tasks || []) : [];
|
|
204
|
+
const doneKids = compAll.filter(t => t.parentId && !ids.has(t.id)).map(t => Object.assign({}, t, {checked: true}))
|
|
205
|
+
.sort((a, b) => (Date.parse(a.completedAt) || 0) - (Date.parse(b.completedAt) || 0));
|
|
206
|
+
const pool = all.concat(doneKids);
|
|
207
|
+
const desc = id => pool.filter(k => k.parentId === id).flatMap(k => [k, ...desc(k.id)]);
|
|
201
208
|
all.filter(t => !t.parentId || !ids.has(t.parentId)).forEach((t, i) => next.push(toItem(t, i, desc(t.id))));
|
|
202
|
-
const done =
|
|
209
|
+
const done = compAll.filter(t => !t.parentId && (Date.parse(t.completedAt) || 0) >= weekAgo).slice(0, 30);
|
|
203
210
|
done.forEach(t => next.push({id: t.id, title: t.content, section: "done", _completed: true, labels: t.labels || [], description: String(t.description || ""), touchedAt: Date.parse(t.completedAt) || 0, subtasks: [], questions: [], _server: []}));
|
|
204
211
|
});
|
|
205
212
|
items = next; cache[w.id] = next; saveCache(w.id, next); setStatus(""); render();
|
|
@@ -263,7 +270,7 @@
|
|
|
263
270
|
function isProject(w, it){
|
|
264
271
|
const n = w.notes; if(!n || !n.dataSource) return false;
|
|
265
272
|
if(it.notion || !["today", "ready", "waiting", "handoff", "upcoming", "later"].includes(it.section)) return false;
|
|
266
|
-
return n.all || (it.subtasks || []).length >= (n.minSteps || 3);
|
|
273
|
+
return n.all || (it.subtasks || []).filter(s => !s.d).length >= (n.minSteps || 3);
|
|
267
274
|
}
|
|
268
275
|
function notesMarkdown(it){
|
|
269
276
|
const out = [];
|
package/package.json
CHANGED