feat: use actionsState from global context + !render SidePanelHeader
This commit is contained in:
@@ -55,14 +55,8 @@ export const RightSidePanel: React.FC<RightSidePanelProps> = ({ onFinishCapture,
|
|||||||
const [showCaptureScreenshot, setShowCaptureScreenshot] = useState(true);
|
const [showCaptureScreenshot, setShowCaptureScreenshot] = useState(true);
|
||||||
const [showCaptureText, setShowCaptureText] = useState(true);
|
const [showCaptureText, setShowCaptureText] = useState(true);
|
||||||
const [hoverStates, setHoverStates] = useState<{ [id: string]: boolean }>({});
|
const [hoverStates, setHoverStates] = useState<{ [id: string]: boolean }>({});
|
||||||
const [actionsState, setActionsState] = useState({
|
|
||||||
hasScrapeListAction: false,
|
|
||||||
hasScreenshotAction: false,
|
|
||||||
hasScrapeSchemaAction: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
|
const { lastAction, notify, currentWorkflowActionsState, setCurrentWorkflowActionsState } = useGlobalInfoStore();
|
||||||
const { lastAction, notify } = useGlobalInfoStore();
|
|
||||||
const { getText, startGetText, stopGetText, getScreenshot, startGetScreenshot, stopGetScreenshot, getList, startGetList, stopGetList, startPaginationMode, stopPaginationMode, paginationType, updatePaginationType, limitType, customLimit, updateLimitType, updateCustomLimit, stopLimitMode, startLimitMode, captureStage, setCaptureStage } = useActionContext();
|
const { getText, startGetText, stopGetText, getScreenshot, startGetScreenshot, stopGetScreenshot, getList, startGetList, stopGetList, startPaginationMode, stopPaginationMode, paginationType, updatePaginationType, limitType, customLimit, updateLimitType, updateCustomLimit, stopLimitMode, startLimitMode, captureStage, setCaptureStage } = useActionContext();
|
||||||
const { browserSteps, updateBrowserTextStepLabel, deleteBrowserStep, addScreenshotStep, updateListTextFieldLabel, removeListTextField } = useBrowserSteps();
|
const { browserSteps, updateBrowserTextStepLabel, deleteBrowserStep, addScreenshotStep, updateListTextFieldLabel, removeListTextField } = useBrowserSteps();
|
||||||
const { id, socket } = useSocketStore();
|
const { id, socket } = useSocketStore();
|
||||||
@@ -111,7 +105,7 @@ export const RightSidePanel: React.FC<RightSidePanelProps> = ({ onFinishCapture,
|
|||||||
pair.what.some(action => action.action === 'scrapeSchema')
|
pair.what.some(action => action.action === 'scrapeSchema')
|
||||||
);
|
);
|
||||||
|
|
||||||
setActionsState({
|
setCurrentWorkflowActionsState({
|
||||||
hasScrapeListAction,
|
hasScrapeListAction,
|
||||||
hasScreenshotAction,
|
hasScreenshotAction,
|
||||||
hasScrapeSchemaAction,
|
hasScrapeSchemaAction,
|
||||||
@@ -380,18 +374,11 @@ export const RightSidePanel: React.FC<RightSidePanelProps> = ({ onFinishCapture,
|
|||||||
stopGetScreenshot();
|
stopGetScreenshot();
|
||||||
};
|
};
|
||||||
|
|
||||||
const { hasScrapeListAction, hasScreenshotAction, hasScrapeSchemaAction } = actionsState;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Paper variant="outlined" sx={{ height: '100%', width: '100%', alignItems: "center" }} id="browser-actions">
|
<Paper variant="outlined" sx={{ height: '100%', width: '100%', alignItems: "center" }} id="browser-actions">
|
||||||
<SimpleBox height={60} width='100%' background='lightGray' radius='0%'>
|
<SimpleBox height={60} width='100%' background='lightGray' radius='0%'>
|
||||||
<Typography sx={{ padding: '10px' }}>Last action: {` ${lastAction}`}</Typography>
|
<Typography sx={{ padding: '10px' }}>Last action: {` ${lastAction}`}</Typography>
|
||||||
</SimpleBox>
|
</SimpleBox>
|
||||||
{
|
|
||||||
hasScrapeListAction || hasScrapeSchemaAction || hasScreenshotAction ? (
|
|
||||||
<SidePanelHeader setShowOutputData={setShowOutputData} />
|
|
||||||
) : ""
|
|
||||||
}
|
|
||||||
<ActionDescriptionBox />
|
<ActionDescriptionBox />
|
||||||
<Box display="flex" flexDirection="column" gap={2} style={{ margin: '15px' }}>
|
<Box display="flex" flexDirection="column" gap={2} style={{ margin: '15px' }}>
|
||||||
{!getText && !getScreenshot && !getList && showCaptureList && <Button variant="contained" onClick={startGetList}>Capture List</Button>}
|
{!getText && !getScreenshot && !getList && showCaptureList && <Button variant="contained" onClick={startGetList}>Capture List</Button>}
|
||||||
|
|||||||
Reference in New Issue
Block a user