Editable workflows (#792)
Co-authored-by: Muhammed Salih Altun <muhammedsalihaltun@gmail.com>
This commit is contained in:
49
skyvern-frontend/src/store/WorkflowPanelStore.ts
Normal file
49
skyvern-frontend/src/store/WorkflowPanelStore.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
import { create } from "zustand";
|
||||
|
||||
type WorkflowPanelState = {
|
||||
active: boolean;
|
||||
content: "parameters" | "nodeLibrary";
|
||||
data?: {
|
||||
previous?: string | null;
|
||||
next?: string | null;
|
||||
parent?: string;
|
||||
connectingEdgeType?: string;
|
||||
};
|
||||
};
|
||||
|
||||
type WorkflowPanelStore = {
|
||||
workflowPanelState: WorkflowPanelState;
|
||||
closeWorkflowPanel: () => void;
|
||||
setWorkflowPanelState: (state: WorkflowPanelState) => void;
|
||||
toggleWorkflowPanel: () => void;
|
||||
};
|
||||
|
||||
const useWorkflowPanelStore = create<WorkflowPanelStore>((set, get) => {
|
||||
return {
|
||||
workflowPanelState: {
|
||||
active: false,
|
||||
content: "parameters",
|
||||
},
|
||||
setWorkflowPanelState: (workflowPanelState: WorkflowPanelState) => {
|
||||
set({ workflowPanelState });
|
||||
},
|
||||
closeWorkflowPanel: () => {
|
||||
set({
|
||||
workflowPanelState: {
|
||||
...get().workflowPanelState,
|
||||
active: false,
|
||||
},
|
||||
});
|
||||
},
|
||||
toggleWorkflowPanel: () => {
|
||||
set({
|
||||
workflowPanelState: {
|
||||
...get().workflowPanelState,
|
||||
active: !get().workflowPanelState.active,
|
||||
},
|
||||
});
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
export { useWorkflowPanelStore };
|
||||
Reference in New Issue
Block a user