Mark unread turn summaries in the switcher and Project rows

This commit is contained in:
Ian Gulliver
2026-10-16 11:08:57 -07:00
parent ec169583ff
commit 34db128afe
24 changed files with 755 additions and 239 deletions
+12 -4
View File
@@ -2,7 +2,7 @@ import { get, post } from "./api.js";
import { errorText, h, replace, showAlert } from "./dom.js";
import { markdown } from "./markdown.js";
import { models } from "./task.js";
import { findTask, focusedProject, focusTask, on, onEach, state, taskState } from "./state.js";
import { findTask, focusedProject, focusTask, on, onEach, openSummary, state, taskState, unreadSummary } from "./state.js";
import { taskStyle } from "./taskcolor.js";
const refreshKinds = new Set(["task.merged", "project.created"]);
export function mountProject(root) {
@@ -71,7 +71,7 @@ export function mountProject(root) {
void load(p.id);
}
}),
onEach(["tasks", "sessions", "inbox"], render),
onEach(["tasks", "sessions", "inbox", "summaries"], render),
];
render();
refresh();
@@ -118,11 +118,19 @@ function tasksBlock(active) {
href: `#/task/${task.id}`,
onclick: (e) => {
e.preventDefault();
focusTask(task.id);
if (unreadSummary(task)) {
openSummary(task);
}
else {
focusTask(task.id);
}
},
}, task.parent_task_id !== undefined && h("span", { class: "subtask-mark", title: `Subtask of ${findTask(task.parent_task_id)?.title ?? task.parent_task_id}` }, "↳"), stateMark(ts), h("span", { class: "task-title task-name" }, task.title), count > 0 && h("span", { class: "badge", title: "inbox items" }, count), h("span", { class: `task-state ${ts.kind}`, title: ts.title }, ts.label)));
}, task.parent_task_id !== undefined && h("span", { class: "subtask-mark", title: `Subtask of ${findTask(task.parent_task_id)?.title ?? task.parent_task_id}` }, "↳"), stateMark(ts), h("span", { class: "task-title task-name" }, task.title), count > 0 && h("span", { class: "badge", title: "inbox items" }, count), summaryMark(task), h("span", { class: `task-state ${ts.kind}`, title: ts.title }, ts.label)));
}));
}
export function summaryMark(task) {
return unreadSummary(task) && h("span", { class: "task-state summary-unread", title: "A turn summary you haven't read", ariaLabel: `New summary from ${task.title}, unread` }, "new summary");
}
function todoBlock(project, todo, active, starting, start) {
if (todo === undefined) {
return [h("p", { class: "empty-row" }, "Loading…")];