Skip to content

Commit

Permalink
Auto minimize the sidebar in workflow editor (#848)
Browse files Browse the repository at this point in the history
  • Loading branch information
ykeremy authored Sep 18, 2024
1 parent eadd05c commit 8f04efa
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,25 @@ import {
BitwardenSensitiveInformationParameter,
ContextParameter,
} from "../types/workflowTypes";
import { useSidebarStore } from "@/store/SidebarStore";
import { useMountEffect } from "@/hooks/useMountEffect";

function WorkflowEditor() {
const { workflowPermanentId } = useParams();
const credentialGetter = useCredentialGetter();
const queryClient = useQueryClient();
const setCollapsed = useSidebarStore((state) => {
return state.setCollapsed;
});

const { data: workflow, isLoading } = useWorkflowQuery({
workflowPermanentId,
});

useMountEffect(() => {
setCollapsed(true);
});

const saveWorkflowMutation = useMutation({
mutationFn: async (data: {
parameters: Array<ParameterYAML>;
Expand Down
15 changes: 15 additions & 0 deletions skyvern-frontend/src/store/SidebarStore.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { create } from "zustand";

type SidebarStore = {
collapsed: boolean;
setCollapsed: (collapsed: boolean) => void;
};

const useSidebarStore = create<SidebarStore>((set) => {
return {
collapsed: false,
setCollapsed: (collapsed: boolean) => set({ collapsed }),
};
});

export { useSidebarStore };

0 comments on commit 8f04efa

Please sign in to comment.