diff --git a/src/App.vue b/src/App.vue index 43f2ec6..0421a12 100644 --- a/src/App.vue +++ b/src/App.vue @@ -4,7 +4,7 @@ import { load } from "@tauri-apps/plugin-store"; import { open, save } from "@tauri-apps/plugin-dialog"; import { invoke } from "@tauri-apps/api/core"; import { listen } from "@tauri-apps/api/event"; -import { Tag as TagIcon, FolderOpen, Settings, Play, Pause, Maximize2, X, RefreshCw, Plus, Trash2, ChevronDown, Calendar, Clock } from "lucide-vue-next"; +import { Tag as TagIcon, FolderOpen, Settings, Play, Pause, Maximize2, X, RefreshCw, Plus, Trash2, ChevronDown, ChevronLeft, ChevronRight, Calendar, Clock } from "lucide-vue-next"; // --- Types --- interface Tag { id: number; name: string; parent_id: number | null; color: string; } @@ -59,6 +59,30 @@ const getTagName = (tagId: number | null) => tags.value.find(t => t.id === tagId let store: any = null; let captureUnlisten: any = null; +// --- Custom Picker States --- +const isCalendarOpen = ref(false); +const calendarMonth = ref(new Date()); +const isStartTimeOpen = ref(false); +const isEndTimeOpen = ref(false); + +const calendarDays = computed(() => { + const y = calendarMonth.value.getFullYear(); + const m = calendarMonth.value.getMonth(); + const firstDay = new Date(y, m, 1).getDay(); + const daysInMonth = new Date(y, m + 1, 0).getDate(); + const days = []; + const padding = (firstDay + 6) % 7; + for (let i = 0; i < padding; i++) days.push(null); + for (let i = 1; i <= daysInMonth; i++) days.push(new Date(y, m, i)); + return days; +}); + +const selectCalendarDate = (date: Date) => { + currentDate.value = date.toLocaleDateString('sv'); // sv locale gives YYYY-MM-DD + isCalendarOpen.value = false; + loadTimeline(); loadEvents(); +}; + // --- Logic --- onMounted(async () => { store = await load("config.json"); @@ -299,8 +323,23 @@ const isTagSelectOpen = ref(false);