From 9495b89dc62eb712b1479efcaa48713b833e7e35 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 19 Oct 2024 18:44:04 +0530 Subject: [PATCH] feat: open output data preview based on pairs in the current workflow --- .../molecules/InterpretationLog.tsx | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 9676c935..99fd65c3 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -19,6 +19,8 @@ import TableHead from '@mui/material/TableHead'; import TableRow from '@mui/material/TableRow'; import Paper from '@mui/material/Paper'; import StorageIcon from '@mui/icons-material/Storage'; +import { SidePanelHeader } from './SidePanelHeader'; +import { useGlobalInfoStore } from '../../context/globalInfo'; interface InterpretationLogProps { isOpen: boolean; @@ -34,6 +36,7 @@ export const InterpretationLog: React.FC = ({ isOpen, se const { width } = useBrowserDimensionsStore(); const { socket } = useSocketStore(); + const { currentWorkflowActionsState } = useGlobalInfoStore(); const toggleDrawer = (newOpen: boolean) => (event: React.KeyboardEvent | React.MouseEvent) => { if ( @@ -100,6 +103,14 @@ export const InterpretationLog: React.FC = ({ isOpen, se // Extract columns dynamically from the first item of tableData const columns = tableData.length > 0 ? Object.keys(tableData[0]) : []; + const { hasScrapeListAction, hasScreenshotAction, hasScrapeSchemaAction } = currentWorkflowActionsState + + useEffect(() => { + if (hasScrapeListAction || hasScrapeSchemaAction || hasScreenshotAction) { + setIsOpen(true); + } + }, [hasScrapeListAction, hasScrapeSchemaAction, hasScreenshotAction, setIsOpen]); + return ( @@ -173,11 +184,11 @@ export const InterpretationLog: React.FC = ({ isOpen, se )) ) : ( - - - It looks like you have not selected anything for extraction yet. Once you do, the robot will show a preview of your selections here. - - + <> + + It looks like you have not selected anything for extraction yet. Once you do, the robot will show a preview of your selections here. + + )}