fix bugs
This commit is contained in:
@@ -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> }>();
|
||||
|
||||
Reference in New Issue
Block a user