Add a Discuss button beside Start on TODO items
This commit is contained in:
Vendored
+7
-5
@@ -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")));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user