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.
This commit is contained in:
Cody Seibert
2025-12-10 08:56:22 -05:00
parent 72cc43d02f
commit 1766357335
2 changed files with 55 additions and 26 deletions

View File

@@ -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<AppState & AppActions>()(
}
},
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 }),