From e04c033ffceead2edaf9f4636cca1f4980b1fce2 Mon Sep 17 00:00:00 2001 From: Julian Freeman Date: Sun, 22 Mar 2026 18:04:05 -0400 Subject: [PATCH] date selector upgrade --- src/App.vue | 105 +++++++++++++++++++++++++++++++++------------------- 1 file changed, 66 insertions(+), 39 deletions(-) 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);

历史活动

- - + +
+
+ + {{ calendarMonth.getFullYear() }}年 {{ calendarMonth.getMonth()+1 }}月 + +
+
{{d}}
+
+
+ +
+
+
@@ -339,21 +378,33 @@ const isTagSelectOpen = ref(false);
-

{{ editingEvent.id ? '编辑事件' : '新增记录' }}

+

{{ editingEvent.id ? '编辑事件' : '新增记录' }}

-
+
-
- - + +
+
选择小时
+
+ +
-
+
-
- - + +
+
选择小时
+
+ +
@@ -375,7 +426,7 @@ const isTagSelectOpen = ref(false);
-
+

标签管理

@@ -390,7 +441,6 @@ const isTagSelectOpen = ref(false);
-
-
@@ -417,23 +466,8 @@ const isTagSelectOpen = ref(false);

设置

-
- -
- - -
-
-
- -
- -
- - -
-
-
+
+
多屏合并
拼接所有屏幕
{{ captureInterval }}s
{{ retainDays }}天
@@ -456,11 +490,4 @@ const isTagSelectOpen = ref(false);