jt-workspace-dashboard 0.1.2-stable → 0.1.4

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/README.md CHANGED
@@ -21,14 +21,14 @@ Publishing uses npm trusted publishing, linked to `.github/workflows/publish.yml
21
21
  {
22
22
  title: "Dashboard",
23
23
  ownerName: "Jeremy",
24
- labels: { ready: "Paused" }, // optional: Todoist label names (defaults below)
24
+ labels: { ready: "Paused" }, // optional: Todoist label names for every workspace (defaults below)
25
25
  workspaces: [
26
26
  {
27
27
  id: "personal", name: "Personal", accent: "#2B8A6E",
28
28
  todoist: { projectId: "…" }, // or projectIds: [...]
29
- sections: { ready: "Paused" }, // display names; ids are fixed
29
+ labels: { ready: "Ready to show" }, // optional: this workspace's label names (= section names)
30
30
  calendar: { ids: ["primary"], hide: ["Time Blocking"] }, // or false
31
- updateTask: "trig_…", updateLabel: "Sort inbox",
31
+ updateTask: "trig_…",
32
32
  features: { handoff: false, meetingAsks: false, showFollowUp: false, chatLink: false }
33
33
  }
34
34
  ]
@@ -37,19 +37,23 @@ Publishing uses npm trusted publishing, linked to `.github/workflows/publish.yml
37
37
 
38
38
  The page's database (only used for the update button's status line) is read at `meta/status-<workspace id>`.
39
39
 
40
+ **Loading:** the page shows the last tasks and today's calendar it saw (saved in the browser) instantly, then refreshes from Todoist in the background: on open, every 2 minutes, and when you come back to the tab after 30+ seconds.
41
+
40
42
  The page's declared capabilities must include `mcp` with Todoist (`find-tasks`, `find-completed-tasks`, `update-tasks`, `complete-tasks`, `uncomplete-tasks`, `delete-object`), Google Calendar (`list_events`), Claude Code Remote (`fire_trigger`), plus `host:claude_browser` (`preview_start`, `find`) if `chatLink` is on, and `db`.
41
43
 
42
44
  ## Todoist conventions
43
45
 
46
+ **Wording is the same everywhere:** a section's name on the dashboard is its Todoist label name. The only exception is the `ready` section: "Paused" for personal stuff, "Ready to show" for client work (set with the workspace's `labels.ready`). The update button is always "Update" and the side rail is always "Today".
47
+
44
48
  **Sections come from labels** (one status label per task; none = To do):
45
49
 
46
50
  | Section id | Default label | Shown as (default) |
47
51
  | --- | --- | --- |
48
52
  | `upcoming` | (no status label) | To do |
49
53
  | `today` | `In progress` | In progress |
50
- | `ready` | `Paused` | Paused / Ready to show |
51
- | `waiting` | `Waiting` | Waiting on others |
52
- | `handoff` | `Handoff` | Handoff prep (feature `handoff`) |
54
+ | `ready` | `Paused` (client work: `Ready to show`) | same as the label |
55
+ | `waiting` | `Waiting` | Waiting |
56
+ | `handoff` | `Handoff` | Handoff (feature `handoff`) |
53
57
  | `later` | `Later` | Later |
54
58
  | `meeting` | `Ask` | Under its meeting in the side rail (feature `meetingAsks`) |
55
59
  | `done` | completed in Todoist | Completed (last 7 days) |
@@ -60,6 +64,7 @@ The page's declared capabilities must include `mcp` with Todoist (`find-tasks`,
60
64
  Waiting on: Jon
61
65
  Link: https://… main source (Slack thread, Gmail, Fathom call)
62
66
  Figma: https://…
67
+ Notion: https://… project notes / longer docs (shows a Notes chip)
63
68
  Chat: https://claude.ai/chat/…
64
69
  Meeting: Jeremy-Tactus UX for Ask tasks: the meeting title it belongs to
65
70
  One or two lines of note.
package/dist/dashboard.js CHANGED
@@ -5,9 +5,10 @@
5
5
  "use strict";
6
6
  const CFG = window.DASHBOARD_CONFIG || {};
7
7
  const WORKSPACES = Array.isArray(CFG.workspaces) && CFG.workspaces.length ? CFG.workspaces : [{id: "main", name: "Dashboard", todoist: {}}];
