MCPcopy
hub / github.com/callumalpass/tasknotes / updateTaskButtonFromPath

Method updateTaskButtonFromPath

src/views/PomodoroView.ts:979–1024  ·  view source on GitHub ↗
(taskPath: string)

Source from the content-addressed store, hash-verified

977 }
978
979 private async updateTaskButtonFromPath(taskPath: string) {
980 try {
981 // Use the cache manager as the single source of truth
982 const task = await this.plugin.cacheManager.getTaskInfo(taskPath);
983
984 if (task) {
985 this.currentSelectedTask = task;
986 if (this.taskSelectButton) {
987 this.taskSelectButton.textContent = this.t("views.pomodoro.buttons.changeTask");
988 setTooltip(
989 this.taskSelectButton,
990 this.t("views.pomodoro.buttons.selectDifferentTask"),
991 { placement: "top" }
992 );
993 this.taskSelectButton.removeClass("pomodoro-no-task");
994 this.taskSelectButton.removeClass("pomodoro-view__task-select-button--no-task");
995 }
996
997 // Update clear button and task card display
998 if (this.taskClearButton) {
999 this.taskClearButton.removeClass("pomodoro-view__task-clear-button--hidden");
1000 }
1001 this.updateTaskCardDisplay(task);
1002 return;
1003 }
1004
1005 // Task not found - reset to no task selected
1006 this.currentSelectedTask = null;
1007 if (this.taskSelectButton) {
1008 this.taskSelectButton.textContent = this.t("views.pomodoro.buttons.chooseTask");
1009 // Remove tooltip for no-task state
1010 this.taskSelectButton.removeAttribute("title");
1011 this.taskSelectButton.addClass("pomodoro-view__task-select-button--no-task");
1012 }
1013 if (this.taskClearButton) {
1014 this.taskClearButton.addClass("pomodoro-view__task-clear-button--hidden");
1015 }
1016 this.updateTaskCardDisplay(null);
1017 } catch (error) {
1018 tasknotesLogger.error("Error updating task button from path:", {
1019 category: "persistence",
1020 operation: "updating-task-button-path",
1021 error: error,
1022 });
1023 }
1024 }
1025
1026 private updateDisplay(
1027 session?: PomodoroSession,

Callers 1

updateDisplayMethod · 0.95

Calls 6

tMethod · 0.95
updateTaskCardDisplayMethod · 0.95
setTooltipFunction · 0.90
errorMethod · 0.80
getTaskInfoMethod · 0.65
addClassMethod · 0.65

Tested by

no test coverage detected