Add a Discuss button beside Start on TODO items

This commit is contained in:
Ian Gulliver
2026-10-16 08:53:02 -07:00
parent cac24e534f
commit 2bb7833de3
14 changed files with 227 additions and 205 deletions
+7 -5
View File
@@ -33,12 +33,12 @@ export function mountProject(root) {
void load(p.id);
}
};
const start = async (project, item) => {
const start = async (project, item, discuss) => {
const key = `${project.id}\n${item.title}`;
starting.add(key);
render();
try {
await post("/api/projects/{projectId}/todo/tasks", { path: { projectId: project.id }, body: { title: item.title, model: models[0] } });
await post("/api/projects/{projectId}/todo/tasks", { path: { projectId: project.id }, body: { title: item.title, model: models[0], discuss } });
}
catch (err) {
void showAlert(errorText(err));
@@ -142,9 +142,11 @@ function todoBlock(project, todo, active, starting, start) {
}
else {
const busy = starting.has(`${project.id}\n${item.title}`);
const button = h("button", { disabled: busy }, busy ? "Starting…" : "Start");
button.onclick = () => void start(project, item);
action = button;
const startButton = h("button", { disabled: busy, title: "Start a task that gets straight to work" }, busy ? "Starting…" : "Start");
startButton.onclick = () => void start(project, item, false);
const discussButton = h("button", { disabled: busy, title: "Start a task that talks it through with you before changing anything" }, "Discuss");
discussButton.onclick = () => void start(project, item, true);
action = h("span", { class: "todo-buttons" }, startButton, discussButton);
}
list.append(h("li", { class: task && task.id === state.selectedTaskId ? "selected" : "", style: task ? taskStyle(task.id) : "" }, h("div", { class: "todo-head" }, h("span", { class: task ? "todo-title task-name" : "todo-title" }, item.title), action), item.body && markdown(item.body, "md todo-body")));
}