From 3b52cb695a3dc54c3425581030f2e140ea5998b4 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 19 Oct 2024 18:25:16 +0530 Subject: [PATCH] feat: global state to know about pairs in the current workflow --- src/context/globalInfo.tsx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/context/globalInfo.tsx b/src/context/globalInfo.tsx index 137ce14c..58589c3a 100644 --- a/src/context/globalInfo.tsx +++ b/src/context/globalInfo.tsx @@ -22,6 +22,16 @@ interface GlobalInfo { setRecordingName: (recordingName: string) => void; recordingUrl: string; setRecordingUrl: (recordingUrl: string) => void; + currentWorkflowActionsState: { + hasScrapeListAction: boolean; + hasScreenshotAction: boolean; + hasScrapeSchemaAction: boolean; + }; + setCurrentWorkflowActionsState: (actionsState: { + hasScrapeListAction: boolean; + hasScreenshotAction: boolean; + hasScrapeSchemaAction: boolean; + }) => void; }; class GlobalInfoStore implements Partial { @@ -38,6 +48,11 @@ class GlobalInfoStore implements Partial { rerenderRuns = false; recordingName = ''; recordingUrl = 'https://'; + currentWorkflowActionsState = { + hasScrapeListAction: false, + hasScreenshotAction: false, + hasScrapeSchemaAction: false, + }; }; const globalInfoStore = new GlobalInfoStore(); @@ -55,6 +70,7 @@ export const GlobalInfoProvider = ({ children }: { children: JSX.Element }) => { const [recordingId, setRecordingId] = useState(globalInfoStore.recordingId); const [recordingName, setRecordingName] = useState(globalInfoStore.recordingName); const [recordingUrl, setRecordingUrl] = useState(globalInfoStore.recordingUrl); + const [currentWorkflowActionsState, setCurrentWorkflowActionsState] = useState(globalInfoStore.currentWorkflowActionsState); const notify = (severity: 'error' | 'warning' | 'info' | 'success', message: string) => { setNotification({ severity, message, isOpen: true }); @@ -93,6 +109,8 @@ export const GlobalInfoProvider = ({ children }: { children: JSX.Element }) => { setRecordingName, recordingUrl, setRecordingUrl, + currentWorkflowActionsState, + setCurrentWorkflowActionsState, }} > {children}