From e6b21d5acd30bc4a9bbb029cf555787c7c2bc6bf Mon Sep 17 00:00:00 2001 From: Julian Freeman Date: Mon, 23 Mar 2026 09:34:45 -0400 Subject: [PATCH] add addEvent button --- src/App.vue | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/src/App.vue b/src/App.vue index 4c05bda..c3261f8 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, ChevronLeft, ChevronRight, Calendar, Download } from "lucide-vue-next"; +import { Tag as TagIcon, FolderOpen, Settings, Play, Pause, Maximize2, X, RefreshCw, Plus, Trash2, ChevronDown, ChevronLeft, ChevronRight, Calendar, Download, SquarePlus } from "lucide-vue-next"; // --- Types --- interface Tag { id: number; name: string; parent_id: number | null; color: string; } @@ -401,6 +401,32 @@ const loadTimeline = async (autoScrollToCurrentTime = false) => { } }; +const handleQuickAddEvent = () => { + let start = 0; + if (dayEvents.value && dayEvents.value.length > 0) { + const lastEvent = dayEvents.value.reduce((prev, curr) => curr.end_minute > prev.end_minute ? curr : prev, dayEvents.value[0]); + start = lastEvent.end_minute; + } + + let end = 1439; + if (currentLogicalMinute.value >= 0) { + end = currentLogicalMinute.value; + } + + if (start > end) start = end; + + editingEvent.value = { + id: 0, + date: currentDate.value, + start_minute: start, + end_minute: end, + main_tag_id: mainTags.value[0]?.id || 0, + sub_tag_id: null, + content: "" + }; + isEventModalOpen.value = true; +}; + const newTagName = ref(""); const newTagParent = ref(null); const newTagColor = ref("#007AFF"); const resetTagForm = () => { newTagName.value = ""; newTagParent.value = null; newTagColor.value = "#007AFF"; }; @@ -565,10 +591,11 @@ const handleExport = async () => {
- - - - + + + + +