mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-02 20:43:36 +00:00
Merge branch 'main' into feat/extend-models-support
This commit is contained in:
@@ -176,6 +176,7 @@ export interface AppActions {
|
||||
addProject: (project: Project) => void;
|
||||
removeProject: (projectId: string) => void;
|
||||
setCurrentProject: (project: Project | null) => void;
|
||||
reorderProjects: (oldIndex: number, newIndex: number) => void;
|
||||
|
||||
// View actions
|
||||
setCurrentView: (view: ViewMode) => void;
|
||||
@@ -290,6 +291,13 @@ export const useAppStore = create<AppState & AppActions>()(
|
||||
set({ projects: get().projects.filter((p) => p.id !== projectId) });
|
||||
},
|
||||
|
||||
reorderProjects: (oldIndex, newIndex) => {
|
||||
const projects = [...get().projects];
|
||||
const [movedProject] = projects.splice(oldIndex, 1);
|
||||
projects.splice(newIndex, 0, movedProject);
|
||||
set({ projects });
|
||||
},
|
||||
|
||||
setCurrentProject: (project) => {
|
||||
set({ currentProject: project });
|
||||
if (project) {
|
||||
|
||||
Reference in New Issue
Block a user