This commit is contained in:
Julian Freeman
2026-03-26 13:19:43 -04:00
parent 05a6ee59ff
commit 06fb78edab
5 changed files with 146 additions and 38 deletions

View File

@@ -1,7 +1,7 @@
import { ref, computed, watch } from "vue";
import { invoke } from "@tauri-apps/api/core";
import { DBEvent } from "../types";
import { currentDate, getTagColor, getTagName, formatMinutes, parseISODate, toISODate } from "./index";
import { currentDate, getTagColor, getTagName, formatMinutes, parseISODate, toISODate, viewMode, refreshSignal } from "./index";
// Re-export for easier access in Dashboard component
export { getTagColor, getTagName, formatMinutes };
@@ -31,6 +31,20 @@ watch([dashboardRange, currentDate], () => {
loadDashboardEvents();
}, { immediate: true });
// Auto-refresh dashboard when a refresh signal is received (event added/deleted)
watch(refreshSignal, () => {
if (viewMode.value === 'dashboard') {
loadDashboardEvents();
}
});
// Refresh when switching to dashboard mode to catch updates that happened in preview mode
watch(viewMode, (mode) => {
if (mode === 'dashboard') {
loadDashboardEvents();
}
});
export const dashboardStats = computed(() => {
let totalMinutes = 0;
const mainTagMap = new Map<number, { total: number, subTags: Map<number, number> }>();