From 001286f5c66a5d479196efbf38e8313a58083824 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Tue, 3 Sep 2024 22:25:54 +0530 Subject: [PATCH] feat: -rm pagination selector selection --- src/components/organisms/RightSidePanel.tsx | 43 ++++----------------- 1 file changed, 8 insertions(+), 35 deletions(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 102cf3c0..ef720c50 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -24,9 +24,6 @@ export const RightSidePanel = () => { const [confirmedTextSteps, setConfirmedTextSteps] = useState<{ [id: number]: boolean }>({}); const [showPaginationOptions, setShowPaginationOptions] = useState(false); const [selectedPaginationSetting, setSelectedPaginationSetting] = useState(null); - const [paginationSelector, setPaginationSelector] = useState(null); - const [showPaginationSelector, setShowPaginationSelector] = useState(false); - const [isSelectingPagination, setIsSelectingPagination] = useState(false); const { lastAction, notify } = useGlobalInfoStore(); const { getText, startGetText, stopGetText, getScreenshot, startGetScreenshot, stopGetScreenshot, getList, startGetList, stopGetList } = useActionContext(); @@ -115,7 +112,6 @@ export const RightSidePanel = () => { fields: fields, pagination: { type: selectedPaginationSetting || '', - selector: paginationSelector || undefined } }; @@ -123,7 +119,7 @@ export const RightSidePanel = () => { }); return settings; - }, [browserSteps, selectedPaginationSetting, paginationSelector]); + }, [browserSteps, selectedPaginationSetting]); const stopCaptureAndEmitGetListSettings = useCallback(() => { @@ -141,31 +137,24 @@ export const RightSidePanel = () => { setShowPaginationOptions(true); return; } - if (['clickNext', 'clickLoadMore'].includes(selectedPaginationSetting) && !paginationSelector) { + if (['clickNext', 'clickLoadMore'].includes(selectedPaginationSetting)) { notify('error', 'Please select the pagination element first.'); return; } stopCaptureAndEmitGetListSettings(); setShowPaginationOptions(false); - setShowPaginationSelector(false); setSelectedPaginationSetting(null); - setPaginationSelector(null); - setIsSelectingPagination(false); - }, [selectedPaginationSetting, paginationSelector, stopCaptureAndEmitGetListSettings, notify]); + (null); + }, [selectedPaginationSetting, stopCaptureAndEmitGetListSettings, notify]); const handlePaginationSettingSelect = (option: string) => { setSelectedPaginationSetting(option); if (['clickNext', 'clickLoadMore'].includes(option)) { - setShowPaginationSelector(true); - } else { - setShowPaginationSelector(false); - setPaginationSelector(null); - } + } }; const handleStartPaginationSelection = () => { // Start the process of selecting the pagination element - setIsSelectingPagination(true); socket?.emit('action', { action: 'startPaginationSelection' }); }; @@ -185,11 +174,6 @@ export const RightSidePanel = () => { }; useEffect(() => { - const handlePaginationSelection = (data: { selector: string }) => { - setPaginationSelector(data.selector); - setIsSelectingPagination(false); - }; - socket?.on('paginationSelected', handlePaginationSelection); return () => { @@ -224,25 +208,14 @@ export const RightSidePanel = () => { )} - - {showPaginationSelector && ( - - Please select the pagination element on the page - - {paginationSelector && ( - Selected pagination element: {paginationSelector} - )} - - )} + {!getText && !getScreenshot && !getList && } {getText && <> - - + + }