MCPcopy Create free account
hub / github.com/callumalpass/tasknotes / selectTask

Method selectTask

src/views/PomodoroView.ts:867–908  ·  view source on GitHub ↗
(task: TaskInfo | null)

Source from the content-addressed store, hash-verified

865 }
866
867 private async selectTask(task: TaskInfo | null) {
868 this.currentSelectedTask = task;
869
870 // Update button text - keep it simple since we have the task card
871 if (this.taskSelectButton) {
872 if (task) {
873 this.taskSelectButton.textContent = this.t("views.pomodoro.buttons.changeTask");
874 setTooltip(
875 this.taskSelectButton,
876 this.t("views.pomodoro.buttons.selectDifferentTask"),
877 { placement: "top" }
878 );
879 this.taskSelectButton.removeClass("pomodoro-view__task-select-button--no-task");
880 } else {
881 this.taskSelectButton.textContent = this.t("views.pomodoro.buttons.chooseTask");
882 // Remove tooltip for no-task state
883 this.taskSelectButton.removeAttribute("title");
884 this.taskSelectButton.addClass("pomodoro-view__task-select-button--no-task");
885 }
886 }
887
888 // Update clear button visibility
889 if (this.taskClearButton) {
890 if (task) {
891 this.taskClearButton.removeClass("pomodoro-view__task-clear-button--hidden");
892 } else {
893 this.taskClearButton.addClass("pomodoro-view__task-clear-button--hidden");
894 }
895 }
896
897 // Update task card display
898 this.updateTaskCardDisplay(task);
899
900 // Save selection for persistence
901 await this.plugin.pomodoroService.saveLastSelectedTask(task?.path);
902
903 // If there's a current work session, update its task assignment
904 const state = this.plugin.pomodoroService.getState();
905 if (state.currentSession && state.currentSession.type === "work") {
906 await this.plugin.pomodoroService.assignTaskToCurrentSession(task || undefined);
907 }
908 }
909
910 private updateTaskCardDisplay(task: TaskInfo | null) {
911 if (!this.taskCardContainer) return;

Callers 4

renderMethod · 0.95
openTaskSelectorMethod · 0.95

Calls 7

tMethod · 0.95
updateTaskCardDisplayMethod · 0.95
setTooltipFunction · 0.90
saveLastSelectedTaskMethod · 0.80
addClassMethod · 0.65
getStateMethod · 0.45

Tested by

no test coverage detected