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 }),