feat: check confirm list capture and render delete button
This commit is contained in:
@@ -57,6 +57,7 @@ export const RightSidePanel: React.FC<RightSidePanelProps> = ({ onFinishCapture
|
|||||||
const [hoverStates, setHoverStates] = useState<{ [id: string]: boolean }>({});
|
const [hoverStates, setHoverStates] = useState<{ [id: string]: boolean }>({});
|
||||||
const [browserStepIdList, setBrowserStepIdList] = useState<number[]>([]);
|
const [browserStepIdList, setBrowserStepIdList] = useState<number[]>([]);
|
||||||
const [isCaptureTextConfirmed, setIsCaptureTextConfirmed] = useState(false);
|
const [isCaptureTextConfirmed, setIsCaptureTextConfirmed] = useState(false);
|
||||||
|
const [isCaptureListConfirmed, setIsCaptureListConfirmed] = useState(false);
|
||||||
|
|
||||||
const { lastAction, notify, currentWorkflowActionsState, setCurrentWorkflowActionsState, resetInterpretationLog } = useGlobalInfoStore();
|
const { lastAction, notify, currentWorkflowActionsState, setCurrentWorkflowActionsState, resetInterpretationLog } = 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();
|
||||||
@@ -136,6 +137,11 @@ export const RightSidePanel: React.FC<RightSidePanelProps> = ({ onFinishCapture
|
|||||||
startGetText();
|
startGetText();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleStartGetList = () => {
|
||||||
|
setIsCaptureListConfirmed(false);
|
||||||
|
startGetList();
|
||||||
|
}
|
||||||
|
|
||||||
const handleTextLabelChange = (id: number, label: string, listId?: number, fieldKey?: string) => {
|
const handleTextLabelChange = (id: number, label: string, listId?: number, fieldKey?: string) => {
|
||||||
if (listId !== undefined && fieldKey !== undefined) {
|
if (listId !== undefined && fieldKey !== undefined) {
|
||||||
// Prevent editing if the field is confirmed
|
// Prevent editing if the field is confirmed
|
||||||
@@ -365,6 +371,7 @@ export const RightSidePanel: React.FC<RightSidePanelProps> = ({ onFinishCapture
|
|||||||
}
|
}
|
||||||
stopLimitMode();
|
stopLimitMode();
|
||||||
setShowLimitOptions(false);
|
setShowLimitOptions(false);
|
||||||
|
setIsCaptureListConfirmed(true);
|
||||||
stopCaptureAndEmitGetListSettings();
|
stopCaptureAndEmitGetListSettings();
|
||||||
setCaptureStage('complete');
|
setCaptureStage('complete');
|
||||||
break;
|
break;
|
||||||
@@ -389,6 +396,7 @@ export const RightSidePanel: React.FC<RightSidePanelProps> = ({ onFinishCapture
|
|||||||
setTextLabels({});
|
setTextLabels({});
|
||||||
setErrors({});
|
setErrors({});
|
||||||
setConfirmedTextSteps({});
|
setConfirmedTextSteps({});
|
||||||
|
setIsCaptureTextConfirmed(false);
|
||||||
notify('error', t('right_panel.errors.capture_text_discarded'));
|
notify('error', t('right_panel.errors.capture_text_discarded'));
|
||||||
}, [browserSteps, stopGetText, deleteBrowserStep]);
|
}, [browserSteps, stopGetText, deleteBrowserStep]);
|
||||||
|
|
||||||
@@ -404,6 +412,7 @@ export const RightSidePanel: React.FC<RightSidePanelProps> = ({ onFinishCapture
|
|||||||
setShowLimitOptions(false);
|
setShowLimitOptions(false);
|
||||||
setCaptureStage('initial');
|
setCaptureStage('initial');
|
||||||
setConfirmedListTextFields({});
|
setConfirmedListTextFields({});
|
||||||
|
setIsCaptureListConfirmed(false);
|
||||||
notify('error', t('right_panel.errors.capture_list_discarded'));
|
notify('error', t('right_panel.errors.capture_list_discarded'));
|
||||||
}, [browserSteps, stopGetList, deleteBrowserStep, resetListState]);
|
}, [browserSteps, stopGetList, deleteBrowserStep, resetListState]);
|
||||||
|
|
||||||
@@ -644,7 +653,7 @@ export const RightSidePanel: React.FC<RightSidePanelProps> = ({ onFinishCapture
|
|||||||
{t('right_panel.buttons.discard')}
|
{t('right_panel.buttons.discard')}
|
||||||
</Button>
|
</Button>
|
||||||
</Box>
|
</Box>
|
||||||
) : (
|
) : !isCaptureListConfirmed && (
|
||||||
<Box display="flex" justifyContent="flex-end" gap={2}>
|
<Box display="flex" justifyContent="flex-end" gap={2}>
|
||||||
<Button
|
<Button
|
||||||
variant="contained"
|
variant="contained"
|
||||||
|
|||||||
Reference in New Issue
Block a user