Bug-fixes
This commit is contained in:
56
src/main.ts
56
src/main.ts
@@ -36,7 +36,7 @@ export default class FocusTaskPlugin extends Plugin {
|
||||
activeTaskId: string | null = null;
|
||||
pomodoroCount: number = 0;
|
||||
|
||||
// Status Bar element
|
||||
// Status bar element
|
||||
statusBarEl: HTMLElement | null = null;
|
||||
|
||||
async onload() {
|
||||
@@ -90,7 +90,7 @@ export default class FocusTaskPlugin extends Plugin {
|
||||
// Add settings tab
|
||||
this.addSettingTab(new FocusTaskSettingTab(this.app, this));
|
||||
|
||||
// Create floating timer if enabled
|
||||
// Create status bar timer
|
||||
this.createStatusBar();
|
||||
}
|
||||
|
||||
@@ -98,7 +98,6 @@ export default class FocusTaskPlugin extends Plugin {
|
||||
this.stopTimer();
|
||||
}
|
||||
|
||||
|
||||
async loadAllData() {
|
||||
const loaded = await this.loadData();
|
||||
this.data = Object.assign({}, DEFAULT_DATA, loaded?.data || {});
|
||||
@@ -251,14 +250,18 @@ export default class FocusTaskPlugin extends Plugin {
|
||||
this.currentTimerSeconds = 0;
|
||||
this.isTimerRunning = true;
|
||||
|
||||
// Full refresh to show the active task card
|
||||
this.refreshView();
|
||||
this.updateStatusBar();
|
||||
|
||||
// Start interval (count up mode - stopwatch)
|
||||
this.timerInterval = window.setInterval(() => {
|
||||
this.currentTimerSeconds++;
|
||||
task.actualMinutes = Math.floor(this.currentTimerSeconds / 60);
|
||||
|
||||
// Update floating timer
|
||||
this.updateFloatingTimer();
|
||||
this.refreshView();
|
||||
// Light update - only timer display, no full refresh
|
||||
this.updateStatusBar();
|
||||
this.updateTimerDisplay();
|
||||
|
||||
// Check if over estimate
|
||||
if (this.currentTimerSeconds === task.estimatedMinutes * 60) {
|
||||
@@ -270,8 +273,6 @@ export default class FocusTaskPlugin extends Plugin {
|
||||
}, 1000);
|
||||
|
||||
this.saveAllData();
|
||||
this.updateTimerDisplay();
|
||||
this.updateFloatingTimer();
|
||||
}
|
||||
|
||||
startPomodoro(taskId: string) {
|
||||
@@ -285,6 +286,10 @@ export default class FocusTaskPlugin extends Plugin {
|
||||
this.currentTimerSeconds = this.settings.pomodoroWorkMinutes * 60;
|
||||
this.isTimerRunning = true;
|
||||
|
||||
// Full refresh to show the active task card
|
||||
this.refreshView();
|
||||
this.updateStatusBar();
|
||||
|
||||
this.timerInterval = window.setInterval(() => {
|
||||
this.currentTimerSeconds--;
|
||||
|
||||
@@ -293,16 +298,14 @@ export default class FocusTaskPlugin extends Plugin {
|
||||
this.data.totalFocusMinutesToday = Math.floor(this.data.totalFocusMinutesToday + 1/60);
|
||||
}
|
||||
|
||||
this.updateFloatingTimer();
|
||||
this.refreshView();
|
||||
// Light update - only timer display, no full refresh
|
||||
this.updateStatusBar();
|
||||
this.updateTimerDisplay();
|
||||
|
||||
if (this.currentTimerSeconds <= 0) {
|
||||
this.handlePomodoroEnd();
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
this.updateFloatingTimer();
|
||||
this.updateTimerDisplay();
|
||||
}
|
||||
|
||||
handlePomodoroEnd() {
|
||||
@@ -342,11 +345,15 @@ export default class FocusTaskPlugin extends Plugin {
|
||||
|
||||
new Notice(isLongBreak ? '☕ Long break time!' : '☕ Short break time!');
|
||||
|
||||
// Full refresh to show break state
|
||||
this.refreshView();
|
||||
|
||||
if (!this.timerInterval) {
|
||||
this.timerInterval = window.setInterval(() => {
|
||||
this.currentTimerSeconds--;
|
||||
this.updateFloatingTimer();
|
||||
this.refreshView();
|
||||
// Light update - only timer display
|
||||
this.updateStatusBar();
|
||||
this.updateTimerDisplay();
|
||||
|
||||
if (this.currentTimerSeconds <= 0) {
|
||||
this.handlePomodoroEnd();
|
||||
@@ -354,8 +361,7 @@ export default class FocusTaskPlugin extends Plugin {
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
this.updateFloatingTimer();
|
||||
this.updateTimerDisplay();
|
||||
this.updateStatusBar();
|
||||
}
|
||||
|
||||
toggleTimer() {
|
||||
@@ -374,8 +380,9 @@ export default class FocusTaskPlugin extends Plugin {
|
||||
if (task && !this.isBreakMode) {
|
||||
task.actualMinutes = Math.floor((this.settings.pomodoroWorkMinutes * 60 - this.currentTimerSeconds) / 60);
|
||||
}
|
||||
this.updateFloatingTimer();
|
||||
this.refreshView();
|
||||
// Light update - only timer display
|
||||
this.updateStatusBar();
|
||||
this.updateTimerDisplay();
|
||||
|
||||
if (this.currentTimerSeconds <= 0) {
|
||||
this.handlePomodoroEnd();
|
||||
@@ -385,8 +392,9 @@ export default class FocusTaskPlugin extends Plugin {
|
||||
new Notice('No active task. Select a task first.');
|
||||
}
|
||||
|
||||
this.updateFloatingTimer();
|
||||
this.updateTimerDisplay();
|
||||
// Full refresh to update pause/resume button state
|
||||
this.updateStatusBar();
|
||||
this.refreshView();
|
||||
}
|
||||
|
||||
stopTimer() {
|
||||
@@ -404,8 +412,9 @@ export default class FocusTaskPlugin extends Plugin {
|
||||
|
||||
this.isTimerRunning = false;
|
||||
this.activeTaskId = null;
|
||||
this.updateFloatingTimer();
|
||||
this.updateStatusBar();
|
||||
this.saveAllData();
|
||||
this.refreshView();
|
||||
}
|
||||
|
||||
startFocusOnNextTask() {
|
||||
@@ -447,8 +456,6 @@ export default class FocusTaskPlugin extends Plugin {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ============ Sounds & Celebrations ============
|
||||
|
||||
showCelebration(task: FocusTask) {
|
||||
@@ -701,7 +708,6 @@ class FocusTaskSettingTab extends PluginSettingTab {
|
||||
await this.plugin.saveAllData();
|
||||
}));
|
||||
|
||||
|
||||
// Lists Management
|
||||
containerEl.createEl('h2', { text: '📋 Lists' });
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ export interface FocusTaskSettings {
|
||||
enableCelebrations: boolean;
|
||||
defaultEstimateMinutes: number;
|
||||
lists: TaskList[];
|
||||
showFloatingTimer: true;
|
||||
autoStartBreak: boolean;
|
||||
tickSoundEnabled: boolean;
|
||||
}
|
||||
@@ -57,7 +56,6 @@ export const DEFAULT_SETTINGS: FocusTaskSettings = {
|
||||
{ id: 'personal', name: 'Personal', color: '#22c55e', icon: '🏠' },
|
||||
{ id: 'learning', name: 'Learning', color: '#f59e0b', icon: '📚' },
|
||||
],
|
||||
showFloatingTimer: true,
|
||||
autoStartBreak: false,
|
||||
tickSoundEnabled: false,
|
||||
};
|
||||
|
||||
14
styles.css
14
styles.css
@@ -215,18 +215,6 @@
|
||||
padding: 24px;
|
||||
color: white;
|
||||
box-shadow: var(--ft-shadow-lg);
|
||||
animation: ft-slideIn 0.3s ease;
|
||||
}
|
||||
|
||||
@keyframes ft-slideIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(-10px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
.focus-task-break-card {
|
||||
@@ -602,7 +590,7 @@
|
||||
}
|
||||
|
||||
/* ============ Dark mode adjustments ============ */
|
||||
.theme-dark .focus-task-floating-timer {
|
||||
.theme-dark .focus-task-status-bar {
|
||||
background: var(--background-secondary);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user