8
- const LABELS = Object.assign({today: "In progress", ready: "Paused", waiting: "Waiting", later: "Later", handoff: "Handoff", meeting: "Ask", question: "Question"}, CFG.labels || {});
8
+ const BASE_LABELS = Object.assign({today: "In progress", ready: "Paused", waiting: "Waiting", later: "Later", handoff: "Handoff", meeting: "Ask", question: "Question"}, CFG.labels || {});
9
+ let LABELS = BASE_LABELS; // per workspace: BASE_LABELS + workspace.labels
9
10
  const OWNER_NAME = String(CFG.ownerName || "").slice(0, 40);
10
- const VERSION = "0.1.2-stable";
11
+ const VERSION = "0.1.4";
11
12
 
12
13
  /* ---------- page skeleton ---------- */
13
14
  document.title = CFG.title || "Dashboard";
@@ -26,6 +27,7 @@
26
27
  chat: SVG('<path d="M8 2v3.2M8 10.8V14M2 8h3.2M10.8 8H14M3.8 3.8l2.2 2.2M10 10l2.2 2.2M12.2 3.8L10 6M6 10l-2.2 2.2"/>'),
27
28
  link: SVG('<path d="M7 9a3 3 0 0 0 4.2 0l2-2a3 3 0 0 0-4.2-4.2l-.6.6M9 7a3 3 0 0 0-4.2 0l-2 2a3 3 0 0 0 4.2 4.2l.6-.6"/>'),
28
29
  todo: SVG('<rect x="2.5" y="2.5" width="11" height="11" rx="2.5"/><path d="M5.5 8l1.8 1.8L10.5 6"/>'),
30
+ notes: SVG('<path d="M4 2.5h6l2.5 2.5v8.5H4z"/><path d="M6.5 7h4M6.5 9.5h4"/>'),
29
31
  cal: SVG('<rect x="2.5" y="3.5" width="11" height="10" rx="2"/><path d="M2.5 6.5h11M5.5 2v3M10.5 2v3"/>')
30
32
  };
31
33
  const CHEV = '<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M4 6l4 4 4-4" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>';
@@ -43,12 +45,13 @@
43
45
  function pickInitial(){ return wsFromHash() || WORKSPACES.find(w => w.id === store("dash.ws", "")) || WORKSPACES[0]; }
44
46
  function applyWorkspace(w){
45
47
  WS = w;
46
- const names = Object.assign({upcoming: "To do", today: "In progress", ready: "Paused", waiting: "Waiting on others", handoff: "Handoff prep", later: "Later"}, w.sections || {});
48
+ LABELS = Object.assign({}, BASE_LABELS, w.labels || {});
49
+ // Section names are the Todoist label names, so the dashboard and Todoist always say the same thing.
50
+ const names = Object.assign({upcoming: "To do", today: LABELS.today, ready: LABELS.ready, waiting: LABELS.waiting, handoff: LABELS.handoff, later: LABELS.later}, w.sections || {});
47
51
  LABEL = Object.assign({}, names, {done: "Complete", removed: "Removed"});
48
52
  SECTIONS = ["today", "ready", "waiting"].concat(feat("handoff") ? ["handoff"] : [], ["upcoming", "later"]);
49
53
  DRAGGABLE = ["today", "upcoming", "later"].concat(feat("handoff") ? ["handoff"] : []);
50
- EMPTY = {today: "Nothing in progress. Start something from " + names.upcoming + ".", ready: "Nothing in " + names.ready + ".", waiting: "Not waiting on anyone.",
51
- handoff: "Nothing approved and waiting for a handoff.", upcoming: "Things you haven't started show here.", later: "Nothing parked for later."};
54
+ EMPTY = {today: "Nothing in progress.", ready: "Nothing here.", waiting: "Not waiting on anyone.", handoff: "Nothing waiting for a handoff.", upcoming: "Nothing to do.", later: "Nothing parked for later."};
52
55
  PRIMARY = {today: [names.ready, "ready"], ready: ["Back to " + names.today.toLowerCase(), "today"], waiting: ["Back to " + names.today.toLowerCase(), "today"],
53
56
  handoff: ["Handed off", "done"], upcoming: ["Start", "today"], later: ["Start", "today"], done: ["Reopen", "today"]};
54
57
  // accent colour per workspace (light and dark)
@@ -59,10 +62,14 @@
59
62
  save("dash.ws", w.id);
60
63
  if(WORKSPACES.length > 1 && location.hash.slice(1) !== w.id){ try { history.replaceState(null, "", "#" + w.id); } catch(_){} }
61
64
  buildSections(); renderSwitcher();
62
- $("railTitle").textContent = w.railTitle || "Today";
65
+ $("railTitle").textContent = "Today";
63
66
  $("activeOnly").title = "Show only " + ["today", "ready", "waiting"].concat(feat("handoff") ? ["handoff"] : []).map(s => LABEL[s]).join(", ");
64
- $("updateLabel").textContent = w.updateLabel || "Update";
65
- items = (cache[w.id] || []); statusDoc = null; renderStatus(); watchStatus();
67
+ $("updateLabel").textContent = "Update";
68
+ const stored = cache[w.id] ? null : readCache(w.id);
69
+ items = cache[w.id] || (stored ? stored.items : []);
70
+ const calStored = store("dash.cal." + w.id, null);
71
+ dayData = calStored && calStored.date === isoDay(new Date()) ? calStored : null;
72
+ statusDoc = null; renderStatus(); watchStatus();
66
73
  render();
67
74
  loadTasks(); loadCalendar();
68
75
  }
