Mark unread turn summaries in the switcher and Project rows
This commit is contained in:
+12
-3
@@ -1,7 +1,8 @@
|
||||
import { get, post, type Project, type WorkflowSummary } from "./api.js";
|
||||
import { errorText, h, replace, showAlert } from "./dom.js";
|
||||
import { focusLead } from "./panes.js";
|
||||
import { activeTasks, findTask, focusedProject, focusProject, focusTab, focusTask, lastVisits, onEach, state, taskState } from "./state.js";
|
||||
import { summaryMark } from "./project.js";
|
||||
import { activeTasks, findTask, focusedProject, focusProject, focusTab, focusTask, lastVisits, onEach, openSummary, state, taskState, unreadSummary } from "./state.js";
|
||||
import { confirmMerge, models } from "./task.js";
|
||||
import { taskStyle } from "./taskcolor.js";
|
||||
|
||||
@@ -99,7 +100,7 @@ export function openSwitcher(): void {
|
||||
let rows: { el: HTMLElement; pick: () => void }[] = [];
|
||||
let picking: { project: Project; title: string; typed: string; workflows: WorkflowSummary[] | undefined } | null = null;
|
||||
|
||||
const offs = onEach(["projects", "tasks", "sessions", "inbox"], () => render());
|
||||
const offs = onEach(["projects", "tasks", "sessions", "inbox", "summaries"], () => render());
|
||||
const onEscape = (e: KeyboardEvent) => {
|
||||
if (e.key !== "Escape") {
|
||||
return;
|
||||
@@ -126,7 +127,14 @@ export function openSwitcher(): void {
|
||||
|
||||
const go = (taskId: string) => {
|
||||
close();
|
||||
focusTask(taskId, state.inbox.some((item) => item.task_id === taskId) ? "inbox" : "transcript");
|
||||
const task = findTask(taskId);
|
||||
if (state.inbox.some((item) => item.task_id === taskId)) {
|
||||
focusTask(taskId, "inbox");
|
||||
} else if (task && unreadSummary(task)) {
|
||||
openSummary(task);
|
||||
} else {
|
||||
focusTask(taskId, "transcript");
|
||||
}
|
||||
};
|
||||
|
||||
const create = async (projectId: string, title: string, workflow?: string) => {
|
||||
@@ -231,6 +239,7 @@ export function openSwitcher(): void {
|
||||
h("span", { class: "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),
|
||||
);
|
||||
return { el, pick: () => go(task.id) };
|
||||
|
||||
Reference in New Issue
Block a user