diff --git a/app/src/components/layout/sidebar.tsx b/app/src/components/layout/sidebar.tsx index b6a797d1..d5a0d366 100644 --- a/app/src/components/layout/sidebar.tsx +++ b/app/src/components/layout/sidebar.tsx @@ -20,16 +20,18 @@ import { Check, BookOpen, GripVertical, - RotateCw, RotateCcw, Trash2, Undo2, UserCircle, + MoreVertical, } from "lucide-react"; import { DropdownMenu, DropdownMenuContent, DropdownMenuTrigger, + DropdownMenuItem, + DropdownMenuSeparator, } from "@/components/ui/dropdown-menu"; import { Dialog, @@ -177,6 +179,7 @@ export function Sidebar() { reorderProjects, cyclePrevProject, cycleNextProject, + clearProjectHistory, } = useAppStore(); // State for project picker dropdown @@ -777,32 +780,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 d6995d0c..c3d670da 100644 --- a/app/src/store/app-store.ts +++ b/app/src/store/app-store.ts @@ -236,6 +236,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; @@ -569,6 +570,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 }),