@@ -97,6 +104,9 @@
97
104
  /* ---------- state ---------- */
98
105
  let db = null, mcp = null, items = [], canWrite = true, undoState = null, toastTimer = null, refreshTimer = null;
99
106
  const cache = {};
107
+ const CACHE_V = 1;
108
+ function saveCache(wsId, list){ try { localStorage.setItem("dash.cache." + wsId, JSON.stringify({v: CACHE_V, t: Date.now(), items: list})); } catch(_){} }
109
+ function readCache(wsId){ try { const c = JSON.parse(localStorage.getItem("dash.cache." + wsId) || "null"); return c && c.v === CACHE_V && Array.isArray(c.items) ? c : null; } catch(_){ return null; } }
100
110
  const seenMap = store("pd.seen", {}), orderMap = store("pd.order", {});
101
111
  function saveSeen(id, t){ seenMap[id] = t; save("pd.seen", seenMap); }
102
112
  function saveOrder(id, o){ orderMap[id] = o; save("pd.order", orderMap); }
@@ -107,14 +117,14 @@
107
117
 
108
118
  /* ---------- Todoist adapter ---------- */
109
119
  const STATUS_KEYS = ["today", "ready", "waiting", "later", "handoff", "meeting"];
110
- const STATUS_LABELS = STATUS_KEYS.map(k => LABELS[k]);
120
+ const statusLabels = () => STATUS_KEYS.map(k => LABELS[k]);
111
121
  const parse = r => {
112
122
  const p = r && r.payload; if(p && typeof p === "object") return p;
113
123
  const txt = typeof p === "string" ? p : ((r && r.content) || []).filter(c => c.type === "text").map(c => c.text)[0] || "";
114
124
  try { return JSON.parse(txt); } catch(_){ const m = txt.match(/\{[\s\S]*\}/); try { return m ? JSON.parse(m[0]) : {}; } catch(_){ return {}; } }
115
125
  };
116
126
  const td = (tool, input) => mcp.callTool(CFG.todoistServer || "Todoist", tool, input, {cache: false});
117
- const KEYLINE = /^(Waiting on|Link|Figma|Chat|Meeting):[ \t]*(.*)$/;
127
+ const KEYLINE = /^(Waiting on|Link|Figma|Notion|Chat|Meeting):[ \t]*(.*)$/;
118
128
  function splitDesc(desc){
119
129
  const [head, ctx = ""] = String(desc || "").split(/^Context:[ \t]*$/m);
120
130
  const keys = {}, rest = [];
@@ -151,12 +161,14 @@
151
161
  return {id: t.id, title: t.content, description: String(t.description || ""), labels, section, order: orderMap[t.id] ?? (i + 1), projectId: t.projectId,
152
162
  note, log, subtasks, questions, _server: subtasks.concat(questions).map(x => ({id: x.id, d: x.d})),
153
163
  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,
154
- figma: safeUrl(keys.Figma), chat: safeUrl(keys.Chat), meeting: keys.Meeting || "", due, overdue, newAt: Date.parse(t.addedAt) || 0, seenAt: seenMap[t.id] || 0};
164
+ figma: safeUrl(keys.Figma), notion: safeUrl(keys.Notion), chat: safeUrl(keys.Chat), meeting: keys.Meeting || "", due, overdue, newAt: Date.parse(t.addedAt) || 0, seenAt: seenMap[t.id] || 0};
155
165
  }
