-
-
Notifications
You must be signed in to change notification settings - Fork 75
Expand file tree
/
Copy pathWorkspaceContext.ts
More file actions
53 lines (51 loc) · 1.78 KB
/
WorkspaceContext.ts
File metadata and controls
53 lines (51 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import { createContext } from "react";
import { Folder, Workflow, WorkflowVersion } from "./types/dbTypes";
import { WorkspaceRoute } from "./types/types";
export type JsonDiff = {
old: Object;
new: Object;
} | null;
export const WorkspaceContext = createContext<{
curFlowID: string | null;
onDuplicateWorkflow?: (flowID: string, newFlowName?: string) => void;
loadWorkflowID: (id: string | null, versionID?: string | null) => void;
setIsDirty: (dirty: boolean) => void;
saveCurWorkflow: (saveCurWorkflow?: string) => Promise<void>;
discardUnsavedChanges: () => Promise<void>;
isDirty: boolean;
loadNewWorkflow: (input?: { json: string; name?: string }) => void;
loadFilePath: (path: string, overwriteCurrent?: boolean) => void;
setRoute: (route: WorkspaceRoute) => void;
route: WorkspaceRoute;
curVersion: WorkflowVersion | null;
setCurVersion: (version: WorkflowVersion | null) => void;
setCurFlowIDAndName: (workflow: Workflow) => void;
}>({
curFlowID: null,
loadWorkflowID: () => {},
saveCurWorkflow: async () => {},
discardUnsavedChanges: async () => {},
isDirty: false,
loadNewWorkflow: () => {},
loadFilePath: () => {},
setRoute: () => {},
route: "root",
curVersion: null,
setIsDirty: () => {},
setCurVersion: () => {},
setCurFlowIDAndName: () => {},
});
export const RecentFilesContext = createContext<{
onRefreshFilesList?: () => void;
draggingFile?: Workflow | Folder;
setDraggingFile?: (file: Workflow | Folder) => void;
isMultiSelecting?: boolean;
multiSelectedFlowsID?: string[];
onMultiSelectFlow?: (flowId: string, selected: boolean) => void;
onDeleteFlow?: (flowId: string) => void;
refreshFolderStamp: number;
setRefreshFolderStamp: (stamp: number) => void;
}>({
refreshFolderStamp: 0,
setRefreshFolderStamp: () => {},
});