(
session?: PomodoroSession,
task?: TaskInfo,
options: { refreshStats?: boolean } = {}
)
| 1024 | } |
| 1025 | |
| 1026 | private updateDisplay( |
| 1027 | session?: PomodoroSession, |
| 1028 | task?: TaskInfo, |
| 1029 | options: { refreshStats?: boolean } = {} |
| 1030 | ) { |
| 1031 | // Check if pomodoroService is available |
| 1032 | if (!this.plugin.pomodoroService) { |
| 1033 | // Set default UI state when service is not available |
| 1034 | if (this.statusDisplay) { |
| 1035 | this.statusDisplay.textContent = this.t("views.pomodoro.status.ready"); |
| 1036 | this.statusDisplay.className = "pomodoro-status pomodoro-view__status"; |
| 1037 | } |
| 1038 | return; |
| 1039 | } |
| 1040 | |
| 1041 | const state = this.plugin.pomodoroService.getState(); |
| 1042 | |
| 1043 | // Update timer and progress |
| 1044 | this.updateTimer(state.timeRemaining); |
| 1045 | this.updateProgress(state); |
| 1046 | this.updateSessionMeta(state); |
| 1047 | |
| 1048 | // Update status |
| 1049 | if (this.statusDisplay) { |
| 1050 | if (state.isRunning && state.currentSession) { |
| 1051 | const typeText = |
| 1052 | state.currentSession.type === "work" |
| 1053 | ? this.t("views.pomodoro.status.focus") |
| 1054 | : state.currentSession.type === "short-break" |
| 1055 | ? this.t("views.pomodoro.status.shortBreak") |
| 1056 | : this.t("views.pomodoro.status.longBreak"); |
| 1057 | this.statusDisplay.textContent = typeText; |
| 1058 | this.statusDisplay.className = `pomodoro-status pomodoro-view__status pomodoro-status-${state.currentSession.type} pomodoro-view__status--${state.currentSession.type}`; |
| 1059 | } else if (state.currentSession && !state.isRunning) { |
| 1060 | this.statusDisplay.textContent = this.t("views.pomodoro.status.paused"); |
| 1061 | this.statusDisplay.className = `pomodoro-status pomodoro-view__status pomodoro-status-paused pomodoro-view__status--paused`; |
| 1062 | } else { |
| 1063 | this.statusDisplay.textContent = this.t("views.pomodoro.status.ready"); |
| 1064 | this.statusDisplay.className = "pomodoro-status pomodoro-view__status"; |
| 1065 | } |
| 1066 | } |
| 1067 | |
| 1068 | // Update task display only if task info changed |
| 1069 | if (this.taskDisplay) { |
| 1070 | const currentTaskPath = state.currentSession?.taskPath; |
| 1071 | const currentDisplayPath = this.taskDisplay.dataset.currentTaskPath; |
| 1072 | |
| 1073 | if (currentTaskPath !== currentDisplayPath) { |
| 1074 | this.taskDisplay.empty(); |
| 1075 | this.taskDisplay.dataset.currentTaskPath = currentTaskPath || ""; |
| 1076 | |
| 1077 | // We now show task info in the task card instead of here |
| 1078 | // Keep this section minimal or remove content entirely since we have the task card |
| 1079 | } |
| 1080 | } |
| 1081 | |
| 1082 | // Update task selector button to reflect current session |
| 1083 | if (this.taskSelectButton) { |
no test coverage detected