From 4d6eaf2ab21b929e505a7241470bc522436021de Mon Sep 17 00:00:00 2001 From: Julian Freeman Date: Sun, 22 Mar 2026 17:59:15 -0400 Subject: [PATCH] optimize ui --- src/App.vue | 66 +++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 49 insertions(+), 17 deletions(-) diff --git a/src/App.vue b/src/App.vue index e0da75e..43f2ec6 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 } from "lucide-vue-next"; +import { Tag as TagIcon, FolderOpen, Settings, Play, Pause, Maximize2, X, RefreshCw, Plus, Trash2, ChevronDown, Calendar, Clock } from "lucide-vue-next"; // --- Types --- interface Tag { id: number; name: string; parent_id: number | null; color: string; } @@ -54,6 +54,7 @@ const rulerHeight = computed(() => TOTAL_MINUTES * timelineZoom.value); const mainTags = computed(() => tags.value.filter(t => t.parent_id === null)); const getSubTags = (parentId: number) => tags.value.filter(t => t.parent_id === parentId); const getTagColor = (tagId: number) => tags.value.find(t => t.id === tagId)?.color || "#007AFF"; +const getTagName = (tagId: number | null) => tags.value.find(t => t.id === tagId)?.name || "-- 无 --"; let store: any = null; let captureUnlisten: any = null; @@ -159,12 +160,10 @@ const logicalMinutesToTime = (min: number) => { const logicalMinutesFromTime = (timeStr: string) => { const [h, m] = timeStr.split(":").map(Number); let total = h * 60 + m; - // If hour < 3, it belongs to the "late night" part of our logical day (03:00 to 03:00) if (h < 3) total += 1440; return total - TIME_OFFSET_MINUTES; }; -// Computed properties for time inputs in the modal const startTimeInput = computed({ get: () => logicalMinutesToTime(editingEvent.value.start_minute), set: (val) => { editingEvent.value.start_minute = logicalMinutesFromTime(val); } @@ -251,7 +250,6 @@ const updateSettings = async () => { await store.set("captureInterval", captureInterval.value); await store.set("timelineZoom", timelineZoom.value); await store.save(); - await invoke("update_db_path", { path: dbPath.value }); await invoke("update_interval", { seconds: captureInterval.value }); }; @@ -261,6 +259,9 @@ const loadTimeline = async () => { if (savePath.value) timelineImages.value = aw const newTagName = ref(""); const newTagParent = ref(null); const newTagColor = ref("#007AFF"); const resetTagForm = () => { newTagName.value = ""; newTagParent.value = null; newTagColor.value = "#007AFF"; }; + +// --- Custom Select State --- +const isTagSelectOpen = ref(false);