156
166
  function projectIds(){ const t = WS.todoist || {}; return [].concat(t.projectIds || [], t.projectId || []).filter(Boolean); }
157
167
  let loadSeq = 0;
168
+ let lastLoad = 0;
158
169
  async function loadTasks(){
159
170
  if(!mcp) return;
171
+ lastLoad = Date.now();
160
172
  const w = WS, seq = ++loadSeq, pids = projectIds();
161
173
  if(!pids.length){ setStatus("This workspace has no Todoist project set in its settings."); return; }
162
174
  try {
@@ -173,7 +185,7 @@
173
185
  const done = comp ? (parse(comp).tasks || []).filter(t => !t.parentId) : [];
174
186
  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: []}));
175
187
  });
176
- items = next; cache[w.id] = next; setStatus(""); render();
188
+ items = next; cache[w.id] = next; saveCache(w.id, next); setStatus(""); render();
177
189
  } catch(e){
178
190
  if(w !== WS) return;
179
191
  const c = e && e.code;
@@ -203,7 +215,7 @@
203
215
  else if(s === "removed"){ await td("delete-object", {type: "task", id}); }
204
216
  else {
205
217
  if(it._completed){ await td("uncomplete-tasks", {ids: [id]}); it._completed = false; }
206
- labels = (it.labels || []).filter(l => !STATUS_LABELS.includes(l)); if(LABELS[s]) labels.push(LABELS[s]);
218
+ labels = (it.labels || []).filter(l => !statusLabels().includes(l)); if(LABELS[s]) labels.push(LABELS[s]);
207
219
  desc = setLine(desc, "Waiting on", s === "waiting" ? (patch.waitingOn || it.waitingOn) : null);
208
220
  desc = setLine(desc, "Meeting", s === "meeting" ? (patch.meeting || it.meeting) : null);
209
221
  }
@@ -242,6 +254,7 @@
242
254
  .sort((a, b) => String((a.start || {}).dateTime || (a.start || {}).date).localeCompare(String((b.start || {}).dateTime || (b.start || {}).date)));
243
255
  dayData = {date: isoDay(n), meetings: evs.map((e, i) => { const st = e.start || {}, en = e.end || {};
244
256
  return {id: e.id || "e" + i, title: e.summary || "(No title)", url: e.htmlLink, time: st.dateTime ? fmt(st.dateTime) + (en.dateTime ? " – " + fmt(en.dateTime) : "") : "All day"}; })};
257
+ save("dash.cal." + w.id, dayData);
245
258
  } catch(e){ if(w !== WS) return; dayData = {date: isoDay(n), meetings: [], error: true}; }
246
259
  renderMeetings();
247
260
  }
@@ -281,6 +294,7 @@
281
294
  const u = safeUrl(it.url); if(u) pill(u, "Link", ICON.link, "Link");
282
295
  const f = safeUrl(it.figma), c = safeUrl(it.chat);
283
296
  if(f) pill(f, o.compact ? "" : "Figma", ICON.figma, "Figma");
297
+ const nn = safeUrl(it.notion); if(nn) pill(nn, o.compact ? "" : "Notes", ICON.notes, "Notion notes");
284
298
  if(c){ pill(c, o.compact ? "" : "Chat", ICON.chat, "Claude chat"); const a = row.lastChild; a.onclick = e => { e.preventDefault(); e.stopPropagation(); openChat(c); }; }
285
299
  const subs = it.subtasks || [];
286
300
  if(subs.length){ const n = el("span", "chip"); n.innerHTML = ICON.todo; n.append(document.createTextNode(subs.filter(x => x && x.d).length + "/" + subs.length)); n.title = "To-dos done"; row.append(n); }
@@ -582,7 +596,7 @@
582
596
  if(dayData.off){ ul.append(el("li", "empty", "No calendar for this workspace.")); }
583
597
  else if(dayData.error){ ul.append(el("li", "empty", "Couldn't load your calendar.")); }
584
598
  const m = meetingsList();
585
- if(!dayData.off && !dayData.error && !m.length) ul.append(el("li", "empty", "Nothing on the calendar today."));
599
+ if(!dayData.off && !dayData.error && !m.length) ul.append(el("li", "empty", "Nothing on your calendar today."));
586
600
  const asks = items.filter(i => i.section === "meeting");
