From 1766357335538af3c4c6ffad60f2d5a09bf9d06f Mon Sep 17 00:00:00 2001 From: Cody Seibert Date: Wed, 10 Dec 2025 08:56:22 -0500 Subject: [PATCH] feat(sidebar, app-store): enhance project history management with dropdown menu - Replaced project cycle buttons in the sidebar with a dropdown menu for improved UI and accessibility. - Added a new `clearProjectHistory` action to the app store, allowing users to clear project history while retaining the current project. - Updated the sidebar component to integrate the new dropdown menu, providing options to cycle through previous and next projects, as well as clear history. These changes streamline project navigation and enhance user experience within the application. --- app/src/components/layout/sidebar.tsx | 63 ++++++++++++++++----------- app/src/store/app-store.ts | 18 ++++++++ 2 files changed, 55 insertions(+), 26 deletions(-) diff --git a/app/src/components/layout/sidebar.tsx b/app/src/components/layout/sidebar.tsx index 45b10e2c..85e9dd7f 100644 --- a/app/src/components/layout/sidebar.tsx +++ b/app/src/components/layout/sidebar.tsx @@ -20,15 +20,17 @@ import { Check, BookOpen, GripVertical, - RotateCw, RotateCcw, Trash2, Undo2, + MoreVertical, } from "lucide-react"; import { DropdownMenu, DropdownMenuContent, DropdownMenuTrigger, + DropdownMenuItem, + DropdownMenuSeparator, } from "@/components/ui/dropdown-menu"; import { Dialog, @@ -176,6 +178,7 @@ export function Sidebar() { reorderProjects, cyclePrevProject, cycleNextProject, + clearProjectHistory, } = useAppStore(); // State for project picker dropdown @@ -770,32 +773,40 @@ export function Sidebar() { - {/* Project Cycle Buttons - only show when there's history */} + {/* Project History Menu - only show when there's history */} {projectHistory.length > 1 && ( -
- - -
+ + + + + + + + Previous + + {ACTION_SHORTCUTS.cyclePrevProject} + + + + + Next + + {ACTION_SHORTCUTS.cycleNextProject} + + + + + + Clear history + + + )} )} diff --git a/app/src/store/app-store.ts b/app/src/store/app-store.ts index 47c0c3dc..771b817f 100644 --- a/app/src/store/app-store.ts +++ b/app/src/store/app-store.ts @@ -168,6 +168,7 @@ export interface AppActions { reorderProjects: (oldIndex: number, newIndex: number) => void; cyclePrevProject: () => void; // Cycle back through project history (Q) cycleNextProject: () => void; // Cycle forward through project history (E) + clearProjectHistory: () => void; // Clear history, keeping only current project // View actions setCurrentView: (view: ViewMode) => void; @@ -424,6 +425,23 @@ export const useAppStore = create()( } }, + clearProjectHistory: () => { + const currentProject = get().currentProject; + if (currentProject) { + // Keep only the current project in history + set({ + projectHistory: [currentProject.id], + projectHistoryIndex: 0, + }); + } else { + // No current project, clear everything + set({ + projectHistory: [], + projectHistoryIndex: -1, + }); + } + }, + // View actions setCurrentView: (view) => set({ currentView: view }), toggleSidebar: () => set({ sidebarOpen: !get().sidebarOpen }),