From cc9252cea142f93fbfe15662ef0184fc00ac74c7 Mon Sep 17 00:00:00 2001 From: bboysoul Date: Tue, 8 Sep 2026 20:59:49 +0800 Subject: [PATCH] refactor: clarify sidebar navigation hierarchy --- frontend/src/App.vue | 37 ++++++++++++++++++++++++++----------- frontend/src/style.css | 2 +- frontend/src/style.test.ts | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 12 deletions(-) diff --git a/frontend/src/App.vue b/frontend/src/App.vue index d0962e6..d49383a 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -2,7 +2,7 @@ import { computed, nextTick, onMounted, ref, watch } from 'vue' import { ArchiveRestore, CalendarDays, CalendarHeart, Check, ChevronDown, ChevronRight, Folder, - GripVertical, Inbox, ListChecks, ListTodo, Menu, Pencil, Plus, Search, + Ellipsis, GripVertical, Inbox, ListChecks, ListTodo, Menu, Pencil, Plus, Search, Settings, Trash2, X, Repeat2, } from 'lucide-vue-next' import { buildTaskRrule, defaultTaskDueAt, filterTasks, fromDateTimeLocal, groupTaskTree, moveItemWithinScope, parseTaskRrule, renderMarkdown, toDateTimeLocal, type TaskRepeatConfig } from './lib/task-utils' @@ -35,6 +35,8 @@ const restoredNavigation = readStoredNavigation(window.localStorage, NAVIGATION_ const activeList = ref(restoredNavigation.listId) const activeView = ref(restoredNavigation.view) const selectedTask = ref(null) +const sidebarCreateOpen = ref(false) +const sidebarAction = ref<{ kind: 'folders' | 'lists'; item: FolderItem | TaskList } | null>(null) const query = ref('') const error = ref('') const notice = ref('') @@ -468,7 +470,7 @@ async function switchView(view: View, listId?: string) { if (listId) activeList.value = listId writeStoredNavigation(window.localStorage, NAVIGATION_STORAGE_KEY, view, activeList.value) page.value = 1 - selectedTask.value = null; mobileSidebar.value = false; mobileDetail.value = false; mobileMore.value = false; taskComposeOpen.value = false + selectedTask.value = null; mobileSidebar.value = false; mobileDetail.value = false; mobileMore.value = false; taskComposeOpen.value = false; sidebarCreateOpen.value = false; sidebarAction.value = null if (view === 'trash') await loadTrash() else if (view === 'today') await loadTodayView() else if (!isTaskView(view)) tasks.value = [] @@ -741,6 +743,16 @@ async function loadArchivedLists() { async function restoreList(item: TaskList) { try { await api(`/lists/${item.id}/restore`, { method: 'POST' }); await loadArchivedLists(); await refreshAll(); toast('清单已恢复') } catch (reason) { fail(reason) } } +function toggleSidebarCreate() { sidebarCreateOpen.value = !sidebarCreateOpen.value; sidebarAction.value = null } +function openSidebarAction(kind: 'folders' | 'lists', item: FolderItem | TaskList) { + sidebarAction.value = sidebarAction.value?.item.id === item.id ? null : { kind, item } + sidebarCreateOpen.value = false +} +function runSidebarCreate(kind: 'folder' | 'list') { + sidebarCreateOpen.value = false + kind === 'folder' ? void createFolder() : void createList(null) +} +function closeSidebarAction() { sidebarAction.value = null } function toggleFolder(id: string) { const next = new Set(expandedFolders.value); next.has(id) ? next.delete(id) : next.add(id); expandedFolders.value = next } function formatDue(value: string | null, hasTime = true) { if (!value) return '' @@ -776,29 +788,32 @@ onMounted(bootstrap)
-