fix: Stopwatch mode and daily stats improvements
Bug Fixes: - Removed progress bar from stopwatch mode (only shows in pomodoro/break) - Fixed daily stats not resetting at midnight when app stays open - Fixed focus time tracking to only count completed tasks, not stopped sessions Improvements: - Added daily reset check interval (checks every 60 seconds) - Added daily reset check on app visibility change - Focus time now accurately reflects completed work only - Session time tracking separated from daily focus time Technical: - Added dailyResetCheckInterval for periodic day change detection - Added sessionStartSeconds to track focus time per session - Removed real-time focus time updates from timer intervals - Focus time only added in completeTask() method - Progress bar conditionally rendered based on isStopwatchMode flag
This commit is contained in:
34
src/view.ts
34
src/view.ts
@@ -173,24 +173,26 @@ export class ImmerseView extends ItemView {
|
||||
text: this.plugin.formatTime(this.plugin.currentTimerSeconds)
|
||||
});
|
||||
|
||||
// Progress bar - store reference for updates
|
||||
const progressWrap = activeCard.createEl('div', { cls: 'immerse-progress-wrap' });
|
||||
this.progressBarEl = progressWrap.createEl('div', { cls: 'immerse-progress-bar' });
|
||||
|
||||
let progressPercent = 0;
|
||||
if (this.plugin.isBreakMode) {
|
||||
const breakDuration = this.plugin.pomodoroCount % this.plugin.settings.longBreakInterval === 0
|
||||
? this.plugin.settings.longBreakMinutes * 60
|
||||
: this.plugin.settings.pomodoroBreakMinutes * 60;
|
||||
progressPercent = ((breakDuration - this.plugin.currentTimerSeconds) / breakDuration) * 100;
|
||||
} else {
|
||||
const workDuration = this.plugin.settings.pomodoroWorkMinutes * 60;
|
||||
progressPercent = ((workDuration - this.plugin.currentTimerSeconds) / workDuration) * 100;
|
||||
// Progress bar - only show in pomodoro/break mode, not stopwatch
|
||||
if (!this.plugin.isStopwatchMode) {
|
||||
const progressWrap = activeCard.createEl('div', { cls: 'immerse-progress-wrap' });
|
||||
this.progressBarEl = progressWrap.createEl('div', { cls: 'immerse-progress-bar' });
|
||||
|
||||
let progressPercent = 0;
|
||||
if (this.plugin.isBreakMode) {
|
||||
const breakDuration = this.plugin.pomodoroCount % this.plugin.settings.longBreakInterval === 0
|
||||
? this.plugin.settings.longBreakMinutes * 60
|
||||
: this.plugin.settings.pomodoroBreakMinutes * 60;
|
||||
progressPercent = ((breakDuration - this.plugin.currentTimerSeconds) / breakDuration) * 100;
|
||||
} else {
|
||||
const workDuration = this.plugin.settings.pomodoroWorkMinutes * 60;
|
||||
progressPercent = ((workDuration - this.plugin.currentTimerSeconds) / workDuration) * 100;
|
||||
}
|
||||
|
||||
this.progressBarEl.style.width = `${Math.min(Math.max(progressPercent, 0), 100)}%`;
|
||||
if (progressPercent >= 100) this.progressBarEl.addClass('immerse-overtime');
|
||||
}
|
||||
|
||||
this.progressBarEl.style.width = `${Math.min(Math.max(progressPercent, 0), 100)}%`;
|
||||
if (progressPercent >= 100) this.progressBarEl.addClass('immerse-overtime');
|
||||
|
||||
// Time info - store reference for actual time updates
|
||||
if (!this.plugin.isBreakMode) {
|
||||
const timeInfo = activeCard.createEl('div', { cls: 'immerse-time-info' });
|
||||
|
||||
Reference in New Issue
Block a user