mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-02 20:43:36 +00:00
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:
@@ -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 }),
|
||||
|
||||
Reference in New Issue
Block a user