3 Commits
1.0.1 ... 1.0.2

Author SHA1 Message Date
1a0c37d642 Updated Version 2025-11-22 16:31:15 +01:00
5a33e641b1 Fixed Focus time not adding time properly 2025-11-22 16:28:44 +01:00
7b4e2e674a Updated README.md 2025-11-22 14:59:53 +01:00
6 changed files with 37 additions and 11 deletions

View File

@@ -4,7 +4,7 @@ A powerful task management and focus timer plugin for [Obsidian](https://obsidia
![Focus Task Banner](https://img.shields.io/badge/Obsidian-Plugin-7c3aed?style=for-the-badge&logo=obsidian&logoColor=white) ![Focus Task Banner](https://img.shields.io/badge/Obsidian-Plugin-7c3aed?style=for-the-badge&logo=obsidian&logoColor=white)
![License](https://img.shields.io/badge/License-MIT-green?style=for-the-badge) ![License](https://img.shields.io/badge/License-MIT-green?style=for-the-badge)
![Version](https://img.shields.io/badge/Version-1.0.0-blue?style=for-the-badge) ![Version](https://img.shields.io/badge/Version-1.0.2-blue?style=for-the-badge)
## 🎯 Overview ## 🎯 Overview

16
main.js
View File

@@ -2,7 +2,6 @@
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin if you want to view the source, please visit the github repository of this plugin
*/ */
/* Build version 1.0.1 */
var __defProp = Object.defineProperty; var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -496,6 +495,8 @@ var FocusTaskPlugin = class extends import_obsidian3.Plugin {
this.isBreakMode = false; this.isBreakMode = false;
this.activeTaskId = null; this.activeTaskId = null;
this.pomodoroCount = 0; this.pomodoroCount = 0;
// Focus time tracking (in seconds for accuracy)
this.focusSecondsToday = 0;
// Status bar element // Status bar element
this.statusBarEl = null; this.statusBarEl = null;
} }
@@ -544,8 +545,10 @@ var FocusTaskPlugin = class extends import_obsidian3.Plugin {
const loaded = await this.loadData(); const loaded = await this.loadData();
this.data = Object.assign({}, DEFAULT_DATA, (loaded == null ? void 0 : loaded.data) || {}); this.data = Object.assign({}, DEFAULT_DATA, (loaded == null ? void 0 : loaded.data) || {});
this.settings = Object.assign({}, DEFAULT_SETTINGS, (loaded == null ? void 0 : loaded.settings) || {}); this.settings = Object.assign({}, DEFAULT_SETTINGS, (loaded == null ? void 0 : loaded.settings) || {});
this.focusSecondsToday = (this.data.totalFocusMinutesToday || 0) * 60;
} }
async saveAllData() { async saveAllData() {
this.data.totalFocusMinutesToday = Math.floor(this.focusSecondsToday / 60);
await this.saveData({ await this.saveData({
settings: this.settings, settings: this.settings,
data: this.data data: this.data
@@ -563,6 +566,7 @@ var FocusTaskPlugin = class extends import_obsidian3.Plugin {
} }
this.data.completedToday = 0; this.data.completedToday = 0;
this.data.totalFocusMinutesToday = 0; this.data.totalFocusMinutesToday = 0;
this.focusSecondsToday = 0;
this.data.lastActiveDate = today; this.data.lastActiveDate = today;
this.saveAllData(); this.saveAllData();
} }
@@ -667,6 +671,7 @@ var FocusTaskPlugin = class extends import_obsidian3.Plugin {
this.timerInterval = window.setInterval(() => { this.timerInterval = window.setInterval(() => {
this.currentTimerSeconds++; this.currentTimerSeconds++;
task.actualMinutes = Math.floor(this.currentTimerSeconds / 60); task.actualMinutes = Math.floor(this.currentTimerSeconds / 60);
this.focusSecondsToday++;
this.updateStatusBar(); this.updateStatusBar();
this.updateTimerDisplay(); this.updateTimerDisplay();
if (this.currentTimerSeconds === task.estimatedMinutes * 60) { if (this.currentTimerSeconds === task.estimatedMinutes * 60) {
@@ -690,11 +695,13 @@ var FocusTaskPlugin = class extends import_obsidian3.Plugin {
this.isTimerRunning = true; this.isTimerRunning = true;
this.refreshView(); this.refreshView();
this.updateStatusBar(); this.updateStatusBar();
let secondsWorked = 0;
this.timerInterval = window.setInterval(() => { this.timerInterval = window.setInterval(() => {
this.currentTimerSeconds--; this.currentTimerSeconds--;
if (!this.isBreakMode) { if (!this.isBreakMode) {
task.actualMinutes = Math.floor((this.settings.pomodoroWorkMinutes * 60 - this.currentTimerSeconds) / 60); secondsWorked++;
this.data.totalFocusMinutesToday = Math.floor(this.data.totalFocusMinutesToday + 1 / 60); task.actualMinutes = Math.floor(secondsWorked / 60);
this.focusSecondsToday++;
} }
this.updateStatusBar(); this.updateStatusBar();
this.updateTimerDisplay(); this.updateTimerDisplay();
@@ -756,6 +763,7 @@ var FocusTaskPlugin = class extends import_obsidian3.Plugin {
this.currentTimerSeconds--; this.currentTimerSeconds--;
if (task && !this.isBreakMode) { if (task && !this.isBreakMode) {
task.actualMinutes = Math.floor((this.settings.pomodoroWorkMinutes * 60 - this.currentTimerSeconds) / 60); task.actualMinutes = Math.floor((this.settings.pomodoroWorkMinutes * 60 - this.currentTimerSeconds) / 60);
this.focusSecondsToday++;
} }
this.updateStatusBar(); this.updateStatusBar();
this.updateTimerDisplay(); this.updateTimerDisplay();
@@ -927,7 +935,7 @@ var FocusTaskPlugin = class extends import_obsidian3.Plugin {
pendingCount: pending.length, pendingCount: pending.length,
completedToday: this.data.completedToday, completedToday: this.data.completedToday,
totalEstimatedMinutes: totalEstimate, totalEstimatedMinutes: totalEstimate,
totalFocusMinutesToday: Math.floor(this.data.totalFocusMinutesToday), totalFocusMinutesToday: Math.floor(this.focusSecondsToday / 60),
streak: this.data.streak, streak: this.data.streak,
pomodorosCompleted: this.data.pomodorosCompleted, pomodorosCompleted: this.data.pomodorosCompleted,
avgAccuracy: Math.round(avgAccuracy * 100) avgAccuracy: Math.round(avgAccuracy * 100)

View File

@@ -1,7 +1,7 @@
{ {
"id": "focus-task", "id": "focus-task",
"name": "Focus Task", "name": "Focus Task",
"version": "1.0.1", "version": "1.0.2",
"minAppVersion": "0.15.0", "minAppVersion": "0.15.0",
"description": "A Blitzit-inspired task management and focus timer plugin. Plan your day, track time with Pomodoro technique, and crush your tasks with satisfying checkoffs.", "description": "A Blitzit-inspired task management and focus timer plugin. Plan your day, track time with Pomodoro technique, and crush your tasks with satisfying checkoffs.",
"author": "Crib", "author": "Crib",

View File

@@ -1,6 +1,6 @@
{ {
"name": "focus-task", "name": "focus-task",
"version": "1.0.1", "version": "1.0.2",
"description": "A Blitzit-inspired task management and focus timer plugin for Obsidian", "description": "A Blitzit-inspired task management and focus timer plugin for Obsidian",
"main": "main.js", "main": "main.js",
"scripts": { "scripts": {

View File

@@ -36,6 +36,9 @@ export default class FocusTaskPlugin extends Plugin {
activeTaskId: string | null = null; activeTaskId: string | null = null;
pomodoroCount: number = 0; pomodoroCount: number = 0;
// Focus time tracking (in seconds for accuracy)
private focusSecondsToday: number = 0;
// Status bar element // Status bar element
statusBarEl: HTMLElement | null = null; statusBarEl: HTMLElement | null = null;
@@ -102,9 +105,13 @@ export default class FocusTaskPlugin extends Plugin {
const loaded = await this.loadData(); const loaded = await this.loadData();
this.data = Object.assign({}, DEFAULT_DATA, loaded?.data || {}); this.data = Object.assign({}, DEFAULT_DATA, loaded?.data || {});
this.settings = Object.assign({}, DEFAULT_SETTINGS, loaded?.settings || {}); this.settings = Object.assign({}, DEFAULT_SETTINGS, loaded?.settings || {});
// Initialize seconds from stored minutes
this.focusSecondsToday = (this.data.totalFocusMinutesToday || 0) * 60;
} }
async saveAllData() { async saveAllData() {
// Sync minutes from seconds before saving
this.data.totalFocusMinutesToday = Math.floor(this.focusSecondsToday / 60);
await this.saveData({ await this.saveData({
settings: this.settings, settings: this.settings,
data: this.data, data: this.data,
@@ -126,6 +133,7 @@ export default class FocusTaskPlugin extends Plugin {
// Reset daily stats // Reset daily stats
this.data.completedToday = 0; this.data.completedToday = 0;
this.data.totalFocusMinutesToday = 0; this.data.totalFocusMinutesToday = 0;
this.focusSecondsToday = 0;
this.data.lastActiveDate = today; this.data.lastActiveDate = today;
this.saveAllData(); this.saveAllData();
} }
@@ -259,6 +267,9 @@ export default class FocusTaskPlugin extends Plugin {
this.currentTimerSeconds++; this.currentTimerSeconds++;
task.actualMinutes = Math.floor(this.currentTimerSeconds / 60); task.actualMinutes = Math.floor(this.currentTimerSeconds / 60);
// Track focus time
this.focusSecondsToday++;
// Light update - only timer display, no full refresh // Light update - only timer display, no full refresh
this.updateStatusBar(); this.updateStatusBar();
this.updateTimerDisplay(); this.updateTimerDisplay();
@@ -290,12 +301,17 @@ export default class FocusTaskPlugin extends Plugin {
this.refreshView(); this.refreshView();
this.updateStatusBar(); this.updateStatusBar();
// Track seconds worked for accurate focus time
let secondsWorked = 0;
this.timerInterval = window.setInterval(() => { this.timerInterval = window.setInterval(() => {
this.currentTimerSeconds--; this.currentTimerSeconds--;
if (!this.isBreakMode) { if (!this.isBreakMode) {
task.actualMinutes = Math.floor((this.settings.pomodoroWorkMinutes * 60 - this.currentTimerSeconds) / 60); secondsWorked++;
this.data.totalFocusMinutesToday = Math.floor(this.data.totalFocusMinutesToday + 1/60); task.actualMinutes = Math.floor(secondsWorked / 60);
// Increment focus time by 1 second
this.focusSecondsToday++;
} }
// Light update - only timer display, no full refresh // Light update - only timer display, no full refresh
@@ -379,6 +395,8 @@ export default class FocusTaskPlugin extends Plugin {
this.currentTimerSeconds--; this.currentTimerSeconds--;
if (task && !this.isBreakMode) { if (task && !this.isBreakMode) {
task.actualMinutes = Math.floor((this.settings.pomodoroWorkMinutes * 60 - this.currentTimerSeconds) / 60); task.actualMinutes = Math.floor((this.settings.pomodoroWorkMinutes * 60 - this.currentTimerSeconds) / 60);
// Track focus time
this.focusSecondsToday++;
} }
// Light update - only timer display // Light update - only timer display
this.updateStatusBar(); this.updateStatusBar();
@@ -588,7 +606,7 @@ export default class FocusTaskPlugin extends Plugin {
pendingCount: pending.length, pendingCount: pending.length,
completedToday: this.data.completedToday, completedToday: this.data.completedToday,
totalEstimatedMinutes: totalEstimate, totalEstimatedMinutes: totalEstimate,
totalFocusMinutesToday: Math.floor(this.data.totalFocusMinutesToday), totalFocusMinutesToday: Math.floor(this.focusSecondsToday / 60),
streak: this.data.streak, streak: this.data.streak,
pomodorosCompleted: this.data.pomodorosCompleted, pomodorosCompleted: this.data.pomodorosCompleted,
avgAccuracy: Math.round(avgAccuracy * 100), avgAccuracy: Math.round(avgAccuracy * 100),

View File

@@ -1,3 +1,3 @@
{ {
"1.0.1": "0.15.0" "1.0.2": "0.15.0"
} }