587
601
  const used = new Set();
588
602
  const follow = feat("showFollowUp") ? sorted("ready").concat(sorted("waiting")) : [];
@@ -703,10 +717,10 @@
703
717
  btn.hidden = !mcp || !/^trig_[A-Za-z0-9]+$/.test(WS.updateTask || "");
704
718
  const running = s.state === "running" && Date.now() - (Number(s.startedAt) || 0) < 20 * 60 * 1000;
705
719
  btn.classList.toggle("busy", running);
706
- if(!btn.dataset.local){ btn.disabled = running; lbl.textContent = running ? (WS.updatingLabel || "Updating…") : (WS.updateLabel || "Update"); }
720
+ if(!btn.dataset.local){ btn.disabled = running; lbl.textContent = running ? "Updating…" : "Update"; }
707
721
  const t = ms => new Date(ms).toLocaleTimeString("en-US", {hour: "numeric", minute: "2-digit"});
708
722
  const day = ms => { const d = new Date(ms), n = new Date(); return d.toDateString() === n.toDateString() ? t(ms) : d.toLocaleDateString("en-US", {weekday: "short"}) + " " + t(ms); };
709
- st.textContent = running ? (WS.updatingLabel || "Updating…") : s.state === "done" && s.finishedAt ? "Updated " + day(Number(s.finishedAt)) : s.state === "error" && s.finishedAt ? "Last update had a problem" : "";
723
+ st.textContent = running ? "Updating…" : s.state === "done" && s.finishedAt ? "Updated " + day(Number(s.finishedAt)) : s.state === "error" && s.finishedAt ? "Last update had a problem" : "";
710
724
  $("updateTip").textContent = s.summary || "";
711
725
  }
712
726
  $("updateState").addEventListener("click", e => { e.stopPropagation(); $("updateTip").classList.toggle("show"); });
@@ -720,7 +734,7 @@
720
734
  lbl.textContent = "Starting…";
721
735
  await mcp.callTool(CFG.remoteServer || "Claude Code Remote", "fire_trigger", {trigger_id: w.updateTask}, {cache: false});
722
736
  if(w === WS) statusDoc = {state: "running", startedAt: Date.now()};
723
- toast((linked ? "Linked " + linked + " chat" + (linked === 1 ? "" : "s") + ". " : "") + (w.updateStartedMsg || "Updating now. New items show up in a few minutes."));
737
+ toast((linked ? "Linked " + linked + " chat" + (linked === 1 ? "" : "s") + ". " : "") + "Updating. New items show up here in a few minutes.");
724
738
  } catch(e){
725
739
  const c = e && e.code;
726
740
  toast(c === "server_not_connected" || c === "needs_reauth" ? "Reconnect Claude Code Remote in Settings → Connectors." :
@@ -741,11 +755,11 @@
741
755
  const use = n => (window.claude && window.claude.use) ? window.claude.use(n).catch(() => null) : Promise.resolve(null);
742
756
  [db, mcp] = await Promise.all([use("db"), use("mcp")]);
743
757
  if(!mcp){ canWrite = false; applyWorkspace(WS); $("refreshed").textContent = "Open this page in Claude to see your dashboard."; return; }
744
- setStatus("Loading your to-dos…");
758
+ if(!cache[WS.id] && !readCache(WS.id)) setStatus("Loading your to-dos…");
745
759
  applyWorkspace(WS);
746
760
  setInterval(loadTasks, 120000);
747
761
  let calDay = new Date().toDateString();
748
762
  setInterval(() => { if(new Date().toDateString() !== calDay){ calDay = new Date().toDateString(); loadCalendar(); $("date").textContent = new Date().toLocaleDateString("en-US", {weekday: "long", month: "long", day: "numeric"}); } $("refreshed").textContent = greeting(); renderStatus(); }, 60000);
749
- document.addEventListener("visibilitychange", () => { if(!document.hidden) loadTasks(); });
763
+ document.addEventListener("visibilitychange", () => { if(!document.hidden && Date.now() - lastLoad > 30000) loadTasks(); });
750
764
  })();
751
765
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jt-workspace-dashboard",
3
- "version": "0.1.2-stable",
3
+ "version": "0.1.4",
4
4
  "description": "Shared code for Jeremy's Claude dashboards: a Todoist + Google Calendar consolidator with workspaces.",
5
5
  "main": "dist/dashboard.js",
6
6
  "files": [