From c656b5782a61571066947a82ec763a8836aea974 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 22 Aug 2024 05:37:25 +0530 Subject: [PATCH 001/328] feat: use Swipeable Drawer instead of Accordian --- .../molecules/InterpretationLog.tsx | 86 ++++++++++--------- 1 file changed, 44 insertions(+), 42 deletions(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 02592511..296acc97 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -1,30 +1,34 @@ import * as React from 'react'; -import Accordion from '@mui/material/Accordion'; -import AccordionDetails from '@mui/material/AccordionDetails'; -import AccordionSummary from '@mui/material/AccordionSummary'; +import SwipeableDrawer from '@mui/material/SwipeableDrawer'; import Typography from '@mui/material/Typography'; -import ExpandMoreIcon from '@mui/icons-material/ExpandMore'; -import Highlight from 'react-highlight' +import Highlight from 'react-highlight'; import { useCallback, useEffect, useRef, useState } from "react"; import { useSocketStore } from "../../context/socket"; export const InterpretationLog = () => { - const [expanded, setExpanded] = useState(false); + const [open, setOpen] = useState(false); const [log, setLog] = useState(''); const logEndRef = useRef(null); - const handleChange = (isExpanded: boolean) => (event: React.SyntheticEvent) => { - setExpanded(isExpanded); + const toggleDrawer = (newOpen: boolean) => (event: React.KeyboardEvent | React.MouseEvent) => { + if ( + event.type === 'keydown' && + ((event as React.KeyboardEvent).key === 'Tab' || + (event as React.KeyboardEvent).key === 'Shift') + ) { + return; + } + setOpen(newOpen); }; const { socket } = useSocketStore(); const scrollLogToBottom = () => { if (logEndRef.current) { - logEndRef.current.scrollIntoView({ behavior: "smooth" }) + logEndRef.current.scrollIntoView({ behavior: "smooth" }); } - } + }; const handleLog = useCallback((msg: string, date: boolean = true) => { if (!date) { @@ -33,14 +37,14 @@ export const InterpretationLog = () => { setLog((prevState) => prevState + '\n' + `[${new Date().toLocaleString()}] ` + msg); } scrollLogToBottom(); - }, [log, scrollLogToBottom]) + }, [scrollLogToBottom]); const handleSerializableCallback = useCallback((data: string) => { setLog((prevState) => prevState + '\n' + '---------- Serializable output data received ----------' + '\n' + JSON.stringify(data, null, 2) + '\n' + '--------------------------------------------------'); scrollLogToBottom(); - }, [log, scrollLogToBottom]) + }, [scrollLogToBottom]); const handleBinaryCallback = useCallback(({ data, mimetype }: any) => { setLog((prevState) => @@ -48,7 +52,7 @@ export const InterpretationLog = () => { + `mimetype: ${mimetype}` + '\n' + `data: ${JSON.stringify(data)}` + '\n' + '------------------------------------------------'); scrollLogToBottom(); - }, [log, scrollLogToBottom]) + }, [scrollLogToBottom]); useEffect(() => { socket?.on('log', handleLog); @@ -58,41 +62,39 @@ export const InterpretationLog = () => { socket?.off('log', handleLog); socket?.off('serializableCallback', handleSerializableCallback); socket?.off('binaryCallback', handleBinaryCallback); - } - }, [socket, handleLog]) + }; + }, [socket, handleLog]); return (
- + Interpretation Log + + - } - aria-controls="panel1bh-content" - id="panel1bh-header" - > - - Interpretation Log - - - + Interpretation Log + +
-
- - {log} - -
-
- - + + {log} + +
+
+
); } From f7b524060acddd5fea0e8c38c28e5b11470432d0 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 22 Aug 2024 05:42:42 +0530 Subject: [PATCH 002/328] feat: pass log in dependency array --- src/components/molecules/InterpretationLog.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 296acc97..43a6646c 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -37,14 +37,14 @@ export const InterpretationLog = () => { setLog((prevState) => prevState + '\n' + `[${new Date().toLocaleString()}] ` + msg); } scrollLogToBottom(); - }, [scrollLogToBottom]); + }, [log, scrollLogToBottom]); const handleSerializableCallback = useCallback((data: string) => { setLog((prevState) => prevState + '\n' + '---------- Serializable output data received ----------' + '\n' + JSON.stringify(data, null, 2) + '\n' + '--------------------------------------------------'); scrollLogToBottom(); - }, [scrollLogToBottom]); + }, [log, scrollLogToBottom]); const handleBinaryCallback = useCallback(({ data, mimetype }: any) => { setLog((prevState) => @@ -52,7 +52,7 @@ export const InterpretationLog = () => { + `mimetype: ${mimetype}` + '\n' + `data: ${JSON.stringify(data)}` + '\n' + '------------------------------------------------'); scrollLogToBottom(); - }, [scrollLogToBottom]); + }, [log, scrollLogToBottom]); useEffect(() => { socket?.on('log', handleLog); From 2140aa786aa305177d1f4b81948b7d876e197176 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 22 Aug 2024 05:44:58 +0530 Subject: [PATCH 003/328] feat: remove InterpretationLog rendering --- src/pages/PageWrappper.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/PageWrappper.tsx b/src/pages/PageWrappper.tsx index 686d4cd4..a3a296d1 100644 --- a/src/pages/PageWrappper.tsx +++ b/src/pages/PageWrappper.tsx @@ -54,7 +54,6 @@ export const PageWrapper = () => { - ) From 9298ceb392c3c63a69c3445a93cdedd01e3acddc Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 22 Aug 2024 05:45:13 +0530 Subject: [PATCH 004/328] chore: remove unused import --- src/pages/PageWrappper.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/pages/PageWrappper.tsx b/src/pages/PageWrappper.tsx index a3a296d1..41360800 100644 --- a/src/pages/PageWrappper.tsx +++ b/src/pages/PageWrappper.tsx @@ -7,8 +7,6 @@ import { MainPage } from "./MainPage"; import { useGlobalInfoStore } from "../context/globalInfo"; import { getActiveBrowserId } from "../api/recording"; import { AlertSnackbar } from "../components/atoms/AlertSnackbar"; -import { InterpretationLog } from "../components/molecules/InterpretationLog"; - export const PageWrapper = () => { From 01c04ed74b0beccc2259896be4e2240d220574db Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 22 Aug 2024 05:45:30 +0530 Subject: [PATCH 005/328] chore: lint --- src/pages/PageWrappper.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/PageWrappper.tsx b/src/pages/PageWrappper.tsx index 41360800..2cbf3102 100644 --- a/src/pages/PageWrappper.tsx +++ b/src/pages/PageWrappper.tsx @@ -9,7 +9,6 @@ import { getActiveBrowserId } from "../api/recording"; import { AlertSnackbar } from "../components/atoms/AlertSnackbar"; export const PageWrapper = () => { - const [recordingName, setRecordingName] = useState(''); const [open, setOpen] = useState(false); From ee940de7abcc5550f0a660c82b7529652323025d Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 22 Aug 2024 05:49:30 +0530 Subject: [PATCH 006/328] feat: set width to 100% --- src/components/molecules/InterpretationLog.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 43a6646c..6cbba539 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -67,7 +67,7 @@ export const InterpretationLog = () => { return (
- Date: Thu, 22 Aug 2024 05:56:30 +0530 Subject: [PATCH 007/328] feat: align text to left --- src/components/molecules/InterpretationLog.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 6cbba539..f8a05e60 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -67,7 +67,7 @@ export const InterpretationLog = () => { return (
- Date: Thu, 22 Aug 2024 05:56:45 +0530 Subject: [PATCH 008/328] chore: lint --- src/components/molecules/InterpretationLog.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index f8a05e60..ea0492be 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -67,7 +67,7 @@ export const InterpretationLog = () => { return (
- Date: Thu, 22 Aug 2024 06:08:19 +0530 Subject: [PATCH 009/328] feat: set width & height --- src/components/molecules/InterpretationLog.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index ea0492be..f9286d3a 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -4,6 +4,7 @@ import Typography from '@mui/material/Typography'; import Highlight from 'react-highlight'; import { useCallback, useEffect, useRef, useState } from "react"; import { useSocketStore } from "../../context/socket"; +import { useBrowserDimensionsStore } from "../../context/browserDimensions"; export const InterpretationLog = () => { const [open, setOpen] = useState(false); @@ -11,6 +12,8 @@ export const InterpretationLog = () => { const logEndRef = useRef(null); + const { width } = useBrowserDimensionsStore(); + const toggleDrawer = (newOpen: boolean) => (event: React.KeyboardEvent | React.MouseEvent) => { if ( event.type === 'keydown' && @@ -76,7 +79,7 @@ export const InterpretationLog = () => { onClose={toggleDrawer(false)} onOpen={toggleDrawer(true)} PaperProps={{ - sx: { background: '#19171c', color: 'white', padding: '10px' } + sx: { background: '#19171c', color: 'white', padding: '10px', height: 720, width: width - 10 } }} > From 70781e6c506996e7e62ed14c3ab7e54163cb2beb Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 22 Aug 2024 07:37:03 +0530 Subject: [PATCH 010/328] fix(temporary): proper width for browser --- src/components/organisms/BrowserContent.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/organisms/BrowserContent.tsx b/src/components/organisms/BrowserContent.tsx index 3b489968..21c337f5 100644 --- a/src/components/organisms/BrowserContent.tsx +++ b/src/components/organisms/BrowserContent.tsx @@ -123,7 +123,8 @@ export const BrowserContent = () => { tabIndex={tabIndex} /> From 839a7427578ac8dc8a8fa1138cf4119c1f63a28d Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 22 Aug 2024 07:37:32 +0530 Subject: [PATCH 011/328] feat: set width as per browser window --- src/components/molecules/InterpretationLog.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index f9286d3a..6ffcca0c 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -70,7 +70,7 @@ export const InterpretationLog = () => { return (
- { onClose={toggleDrawer(false)} onOpen={toggleDrawer(true)} PaperProps={{ - sx: { background: '#19171c', color: 'white', padding: '10px', height: 720, width: width - 10 } + sx: { background: '#19171c', color: 'white', padding: '10px', height: 720, width: width - 10, display: 'flex' } }} > From 8779b2d693ccaff8c260d7c2b1ad25687fae4817 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 22 Aug 2024 07:38:15 +0530 Subject: [PATCH 012/328] chore: lint --- src/components/molecules/InterpretationLog.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 6ffcca0c..1fc1acd8 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -70,7 +70,16 @@ export const InterpretationLog = () => { return (
- Date: Thu, 22 Aug 2024 23:58:08 +0530 Subject: [PATCH 013/328] chore: remove comment --- src/components/molecules/BrowserNavBar.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/molecules/BrowserNavBar.tsx b/src/components/molecules/BrowserNavBar.tsx index e57e7c21..91980cf3 100644 --- a/src/components/molecules/BrowserNavBar.tsx +++ b/src/components/molecules/BrowserNavBar.tsx @@ -30,7 +30,6 @@ const BrowserNavBar: FC = ({ handleUrlChanged, }) => { - // context: const { socket } = useSocketStore(); const [currentUrl, setCurrentUrl] = useState('https://'); From 5a23e3c1b243ba8365d0c2603964d82e2574d8c2 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 22 Aug 2024 23:58:21 +0530 Subject: [PATCH 014/328] fix: format --- src/components/molecules/BrowserNavBar.tsx | 102 ++++++++++----------- 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/src/components/molecules/BrowserNavBar.tsx b/src/components/molecules/BrowserNavBar.tsx index 91980cf3..b35e4d7f 100644 --- a/src/components/molecules/BrowserNavBar.tsx +++ b/src/components/molecules/BrowserNavBar.tsx @@ -1,5 +1,5 @@ import type { - FC, + FC, } from 'react'; import styled from 'styled-components'; @@ -8,9 +8,9 @@ import ArrowBackIcon from '@mui/icons-material/ArrowBack'; import ArrowForwardIcon from '@mui/icons-material/ArrowForward'; import { NavBarButton } from '../atoms/buttons/buttons'; -import { UrlForm } from './UrlForm'; +import { UrlForm } from './UrlForm'; import { useCallback, useEffect, useState } from "react"; -import {useSocketStore} from "../../context/socket"; +import { useSocketStore } from "../../context/socket"; import { getCurrentUrl } from "../../api/recording"; const StyledNavBar = styled.div<{ browserWidth: number }>` @@ -21,8 +21,8 @@ const StyledNavBar = styled.div<{ browserWidth: number }>` `; interface NavBarProps { - browserWidth: number; - handleUrlChanged: (url: string) => void; + browserWidth: number; + handleUrlChanged: (url: string) => void; }; const BrowserNavBar: FC = ({ @@ -34,11 +34,11 @@ const BrowserNavBar: FC = ({ const [currentUrl, setCurrentUrl] = useState('https://'); - const handleRefresh = useCallback(() : void => { + const handleRefresh = useCallback((): void => { socket?.emit('input:refresh'); }, [socket]); - const handleGoTo = useCallback((address: string) : void => { + const handleGoTo = useCallback((address: string): void => { socket?.emit('input:url', address); }, [socket]); @@ -69,54 +69,54 @@ const BrowserNavBar: FC = ({ } }, [socket, handleCurrentUrlChange]) - const addAddress = (address: string) => { - if (socket) { - handleUrlChanged(address); - handleGoTo(address); - } - }; + const addAddress = (address: string) => { + if (socket) { + handleUrlChanged(address); + handleGoTo(address); + } + }; - return ( - - { - socket?.emit('input:back'); - }} - disabled={false} - > - - + return ( + + { + socket?.emit('input:back'); + }} + disabled={false} + > + + - { - socket?.emit('input:forward'); - }} - disabled={false} - > - - + { + socket?.emit('input:forward'); + }} + disabled={false} + > + + - { - if (socket) { - handleRefresh() - } - }} - disabled={false} - > - - + { + if (socket) { + handleRefresh() + } + }} + disabled={false} + > + + - - - ); + + + ); } export default BrowserNavBar; From 28d8d60123713e0cb195043351b97ec748a02b09 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 23 Aug 2024 19:26:37 +0530 Subject: [PATCH 015/328] feat: use getList from action context --- src/components/molecules/InterpretationLog.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 1fc1acd8..de0c371a 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -5,6 +5,7 @@ import Highlight from 'react-highlight'; import { useCallback, useEffect, useRef, useState } from "react"; import { useSocketStore } from "../../context/socket"; import { useBrowserDimensionsStore } from "../../context/browserDimensions"; +import { useActionContext } from '../../context/browserActions'; export const InterpretationLog = () => { const [open, setOpen] = useState(false); @@ -13,6 +14,7 @@ export const InterpretationLog = () => { const logEndRef = useRef(null); const { width } = useBrowserDimensionsStore(); + const { getList } = useActionContext(); const toggleDrawer = (newOpen: boolean) => (event: React.KeyboardEvent | React.MouseEvent) => { if ( From 4ad70590d4d0c771dfab36327ec8e9ff609de474 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 23 Aug 2024 19:35:22 +0530 Subject: [PATCH 016/328] feat: check if getList true for row data collection --- src/components/molecules/InterpretationLog.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index de0c371a..355c9855 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -105,6 +105,11 @@ export const InterpretationLog = () => { {log} + { + getList ? ( +

How many rows of data do you want?

+ ) : null + }
From 062b491afbc9d0ebc3db3282669316d7a4c6acae Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 24 Aug 2024 02:28:22 +0530 Subject: [PATCH 017/328] feat: ask user for amount of data row collection --- src/components/molecules/InterpretationLog.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 355c9855..e76caa7a 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -107,7 +107,7 @@ export const InterpretationLog = () => { { getList ? ( -

How many rows of data do you want?

+

What is the maximum number of rows you want to extract?

) : null }
Date: Sat, 24 Aug 2024 09:57:47 +0530 Subject: [PATCH 018/328] feat: import form & radio group --- src/components/molecules/InterpretationLog.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index e76caa7a..a1ea2582 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -1,6 +1,11 @@ import * as React from 'react'; import SwipeableDrawer from '@mui/material/SwipeableDrawer'; import Typography from '@mui/material/Typography'; +import Radio from '@mui/material/Radio'; +import RadioGroup from '@mui/material/RadioGroup'; +import FormControlLabel from '@mui/material/FormControlLabel'; +import FormControl from '@mui/material/FormControl'; +import FormLabel from '@mui/material/FormLabel'; import Highlight from 'react-highlight'; import { useCallback, useEffect, useRef, useState } from "react"; import { useSocketStore } from "../../context/socket"; From 91f5fa83b4af45c5190ecb84ffb7cdadb06e192d Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 24 Aug 2024 09:58:45 +0530 Subject: [PATCH 019/328] feat: create form with radio for user input --- .../molecules/InterpretationLog.tsx | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index a1ea2582..2733a40d 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -112,7 +112,27 @@ export const InterpretationLog = () => { { getList ? ( + <>

What is the maximum number of rows you want to extract?

+ + Gender + + } label="Female" /> + } label="Male" /> + } label="Other" /> + } + label="other" + /> + + + ) : null }
Date: Sat, 24 Aug 2024 09:59:19 +0530 Subject: [PATCH 020/328] chore: lint --- .../molecules/InterpretationLog.tsx | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 2733a40d..1b326d21 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -113,26 +113,26 @@ export const InterpretationLog = () => { { getList ? ( <> -

What is the maximum number of rows you want to extract?

- - Gender - - } label="Female" /> - } label="Male" /> - } label="Other" /> - } - label="other" - /> - - - +

What is the maximum number of rows you want to extract?

+ + Gender + + } label="Female" /> + } label="Male" /> + } label="Other" /> + } + label="other" + /> + + + ) : null }
Date: Sat, 24 Aug 2024 09:59:54 +0530 Subject: [PATCH 021/328] fix: remove FormLabel id --- src/components/molecules/InterpretationLog.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 1b326d21..22b2098d 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -115,7 +115,7 @@ export const InterpretationLog = () => { <>

What is the maximum number of rows you want to extract?

- Gender + Gender Date: Sat, 24 Aug 2024 10:00:19 +0530 Subject: [PATCH 022/328] feat: set FormLabe; --- src/components/molecules/InterpretationLog.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 22b2098d..3f2fe9f8 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -115,7 +115,7 @@ export const InterpretationLog = () => { <>

What is the maximum number of rows you want to extract?

- Gender + What is the maximum number of rows you want to extract? Date: Sat, 24 Aug 2024 10:00:53 +0530 Subject: [PATCH 023/328] feat: remove aria-label & name from RadioGroup --- src/components/molecules/InterpretationLog.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 3f2fe9f8..4552f9f6 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -118,8 +118,6 @@ export const InterpretationLog = () => { What is the maximum number of rows you want to extract? } label="Female" /> } label="Male" /> From e8deec04fed76cb1744534948fe46cd64c4595eb Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 24 Aug 2024 10:01:51 +0530 Subject: [PATCH 024/328] feat: label & value for Radios --- src/components/molecules/InterpretationLog.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 4552f9f6..f54981ba 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -119,9 +119,9 @@ export const InterpretationLog = () => { - } label="Female" /> - } label="Male" /> - } label="Other" /> + } label="10" /> + } label="100" /> + } label="Custom" /> Date: Sat, 24 Aug 2024 10:02:15 +0530 Subject: [PATCH 025/328] fix: remove disabled form control label --- src/components/molecules/InterpretationLog.tsx | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index f54981ba..09b3565a 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -122,12 +122,6 @@ export const InterpretationLog = () => { } label="10" /> } label="100" /> } label="Custom" /> - } - label="other" - /> From d6609676551f85f088da4d95b9eb46c6a91bdbcd Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 24 Aug 2024 10:02:42 +0530 Subject: [PATCH 026/328] fix: format --- src/components/molecules/InterpretationLog.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 09b3565a..ac761eb3 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -116,9 +116,7 @@ export const InterpretationLog = () => {

What is the maximum number of rows you want to extract?

What is the maximum number of rows you want to extract? - + } label="10" /> } label="100" /> } label="Custom" /> From 27acb56691169a380d252b818b3cd40ef8d4cbb3 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 24 Aug 2024 10:04:20 +0530 Subject: [PATCH 027/328] feat: -rm

tag for user input question --- src/components/molecules/InterpretationLog.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index ac761eb3..540c6ddf 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -113,7 +113,6 @@ export const InterpretationLog = () => { { getList ? ( <> -

What is the maximum number of rows you want to extract?

What is the maximum number of rows you want to extract? From de86c4c46a7ffac50dbab044b26b7bf1e203ea27 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 24 Aug 2024 10:05:06 +0530 Subject: [PATCH 028/328] feat: set overflowY to none --- src/components/molecules/InterpretationLog.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 540c6ddf..948d746f 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -103,7 +103,7 @@ export const InterpretationLog = () => {
From 48a9422d15bc0e0d154ca8a636bd94bd638520d5 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 24 Aug 2024 10:05:25 +0530 Subject: [PATCH 029/328] fix: set overflow to none --- src/components/molecules/InterpretationLog.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 948d746f..d6a7c2b7 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -103,7 +103,7 @@ export const InterpretationLog = () => {
From cac076be8b3a751feabdb94df4d9f7979323f9b0 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sun, 25 Aug 2024 22:46:52 +0530 Subject: [PATCH 030/328] feat: use table component --- src/components/molecules/InterpretationLog.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index d6a7c2b7..73a366be 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -11,6 +11,12 @@ import { useCallback, useEffect, useRef, useState } from "react"; import { useSocketStore } from "../../context/socket"; import { useBrowserDimensionsStore } from "../../context/browserDimensions"; import { useActionContext } from '../../context/browserActions'; +import Table from '@mui/material/Table'; +import TableBody from '@mui/material/TableBody'; +import TableCell from '@mui/material/TableCell'; +import TableContainer from '@mui/material/TableContainer'; +import TableHead from '@mui/material/TableHead'; +import TableRow from '@mui/material/TableRow'; export const InterpretationLog = () => { const [open, setOpen] = useState(false); From f753e7ce159e292ecd36df1e0c32442845288b8a Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sun, 25 Aug 2024 22:47:30 +0530 Subject: [PATCH 031/328] feat(temp): sample data --- src/components/molecules/InterpretationLog.tsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 73a366be..738a67fb 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -18,6 +18,18 @@ import TableContainer from '@mui/material/TableContainer'; import TableHead from '@mui/material/TableHead'; import TableRow from '@mui/material/TableRow'; + +function createData( + name: string, + calories: number, + fat: number, + carbs: number, + protein: number, +) { + return { name, calories, fat, carbs, protein }; +} + + export const InterpretationLog = () => { const [open, setOpen] = useState(false); const [log, setLog] = useState(''); From 6404aded98e761180877b00b6c830bc3fb1e0ad0 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sun, 25 Aug 2024 22:47:47 +0530 Subject: [PATCH 032/328] feat(temp): sample data --- src/components/molecules/InterpretationLog.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 738a67fb..8a9ee362 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -29,6 +29,14 @@ function createData( return { name, calories, fat, carbs, protein }; } +const rows = [ + createData('Frozen yoghurt', 159, 6.0, 24, 4.0), + createData('Ice cream sandwich', 237, 9.0, 37, 4.3), + createData('Eclair', 262, 16.0, 24, 6.0), + createData('Cupcake', 305, 3.7, 67, 4.3), + createData('Gingerbread', 356, 16.0, 49, 3.9), +]; + export const InterpretationLog = () => { const [open, setOpen] = useState(false); From 0133a3ef9c621099952261a86dc709a8580d875b Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sun, 25 Aug 2024 22:48:36 +0530 Subject: [PATCH 033/328] feat(temp): sample table --- .../molecules/InterpretationLog.tsx | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 8a9ee362..16e2fc3f 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -147,6 +147,36 @@ export const InterpretationLog = () => { } label="Custom" /> + + + + + + Dessert (100g serving) + Calories + Fat (g) + Carbs (g) + Protein (g) + + + + {rows.map((row) => ( + + + {row.name} + + {row.calories} + {row.fat} + {row.carbs} + {row.protein} + + ))} + +
+
) : null } From a8f9358247428a8fb623e8a9a41a5e30ae862552 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sun, 25 Aug 2024 22:49:07 +0530 Subject: [PATCH 034/328] feat(temp): use paper --- src/components/molecules/InterpretationLog.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 16e2fc3f..f7f98d9e 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -17,6 +17,8 @@ import TableCell from '@mui/material/TableCell'; import TableContainer from '@mui/material/TableContainer'; import TableHead from '@mui/material/TableHead'; import TableRow from '@mui/material/TableRow'; +import Paper from '@mui/material/Paper'; + function createData( From c9aced0180053d70d7576114cdd8a2a166027420 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sun, 25 Aug 2024 23:46:07 +0530 Subject: [PATCH 035/328] fix: format --- .../molecules/InterpretationLog.tsx | 56 +++++++++---------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index f7f98d9e..83486b65 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -151,34 +151,34 @@ export const InterpretationLog = () => { - - - - Dessert (100g serving) - Calories - Fat (g) - Carbs (g) - Protein (g) - - - - {rows.map((row) => ( - - - {row.name} - - {row.calories} - {row.fat} - {row.carbs} - {row.protein} - - ))} - -
-
+ + + + Dessert (100g serving) + Calories + Fat (g) + Carbs (g) + Protein (g) + + + + {rows.map((row) => ( + + + {row.name} + + {row.calories} + {row.fat} + {row.carbs} + {row.protein} + + ))} + +
+ ) : null } From 29419971f23b4a7238c312e93d2f5314d30a902b Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sun, 25 Aug 2024 23:46:24 +0530 Subject: [PATCH 036/328] chore: remove whitespace --- src/components/molecules/InterpretationLog.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 83486b65..22822307 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -19,8 +19,6 @@ import TableHead from '@mui/material/TableHead'; import TableRow from '@mui/material/TableRow'; import Paper from '@mui/material/Paper'; - - function createData( name: string, calories: number, From a67c98e35eca321e8aad4c0e0482fa50df731e09 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sun, 25 Aug 2024 23:49:10 +0530 Subject: [PATCH 037/328] feat: make table heading sticky --- src/components/molecules/InterpretationLog.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 22822307..0104c091 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -149,7 +149,7 @@ export const InterpretationLog = () => { - +
Dessert (100g serving) From e73f61eaf087f420ae2b32c27ecb0e9758fa9317 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 26 Aug 2024 19:51:07 +0530 Subject: [PATCH 038/328] feat: rename to Output data priview --- src/components/molecules/InterpretationLog.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 0104c091..4d1866b1 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -125,7 +125,7 @@ export const InterpretationLog = () => { }} > - Interpretation Log + Output Data Preview
Date: Mon, 26 Aug 2024 19:52:09 +0530 Subject: [PATCH 039/328] fix(temp): disable action description --- src/components/molecules/ActionSettings.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/molecules/ActionSettings.tsx b/src/components/molecules/ActionSettings.tsx index dcf2ba5c..79e120b8 100644 --- a/src/components/molecules/ActionSettings.tsx +++ b/src/components/molecules/ActionSettings.tsx @@ -1,7 +1,7 @@ import React, { useRef } from 'react'; import styled from "styled-components"; import { Button } from "@mui/material"; -import { ActionDescription } from "../organisms/RightSidePanel"; +//import { ActionDescription } from "../organisms/RightSidePanel"; import * as Settings from "./action-settings"; import { useSocketStore } from "../../context/socket"; @@ -42,7 +42,7 @@ export const ActionSettings = ({ action }: ActionSettingsProps) => { return (
- Action settings: + {/* Action settings: */}
From c92c1ed267c2b37600b704aa6f9a0f2ba2930431 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 26 Aug 2024 19:57:30 +0530 Subject: [PATCH 040/328] feat: storage icon for data preview --- src/components/molecules/InterpretationLog.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 4d1866b1..61144287 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -18,6 +18,7 @@ import TableContainer from '@mui/material/TableContainer'; 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'; function createData( name: string, @@ -125,7 +126,7 @@ export const InterpretationLog = () => { }} > - Output Data Preview + Output Data Preview
Date: Mon, 26 Aug 2024 20:02:52 +0530 Subject: [PATCH 041/328] feat: move table above data row collection count --- .../molecules/InterpretationLog.tsx | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 61144287..93b23dd6 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -140,16 +140,7 @@ export const InterpretationLog = () => { { getList ? ( <> - - What is the maximum number of rows you want to extract? - - } label="10" /> - } label="100" /> - } label="Custom" /> - - - - +
@@ -178,6 +169,15 @@ export const InterpretationLog = () => {
+ + + What is the maximum number of rows you want to extract? + + } label="10" /> + } label="100" /> + } label="Custom" /> + + ) : null } From 14f89a695d38d4bd34310f4233fd5d97ff98d2c5 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 26 Aug 2024 20:03:18 +0530 Subject: [PATCH 042/328] chorE: lint --- src/components/molecules/InterpretationLog.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 93b23dd6..695c3d7e 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -140,7 +140,7 @@ export const InterpretationLog = () => { { getList ? ( <> - + @@ -169,7 +169,7 @@ export const InterpretationLog = () => {
- + What is the maximum number of rows you want to extract? From 4f297423101005de2dc8b85f9bc4ec89468167c9 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 26 Aug 2024 20:06:29 +0530 Subject: [PATCH 043/328] feat: use h4 for form label --- src/components/molecules/InterpretationLog.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 695c3d7e..2daab607 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -171,7 +171,7 @@ export const InterpretationLog = () => {
- What is the maximum number of rows you want to extract? +

What is the maximum number of rows you want to extract?

} label="10" /> } label="100" /> From 7057662c871b9c2109ff714bf7601e0183622451 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 26 Aug 2024 20:06:47 +0530 Subject: [PATCH 044/328] chorE: lint --- src/components/molecules/InterpretationLog.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 2daab607..6fe12845 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -171,7 +171,9 @@ export const InterpretationLog = () => { -

What is the maximum number of rows you want to extract?

+ +

What is the maximum number of rows you want to extract?

+
} label="10" /> } label="100" /> From 69ac71337263c0561728238d0df55dee94f1febd Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 26 Aug 2024 20:13:48 +0530 Subject: [PATCH 045/328] feat: additional options --- .../molecules/InterpretationLog.tsx | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 6fe12845..b63ad91d 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -3,6 +3,7 @@ import SwipeableDrawer from '@mui/material/SwipeableDrawer'; import Typography from '@mui/material/Typography'; import Radio from '@mui/material/Radio'; import RadioGroup from '@mui/material/RadioGroup'; +import { Button } from '@mui/material'; import FormControlLabel from '@mui/material/FormControlLabel'; import FormControl from '@mui/material/FormControl'; import FormLabel from '@mui/material/FormLabel'; @@ -170,16 +171,22 @@ export const InterpretationLog = () => { - - -

What is the maximum number of rows you want to extract?

-
- - } label="10" /> - } label="100" /> - } label="Custom" /> - -
+
+ + +

What is the maximum number of rows you want to extract?

+
+ + } label="10" /> + } label="100" /> + } label="Custom" /> + +
+
+

Additional Options

+ +
+
) : null } From 6022063877fda08520526020d7ab55d681fab40b Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 26 Aug 2024 20:20:08 +0530 Subject: [PATCH 046/328] feat: use flex-start --- .../molecules/InterpretationLog.tsx | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index b63ad91d..76a73b5e 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -171,22 +171,25 @@ export const InterpretationLog = () => { -
- - -

What is the maximum number of rows you want to extract?

-
- - } label="10" /> - } label="100" /> - } label="Custom" /> - -
-
-

Additional Options

- -
+
+ + +

What is the maximum number of rows you want to extract?

+
+ + } label="10" /> + } label="100" /> + } label="Custom" /> + +
+ +
+

Additional Options

+
+
) : null } From b39e2fea29ce91cde68df2505b1d22b034fe4629 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 26 Aug 2024 20:21:21 +0530 Subject: [PATCH 047/328] feat: set gap to 200px --- src/components/molecules/InterpretationLog.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 76a73b5e..5fed3b2f 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -171,7 +171,7 @@ export const InterpretationLog = () => { -
+

What is the maximum number of rows you want to extract?

From e7f564d06e3761f578fd2ac96392978f7c87db18 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 26 Aug 2024 20:21:32 +0530 Subject: [PATCH 048/328] chore: lint --- .../molecules/InterpretationLog.tsx | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 5fed3b2f..ea62a3fa 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -172,24 +172,24 @@ export const InterpretationLog = () => {
- - -

What is the maximum number of rows you want to extract?

-
- - } label="10" /> - } label="100" /> - } label="Custom" /> - -
+ + +

What is the maximum number of rows you want to extract?

+
+ + } label="10" /> + } label="100" /> + } label="Custom" /> + +
-
-

Additional Options

- +
+

Additional Options

+ +
-
) : null } From 8e508d45e0e3d2b0c5c97e7a9886a970689cddb9 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 26 Aug 2024 20:23:52 +0530 Subject: [PATCH 049/328] feat: instructions for pagination --- src/components/molecules/InterpretationLog.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index ea62a3fa..f2db28f6 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -184,7 +184,8 @@ export const InterpretationLog = () => {
-

Additional Options

+

How can we find the next item?

+

Select and review the pagination setting this webpage is using

From 3ffe4c28ea430f38d4c0bc2d0d5ffc2bd00ef6c4 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 26 Aug 2024 20:24:25 +0530 Subject: [PATCH 050/328] feat: select pagination setting button --- src/components/molecules/InterpretationLog.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index f2db28f6..c21ee07b 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -187,7 +187,7 @@ export const InterpretationLog = () => {

How can we find the next item?

Select and review the pagination setting this webpage is using

From a1ae438d3a2fcaeab5bcddaceefeaa4bb931604c Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 26 Aug 2024 20:25:25 +0530 Subject: [PATCH 051/328] feat: set variant to outlined --- src/components/molecules/InterpretationLog.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index c21ee07b..1110f0bb 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -186,7 +186,7 @@ export const InterpretationLog = () => {

How can we find the next item?

Select and review the pagination setting this webpage is using

-
From 67610f75f333f7ca4c38ae5cc8b60d4ad2f5e400 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 26 Aug 2024 23:45:06 +0530 Subject: [PATCH 052/328] fix: -rm styled components --- src/components/organisms/RightSidePanel.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 9a9fff51..bca1307a 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -3,7 +3,6 @@ import { Button, Paper, Box, TextField } from "@mui/material"; import EditIcon from '@mui/icons-material/Edit'; import TextFieldsIcon from '@mui/icons-material/TextFields'; import DocumentScannerIcon from '@mui/icons-material/DocumentScanner'; -import styled from "styled-components"; import { SimpleBox } from "../atoms/Box"; import Typography from "@mui/material/Typography"; import { useGlobalInfoStore } from "../../context/globalInfo"; From 15184f286a46086ec1caecf999d625cd8d5fe376 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Tue, 27 Aug 2024 22:58:47 +0530 Subject: [PATCH 053/328] fix: whitespace --- src/components/molecules/InterpretationLog.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 1110f0bb..68c28fc3 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -39,7 +39,6 @@ const rows = [ createData('Gingerbread', 356, 16.0, 49, 3.9), ]; - export const InterpretationLog = () => { const [open, setOpen] = useState(false); const [log, setLog] = useState(''); From 80a776585d2a6ff2960d1bcfd70b3b1cb90c24c3 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Tue, 27 Aug 2024 22:59:23 +0530 Subject: [PATCH 054/328] fix: add spacing --- src/pages/RecordingPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/RecordingPage.tsx b/src/pages/RecordingPage.tsx index fa5c3a14..d0c322e4 100644 --- a/src/pages/RecordingPage.tsx +++ b/src/pages/RecordingPage.tsx @@ -47,7 +47,7 @@ export const RecordingPage = ({ recordingName }: RecordingPageProps) => { }); }; - //resize browser content when loaded event is fired + // resize browser content when loaded event is fired useEffect(() => changeBrowserDimensions(), [isLoaded]) useEffect(() => { From a31860e98934b51c6f7db75148b6fd2bee3f53ca Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Tue, 27 Aug 2024 22:59:47 +0530 Subject: [PATCH 055/328] fix: -rm cmnt --- src/pages/RecordingPage.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/RecordingPage.tsx b/src/pages/RecordingPage.tsx index d0c322e4..f17163bf 100644 --- a/src/pages/RecordingPage.tsx +++ b/src/pages/RecordingPage.tsx @@ -47,7 +47,6 @@ export const RecordingPage = ({ recordingName }: RecordingPageProps) => { }); }; - // resize browser content when loaded event is fired useEffect(() => changeBrowserDimensions(), [isLoaded]) useEffect(() => { From 636b3e414503bcd7bf57249ae2fbb16babeba590 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Wed, 28 Aug 2024 23:50:50 +0530 Subject: [PATCH 056/328] feat: custom val state --- src/components/molecules/InterpretationLog.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 68c28fc3..ed6ca0e5 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -42,6 +42,7 @@ const rows = [ export const InterpretationLog = () => { const [open, setOpen] = useState(false); const [log, setLog] = useState(''); + const [customValue, setCustomValue] = useState(''); const logEndRef = useRef(null); From 83f14e894c578849079d371e5dd4729165a363d1 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Wed, 28 Aug 2024 23:55:24 +0530 Subject: [PATCH 057/328] feat: handle radio change --- src/components/molecules/InterpretationLog.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index ed6ca0e5..ab5605ab 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -92,6 +92,13 @@ export const InterpretationLog = () => { scrollLogToBottom(); }, [log, scrollLogToBottom]); + const handleRadioChange = (event) => { + if (event.target.value === 'custom') { + setCustomValue(''); // Clear previous custom value on selection + } + }; + + useEffect(() => { socket?.on('log', handleLog); socket?.on('serializableCallback', handleSerializableCallback); From 765c13cc079c6d5d7be48fc29d205f99baa8f03a Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Wed, 28 Aug 2024 23:55:56 +0530 Subject: [PATCH 058/328] feat(ts): set type to any --- src/components/molecules/InterpretationLog.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index ab5605ab..7a7c45cf 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -92,7 +92,7 @@ export const InterpretationLog = () => { scrollLogToBottom(); }, [log, scrollLogToBottom]); - const handleRadioChange = (event) => { + const handleRadioChange = (event: any) => { if (event.target.value === 'custom') { setCustomValue(''); // Clear previous custom value on selection } From 4d686a990a1df4efc41f144915946f5b51ba19b3 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Wed, 28 Aug 2024 23:56:30 +0530 Subject: [PATCH 059/328] feat: handle custom input change --- src/components/molecules/InterpretationLog.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 7a7c45cf..29ad7da0 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -98,6 +98,11 @@ export const InterpretationLog = () => { } }; + const handleCustomInputChange = (event) => { + setCustomValue(event.target.value); + }; + + useEffect(() => { socket?.on('log', handleLog); From 8355b70f583ce870b3c6c79fba52c0478ef70779 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Wed, 28 Aug 2024 23:57:10 +0530 Subject: [PATCH 060/328] feat(ts): set type to any --- src/components/molecules/InterpretationLog.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 29ad7da0..b6ff103f 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -98,7 +98,7 @@ export const InterpretationLog = () => { } }; - const handleCustomInputChange = (event) => { + const handleCustomInputChange = (event: any) => { setCustomValue(event.target.value); }; From a4402eb6541535e7b2f14c1ecae380641bf1cbb5 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Wed, 28 Aug 2024 23:58:17 +0530 Subject: [PATCH 061/328] feat: accept input for custom no. of rows --- src/components/molecules/InterpretationLog.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index b6ff103f..40845168 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -192,6 +192,15 @@ export const InterpretationLog = () => { } label="10" /> } label="100" /> } label="Custom" /> + {customValue && ( + + )} From b8141b06d7826a1ea8eef1c7250e6cfd2fb96cd5 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Wed, 28 Aug 2024 23:59:22 +0530 Subject: [PATCH 062/328] chore: lint --- src/components/molecules/InterpretationLog.tsx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 40845168..3297d9d3 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -192,15 +192,15 @@ export const InterpretationLog = () => { } label="10" /> } label="100" /> } label="Custom" /> - {customValue && ( - - )} + {customValue && ( + + )} From feeb01b8c4552706c80e736837b9e4d87b6e6d42 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 29 Aug 2024 05:24:41 +0530 Subject: [PATCH 063/328] fix: whitespace --- src/components/molecules/InterpretationLog.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 3297d9d3..8abed4d9 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -102,8 +102,6 @@ export const InterpretationLog = () => { setCustomValue(event.target.value); }; - - useEffect(() => { socket?.on('log', handleLog); socket?.on('serializableCallback', handleSerializableCallback); From 648b6b3554739341d23c33f568725be16fb42708 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 29 Aug 2024 23:00:53 +0530 Subject: [PATCH 064/328] feat: state for selected option --- src/components/molecules/InterpretationLog.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 8abed4d9..a8145249 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -42,6 +42,7 @@ const rows = [ export const InterpretationLog = () => { const [open, setOpen] = useState(false); const [log, setLog] = useState(''); +   const [selectedOption, setSelectedOption] = useState(''); const [customValue, setCustomValue] = useState(''); const logEndRef = useRef(null); From 9a3394c30b324bae9beed855511c2f00bcdf36f7 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 29 Aug 2024 23:01:10 +0530 Subject: [PATCH 065/328] feat: set default val to 10 --- src/components/molecules/InterpretationLog.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index a8145249..c913ce4d 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -42,7 +42,7 @@ const rows = [ export const InterpretationLog = () => { const [open, setOpen] = useState(false); const [log, setLog] = useState(''); -   const [selectedOption, setSelectedOption] = useState(''); +   const [selectedOption, setSelectedOption] = useState('10'); const [customValue, setCustomValue] = useState(''); const logEndRef = useRef(null); From f6df1ad2c6753341534bc89f3135ef30e3117e9b Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 29 Aug 2024 23:01:52 +0530 Subject: [PATCH 066/328] feat: handle radio change --- src/components/molecules/InterpretationLog.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index c913ce4d..57759192 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -93,11 +93,10 @@ export const InterpretationLog = () => { scrollLogToBottom(); }, [log, scrollLogToBottom]); - const handleRadioChange = (event: any) => { - if (event.target.value === 'custom') { - setCustomValue(''); // Clear previous custom value on selection - } - }; + const handleRadioChange = (event: React.ChangeEvent) => { +   setSelectedOption(event.target.value); +   }; + const handleCustomInputChange = (event: any) => { setCustomValue(event.target.value); From 2ad4e2792de4f3ababf86f0b13276bd9ee3313c6 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 29 Aug 2024 23:02:12 +0530 Subject: [PATCH 067/328] feat: handle vustom val change --- src/components/molecules/InterpretationLog.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 57759192..ff3871e5 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -98,9 +98,9 @@ export const InterpretationLog = () => {   }; - const handleCustomInputChange = (event: any) => { - setCustomValue(event.target.value); - }; + const handleCustomValueChange = (event: React.ChangeEvent) => { +     setCustomValue(event.target.value); +   }; useEffect(() => { socket?.on('log', handleLog); From 62146be3e6d8f65330438646aa8a6ecd04baa275 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 29 Aug 2024 23:02:26 +0530 Subject: [PATCH 068/328] chore: lint --- src/components/molecules/InterpretationLog.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index ff3871e5..99304ec4 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -42,7 +42,7 @@ const rows = [ export const InterpretationLog = () => { const [open, setOpen] = useState(false); const [log, setLog] = useState(''); -   const [selectedOption, setSelectedOption] = useState('10'); + const [selectedOption, setSelectedOption] = useState('10'); const [customValue, setCustomValue] = useState(''); const logEndRef = useRef(null); @@ -94,13 +94,13 @@ export const InterpretationLog = () => { }, [log, scrollLogToBottom]); const handleRadioChange = (event: React.ChangeEvent) => { -   setSelectedOption(event.target.value); -   }; - + setSelectedOption(event.target.value); + }; - const handleCustomValueChange = (event: React.ChangeEvent) => { -     setCustomValue(event.target.value); -   }; + + const handleCustomValueChange = (event: React.ChangeEvent) => { + setCustomValue(event.target.value); + }; useEffect(() => { socket?.on('log', handleLog); From 553c977870603d700cec6f2283aeca19333db974 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 29 Aug 2024 23:02:45 +0530 Subject: [PATCH 069/328] fix: empty onChange --- src/components/molecules/InterpretationLog.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 99304ec4..f1acf062 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -194,7 +194,7 @@ export const InterpretationLog = () => { From a8248ae1b0d412b72fdc595f73db474375db6b5b Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 29 Aug 2024 23:03:47 +0530 Subject: [PATCH 070/328] feat: render text field if selected option custom --- src/components/molecules/InterpretationLog.tsx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index f1acf062..314e7fe9 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -190,15 +190,15 @@ export const InterpretationLog = () => { } label="10" /> } label="100" /> } label="Custom" /> - {customValue && ( - - )} + {selectedOption === 'custom' && ( +                        +                      )} From 6e0770d2f5fd2a505fcd752a93c56aaa21d8a4ef Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 29 Aug 2024 23:03:57 +0530 Subject: [PATCH 071/328] chore: lint --- src/components/molecules/InterpretationLog.tsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 314e7fe9..79e7f26c 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -191,14 +191,14 @@ export const InterpretationLog = () => { } label="100" /> } label="Custom" /> {selectedOption === 'custom' && ( -                        -                      )} + + )} From 3899e2e85c384925b4cb86eb9fe73672a545b31b Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 29 Aug 2024 23:04:36 +0530 Subject: [PATCH 072/328] fix: missing import for text field --- src/components/molecules/InterpretationLog.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 79e7f26c..30b08ee3 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -3,7 +3,7 @@ import SwipeableDrawer from '@mui/material/SwipeableDrawer'; import Typography from '@mui/material/Typography'; import Radio from '@mui/material/Radio'; import RadioGroup from '@mui/material/RadioGroup'; -import { Button } from '@mui/material'; +import { Button, TextField } from '@mui/material'; import FormControlLabel from '@mui/material/FormControlLabel'; import FormControl from '@mui/material/FormControl'; import FormLabel from '@mui/material/FormLabel'; From f96f9a3bb0035403982a84b4407b2710d6d5fca0 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 29 Aug 2024 23:05:25 +0530 Subject: [PATCH 073/328] feat: set radio group val to selected option --- src/components/molecules/InterpretationLog.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 30b08ee3..52526a92 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -186,7 +186,7 @@ export const InterpretationLog = () => {

What is the maximum number of rows you want to extract?

- + } label="10" /> } label="100" /> } label="Custom" /> From 6313f1a69e33c4e642cd3ffd64d43cf006e99fa5 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 29 Aug 2024 23:05:55 +0530 Subject: [PATCH 074/328] feat: set onChange for radio group --- src/components/molecules/InterpretationLog.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 52526a92..802bfdd3 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -186,7 +186,7 @@ export const InterpretationLog = () => {

What is the maximum number of rows you want to extract?

- + } label="10" /> } label="100" /> } label="Custom" /> From a2daa730d4ba5241efe5eff7eb0e049b17b32889 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 29 Aug 2024 23:14:04 +0530 Subject: [PATCH 075/328] feat: text field styles --- src/components/molecules/InterpretationLog.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 802bfdd3..87240871 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -196,7 +196,14 @@ export const InterpretationLog = () => { value={customValue} onChange={handleCustomValueChange} placeholder="Enter number" - sx={{ marginLeft: '10px', marginTop: '10px', color: 'white' }} + sx={{ + marginLeft: '10px', + marginTop: '-8px', + width: '80px', + '& input': { + padding: '10px', + }, + }} /> )} From 44f701eb4d9fa12deddae8107c8ff8c56b7431a4 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 29 Aug 2024 23:14:19 +0530 Subject: [PATCH 076/328] feat: remove width --- src/components/molecules/InterpretationLog.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 87240871..ca31cff3 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -199,7 +199,6 @@ export const InterpretationLog = () => { sx={{ marginLeft: '10px', marginTop: '-8px', - width: '80px', '& input': { padding: '10px', }, From d21898d42a33d274b0d201f5c75f9cf8a508e795 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 29 Aug 2024 23:16:00 +0530 Subject: [PATCH 077/328] feat: increase margin top --- src/components/molecules/InterpretationLog.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index ca31cff3..c43fee05 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -198,7 +198,7 @@ export const InterpretationLog = () => { placeholder="Enter number" sx={{ marginLeft: '10px', - marginTop: '-8px', + marginTop: '-3px', '& input': { padding: '10px', }, From 2439534eb6a40b4ba3491a20cc707d0e0b96883e Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 29 Aug 2024 23:16:16 +0530 Subject: [PATCH 078/328] chore: lint --- src/components/molecules/InterpretationLog.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index c43fee05..8ba9cd2b 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -197,10 +197,10 @@ export const InterpretationLog = () => { onChange={handleCustomValueChange} placeholder="Enter number" sx={{ - marginLeft: '10px', - marginTop: '-3px', + marginLeft: '10px', + marginTop: '-3px', '& input': { - padding: '10px', + padding: '10px', }, }} /> From da51f6a4d7b3acb07fce819e07ecfe9677f29f03 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 29 Aug 2024 23:21:08 +0530 Subject: [PATCH 079/328] feat: remove black bg from form --- src/components/molecules/InterpretationLog.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 8ba9cd2b..d02bf4ee 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -143,7 +143,7 @@ export const InterpretationLog = () => { height: '50vh', overflow: 'none', padding: '10px', - background: '#19171c', + }}> {log} From 2eb30dbd51213b1cfc6e514677f480411dee363e Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 29 Aug 2024 23:21:22 +0530 Subject: [PATCH 080/328] feat: set bg white --- src/components/molecules/InterpretationLog.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index d02bf4ee..b49aef0e 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -133,7 +133,7 @@ export const InterpretationLog = () => { onClose={toggleDrawer(false)} onOpen={toggleDrawer(true)} PaperProps={{ - sx: { background: '#19171c', color: 'white', padding: '10px', height: 720, width: width - 10, display: 'flex' } + sx: { background: 'white', color: 'white', padding: '10px', height: 720, width: width - 10, display: 'flex' } }} > From ca03a93e3812da4bbdde4fcc88d6adca22ae6ac5 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 29 Aug 2024 23:21:33 +0530 Subject: [PATCH 081/328] feat: set text black --- src/components/molecules/InterpretationLog.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index b49aef0e..e5b502b2 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -133,7 +133,7 @@ export const InterpretationLog = () => { onClose={toggleDrawer(false)} onOpen={toggleDrawer(true)} PaperProps={{ - sx: { background: 'white', color: 'white', padding: '10px', height: 720, width: width - 10, display: 'flex' } + sx: { background: 'white', color: 'black', padding: '10px', height: 720, width: width - 10, display: 'flex' } }} > From a4c8b797ce4e71e02be9afb05ecca5aeeb8b7045 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 29 Aug 2024 23:21:51 +0530 Subject: [PATCH 082/328] chore: lint --- src/components/molecules/InterpretationLog.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index e5b502b2..3b590f96 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -143,7 +143,7 @@ export const InterpretationLog = () => { height: '50vh', overflow: 'none', padding: '10px', - + }}> {log} From d09b7bff9096ce6c1c78ac9b69e076ac9a369c20 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 29 Aug 2024 23:22:05 +0530 Subject: [PATCH 083/328] fix: whitespace --- src/components/molecules/InterpretationLog.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 3b590f96..5ca592fb 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -143,7 +143,6 @@ export const InterpretationLog = () => { height: '50vh', overflow: 'none', padding: '10px', - }}> {log} From 3db4cbfbc4a9f749b81a51a27c391a6b27e04fa2 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 29 Aug 2024 23:22:44 +0530 Subject: [PATCH 084/328] refactor: sx format --- src/components/molecules/InterpretationLog.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 5ca592fb..74f53e7d 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -133,7 +133,14 @@ export const InterpretationLog = () => { onClose={toggleDrawer(false)} onOpen={toggleDrawer(true)} PaperProps={{ - sx: { background: 'white', color: 'black', padding: '10px', height: 720, width: width - 10, display: 'flex' } + sx: { + background: 'white', + color: 'black', + padding: '10px', + height: 720, + width: width - 10, + display: 'flex' + } }} > From 6deb9a8fc0db9d329cfa1acb18444023d8d8b561 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 30 Aug 2024 00:25:32 +0530 Subject: [PATCH 085/328] feat: set radio ggroup width --- src/components/molecules/InterpretationLog.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 74f53e7d..27bd3767 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -192,7 +192,7 @@ export const InterpretationLog = () => {

What is the maximum number of rows you want to extract?

- + } label="10" /> } label="100" /> } label="Custom" /> From d7e804c70b898424b51b195dc41dabb8bd80a3c1 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 30 Aug 2024 00:27:06 +0530 Subject: [PATCH 086/328] fix: whietspace --- src/components/molecules/InterpretationLog.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 27bd3767..bffc8654 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -97,7 +97,6 @@ export const InterpretationLog = () => { setSelectedOption(event.target.value); }; - const handleCustomValueChange = (event: React.ChangeEvent) => { setCustomValue(event.target.value); }; From 528d81958b908d119b905ea116cbdbd748c0eb67 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 30 Aug 2024 02:53:23 +0530 Subject: [PATCH 087/328] fix: do not allow empty strings --- src/components/organisms/BrowserWindow.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index 6a8cd800..1adc5edb 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -222,7 +222,7 @@ export const BrowserWindow = () => { id: Date.now(), type: 'text', label: `Label ${Object.keys(fields).length + 1}`, - data: selectedElement.info?.innerText || '', + data: selectedElement.info?.innerText, selectorObj: { selector: selectedElement.selector, tag: selectedElement.info?.tagName, From 5b147895e0da44892f3c83bfb03a61b51b161ab1 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 30 Aug 2024 02:54:11 +0530 Subject: [PATCH 088/328] fix: use data instead of selectedElement.innerText --- src/components/organisms/BrowserWindow.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index 1adc5edb..bd7fc9ae 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -222,7 +222,7 @@ export const BrowserWindow = () => { id: Date.now(), type: 'text', label: `Label ${Object.keys(fields).length + 1}`, - data: selectedElement.info?.innerText, + data: data, selectorObj: { selector: selectedElement.selector, tag: selectedElement.info?.tagName, From 38042adbc00a94386c29b7ce299287751f74716a Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 30 Aug 2024 03:16:44 +0530 Subject: [PATCH 089/328] chore: lint --- src/components/organisms/LeftSidePanel.tsx | 43 +++++++++++----------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/src/components/organisms/LeftSidePanel.tsx b/src/components/organisms/LeftSidePanel.tsx index 164dc38c..09c5fc46 100644 --- a/src/components/organisms/LeftSidePanel.tsx +++ b/src/components/organisms/LeftSidePanel.tsx @@ -14,21 +14,21 @@ import { RunSettings } from "../molecules/RunSettings"; const fetchWorkflow = (id: string, callback: (response: WorkflowFile) => void) => { getActiveWorkflow(id).then( - (response ) => { - if (response){ + (response) => { + if (response) { callback(response); } else { throw new Error("No workflow found"); } } - ).catch((error) => {console.log(error.message)}) + ).catch((error) => { console.log(error.message) }) }; interface LeftSidePanelProps { sidePanelRef: HTMLDivElement | null; alreadyHasScrollbar: boolean; recordingName: string; - handleSelectPairForEdit: (pair:WhereWhatPair, index:number) => void; + handleSelectPairForEdit: (pair: WhereWhatPair, index: number) => void; } export const LeftSidePanel = ( @@ -59,10 +59,11 @@ export const LeftSidePanel = ( fetchWorkflow(id, workflowHandler); } // fetch workflow in 15min intervals - let interval = setInterval(() =>{ - if (id) { - fetchWorkflow(id, workflowHandler); - }}, (1000 * 60 * 15)); + let interval = setInterval(() => { + if (id) { + fetchWorkflow(id, workflowHandler); + } + }, (1000 * 60 * 15)); return () => clearInterval(interval) }, [id]); @@ -104,19 +105,19 @@ export const LeftSidePanel = ( flexDirection: 'column', }} > - + - setTab(newTab)}> - - { - getParamsOfActiveWorkflow(id).then((response) => { - if (response) { - setParams(response); - } - }) - }}/> - - + setTab(newTab)}> + + { + getParamsOfActiveWorkflow(id).then((response) => { + if (response) { + setParams(response); + } + }) + }} /> + + + settings={settings} setSettings={setSettings} /> From 19f840259e53f91443fd2fff9675df1cff5f55ad Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 30 Aug 2024 03:19:56 +0530 Subject: [PATCH 090/328] chore: lint --- .../molecules/InterpretationButtons.tsx | 125 +++++++++--------- 1 file changed, 63 insertions(+), 62 deletions(-) diff --git a/src/components/molecules/InterpretationButtons.tsx b/src/components/molecules/InterpretationButtons.tsx index 7e0633af..848c7e05 100644 --- a/src/components/molecules/InterpretationButtons.tsx +++ b/src/components/molecules/InterpretationButtons.tsx @@ -29,59 +29,60 @@ export const InterpretationButtons = ({ enableStepping }: InterpretationButtonsP actionType: string, selector: string, action: string, - open:boolean - }>({ pair: null, actionType: '', selector: '', action: '', open: false} ); + open: boolean + }>({ pair: null, actionType: '', selector: '', action: '', open: false }); const { socket } = useSocketStore(); const { notify } = useGlobalInfoStore(); const finishedHandler = useCallback(() => { - setInfo({...info, isPaused: false}); + setInfo({ ...info, isPaused: false }); enableStepping(false); }, [info, enableStepping]); const breakpointHitHandler = useCallback(() => { - setInfo({running: false, isPaused: true}); + setInfo({ running: false, isPaused: true }); notify('warning', 'Please restart the interpretation, after updating the recording'); enableStepping(true); }, [info, enableStepping]); const decisionHandler = useCallback( - ({pair, actionType, lastData} - : {pair: WhereWhatPair | null, actionType: string, lastData: { selector: string, action: string }}) => { - const {selector, action} = lastData; - setDecisionModal((prevState) => { - return { - pair, - actionType, - selector, - action, - open: true, - } - }) - }, [decisionModal]); + ({ pair, actionType, lastData } + : { pair: WhereWhatPair | null, actionType: string, lastData: { selector: string, action: string } }) => { + const { selector, action } = lastData; + setDecisionModal((prevState) => { + return { + pair, + actionType, + selector, + action, + open: true, + } + }) + }, [decisionModal]); const handleDecision = (decision: boolean) => { - const {pair, actionType} = decisionModal; - socket?.emit('decision', {pair, actionType, decision}); - setDecisionModal({pair: null, actionType: '', selector: '', action: '', open: false}); + const { pair, actionType } = decisionModal; + socket?.emit('decision', { pair, actionType, decision }); + setDecisionModal({ pair: null, actionType: '', selector: '', action: '', open: false }); } const handleDescription = () => { - switch (decisionModal.actionType){ + switch (decisionModal.actionType) { case 'customAction': return ( - - Do you want to use the previously recorded selector - as a where condition for matching the action? - - - [previous action: {decisionModal.action}] -
{decisionModal.selector}
-
+ + Do you want to use the previously recorded selector + as a where condition for matching the action? + + + [previous action: {decisionModal.action}] +
{decisionModal.selector}
+
); - default: return null;} + default: return null; + } } useEffect(() => { @@ -100,12 +101,12 @@ export const InterpretationButtons = ({ enableStepping }: InterpretationButtonsP const handlePlay = async () => { if (info.isPaused) { socket?.emit("resume"); - setInfo({running: true, isPaused: false}); + setInfo({ running: true, isPaused: false }); enableStepping(false); } else { - setInfo({...info, running: true}); + setInfo({ ...info, running: true }); const finished = await interpretCurrentRecording(); - setInfo({...info, running: false}); + setInfo({ ...info, running: false }); if (finished) { notify('info', 'Interpretation finished'); } else { @@ -131,45 +132,45 @@ export const InterpretationButtons = ({ enableStepping }: InterpretationButtonsP return ( - - + sx={{ marginTop: '10px', marginBottom: '5px', justifyContent: 'space-evenly', }} > + + Pause - - + + {info.isPaused ? 'Resume' : 'Start'} - - + Stop - {}} isOpen={decisionModal.open} canBeClosed={false} - modalStyle={{ - position: 'absolute', - top: '50%', - left: '50%', - transform: 'translate(-50%, -50%)', - width: 500, - background: 'white', - border: '2px solid #000', - boxShadow: '24', - height:'fit-content', - display:'block', - overflow:'scroll', - padding: '5px 25px 10px 25px', - }}> -
- + { }} isOpen={decisionModal.open} canBeClosed={false} + modalStyle={{ + position: 'absolute', + top: '50%', + left: '50%', + transform: 'translate(-50%, -50%)', + width: 500, + background: 'white', + border: '2px solid #000', + boxShadow: '24', + height: 'fit-content', + display: 'block', + overflow: 'scroll', + padding: '5px 25px 10px 25px', + }}> +
+ { handleDescription() } -
- - +
+ +
From 1d41204dc8d7f038a47d31b3f71d0490b67ffc1f Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 30 Aug 2024 22:45:23 +0530 Subject: [PATCH 091/328] feat(Temp): render table even if no getList --- src/components/molecules/InterpretationLog.tsx | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index bffc8654..6e760097 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -153,9 +153,6 @@ export const InterpretationLog = () => { {log} - { - getList ? ( - <> @@ -221,9 +218,6 @@ export const InterpretationLog = () => { - - ) : null - }
From 165e424da2c7115d910f3184457eebf81da7206d Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 30 Aug 2024 22:45:49 +0530 Subject: [PATCH 092/328] chore: lint --- .../molecules/InterpretationLog.tsx | 126 +++++++++--------- 1 file changed, 63 insertions(+), 63 deletions(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 6e760097..17247f65 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -153,71 +153,71 @@ export const InterpretationLog = () => { {log} - -
- - - Dessert (100g serving) - Calories - Fat (g) - Carbs (g) - Protein (g) - - - - {rows.map((row) => ( - - - {row.name} - - {row.calories} - {row.fat} - {row.carbs} - {row.protein} - - ))} - -
-
+ + + + + Dessert (100g serving) + Calories + Fat (g) + Carbs (g) + Protein (g) + + + + {rows.map((row) => ( + + + {row.name} + + {row.calories} + {row.fat} + {row.carbs} + {row.protein} + + ))} + +
+
-
- - -

What is the maximum number of rows you want to extract?

-
- - } label="10" /> - } label="100" /> - } label="Custom" /> - {selectedOption === 'custom' && ( - - )} - -
+
+ + +

What is the maximum number of rows you want to extract?

+
+ + } label="10" /> + } label="100" /> + } label="Custom" /> + {selectedOption === 'custom' && ( + + )} + +
-
-

How can we find the next item?

-

Select and review the pagination setting this webpage is using

- -
-
+
+

How can we find the next item?

+

Select and review the pagination setting this webpage is using

+ +
+
From b9e36b5ec8a7222b8b25586d0b717ccd498b0ff6 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 30 Aug 2024 22:46:25 +0530 Subject: [PATCH 093/328] fix: spacing --- src/components/molecules/InterpretationLog.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 17247f65..a81fb4b2 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -182,7 +182,6 @@ export const InterpretationLog = () => { -
@@ -209,7 +208,6 @@ export const InterpretationLog = () => { )} -

How can we find the next item?

Select and review the pagination setting this webpage is using

From 9b8d1ac8c75cd7e25382e4ef100c5b178b397f4d Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 30 Aug 2024 23:05:28 +0530 Subject: [PATCH 094/328] feat: set padding for pagination settings --- src/components/molecules/InterpretationLog.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index a81fb4b2..194dc427 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -208,7 +208,7 @@ export const InterpretationLog = () => { )} -
+

How can we find the next item?

Select and review the pagination setting this webpage is using

+ From 318b3d17977bc256534f6428700ab89f8ff4bd80 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 31 Aug 2024 01:19:24 +0530 Subject: [PATCH 107/328] feat: display options to user --- src/components/organisms/RightSidePanel.tsx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 134369c3..d7898094 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -175,6 +175,17 @@ export const RightSidePanel = () => { } +{showPaginationOptions && ( + + Select an option for the list: + + + + + + + )} + {!getText && !getScreenshot && !getList && } {getText && <> From c298236975f2cc0cd0dd611a4c3dca9a8c000d3a Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 31 Aug 2024 01:19:34 +0530 Subject: [PATCH 108/328] chore: lint --- src/components/organisms/RightSidePanel.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index d7898094..c090911e 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -175,7 +175,7 @@ export const RightSidePanel = () => { } -{showPaginationOptions && ( + {showPaginationOptions && ( Select an option for the list: From 1e2407ca7a0a77cf31ef70778e118e302cf1e8af Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 31 Aug 2024 01:20:28 +0530 Subject: [PATCH 109/328] feat: remove duplicate selection confirmation button --- src/components/organisms/RightSidePanel.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index c090911e..d5017648 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -182,7 +182,6 @@ export const RightSidePanel = () => { - )} From 16d67da6652dd83fb43513eb4c76338d724d7dde Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 31 Aug 2024 01:22:41 +0530 Subject: [PATCH 110/328] feat: next navigation --- src/components/organisms/RightSidePanel.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index d5017648..0ebd6bba 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -178,7 +178,7 @@ export const RightSidePanel = () => { {showPaginationOptions && ( Select an option for the list: - + From cee67c7652965bea751d40f502d3cd8ae028d06b Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 31 Aug 2024 01:23:06 +0530 Subject: [PATCH 111/328] feat: load more --- src/components/organisms/RightSidePanel.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 0ebd6bba..4aecc1ae 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -179,7 +179,7 @@ export const RightSidePanel = () => { Select an option for the list: - + From 478451f85be6261bfc879b92015d03d8d8736b51 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 31 Aug 2024 01:23:38 +0530 Subject: [PATCH 112/328] feat: scroll down --- src/components/organisms/RightSidePanel.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 4aecc1ae..a57deedd 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -180,7 +180,7 @@ export const RightSidePanel = () => { Select an option for the list: - + )} From 00be7c13b8d365b0a92f7061433388da2f7bbac1 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 31 Aug 2024 01:23:53 +0530 Subject: [PATCH 113/328] feat: scroll up --- src/components/organisms/RightSidePanel.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index a57deedd..64dddd6b 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -181,7 +181,7 @@ export const RightSidePanel = () => { - + )} From 43f577177024433f66a85f3f8ad51aab8666795e Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 31 Aug 2024 01:24:21 +0530 Subject: [PATCH 114/328] feat: set option 5 --- src/components/organisms/RightSidePanel.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 64dddd6b..389e9728 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -182,6 +182,7 @@ export const RightSidePanel = () => { + )} From 505b078413cab5763a40f8d163344e97bdd35284 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 31 Aug 2024 01:25:18 +0530 Subject: [PATCH 115/328] feat: no more items to load --- src/components/organisms/RightSidePanel.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 389e9728..9198100d 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -182,7 +182,7 @@ export const RightSidePanel = () => { - + )} From d7b9cbbab0ae4a4cfad87ef3003222584e0d604e Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 31 Aug 2024 01:28:13 +0530 Subject: [PATCH 116/328] feat: heading for user input --- src/components/organisms/RightSidePanel.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 9198100d..91e4d713 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -177,7 +177,7 @@ export const RightSidePanel = () => { {showPaginationOptions && ( - Select an option for the list: + How can we find the next list item on the page? From c6f7af64547563014e2eb2d7f1358a86f80a8da6 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 31 Aug 2024 01:57:13 +0530 Subject: [PATCH 117/328] fix: format --- maxun-core/src/browserSide/scraper.js | 1 - 1 file changed, 1 deletion(-) diff --git a/maxun-core/src/browserSide/scraper.js b/maxun-core/src/browserSide/scraper.js index 99c8ee33..1ea4b3b4 100644 --- a/maxun-core/src/browserSide/scraper.js +++ b/maxun-core/src/browserSide/scraper.js @@ -421,7 +421,6 @@ async function clickNextPagination(selector, scrapedData, limit) { return results; }; - window.scrollDown = async function (selector, limit) { let previousHeight = 0; let itemsLoaded = 0; From facb492a42d724e9b2c1817ecba2ade38882f5c5 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 31 Aug 2024 02:04:32 +0530 Subject: [PATCH 118/328] feat: replace setting as per maxun-core --- src/components/organisms/RightSidePanel.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 91e4d713..cc8ff9de 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -178,7 +178,7 @@ export const RightSidePanel = () => { {showPaginationOptions && ( How can we find the next list item on the page? - + From bc6dbabc87b33e157bdab0e9ebd98a21ba63c15b Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 31 Aug 2024 02:05:29 +0530 Subject: [PATCH 119/328] feat: replace setting as per maxun-core --- src/components/organisms/RightSidePanel.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index cc8ff9de..162e3543 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -179,7 +179,7 @@ export const RightSidePanel = () => { How can we find the next list item on the page? - + From f072b31c2d996b8eec7ef223915e7accfe466a24 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 31 Aug 2024 02:05:53 +0530 Subject: [PATCH 120/328] feat: heading for user input --- src/components/organisms/RightSidePanel.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 162e3543..58312f61 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -180,7 +180,7 @@ export const RightSidePanel = () => { How can we find the next list item on the page? - + From 178e04c4a222455a2ad27ee04a00a52bed9510d1 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 31 Aug 2024 02:06:14 +0530 Subject: [PATCH 121/328] feat: replace setting as per maxun-core --- src/components/organisms/RightSidePanel.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 58312f61..28180f2d 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -181,7 +181,7 @@ export const RightSidePanel = () => { - + )} From f9ae7c6540bfbc74a908c38f7f3a8644a5cdeb89 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 31 Aug 2024 02:06:43 +0530 Subject: [PATCH 122/328] feat: heading for user input --- src/components/organisms/RightSidePanel.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 28180f2d..984d213a 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -182,7 +182,7 @@ export const RightSidePanel = () => { - + )} From ffa84cb4ad9c6b08295584ca75588363787c11bb Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 31 Aug 2024 03:31:20 +0530 Subject: [PATCH 123/328] refactor: list settings format --- src/components/organisms/RightSidePanel.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 984d213a..3515055b 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -88,7 +88,10 @@ export const RightSidePanel = () => { const getListSettingsObject = useCallback(() => { - let settings: { listSelector?: string; fields?: Record } = {}; + let settings: { + listSelector?: string; + fields?: Record + } = {}; browserSteps.forEach(step => { if (step.type === 'list' && step.listSelector && Object.keys(step.fields).length > 0) { From 05c8e54401ce228641feb45a17dcbf83f42e17b4 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 31 Aug 2024 03:32:16 +0530 Subject: [PATCH 124/328] feat: add pagination to list settings --- src/components/organisms/RightSidePanel.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 3515055b..dea6b03b 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -90,7 +90,8 @@ export const RightSidePanel = () => { const getListSettingsObject = useCallback(() => { let settings: { listSelector?: string; - fields?: Record + fields?: Record; + pagination?: { type: string; selector?: string } } = {}; browserSteps.forEach(step => { From d3fe5ce2eda9202bdb455995b97a8d129d7a56e7 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 31 Aug 2024 03:32:43 +0530 Subject: [PATCH 125/328] chore: lint --- src/components/organisms/RightSidePanel.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index dea6b03b..308a5ea7 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -88,10 +88,10 @@ export const RightSidePanel = () => { const getListSettingsObject = useCallback(() => { - let settings: { - listSelector?: string; - fields?: Record; - pagination?: { type: string; selector?: string } + let settings: { + listSelector?: string; + fields?: Record; + pagination?: { type: string; selector?: string } } = {}; browserSteps.forEach(step => { From ca79349908ce5075cd4eb47ce3af72e864fa6322 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 31 Aug 2024 03:33:19 +0530 Subject: [PATCH 126/328] feat: pass pagination type in settings --- src/components/organisms/RightSidePanel.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 308a5ea7..f9728bef 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -110,6 +110,9 @@ export const RightSidePanel = () => { settings = { listSelector: step.listSelector, fields: fields + pagination: { + type: selectedPaginationSetting || 'none' + } }; } From 28a508a0729fd61e7efe4f9e381362fd96e928d6 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 31 Aug 2024 03:33:34 +0530 Subject: [PATCH 127/328] fix: add missing comma --- src/components/organisms/RightSidePanel.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index f9728bef..e4143d00 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -109,7 +109,7 @@ export const RightSidePanel = () => { settings = { listSelector: step.listSelector, - fields: fields + fields: fields, pagination: { type: selectedPaginationSetting || 'none' } From f367463f60c3a7defcbb11a26686b7c5c8986b15 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 31 Aug 2024 22:43:45 +0530 Subject: [PATCH 128/328] fix: format --- src/components/organisms/RightSidePanel.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index e4143d00..09fb4016 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -111,7 +111,7 @@ export const RightSidePanel = () => { listSelector: step.listSelector, fields: fields, pagination: { - type: selectedPaginationSetting || 'none' + type: selectedPaginationSetting || '' } }; From d9395a7686e8cdee191b6abd3187b04eadaaa18a Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 31 Aug 2024 22:44:26 +0530 Subject: [PATCH 129/328] feat: -rm pagination selection exp --- src/components/organisms/RightSidePanel.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 09fb4016..e72bec1d 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -144,7 +144,7 @@ export const RightSidePanel = () => { // Proceed to stop capture and emit settings only after option is selected stopCaptureAndEmitGetListSettings(); setShowPaginationOptions(false); // Reset options display - setSelectedPaginationSetting(null); // Reset selected option + setSelectedPaginationSetting(null); }, [selectedPaginationSetting, stopCaptureAndEmitGetListSettings]); const handlePaginationSettingSelect = (option: string) => { From ab7ee021ac70b0d3291606bdbe161f29d6568f20 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 31 Aug 2024 22:44:46 +0530 Subject: [PATCH 130/328] feat: -rm pagination opt exp --- src/components/organisms/RightSidePanel.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index e72bec1d..2167e726 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -143,7 +143,7 @@ export const RightSidePanel = () => { } // Proceed to stop capture and emit settings only after option is selected stopCaptureAndEmitGetListSettings(); - setShowPaginationOptions(false); // Reset options display + setShowPaginationOptions(false); setSelectedPaginationSetting(null); }, [selectedPaginationSetting, stopCaptureAndEmitGetListSettings]); From d706e074cf972fcf61d899fbb3de5998b2ad11a1 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 31 Aug 2024 22:45:19 +0530 Subject: [PATCH 131/328] feat: pagination docs --- src/components/organisms/RightSidePanel.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 2167e726..0a30e755 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -141,7 +141,7 @@ export const RightSidePanel = () => { setShowPaginationOptions(true); return; } - // Proceed to stop capture and emit settings only after option is selected + // Proceed to stop capture and emit settings only after pagination type is selected stopCaptureAndEmitGetListSettings(); setShowPaginationOptions(false); setSelectedPaginationSetting(null); From 08229c386798abb9ea826bb16ee3479399758b26 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 31 Aug 2024 22:45:37 +0530 Subject: [PATCH 132/328] feat: remove handlistfieldchange --- src/components/organisms/RightSidePanel.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 0a30e755..69180a6e 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -132,9 +132,7 @@ export const RightSidePanel = () => { } }, [stopGetList, getListSettingsObject, socket, notify]); - // const handleListFieldChange = (stepId: number, key: 'label' | 'data', value: string) => { - // updateListStepField(stepId, key, value); - // }; + const handleConfirmListCapture = useCallback(() => { if (!selectedPaginationSetting) { From 728aa5461943e527260df0c2f5ae49544262e186 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 31 Aug 2024 22:45:51 +0530 Subject: [PATCH 133/328] fix: format --- src/components/organisms/RightSidePanel.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 69180a6e..c1f89f4c 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -90,7 +90,7 @@ export const RightSidePanel = () => { const getListSettingsObject = useCallback(() => { let settings: { listSelector?: string; - fields?: Record; + fields?: Record; pagination?: { type: string; selector?: string } } = {}; @@ -132,7 +132,7 @@ export const RightSidePanel = () => { } }, [stopGetList, getListSettingsObject, socket, notify]); - + const handleConfirmListCapture = useCallback(() => { if (!selectedPaginationSetting) { @@ -142,7 +142,7 @@ export const RightSidePanel = () => { // Proceed to stop capture and emit settings only after pagination type is selected stopCaptureAndEmitGetListSettings(); setShowPaginationOptions(false); - setSelectedPaginationSetting(null); + setSelectedPaginationSetting(null); }, [selectedPaginationSetting, stopCaptureAndEmitGetListSettings]); const handlePaginationSettingSelect = (option: string) => { From 76f864e6729c50dfc5d114d2d866a25e1fdc23e0 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 31 Aug 2024 22:46:03 +0530 Subject: [PATCH 134/328] chore: lint --- src/components/organisms/RightSidePanel.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index c1f89f4c..5e481960 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -132,8 +132,6 @@ export const RightSidePanel = () => { } }, [stopGetList, getListSettingsObject, socket, notify]); - - const handleConfirmListCapture = useCallback(() => { if (!selectedPaginationSetting) { setShowPaginationOptions(true); From 794a85bbac9b82fdb9039b2b32c656ed5c34afac Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sun, 1 Sep 2024 01:01:00 +0530 Subject: [PATCH 135/328] feat: pagination selector state --- src/components/organisms/RightSidePanel.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 5e481960..09807130 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -24,6 +24,8 @@ 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 { lastAction, notify } = useGlobalInfoStore(); const { getText, startGetText, stopGetText, getScreenshot, startGetScreenshot, stopGetScreenshot, getList, startGetList, stopGetList } = useActionContext(); From 77c172d034a041cf3c93819cabd8103ada5a0056 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sun, 1 Sep 2024 01:02:11 +0530 Subject: [PATCH 136/328] feat: show pagination selector state --- src/components/organisms/RightSidePanel.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 09807130..29900903 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -25,6 +25,7 @@ export const RightSidePanel = () => { const [showPaginationOptions, setShowPaginationOptions] = useState(false); const [selectedPaginationSetting, setSelectedPaginationSetting] = useState(null); const [paginationSelector, setPaginationSelector] = useState(null); + const [showPaginationSelector, setShowPaginationSelector] = useState(false); const { lastAction, notify } = useGlobalInfoStore(); From 90aa2d4cd0a061b0431129b5ce6445de6add5a2a Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sun, 1 Sep 2024 01:03:18 +0530 Subject: [PATCH 137/328] fix: whitespace --- src/components/organisms/RightSidePanel.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 29900903..5cb8ce28 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -27,7 +27,6 @@ export const RightSidePanel = () => { const [paginationSelector, setPaginationSelector] = useState(null); const [showPaginationSelector, setShowPaginationSelector] = useState(false); - const { lastAction, notify } = useGlobalInfoStore(); const { getText, startGetText, stopGetText, getScreenshot, startGetScreenshot, stopGetScreenshot, getList, startGetList, stopGetList } = useActionContext(); const { browserSteps, updateBrowserTextStepLabel, deleteBrowserStep, addScreenshotStep } = useBrowserSteps(); From 2109c0ddad2c55667bafecacfe151c179828e8e7 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sun, 1 Sep 2024 01:05:11 +0530 Subject: [PATCH 138/328] feat: pass selector in getList pagination settings --- src/components/organisms/RightSidePanel.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 5cb8ce28..21b13e10 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -113,7 +113,8 @@ export const RightSidePanel = () => { listSelector: step.listSelector, fields: fields, pagination: { - type: selectedPaginationSetting || '' + type: selectedPaginationSetting || '', + selector: paginationSelector || undefined } }; From af552f2a116e1a01698ad3e088ed1cedeae86afd Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sun, 1 Sep 2024 01:08:24 +0530 Subject: [PATCH 139/328] feat: pass selectedPaginationSetiing & paginationSelector in dependency array --- src/components/organisms/RightSidePanel.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 21b13e10..b6b58a85 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -122,7 +122,7 @@ export const RightSidePanel = () => { }); return settings; - }, [browserSteps]); + }, [browserSteps, selectedPaginationSetting, paginationSelector]); const stopCaptureAndEmitGetListSettings = useCallback(() => { From d6dcdd0a87e499aea983f04122f45f9179dd9e23 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sun, 1 Sep 2024 01:10:09 +0530 Subject: [PATCH 140/328] feat: accept selector for clickNext & clickLoadMore pagination type --- src/components/organisms/RightSidePanel.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index b6b58a85..e858f10c 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -148,6 +148,12 @@ export const RightSidePanel = () => { const handlePaginationSettingSelect = (option: string) => { setSelectedPaginationSetting(option); + if (['clickNext', 'clickLoadMore'].includes(option)) { + setShowPaginationSelector(true); + } else { + setShowPaginationSelector(false); + setPaginationSelector(null); + } }; const captureScreenshot = (fullPage: boolean) => { From 259012407bed843d63d257aaaab6c1de3202531e Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sun, 1 Sep 2024 01:12:03 +0530 Subject: [PATCH 141/328] feat: emit socket to start pagination selection via UI --- src/components/organisms/RightSidePanel.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index e858f10c..5cdbb5f4 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -156,6 +156,12 @@ export const RightSidePanel = () => { } }; + const handleStartPaginationSelection = () => { + // Start the process of selecting the pagination element + socket?.emit('action', { action: 'startPaginationSelection' }); + }; + + const captureScreenshot = (fullPage: boolean) => { const screenshotSettings: ScreenshotSettings = { fullPage, From 0d71cd7d100a44063b11e8fba2a24e0ba9edeb79 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sun, 1 Sep 2024 01:13:29 +0530 Subject: [PATCH 142/328] feat: handle pagination selection before emitting getList settings --- src/components/organisms/RightSidePanel.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 5cdbb5f4..b56544da 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -140,11 +140,16 @@ export const RightSidePanel = () => { setShowPaginationOptions(true); return; } - // Proceed to stop capture and emit settings only after pagination type is selected + if (['clickNext', 'clickLoadMore'].includes(selectedPaginationSetting) && !paginationSelector) { + notify('error', 'Please select the pagination element first.'); + return; + } stopCaptureAndEmitGetListSettings(); setShowPaginationOptions(false); + setShowPaginationSelector(false); setSelectedPaginationSetting(null); - }, [selectedPaginationSetting, stopCaptureAndEmitGetListSettings]); + setPaginationSelector(null); + }, [selectedPaginationSetting, paginationSelector, stopCaptureAndEmitGetListSettings, notify]); const handlePaginationSettingSelect = (option: string) => { setSelectedPaginationSetting(option); From 148e3363f6894e1364cd46fe89b86f5de8803711 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sun, 1 Sep 2024 01:17:15 +0530 Subject: [PATCH 143/328] feat: pagination selection ui --- src/components/organisms/RightSidePanel.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index b56544da..fb2fae9b 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -209,6 +209,16 @@ export const RightSidePanel = () => { )} +{showPaginationSelector && ( + + Please select the pagination element on the page + + {paginationSelector && ( + Selected pagination element: {paginationSelector} + )} + + )} + {!getText && !getScreenshot && !getList && } {getText && <> From 8f3984c8e0189b648b31286fe12bcba3821a23d5 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sun, 1 Sep 2024 01:17:36 +0530 Subject: [PATCH 144/328] chore: lint --- src/components/organisms/RightSidePanel.tsx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index fb2fae9b..e060b6ef 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -209,15 +209,15 @@ export const RightSidePanel = () => { )} -{showPaginationSelector && ( - - Please select the pagination element on the page - - {paginationSelector && ( - Selected pagination element: {paginationSelector} - )} - - )} + {showPaginationSelector && ( + + Please select the pagination element on the page + + {paginationSelector && ( + Selected pagination element: {paginationSelector} + )} + + )} {!getText && !getScreenshot && !getList && } {getText && From 0ca42510b0a90b1f647310edaf57aed0dfd97e16 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sun, 1 Sep 2024 22:42:34 +0530 Subject: [PATCH 145/328] feat: state for pagination selection --- src/components/organisms/RightSidePanel.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index e060b6ef..f7c727ed 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -26,6 +26,8 @@ export const RightSidePanel = () => { 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(); From e4496317946ea77e6227c84f5507dcd7a9b5a3b1 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sun, 1 Sep 2024 22:42:54 +0530 Subject: [PATCH 146/328] fix: whitespace --- src/components/organisms/RightSidePanel.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index f7c727ed..4d419860 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -28,7 +28,6 @@ export const RightSidePanel = () => { 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(); const { browserSteps, updateBrowserTextStepLabel, deleteBrowserStep, addScreenshotStep } = useBrowserSteps(); From d0f554a7c124eb00ca97631cff6ee89bec59b8aa Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sun, 1 Sep 2024 22:44:03 +0530 Subject: [PATCH 147/328] feat: start pagination selection --- src/components/organisms/RightSidePanel.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 4d419860..4756be46 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -164,6 +164,7 @@ export const RightSidePanel = () => { const handleStartPaginationSelection = () => { // Start the process of selecting the pagination element + setIsSelectingPagination(true); socket?.emit('action', { action: 'startPaginationSelection' }); }; From c98b5b605421b9448415201a61184918f0eaf66a Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sun, 1 Sep 2024 22:45:22 +0530 Subject: [PATCH 148/328] feat: check if pagination setting selected --- src/components/organisms/RightSidePanel.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 4756be46..f0766768 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -153,6 +153,10 @@ export const RightSidePanel = () => { }, [selectedPaginationSetting, paginationSelector, stopCaptureAndEmitGetListSettings, notify]); const handlePaginationSettingSelect = (option: string) => { + if (!selectedPaginationSetting) { + setShowPaginationOptions(true); + return; + } setSelectedPaginationSetting(option); if (['clickNext', 'clickLoadMore'].includes(option)) { setShowPaginationSelector(true); From 6efdea4133b5c3cb0125792f701e2c81d643f9e6 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sun, 1 Sep 2024 22:46:31 +0530 Subject: [PATCH 149/328] fix: revert changes --- src/components/organisms/RightSidePanel.tsx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index f0766768..4756be46 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -153,10 +153,6 @@ export const RightSidePanel = () => { }, [selectedPaginationSetting, paginationSelector, stopCaptureAndEmitGetListSettings, notify]); const handlePaginationSettingSelect = (option: string) => { - if (!selectedPaginationSetting) { - setShowPaginationOptions(true); - return; - } setSelectedPaginationSetting(option); if (['clickNext', 'clickLoadMore'].includes(option)) { setShowPaginationSelector(true); From 8817657af0e5144e8b8d02949a02766309ea0535 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sun, 1 Sep 2024 22:47:06 +0530 Subject: [PATCH 150/328] fix: setIsSelectingPagination to false --- src/components/organisms/RightSidePanel.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 4756be46..426a7c04 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -150,6 +150,7 @@ export const RightSidePanel = () => { setShowPaginationSelector(false); setSelectedPaginationSetting(null); setPaginationSelector(null); + setIsSelectingPagination(false); }, [selectedPaginationSetting, paginationSelector, stopCaptureAndEmitGetListSettings, notify]); const handlePaginationSettingSelect = (option: string) => { From 4669d4021144a35a6852c1163cdebf3d438aeb91 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sun, 1 Sep 2024 22:48:20 +0530 Subject: [PATCH 151/328] feat: handle pagination selection in use effect --- src/components/organisms/RightSidePanel.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 426a7c04..5ff7c471 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -184,6 +184,14 @@ export const RightSidePanel = () => { stopGetScreenshot(); }; + useEffect(() => { + const handlePaginationSelection = (data: { selector: string }) => { + setPaginationSelector(data.selector); + setIsSelectingPagination(false); + }; + + }); + return ( From f8ea80a18ad5884443d6093ad7923c910adf66e2 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sun, 1 Sep 2024 22:49:38 +0530 Subject: [PATCH 152/328] feat: socket for pagination selection --- src/components/organisms/RightSidePanel.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 5ff7c471..09a40be7 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -190,7 +190,12 @@ export const RightSidePanel = () => { setIsSelectingPagination(false); }; - }); + socket?.on('paginationSelected', handlePaginationSelection); + + return () => { + socket?.off('paginationSelected', handlePaginationSelection); + }; + }, [socket]); return ( From 093fa2d202483d840b73ce705dfe7a41bb1b91fc Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sun, 1 Sep 2024 22:51:08 +0530 Subject: [PATCH 153/328] fix: import useEffect --- src/components/organisms/RightSidePanel.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 09a40be7..303b6a0c 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -1,4 +1,4 @@ -import React, { useState, useCallback } from 'react'; +import React, { useState, useCallback, useEffect } from 'react'; import { Button, Paper, Box, TextField } from "@mui/material"; import EditIcon from '@mui/icons-material/Edit'; import TextFieldsIcon from '@mui/icons-material/TextFields'; From a128c150cc1cef25ae9a944d72bdde6551d3389c Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sun, 1 Sep 2024 22:53:32 +0530 Subject: [PATCH 154/328] feat: show user selection is happenning --- src/components/organisms/RightSidePanel.tsx | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 303b6a0c..5df7903b 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -225,15 +225,17 @@ export const RightSidePanel = () => { )} - {showPaginationSelector && ( - - Please select the pagination element on the page - - {paginationSelector && ( - Selected pagination element: {paginationSelector} - )} - - )} +{showPaginationSelector && ( + + Please select the pagination element on the page + + {paginationSelector && ( + Selected pagination element: {paginationSelector} + )} + + )} {!getText && !getScreenshot && !getList && } {getText && From aa8ee34eb36d1e30351fd76acd8e15b9ba0a789b Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sun, 1 Sep 2024 22:53:51 +0530 Subject: [PATCH 155/328] chore: lint --- src/components/organisms/RightSidePanel.tsx | 22 ++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 5df7903b..20798646 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -225,17 +225,17 @@ export const RightSidePanel = () => { )} -{showPaginationSelector && ( - - Please select the pagination element on the page - - {paginationSelector && ( - Selected pagination element: {paginationSelector} - )} - - )} + {showPaginationSelector && ( + + Please select the pagination element on the page + + {paginationSelector && ( + Selected pagination element: {paginationSelector} + )} + + )} {!getText && !getScreenshot && !getList && } {getText && From be79f84d8da3d3764e500586cb4587b0957ad8e5 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sun, 1 Sep 2024 22:54:38 +0530 Subject: [PATCH 156/328] feat: disable confirm button during pagination selection --- src/components/organisms/RightSidePanel.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 20798646..115497b8 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -241,7 +241,7 @@ export const RightSidePanel = () => { {getText && <> - + From e4eed64cb94a9c32e444241de850e1f29e55a288 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 2 Sep 2024 01:56:22 +0530 Subject: [PATCH 157/328] feat: disable discard button during pagination selection --- src/components/organisms/RightSidePanel.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 115497b8..102cf3c0 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -242,7 +242,7 @@ export const RightSidePanel = () => { <> - + } From dd3886ccb1a069ad8166c51c43d9199bb9037202 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 2 Sep 2024 01:58:59 +0530 Subject: [PATCH 158/328] feat: state to check pagination selection status --- src/components/organisms/BrowserWindow.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index bd7fc9ae..913f9c53 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -54,6 +54,7 @@ export const BrowserWindow = () => { const [showAttributeModal, setShowAttributeModal] = useState(false); const [attributeOptions, setAttributeOptions] = useState([]); const [selectedElement, setSelectedElement] = useState<{ selector: string, info: ElementInfo | null } | null>(null); + const [isSelectingPagination, setIsSelectingPagination] = useState(false); const [listSelector, setListSelector] = useState(null); const [fields, setFields] = useState>({}); From 97b1012a86293481bfe0ee0f9f4413bf7a975f3b Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 2 Sep 2024 02:34:19 +0530 Subject: [PATCH 159/328] feat: useEffect for pagination selection start --- src/components/organisms/BrowserWindow.tsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index 913f9c53..10b11179 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -248,6 +248,18 @@ export const BrowserWindow = () => { setShowAttributeModal(false); }; + useEffect(() => { + const handleStartPaginationSelection = () => { + setIsSelectingPagination(true); + }; + + socket?.on('startPaginationSelection', handleStartPaginationSelection); + + return () => { + socket?.off('startPaginationSelection', handleStartPaginationSelection); + }; + }, [socket]); + return (
{ From 656a82c8644a561a37fad1285b840793c3e968b5 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 2 Sep 2024 02:36:47 +0530 Subject: [PATCH 160/328] feat: handleClick case for pagination selection --- src/components/organisms/BrowserWindow.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index 10b11179..eaa82cc6 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -130,6 +130,11 @@ export const BrowserWindow = () => { ) { const options = getAttributeOptions(highlighterData.elementInfo?.tagName || '', highlighterData.elementInfo); + if (isSelectingPagination) { + socket?.emit('paginationSelected', { selector: highlighterData.selector }); + setIsSelectingPagination(false); + } + if (getText === true) { if (options.length === 1) { // Directly use the available attribute if only one option is present From 88b7a7bf166587c3674c8d7b5ded861939ca711f Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 2 Sep 2024 10:31:27 +0530 Subject: [PATCH 161/328] chore: lint --- server/src/workflow-management/selector.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/server/src/workflow-management/selector.ts b/server/src/workflow-management/selector.ts index 00a19f40..96e1737d 100644 --- a/server/src/workflow-management/selector.ts +++ b/server/src/workflow-management/selector.ts @@ -754,11 +754,23 @@ export const getNonUniqueSelectors = async (page: Page, coordinates: Coordinates function getSelectorPath(element: HTMLElement | null): string { const path: string[] = []; - while (element && element !== document.body) { + let depth = 0; + const maxDepth = 2; // Limiting the depth of the selector path + + while (element && element !== document.body && depth < maxDepth) { const selector = getNonUniqueSelector(element); + + // Stop adding selectors when we reach certain container elements + if (selector.includes('quotes') || selector.includes('container')) { + path.unshift(selector); + break; + } + path.unshift(selector); element = element.parentElement; + depth++; } + return path.join(' > '); } @@ -781,6 +793,7 @@ export const getNonUniqueSelectors = async (page: Page, coordinates: Coordinates + /** * Returns the first pair from the given workflow that contains the given selector * inside the where condition, and it is the only selector there. From 002e17b5966354f41b90f666d0b6a2c92ff29982 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 2 Sep 2024 10:31:45 +0530 Subject: [PATCH 162/328] fix: whitespace --- server/src/workflow-management/selector.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/server/src/workflow-management/selector.ts b/server/src/workflow-management/selector.ts index 96e1737d..b3bc27f9 100644 --- a/server/src/workflow-management/selector.ts +++ b/server/src/workflow-management/selector.ts @@ -790,10 +790,6 @@ export const getNonUniqueSelectors = async (page: Page, coordinates: Coordinates } }; - - - - /** * Returns the first pair from the given workflow that contains the given selector * inside the where condition, and it is the only selector there. From ab7f5f969bea34e90425cd7bb69aeef236433327 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 2 Sep 2024 11:54:02 +0530 Subject: [PATCH 163/328] fix: remove hard-coded selectors for selector path --- server/src/workflow-management/selector.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/server/src/workflow-management/selector.ts b/server/src/workflow-management/selector.ts index b3bc27f9..1941e49d 100644 --- a/server/src/workflow-management/selector.ts +++ b/server/src/workflow-management/selector.ts @@ -760,12 +760,6 @@ export const getNonUniqueSelectors = async (page: Page, coordinates: Coordinates while (element && element !== document.body && depth < maxDepth) { const selector = getNonUniqueSelector(element); - // Stop adding selectors when we reach certain container elements - if (selector.includes('quotes') || selector.includes('container')) { - path.unshift(selector); - break; - } - path.unshift(selector); element = element.parentElement; depth++; @@ -790,6 +784,7 @@ export const getNonUniqueSelectors = async (page: Page, coordinates: Coordinates } }; + /** * Returns the first pair from the given workflow that contains the given selector * inside the where condition, and it is the only selector there. From d9e67694945ba739deae661813ab82eec46d4a00 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 2 Sep 2024 11:59:34 +0530 Subject: [PATCH 164/328] feat: get children selectors of each gen selector --- server/src/workflow-management/selector.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/server/src/workflow-management/selector.ts b/server/src/workflow-management/selector.ts index 1941e49d..8f5d2cf8 100644 --- a/server/src/workflow-management/selector.ts +++ b/server/src/workflow-management/selector.ts @@ -759,7 +759,6 @@ export const getNonUniqueSelectors = async (page: Page, coordinates: Coordinates while (element && element !== document.body && depth < maxDepth) { const selector = getNonUniqueSelector(element); - path.unshift(selector); element = element.parentElement; depth++; @@ -768,12 +767,27 @@ export const getNonUniqueSelectors = async (page: Page, coordinates: Coordinates return path.join(' > '); } + function getChildSelectors(parent: HTMLElement): string[] { + const childSelectors: string[] = []; + const children = parent.querySelectorAll('*'); + + children.forEach(child => { + const childSelector = getSelectorPath(child as HTMLElement); + childSelectors.push(childSelector); + }); + + return childSelectors; + } + const element = document.elementFromPoint(x, y) as HTMLElement | null; if (!element) return null; const generalSelector = getSelectorPath(element); + const childSelectors = getChildSelectors(element); + return { generalSelector, + childSelectors, }; }, coordinates); @@ -785,6 +799,7 @@ export const getNonUniqueSelectors = async (page: Page, coordinates: Coordinates }; + /** * Returns the first pair from the given workflow that contains the given selector * inside the where condition, and it is the only selector there. From 06292ef9eda23f2a47d97f0def58675328f045a6 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 2 Sep 2024 11:59:59 +0530 Subject: [PATCH 165/328] chore: lint --- server/src/workflow-management/selector.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/server/src/workflow-management/selector.ts b/server/src/workflow-management/selector.ts index 8f5d2cf8..25615a2c 100644 --- a/server/src/workflow-management/selector.ts +++ b/server/src/workflow-management/selector.ts @@ -748,7 +748,6 @@ export const getNonUniqueSelectors = async (page: Page, coordinates: Coordinates } } } - return selector; } @@ -763,7 +762,6 @@ export const getNonUniqueSelectors = async (page: Page, coordinates: Coordinates element = element.parentElement; depth++; } - return path.join(' > '); } @@ -775,7 +773,6 @@ export const getNonUniqueSelectors = async (page: Page, coordinates: Coordinates const childSelector = getSelectorPath(child as HTMLElement); childSelectors.push(childSelector); }); - return childSelectors; } From 3538a8e70fccec66496af42b4c15488b4892e334 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 2 Sep 2024 20:21:53 +0530 Subject: [PATCH 166/328] feat(ts): interface for nonUniqueSelectors result --- server/src/workflow-management/selector.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/src/workflow-management/selector.ts b/server/src/workflow-management/selector.ts index 25615a2c..e24e3f33 100644 --- a/server/src/workflow-management/selector.ts +++ b/server/src/workflow-management/selector.ts @@ -721,6 +721,10 @@ export const getSelectors = async (page: Page, coordinates: Coordinates) => { return null; }; +interface NonUniqueSelectorsResult { + generalSelector: string; + childSelectors: string[]; +} /** * Returns the best non-unique css {@link Selectors} for the element on the page. From 27da289660daacebf4f6598259ad513423d93e47 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 2 Sep 2024 20:22:21 +0530 Subject: [PATCH 167/328] feat(ts): define return type --- server/src/workflow-management/selector.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/workflow-management/selector.ts b/server/src/workflow-management/selector.ts index e24e3f33..3f70530f 100644 --- a/server/src/workflow-management/selector.ts +++ b/server/src/workflow-management/selector.ts @@ -734,7 +734,7 @@ interface NonUniqueSelectorsResult { * @returns {Promise} */ -export const getNonUniqueSelectors = async (page: Page, coordinates: Coordinates) => { +export const getNonUniqueSelectors = async (page: Page, coordinates: Coordinates): Promise => { try { const selectors = await page.evaluate(({ x, y }: { x: number, y: number }) => { From 45f776c6f29996999ae490834e7ff220aa969a16 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 2 Sep 2024 20:23:11 +0530 Subject: [PATCH 168/328] feat: handle parent and child selectors --- server/src/workflow-management/selector.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/workflow-management/selector.ts b/server/src/workflow-management/selector.ts index 3f70530f..d94ba14c 100644 --- a/server/src/workflow-management/selector.ts +++ b/server/src/workflow-management/selector.ts @@ -792,7 +792,7 @@ export const getNonUniqueSelectors = async (page: Page, coordinates: Coordinates }; }, coordinates); - return selectors || {}; + return selectors || { generalSelector: '', childSelectors: [] }; } catch (error) { console.error('Error in getNonUniqueSelectors:', error); return {}; From 159c6bdcf43c839b7ff96edb2bc45d54604ab11f Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 2 Sep 2024 20:23:45 +0530 Subject: [PATCH 169/328] feat: return empty parent & child selector on error --- server/src/workflow-management/selector.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/workflow-management/selector.ts b/server/src/workflow-management/selector.ts index d94ba14c..ab454895 100644 --- a/server/src/workflow-management/selector.ts +++ b/server/src/workflow-management/selector.ts @@ -795,7 +795,7 @@ export const getNonUniqueSelectors = async (page: Page, coordinates: Coordinates return selectors || { generalSelector: '', childSelectors: [] }; } catch (error) { console.error('Error in getNonUniqueSelectors:', error); - return {}; + return { generalSelector: '', childSelectors: [] }; } }; From 5abdc15d89983f6a33c2c05d89f3bd1896301785 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 2 Sep 2024 20:24:39 +0530 Subject: [PATCH 170/328] feat: retrieve parent & child selector --- server/src/workflow-management/classes/Generator.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/src/workflow-management/classes/Generator.ts b/server/src/workflow-management/classes/Generator.ts index a7b5a641..595875fa 100644 --- a/server/src/workflow-management/classes/Generator.ts +++ b/server/src/workflow-management/classes/Generator.ts @@ -476,6 +476,11 @@ export class WorkflowGenerator { */ private generateSelector = async (page: Page, coordinates: Coordinates, action: ActionType) => { const elementInfo = await getElementInformation(page, coordinates); + const nonUniqueDebug = await getNonUniqueSelectors(page, coordinates) + + const { generalSelector, childSelectors } = await getNonUniqueSelectors(page, coordinates); + + console.log('Non Unique Selectors [DEBUG]:',nonUniqueDebug); const selectorBasedOnCustomAction = (this.getList === true) ? await getNonUniqueSelectors(page, coordinates) From 62bb74a0c43c85a6768cc263348df053dbd12f3a Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 2 Sep 2024 20:25:10 +0530 Subject: [PATCH 171/328] feat use generalSelector for custom action --- server/src/workflow-management/classes/Generator.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/workflow-management/classes/Generator.ts b/server/src/workflow-management/classes/Generator.ts index 595875fa..e65fb18e 100644 --- a/server/src/workflow-management/classes/Generator.ts +++ b/server/src/workflow-management/classes/Generator.ts @@ -483,7 +483,7 @@ export class WorkflowGenerator { console.log('Non Unique Selectors [DEBUG]:',nonUniqueDebug); const selectorBasedOnCustomAction = (this.getList === true) - ? await getNonUniqueSelectors(page, coordinates) + ? generalSelector : await getSelectors(page, coordinates); const bestSelector = getBestSelectorForAction( { From 8a264506335af48d2b4814d9b158eb04b70d91fe Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 2 Sep 2024 20:29:43 +0530 Subject: [PATCH 172/328] fix: revert changes --- server/src/workflow-management/classes/Generator.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/server/src/workflow-management/classes/Generator.ts b/server/src/workflow-management/classes/Generator.ts index e65fb18e..90f6f5ee 100644 --- a/server/src/workflow-management/classes/Generator.ts +++ b/server/src/workflow-management/classes/Generator.ts @@ -478,12 +478,10 @@ export class WorkflowGenerator { const elementInfo = await getElementInformation(page, coordinates); const nonUniqueDebug = await getNonUniqueSelectors(page, coordinates) - const { generalSelector, childSelectors } = await getNonUniqueSelectors(page, coordinates); - console.log('Non Unique Selectors [DEBUG]:',nonUniqueDebug); const selectorBasedOnCustomAction = (this.getList === true) - ? generalSelector + ? await getNonUniqueSelectors(page, coordinates) : await getSelectors(page, coordinates); const bestSelector = getBestSelectorForAction( { From 66c40ed6433ae6856d90bb256dcbcdb9e8fdcdcc Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 2 Sep 2024 20:40:17 +0530 Subject: [PATCH 173/328] feat: move child selector in a separate function --- server/src/workflow-management/selector.ts | 28 +++++----------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/server/src/workflow-management/selector.ts b/server/src/workflow-management/selector.ts index ab454895..1941e49d 100644 --- a/server/src/workflow-management/selector.ts +++ b/server/src/workflow-management/selector.ts @@ -721,10 +721,6 @@ export const getSelectors = async (page: Page, coordinates: Coordinates) => { return null; }; -interface NonUniqueSelectorsResult { - generalSelector: string; - childSelectors: string[]; -} /** * Returns the best non-unique css {@link Selectors} for the element on the page. @@ -734,7 +730,7 @@ interface NonUniqueSelectorsResult { * @returns {Promise} */ -export const getNonUniqueSelectors = async (page: Page, coordinates: Coordinates): Promise => { +export const getNonUniqueSelectors = async (page: Page, coordinates: Coordinates) => { try { const selectors = await page.evaluate(({ x, y }: { x: number, y: number }) => { @@ -752,6 +748,7 @@ export const getNonUniqueSelectors = async (page: Page, coordinates: Coordinates } } } + return selector; } @@ -762,45 +759,32 @@ export const getNonUniqueSelectors = async (page: Page, coordinates: Coordinates while (element && element !== document.body && depth < maxDepth) { const selector = getNonUniqueSelector(element); + path.unshift(selector); element = element.parentElement; depth++; } + return path.join(' > '); } - function getChildSelectors(parent: HTMLElement): string[] { - const childSelectors: string[] = []; - const children = parent.querySelectorAll('*'); - - children.forEach(child => { - const childSelector = getSelectorPath(child as HTMLElement); - childSelectors.push(childSelector); - }); - return childSelectors; - } - const element = document.elementFromPoint(x, y) as HTMLElement | null; if (!element) return null; const generalSelector = getSelectorPath(element); - const childSelectors = getChildSelectors(element); - return { generalSelector, - childSelectors, }; }, coordinates); - return selectors || { generalSelector: '', childSelectors: [] }; + return selectors || {}; } catch (error) { console.error('Error in getNonUniqueSelectors:', error); - return { generalSelector: '', childSelectors: [] }; + return {}; } }; - /** * Returns the first pair from the given workflow that contains the given selector * inside the where condition, and it is the only selector there. From 8d9663dc467a6c8fc5d84f1f5bfbc75cdc9697d4 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 2 Sep 2024 20:42:46 +0530 Subject: [PATCH 174/328] feat(ts): define return type as string --- server/src/workflow-management/selector.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/workflow-management/selector.ts b/server/src/workflow-management/selector.ts index 1941e49d..59011204 100644 --- a/server/src/workflow-management/selector.ts +++ b/server/src/workflow-management/selector.ts @@ -730,7 +730,7 @@ export const getSelectors = async (page: Page, coordinates: Coordinates) => { * @returns {Promise} */ -export const getNonUniqueSelectors = async (page: Page, coordinates: Coordinates) => { +export const getNonUniqueSelectors = async (page: Page, coordinates: Coordinates): Promise => { try { const selectors = await page.evaluate(({ x, y }: { x: number, y: number }) => { From d66f071e63602b52e00ca533f77d32b1eb8e09ce Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 2 Sep 2024 20:43:41 +0530 Subject: [PATCH 175/328] chore: revert --- server/src/workflow-management/selector.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/workflow-management/selector.ts b/server/src/workflow-management/selector.ts index 59011204..1941e49d 100644 --- a/server/src/workflow-management/selector.ts +++ b/server/src/workflow-management/selector.ts @@ -730,7 +730,7 @@ export const getSelectors = async (page: Page, coordinates: Coordinates) => { * @returns {Promise} */ -export const getNonUniqueSelectors = async (page: Page, coordinates: Coordinates): Promise => { +export const getNonUniqueSelectors = async (page: Page, coordinates: Coordinates) => { try { const selectors = await page.evaluate(({ x, y }: { x: number, y: number }) => { From 8fe1b61fdd4f2e3ba8f85c7a5f7e3dfa5c4193e3 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 2 Sep 2024 20:46:30 +0530 Subject: [PATCH 176/328] feat: get child selectors --- server/src/workflow-management/selector.ts | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/server/src/workflow-management/selector.ts b/server/src/workflow-management/selector.ts index 1941e49d..02e5f494 100644 --- a/server/src/workflow-management/selector.ts +++ b/server/src/workflow-management/selector.ts @@ -785,6 +785,37 @@ export const getNonUniqueSelectors = async (page: Page, coordinates: Coordinates }; +export const getChildSelectors = async (page: Page, parentSelector: string): Promise => { + try { + const childSelectors = await page.evaluate((parentSelector: string) => { + const parentElement = document.querySelector(parentSelector); + if (!parentElement) return []; + + const childElements = Array.from(parentElement.children); + return childElements.map(child => { + let selector = child.tagName.toLowerCase(); + if (child.className) { + const classes = child.className.split(/\s+/).filter((cls: string) => Boolean(cls)); + if (classes.length > 0) { + const validClasses = classes.filter((cls: string) => !cls.startsWith('!') && !cls.includes(':')); + if (validClasses.length > 0) { + selector += '.' + validClasses.map(cls => CSS.escape(cls)).join('.'); + } + } + } + return selector; + }); + }, parentSelector); + + return childSelectors || []; + } catch (error) { + console.error('Error in getChildSelectors:', error); + return []; + } +}; + + + /** * Returns the first pair from the given workflow that contains the given selector * inside the where condition, and it is the only selector there. From 116683bb82d855dd6962294ff739ba0f6b532bb2 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 2 Sep 2024 20:47:02 +0530 Subject: [PATCH 177/328] chore: lint --- server/src/workflow-management/selector.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/server/src/workflow-management/selector.ts b/server/src/workflow-management/selector.ts index 02e5f494..a553064f 100644 --- a/server/src/workflow-management/selector.ts +++ b/server/src/workflow-management/selector.ts @@ -784,7 +784,6 @@ export const getNonUniqueSelectors = async (page: Page, coordinates: Coordinates } }; - export const getChildSelectors = async (page: Page, parentSelector: string): Promise => { try { const childSelectors = await page.evaluate((parentSelector: string) => { From 9a68c219f4744da785c0cb39e80f0744450c39b0 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 2 Sep 2024 22:06:48 +0530 Subject: [PATCH 178/328] feat: import getChildSelectors --- server/src/workflow-management/classes/Generator.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/server/src/workflow-management/classes/Generator.ts b/server/src/workflow-management/classes/Generator.ts index 90f6f5ee..7073fd06 100644 --- a/server/src/workflow-management/classes/Generator.ts +++ b/server/src/workflow-management/classes/Generator.ts @@ -7,6 +7,7 @@ import { getElementInformation, getRect, getSelectors, + getChildSelectors, getNonUniqueSelectors, isRuleOvershadowing, selectorAlreadyInWorkflow From 407917dfe11356faeb06bdcc29e5d13de5fd0d0f Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 2 Sep 2024 22:37:25 +0530 Subject: [PATCH 179/328] feat: define return type --- server/src/workflow-management/selector.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/src/workflow-management/selector.ts b/server/src/workflow-management/selector.ts index a553064f..d948b01a 100644 --- a/server/src/workflow-management/selector.ts +++ b/server/src/workflow-management/selector.ts @@ -722,6 +722,10 @@ export const getSelectors = async (page: Page, coordinates: Coordinates) => { }; +interface SelectorResult { + generalSelector: string; +} + /** * Returns the best non-unique css {@link Selectors} for the element on the page. * @param page The page instance. From efb284b1e630060d657c5e23a7ee434d307d8ed7 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 2 Sep 2024 22:37:39 +0530 Subject: [PATCH 180/328] feat: define return type --- server/src/workflow-management/selector.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/workflow-management/selector.ts b/server/src/workflow-management/selector.ts index d948b01a..71a0e965 100644 --- a/server/src/workflow-management/selector.ts +++ b/server/src/workflow-management/selector.ts @@ -734,7 +734,7 @@ interface SelectorResult { * @returns {Promise} */ -export const getNonUniqueSelectors = async (page: Page, coordinates: Coordinates) => { +export const getNonUniqueSelectors = async (page: Page, coordinates: Coordinates): Promise => { try { const selectors = await page.evaluate(({ x, y }: { x: number, y: number }) => { From fd63b0788b54501a9c01c9aba6b916f73685b591 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 2 Sep 2024 22:37:57 +0530 Subject: [PATCH 181/328] feat: handle empty return --- server/src/workflow-management/selector.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/src/workflow-management/selector.ts b/server/src/workflow-management/selector.ts index 71a0e965..ac65aa50 100644 --- a/server/src/workflow-management/selector.ts +++ b/server/src/workflow-management/selector.ts @@ -781,10 +781,11 @@ export const getNonUniqueSelectors = async (page: Page, coordinates: Coordinates }; }, coordinates); - return selectors || {}; + return selectors || {generalSelector: ''}; } catch (error) { console.error('Error in getNonUniqueSelectors:', error); - return {}; + return { generalSelector: '' }; + } }; From 3dd4cdcf7896cb873efcb8e43781dfce631efe4c Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 2 Sep 2024 22:40:31 +0530 Subject: [PATCH 182/328] chore: lint --- server/src/workflow-management/selector.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/server/src/workflow-management/selector.ts b/server/src/workflow-management/selector.ts index ac65aa50..8de62203 100644 --- a/server/src/workflow-management/selector.ts +++ b/server/src/workflow-management/selector.ts @@ -781,7 +781,7 @@ export const getNonUniqueSelectors = async (page: Page, coordinates: Coordinates }; }, coordinates); - return selectors || {generalSelector: ''}; + return selectors || { generalSelector: '' }; } catch (error) { console.error('Error in getNonUniqueSelectors:', error); return { generalSelector: '' }; @@ -818,8 +818,6 @@ export const getChildSelectors = async (page: Page, parentSelector: string): Pro } }; - - /** * Returns the first pair from the given workflow that contains the given selector * inside the where condition, and it is the only selector there. From 6a2a67e0906d3bfa79105392df4de9a9dd65c21a Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 2 Sep 2024 22:44:30 +0530 Subject: [PATCH 183/328] feat(temp): generate child selectors from general selectors --- server/src/workflow-management/classes/Generator.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server/src/workflow-management/classes/Generator.ts b/server/src/workflow-management/classes/Generator.ts index 7073fd06..dc916810 100644 --- a/server/src/workflow-management/classes/Generator.ts +++ b/server/src/workflow-management/classes/Generator.ts @@ -477,9 +477,11 @@ export class WorkflowGenerator { */ private generateSelector = async (page: Page, coordinates: Coordinates, action: ActionType) => { const elementInfo = await getElementInformation(page, coordinates); - const nonUniqueDebug = await getNonUniqueSelectors(page, coordinates) + const generalSelector = await getNonUniqueSelectors(page, coordinates) + const childSelectors = await getChildSelectors(page, generalSelector.generalSelector); - console.log('Non Unique Selectors [DEBUG]:',nonUniqueDebug); + console.log('Non Unique Selectors [DEBUG]:', generalSelector); + console.log('Child Selectors [DEBUG]:', childSelectors); const selectorBasedOnCustomAction = (this.getList === true) ? await getNonUniqueSelectors(page, coordinates) From c2472c2251077f84781ffeb2da9ab3190cb5dfc0 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 2 Sep 2024 23:13:29 +0530 Subject: [PATCH 184/328] feat: send childSelectors in payload for getList --- server/src/workflow-management/classes/Generator.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/server/src/workflow-management/classes/Generator.ts b/server/src/workflow-management/classes/Generator.ts index dc916810..64ca0519 100644 --- a/server/src/workflow-management/classes/Generator.ts +++ b/server/src/workflow-management/classes/Generator.ts @@ -513,7 +513,14 @@ export class WorkflowGenerator { const displaySelector = await this.generateSelector(page, coordinates, ActionType.Click); const elementInfo = await getElementInformation(page, coordinates); if (rect) { - this.socket.emit('highlighter', { rect, selector: displaySelector, elementInfo }); + if (this.getList === true) { + const childSelectors = await getChildSelectors(page, displaySelector || ''); + this.socket.emit('highlighter', { rect, selector: displaySelector, elementInfo, childSelectors }) + } else { + this.socket.emit('highlighter', { rect, selector: displaySelector, elementInfo }); + + } + } // reset getList after usage this.getList = false; From 00e28c97413fc8c5420af78aad5b794169b72b57 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Tue, 3 Sep 2024 03:30:53 +0530 Subject: [PATCH 185/328] feat: set depth for child selectors --- server/src/workflow-management/selector.ts | 46 ++++++++++++++-------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/server/src/workflow-management/selector.ts b/server/src/workflow-management/selector.ts index 8de62203..10d0c894 100644 --- a/server/src/workflow-management/selector.ts +++ b/server/src/workflow-management/selector.ts @@ -789,27 +789,40 @@ export const getNonUniqueSelectors = async (page: Page, coordinates: Coordinates } }; -export const getChildSelectors = async (page: Page, parentSelector: string): Promise => { +export const getChildSelectors = async (page: Page, parentSelector: string, maxDepth: number = 2): Promise => { try { - const childSelectors = await page.evaluate((parentSelector: string) => { - const parentElement = document.querySelector(parentSelector); - if (!parentElement) return []; + const childSelectors = await page.evaluate(({ parentSelector, maxDepth }: { parentSelector: string, maxDepth: number }) => { + function getSelectors(element: HTMLElement, currentDepth: number): string[] { + if (currentDepth > maxDepth) return []; - const childElements = Array.from(parentElement.children); - return childElements.map(child => { - let selector = child.tagName.toLowerCase(); - if (child.className) { - const classes = child.className.split(/\s+/).filter((cls: string) => Boolean(cls)); - if (classes.length > 0) { - const validClasses = classes.filter((cls: string) => !cls.startsWith('!') && !cls.includes(':')); - if (validClasses.length > 0) { - selector += '.' + validClasses.map(cls => CSS.escape(cls)).join('.'); + const selectors: string[] = []; + const childElements = Array.from(element.children); + + for (const child of childElements) { + let selector = child.tagName.toLowerCase(); + if (child.className) { + const classes = child.className.split(/\s+/).filter((cls: string) => Boolean(cls)); + if (classes.length > 0) { + const validClasses = classes.filter((cls: string) => !cls.startsWith('!') && !cls.includes(':')); + if (validClasses.length > 0) { + selector += '.' + validClasses.map(cls => CSS.escape(cls)).join('.'); + } } } + selectors.push(selector); + + // Recursively get selectors for deeper levels + selectors.push(...getSelectors(child as HTMLElement, currentDepth + 1)); } - return selector; - }); - }, parentSelector); + + return selectors; + } + + const parentElement = document.querySelector(parentSelector) as HTMLElement; + if (!parentElement) return []; + + return getSelectors(parentElement, 0); + }, { parentSelector, maxDepth }); return childSelectors || []; } catch (error) { @@ -818,6 +831,7 @@ export const getChildSelectors = async (page: Page, parentSelector: string): Pro } }; + /** * Returns the first pair from the given workflow that contains the given selector * inside the where condition, and it is the only selector there. From 7e7f6dac482bb9319f917d9599ded71e87724a10 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Tue, 3 Sep 2024 03:31:33 +0530 Subject: [PATCH 186/328] feat: standalone functin to generate non unique selectors --- server/src/workflow-management/selector.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/server/src/workflow-management/selector.ts b/server/src/workflow-management/selector.ts index 10d0c894..5f896548 100644 --- a/server/src/workflow-management/selector.ts +++ b/server/src/workflow-management/selector.ts @@ -721,6 +721,23 @@ export const getSelectors = async (page: Page, coordinates: Coordinates) => { return null; }; +function generateNonUniqueSelector(element: HTMLElement): string { + let selector = element.tagName.toLowerCase(); + + if (element.className) { + const classes = element.className.split(/\s+/).filter((cls: string) => Boolean(cls)); + if (classes.length > 0) { + const validClasses = classes.filter((cls: string) => !cls.startsWith('!') && !cls.includes(':')); + if (validClasses.length > 0) { + selector += '.' + validClasses.map(cls => CSS.escape(cls)).join('.'); + } + } + } + + return selector; +} + + interface SelectorResult { generalSelector: string; From f491d1bf3d1d74c2dfd497207164c0fd7bc5087b Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Tue, 3 Sep 2024 03:34:17 +0530 Subject: [PATCH 187/328] refactor: use generateNonUniqueSelector --- server/src/workflow-management/selector.ts | 32 +++++++++++----------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/server/src/workflow-management/selector.ts b/server/src/workflow-management/selector.ts index 5f896548..ff269b71 100644 --- a/server/src/workflow-management/selector.ts +++ b/server/src/workflow-management/selector.ts @@ -755,23 +755,23 @@ export const getNonUniqueSelectors = async (page: Page, coordinates: Coordinates try { const selectors = await page.evaluate(({ x, y }: { x: number, y: number }) => { - function getNonUniqueSelector(element: HTMLElement): string { - let selector = element.tagName.toLowerCase(); + // function getNonUniqueSelector(element: HTMLElement): string { + // let selector = element.tagName.toLowerCase(); - // Avoid using IDs to maintain non-uniqueness - if (element.className) { - const classes = element.className.split(/\s+/).filter((cls: string) => Boolean(cls)); - if (classes.length > 0) { - // Exclude utility classes and escape special characters - const validClasses = classes.filter((cls: string) => !cls.startsWith('!') && !cls.includes(':')); - if (validClasses.length > 0) { - selector += '.' + validClasses.map(cls => CSS.escape(cls)).join('.'); - } - } - } + // // Avoid using IDs to maintain non-uniqueness + // if (element.className) { + // const classes = element.className.split(/\s+/).filter((cls: string) => Boolean(cls)); + // if (classes.length > 0) { + // // Exclude utility classes and escape special characters + // const validClasses = classes.filter((cls: string) => !cls.startsWith('!') && !cls.includes(':')); + // if (validClasses.length > 0) { + // selector += '.' + validClasses.map(cls => CSS.escape(cls)).join('.'); + // } + // } + // } - return selector; - } + // return selector; + // } function getSelectorPath(element: HTMLElement | null): string { const path: string[] = []; @@ -779,7 +779,7 @@ export const getNonUniqueSelectors = async (page: Page, coordinates: Coordinates const maxDepth = 2; // Limiting the depth of the selector path while (element && element !== document.body && depth < maxDepth) { - const selector = getNonUniqueSelector(element); + const selector = generateNonUniqueSelector(element); path.unshift(selector); element = element.parentElement; From 8b20b8223b956f358894fd2768069a365c7dbdc8 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Tue, 3 Sep 2024 03:45:06 +0530 Subject: [PATCH 188/328] fix: revert --- server/src/workflow-management/selector.ts | 99 ++++++++-------------- 1 file changed, 34 insertions(+), 65 deletions(-) diff --git a/server/src/workflow-management/selector.ts b/server/src/workflow-management/selector.ts index ff269b71..8de62203 100644 --- a/server/src/workflow-management/selector.ts +++ b/server/src/workflow-management/selector.ts @@ -721,23 +721,6 @@ export const getSelectors = async (page: Page, coordinates: Coordinates) => { return null; }; -function generateNonUniqueSelector(element: HTMLElement): string { - let selector = element.tagName.toLowerCase(); - - if (element.className) { - const classes = element.className.split(/\s+/).filter((cls: string) => Boolean(cls)); - if (classes.length > 0) { - const validClasses = classes.filter((cls: string) => !cls.startsWith('!') && !cls.includes(':')); - if (validClasses.length > 0) { - selector += '.' + validClasses.map(cls => CSS.escape(cls)).join('.'); - } - } - } - - return selector; -} - - interface SelectorResult { generalSelector: string; @@ -755,23 +738,23 @@ export const getNonUniqueSelectors = async (page: Page, coordinates: Coordinates try { const selectors = await page.evaluate(({ x, y }: { x: number, y: number }) => { - // function getNonUniqueSelector(element: HTMLElement): string { - // let selector = element.tagName.toLowerCase(); + function getNonUniqueSelector(element: HTMLElement): string { + let selector = element.tagName.toLowerCase(); - // // Avoid using IDs to maintain non-uniqueness - // if (element.className) { - // const classes = element.className.split(/\s+/).filter((cls: string) => Boolean(cls)); - // if (classes.length > 0) { - // // Exclude utility classes and escape special characters - // const validClasses = classes.filter((cls: string) => !cls.startsWith('!') && !cls.includes(':')); - // if (validClasses.length > 0) { - // selector += '.' + validClasses.map(cls => CSS.escape(cls)).join('.'); - // } - // } - // } + // Avoid using IDs to maintain non-uniqueness + if (element.className) { + const classes = element.className.split(/\s+/).filter((cls: string) => Boolean(cls)); + if (classes.length > 0) { + // Exclude utility classes and escape special characters + const validClasses = classes.filter((cls: string) => !cls.startsWith('!') && !cls.includes(':')); + if (validClasses.length > 0) { + selector += '.' + validClasses.map(cls => CSS.escape(cls)).join('.'); + } + } + } - // return selector; - // } + return selector; + } function getSelectorPath(element: HTMLElement | null): string { const path: string[] = []; @@ -779,7 +762,7 @@ export const getNonUniqueSelectors = async (page: Page, coordinates: Coordinates const maxDepth = 2; // Limiting the depth of the selector path while (element && element !== document.body && depth < maxDepth) { - const selector = generateNonUniqueSelector(element); + const selector = getNonUniqueSelector(element); path.unshift(selector); element = element.parentElement; @@ -806,40 +789,27 @@ export const getNonUniqueSelectors = async (page: Page, coordinates: Coordinates } }; -export const getChildSelectors = async (page: Page, parentSelector: string, maxDepth: number = 2): Promise => { +export const getChildSelectors = async (page: Page, parentSelector: string): Promise => { try { - const childSelectors = await page.evaluate(({ parentSelector, maxDepth }: { parentSelector: string, maxDepth: number }) => { - function getSelectors(element: HTMLElement, currentDepth: number): string[] { - if (currentDepth > maxDepth) return []; - - const selectors: string[] = []; - const childElements = Array.from(element.children); - - for (const child of childElements) { - let selector = child.tagName.toLowerCase(); - if (child.className) { - const classes = child.className.split(/\s+/).filter((cls: string) => Boolean(cls)); - if (classes.length > 0) { - const validClasses = classes.filter((cls: string) => !cls.startsWith('!') && !cls.includes(':')); - if (validClasses.length > 0) { - selector += '.' + validClasses.map(cls => CSS.escape(cls)).join('.'); - } - } - } - selectors.push(selector); - - // Recursively get selectors for deeper levels - selectors.push(...getSelectors(child as HTMLElement, currentDepth + 1)); - } - - return selectors; - } - - const parentElement = document.querySelector(parentSelector) as HTMLElement; + const childSelectors = await page.evaluate((parentSelector: string) => { + const parentElement = document.querySelector(parentSelector); if (!parentElement) return []; - return getSelectors(parentElement, 0); - }, { parentSelector, maxDepth }); + const childElements = Array.from(parentElement.children); + return childElements.map(child => { + let selector = child.tagName.toLowerCase(); + if (child.className) { + const classes = child.className.split(/\s+/).filter((cls: string) => Boolean(cls)); + if (classes.length > 0) { + const validClasses = classes.filter((cls: string) => !cls.startsWith('!') && !cls.includes(':')); + if (validClasses.length > 0) { + selector += '.' + validClasses.map(cls => CSS.escape(cls)).join('.'); + } + } + } + return selector; + }); + }, parentSelector); return childSelectors || []; } catch (error) { @@ -848,7 +818,6 @@ export const getChildSelectors = async (page: Page, parentSelector: string, maxD } }; - /** * Returns the first pair from the given workflow that contains the given selector * inside the where condition, and it is the only selector there. From 9843116cbfa277ff093c84970ba9bd53b3aff461 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Tue, 3 Sep 2024 05:30:46 +0530 Subject: [PATCH 189/328] feat: generate same child & nonunique seelctors --- server/src/workflow-management/selector.ts | 45 +++++++++++++++------- 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/server/src/workflow-management/selector.ts b/server/src/workflow-management/selector.ts index 8de62203..b8f9d3d5 100644 --- a/server/src/workflow-management/selector.ts +++ b/server/src/workflow-management/selector.ts @@ -741,11 +741,9 @@ export const getNonUniqueSelectors = async (page: Page, coordinates: Coordinates function getNonUniqueSelector(element: HTMLElement): string { let selector = element.tagName.toLowerCase(); - // Avoid using IDs to maintain non-uniqueness if (element.className) { const classes = element.className.split(/\s+/).filter((cls: string) => Boolean(cls)); if (classes.length > 0) { - // Exclude utility classes and escape special characters const validClasses = classes.filter((cls: string) => !cls.startsWith('!') && !cls.includes(':')); if (validClasses.length > 0) { selector += '.' + validClasses.map(cls => CSS.escape(cls)).join('.'); @@ -759,11 +757,10 @@ export const getNonUniqueSelectors = async (page: Page, coordinates: Coordinates function getSelectorPath(element: HTMLElement | null): string { const path: string[] = []; let depth = 0; - const maxDepth = 2; // Limiting the depth of the selector path + const maxDepth = 2; while (element && element !== document.body && depth < maxDepth) { const selector = getNonUniqueSelector(element); - path.unshift(selector); element = element.parentElement; depth++; @@ -785,21 +782,19 @@ export const getNonUniqueSelectors = async (page: Page, coordinates: Coordinates } catch (error) { console.error('Error in getNonUniqueSelectors:', error); return { generalSelector: '' }; - } }; + export const getChildSelectors = async (page: Page, parentSelector: string): Promise => { try { const childSelectors = await page.evaluate((parentSelector: string) => { - const parentElement = document.querySelector(parentSelector); - if (!parentElement) return []; - const childElements = Array.from(parentElement.children); - return childElements.map(child => { - let selector = child.tagName.toLowerCase(); - if (child.className) { - const classes = child.className.split(/\s+/).filter((cls: string) => Boolean(cls)); + function getNonUniqueSelector(element: HTMLElement): string { + let selector = element.tagName.toLowerCase(); + + if (element.className) { + const classes = element.className.split(/\s+/).filter((cls: string) => Boolean(cls)); if (classes.length > 0) { const validClasses = classes.filter((cls: string) => !cls.startsWith('!') && !cls.includes(':')); if (validClasses.length > 0) { @@ -807,8 +802,30 @@ export const getChildSelectors = async (page: Page, parentSelector: string): Pro } } } + return selector; - }); + } + + function getSelectorPath(element: HTMLElement | null): string { + const path: string[] = []; + let depth = 0; + const maxDepth = 2; + + while (element && element !== document.body && depth < maxDepth) { + const selector = getNonUniqueSelector(element); + path.unshift(selector); + element = element.parentElement; + depth++; + } + + return path.join(' > '); + } + + const parentElement = document.querySelector(parentSelector); + if (!parentElement) return []; + + const childElements = Array.from(parentElement.children) as HTMLElement[]; // Type assertion to HTMLElement[] + return childElements.map(child => getSelectorPath(child)); }, parentSelector); return childSelectors || []; @@ -818,6 +835,8 @@ export const getChildSelectors = async (page: Page, parentSelector: string): Pro } }; + + /** * Returns the first pair from the given workflow that contains the given selector * inside the where condition, and it is the only selector there. From 0dfb3f66735235a6c4fffb00b9362fde3aeff3fe Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Tue, 3 Sep 2024 05:49:47 +0530 Subject: [PATCH 190/328] feat: hierarchical selectors --- server/src/workflow-management/selector.ts | 30 +++++++++++++++------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/server/src/workflow-management/selector.ts b/server/src/workflow-management/selector.ts index b8f9d3d5..3b4e7c07 100644 --- a/server/src/workflow-management/selector.ts +++ b/server/src/workflow-management/selector.ts @@ -784,12 +784,14 @@ export const getNonUniqueSelectors = async (page: Page, coordinates: Coordinates return { generalSelector: '' }; } }; +interface SelectorNode { + selector: string; + children: SelectorNode[]; +} - -export const getChildSelectors = async (page: Page, parentSelector: string): Promise => { +export const getChildSelectors = async (page: Page, parentSelector: string, maxDepth: number = 2): Promise => { try { - const childSelectors = await page.evaluate((parentSelector: string) => { - + const childSelectors = await page.evaluate(({ parentSelector, maxDepth }: { parentSelector: string, maxDepth: number }) => { function getNonUniqueSelector(element: HTMLElement): string { let selector = element.tagName.toLowerCase(); @@ -809,7 +811,6 @@ export const getChildSelectors = async (page: Page, parentSelector: string): Pro function getSelectorPath(element: HTMLElement | null): string { const path: string[] = []; let depth = 0; - const maxDepth = 2; while (element && element !== document.body && depth < maxDepth) { const selector = getNonUniqueSelector(element); @@ -821,12 +822,23 @@ export const getChildSelectors = async (page: Page, parentSelector: string): Pro return path.join(' > '); } - const parentElement = document.querySelector(parentSelector); + function getDescendantSelectors(element: HTMLElement, currentDepth: number = 0): SelectorNode[] { + if (currentDepth >= maxDepth) return []; + + const children = Array.from(element.children) as HTMLElement[]; + return children.map(child => { + return { + selector: getSelectorPath(child), + children: getDescendantSelectors(child, currentDepth + 1) + }; + }); + } + + const parentElement = document.querySelector(parentSelector) as HTMLElement; if (!parentElement) return []; - const childElements = Array.from(parentElement.children) as HTMLElement[]; // Type assertion to HTMLElement[] - return childElements.map(child => getSelectorPath(child)); - }, parentSelector); + return getDescendantSelectors(parentElement); + }, { parentSelector, maxDepth }); return childSelectors || []; } catch (error) { From e727d11861825a5bc4b9e514080f2df1c029cc2a Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Tue, 3 Sep 2024 05:50:04 +0530 Subject: [PATCH 191/328] feat: get all descendant selectors --- server/src/workflow-management/selector.ts | 25 +++++++++++----------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/server/src/workflow-management/selector.ts b/server/src/workflow-management/selector.ts index 3b4e7c07..aacc9a5e 100644 --- a/server/src/workflow-management/selector.ts +++ b/server/src/workflow-management/selector.ts @@ -784,12 +784,9 @@ export const getNonUniqueSelectors = async (page: Page, coordinates: Coordinates return { generalSelector: '' }; } }; -interface SelectorNode { - selector: string; - children: SelectorNode[]; -} -export const getChildSelectors = async (page: Page, parentSelector: string, maxDepth: number = 2): Promise => { + +export const getChildSelectors = async (page: Page, parentSelector: string, maxDepth: number = 2): Promise => { try { const childSelectors = await page.evaluate(({ parentSelector, maxDepth }: { parentSelector: string, maxDepth: number }) => { function getNonUniqueSelector(element: HTMLElement): string { @@ -822,22 +819,24 @@ export const getChildSelectors = async (page: Page, parentSelector: string, maxD return path.join(' > '); } - function getDescendantSelectors(element: HTMLElement, currentDepth: number = 0): SelectorNode[] { + function getAllDescendantSelectors(element: HTMLElement, currentDepth: number = 0): string[] { if (currentDepth >= maxDepth) return []; + let selectors: string[] = []; const children = Array.from(element.children) as HTMLElement[]; - return children.map(child => { - return { - selector: getSelectorPath(child), - children: getDescendantSelectors(child, currentDepth + 1) - }; - }); + + for (const child of children) { + selectors.push(getSelectorPath(child)); + selectors = selectors.concat(getAllDescendantSelectors(child, currentDepth + 1)); + } + + return selectors; } const parentElement = document.querySelector(parentSelector) as HTMLElement; if (!parentElement) return []; - return getDescendantSelectors(parentElement); + return getAllDescendantSelectors(parentElement); }, { parentSelector, maxDepth }); return childSelectors || []; From f09cb3fc73b38e8c681655ff3b921ab9367c4de3 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Tue, 3 Sep 2024 06:13:26 +0530 Subject: [PATCH 192/328] fix: check type of className --- server/src/workflow-management/selector.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/server/src/workflow-management/selector.ts b/server/src/workflow-management/selector.ts index aacc9a5e..09b8b88f 100644 --- a/server/src/workflow-management/selector.ts +++ b/server/src/workflow-management/selector.ts @@ -786,14 +786,16 @@ export const getNonUniqueSelectors = async (page: Page, coordinates: Coordinates }; -export const getChildSelectors = async (page: Page, parentSelector: string, maxDepth: number = 2): Promise => { +export const getChildSelectors = async (page: Page, parentSelector: string, maxDepth: number = 5): Promise => { try { const childSelectors = await page.evaluate(({ parentSelector, maxDepth }: { parentSelector: string, maxDepth: number }) => { function getNonUniqueSelector(element: HTMLElement): string { let selector = element.tagName.toLowerCase(); - if (element.className) { - const classes = element.className.split(/\s+/).filter((cls: string) => Boolean(cls)); + // Ensure that className is a string before splitting + const className = typeof element.className === 'string' ? element.className : ''; + if (className) { + const classes = className.split(/\s+/).filter((cls: string) => Boolean(cls)); if (classes.length > 0) { const validClasses = classes.filter((cls: string) => !cls.startsWith('!') && !cls.includes(':')); if (validClasses.length > 0) { From 3b398d1027def107d3437c621bf48f5c733b5cd7 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Tue, 3 Sep 2024 09:06:27 +0530 Subject: [PATCH 193/328] feat: produce full path from child element up to top-level parent --- server/src/workflow-management/selector.ts | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/server/src/workflow-management/selector.ts b/server/src/workflow-management/selector.ts index 09b8b88f..40dd414b 100644 --- a/server/src/workflow-management/selector.ts +++ b/server/src/workflow-management/selector.ts @@ -786,13 +786,12 @@ export const getNonUniqueSelectors = async (page: Page, coordinates: Coordinates }; -export const getChildSelectors = async (page: Page, parentSelector: string, maxDepth: number = 5): Promise => { +export const getChildSelectors = async (page: Page, parentSelector: string): Promise => { try { - const childSelectors = await page.evaluate(({ parentSelector, maxDepth }: { parentSelector: string, maxDepth: number }) => { + const childSelectors = await page.evaluate((parentSelector: string) => { function getNonUniqueSelector(element: HTMLElement): string { let selector = element.tagName.toLowerCase(); - // Ensure that className is a string before splitting const className = typeof element.className === 'string' ? element.className : ''; if (className) { const classes = className.split(/\s+/).filter((cls: string) => Boolean(cls)); @@ -809,27 +808,23 @@ export const getChildSelectors = async (page: Page, parentSelector: string, maxD function getSelectorPath(element: HTMLElement | null): string { const path: string[] = []; - let depth = 0; - while (element && element !== document.body && depth < maxDepth) { + while (element && element !== document.body) { const selector = getNonUniqueSelector(element); path.unshift(selector); element = element.parentElement; - depth++; } return path.join(' > '); } - function getAllDescendantSelectors(element: HTMLElement, currentDepth: number = 0): string[] { - if (currentDepth >= maxDepth) return []; - + function getAllDescendantSelectors(element: HTMLElement): string[] { let selectors: string[] = []; const children = Array.from(element.children) as HTMLElement[]; for (const child of children) { selectors.push(getSelectorPath(child)); - selectors = selectors.concat(getAllDescendantSelectors(child, currentDepth + 1)); + selectors = selectors.concat(getAllDescendantSelectors(child)); } return selectors; @@ -839,7 +834,7 @@ export const getChildSelectors = async (page: Page, parentSelector: string, maxD if (!parentElement) return []; return getAllDescendantSelectors(parentElement); - }, { parentSelector, maxDepth }); + }, parentSelector); return childSelectors || []; } catch (error) { @@ -850,6 +845,7 @@ export const getChildSelectors = async (page: Page, parentSelector: string, maxD + /** * Returns the first pair from the given workflow that contains the given selector * inside the where condition, and it is the only selector there. From c587a3264b1758efee509644bb46203e60275780 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Tue, 3 Sep 2024 09:26:07 +0530 Subject: [PATCH 194/328] feat: generate selectors relative to the same parent element as getNonUniqueSelectors --- server/src/workflow-management/selector.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/server/src/workflow-management/selector.ts b/server/src/workflow-management/selector.ts index 40dd414b..f8ab5482 100644 --- a/server/src/workflow-management/selector.ts +++ b/server/src/workflow-management/selector.ts @@ -806,10 +806,10 @@ export const getChildSelectors = async (page: Page, parentSelector: string): Pro return selector; } - function getSelectorPath(element: HTMLElement | null): string { + function getSelectorPath(element: HTMLElement | null, stopAtParent: HTMLElement | null): string { const path: string[] = []; - while (element && element !== document.body) { + while (element && element !== stopAtParent && element !== document.body) { const selector = getNonUniqueSelector(element); path.unshift(selector); element = element.parentElement; @@ -818,13 +818,13 @@ export const getChildSelectors = async (page: Page, parentSelector: string): Pro return path.join(' > '); } - function getAllDescendantSelectors(element: HTMLElement): string[] { + function getAllDescendantSelectors(element: HTMLElement, stopAtParent: HTMLElement | null): string[] { let selectors: string[] = []; const children = Array.from(element.children) as HTMLElement[]; for (const child of children) { - selectors.push(getSelectorPath(child)); - selectors = selectors.concat(getAllDescendantSelectors(child)); + selectors.push(getSelectorPath(child, stopAtParent)); + selectors = selectors.concat(getAllDescendantSelectors(child, stopAtParent)); } return selectors; @@ -833,7 +833,7 @@ export const getChildSelectors = async (page: Page, parentSelector: string): Pro const parentElement = document.querySelector(parentSelector) as HTMLElement; if (!parentElement) return []; - return getAllDescendantSelectors(parentElement); + return getAllDescendantSelectors(parentElement, parentElement); }, parentSelector); return childSelectors || []; From 01e57ee5aaaebb0e544f822914ebab135725d7ba Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Tue, 3 Sep 2024 09:44:38 +0530 Subject: [PATCH 195/328] feat: include immediate parent of each child element in the selector path --- server/src/workflow-management/selector.ts | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/server/src/workflow-management/selector.ts b/server/src/workflow-management/selector.ts index f8ab5482..982bd664 100644 --- a/server/src/workflow-management/selector.ts +++ b/server/src/workflow-management/selector.ts @@ -806,24 +806,22 @@ export const getChildSelectors = async (page: Page, parentSelector: string): Pro return selector; } - function getSelectorPath(element: HTMLElement | null, stopAtParent: HTMLElement | null): string { - const path: string[] = []; - - while (element && element !== stopAtParent && element !== document.body) { - const selector = getNonUniqueSelector(element); - path.unshift(selector); - element = element.parentElement; - } - - return path.join(' > '); + function getSelectorPath(element: HTMLElement | null): string { + if (!element || !element.parentElement) return ''; + + const parentSelector = getNonUniqueSelector(element.parentElement); + const elementSelector = getNonUniqueSelector(element); + + return `${parentSelector} > ${elementSelector}`; } + function getAllDescendantSelectors(element: HTMLElement, stopAtParent: HTMLElement | null): string[] { let selectors: string[] = []; const children = Array.from(element.children) as HTMLElement[]; for (const child of children) { - selectors.push(getSelectorPath(child, stopAtParent)); + selectors.push(getSelectorPath(child)); selectors = selectors.concat(getAllDescendantSelectors(child, stopAtParent)); } From 497f29d4c48eb112a79cdee0ecebccffed36e92b Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Tue, 3 Sep 2024 09:44:58 +0530 Subject: [PATCH 196/328] chore: lint --- server/src/workflow-management/selector.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/server/src/workflow-management/selector.ts b/server/src/workflow-management/selector.ts index 982bd664..16a227a9 100644 --- a/server/src/workflow-management/selector.ts +++ b/server/src/workflow-management/selector.ts @@ -808,13 +808,12 @@ export const getChildSelectors = async (page: Page, parentSelector: string): Pro function getSelectorPath(element: HTMLElement | null): string { if (!element || !element.parentElement) return ''; - + const parentSelector = getNonUniqueSelector(element.parentElement); const elementSelector = getNonUniqueSelector(element); - + return `${parentSelector} > ${elementSelector}`; } - function getAllDescendantSelectors(element: HTMLElement, stopAtParent: HTMLElement | null): string[] { let selectors: string[] = []; From a29d9881cacddcd02f834b5e1c29d382555c702c Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Tue, 3 Sep 2024 09:45:09 +0530 Subject: [PATCH 197/328] chore: lint --- server/src/workflow-management/selector.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/server/src/workflow-management/selector.ts b/server/src/workflow-management/selector.ts index 16a227a9..475e3cef 100644 --- a/server/src/workflow-management/selector.ts +++ b/server/src/workflow-management/selector.ts @@ -840,9 +840,6 @@ export const getChildSelectors = async (page: Page, parentSelector: string): Pro } }; - - - /** * Returns the first pair from the given workflow that contains the given selector * inside the where condition, and it is the only selector there. From 60629f8382405613870162497ce0a1e34b7f2c83 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Tue, 3 Sep 2024 09:47:13 +0530 Subject: [PATCH 198/328] chore: todo --- server/src/workflow-management/selector.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/src/workflow-management/selector.ts b/server/src/workflow-management/selector.ts index 475e3cef..a91a4865 100644 --- a/server/src/workflow-management/selector.ts +++ b/server/src/workflow-management/selector.ts @@ -4,6 +4,11 @@ import { WhereWhatPair, WorkflowFile } from "maxun-core"; import logger from "../logger"; import { getBestSelectorForAction } from "./utils"; +/*TODO: +1. Handle TS errors (here we definetly know better) +2. Add pending function descriptions + thought process (esp. selector generation) +*/ + type Workflow = WorkflowFile["workflow"]; /** From b4f8cbb90102031ae62071c6cbb2adabaa761562 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Tue, 3 Sep 2024 09:47:40 +0530 Subject: [PATCH 199/328] fix: remove unused code --- server/src/workflow-management/selector.ts | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/server/src/workflow-management/selector.ts b/server/src/workflow-management/selector.ts index a91a4865..dfd4c452 100644 --- a/server/src/workflow-management/selector.ts +++ b/server/src/workflow-management/selector.ts @@ -102,21 +102,6 @@ export const getElementInformation = async ( }, { x: coordinates.x, y: coordinates.y }, ); - - // if (elementInfo) { - // if (elementInfo.tagName === 'A') { - // if (elementInfo.innerText) { - // console.log(`Link text: ${elementInfo.innerText}, URL: ${elementInfo.url}`); - // } else { - // console.log(`URL: ${elementInfo.url}`); - // } - // } else if (elementInfo.tagName === 'IMG') { - // console.log(`Image URL: ${elementInfo.imageUrl}`); - // } else { - // console.log(`Element innerText: ${elementInfo.innerText}`); - // } - // } - return elementInfo; } catch (error) { const { message, stack } = error as Error; From 0071e4bf24b38353747783fb91a57d5b98c1dd46 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Tue, 3 Sep 2024 10:02:45 +0530 Subject: [PATCH 200/328] feat: get childSelectors from highlight handler --- src/components/organisms/BrowserWindow.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index eaa82cc6..b840bb86 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -50,7 +50,7 @@ const getAttributeOptions = (tagName: string, elementInfo: ElementInfo | null): export const BrowserWindow = () => { const [canvasRef, setCanvasReference] = useState | undefined>(undefined); const [screenShot, setScreenShot] = useState(""); - const [highlighterData, setHighlighterData] = useState<{ rect: DOMRect, selector: string, elementInfo: ElementInfo | null; } | null>(null); + const [highlighterData, setHighlighterData] = useState<{ rect: DOMRect, selector: string, elementInfo: ElementInfo | null, childSelectors?: string } | null>(null); const [showAttributeModal, setShowAttributeModal] = useState(false); const [attributeOptions, setAttributeOptions] = useState([]); const [selectedElement, setSelectedElement] = useState<{ selector: string, info: ElementInfo | null } | null>(null); @@ -97,9 +97,10 @@ export const BrowserWindow = () => { } }, [screenShot, canvasRef, socket, screencastHandler]); - const highlighterHandler = useCallback((data: { rect: DOMRect, selector: string, elementInfo: ElementInfo | null }) => { + const highlighterHandler = useCallback((data: { rect: DOMRect, selector: string, elementInfo: ElementInfo | null, childSelectors?: string }) => { if (getList === true) { socket?.emit('setGetList', { getList: true }); + console.log('Child Selectors are:', data.childSelectors) } setHighlighterData(data); }, [highlighterData, getList, socket]); From c888f636b43ad5f9e04c31fe74a1cb0e9c734f4d Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Tue, 3 Sep 2024 10:06:59 +0530 Subject: [PATCH 201/328] feat: create getList in constructor --- server/src/workflow-management/classes/Generator.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/src/workflow-management/classes/Generator.ts b/server/src/workflow-management/classes/Generator.ts index 64ca0519..df94578e 100644 --- a/server/src/workflow-management/classes/Generator.ts +++ b/server/src/workflow-management/classes/Generator.ts @@ -54,6 +54,8 @@ export class WorkflowGenerator { */ private getList: boolean = false; + private listSelector: string = ''; + /** * The public constructor of the WorkflowGenerator. * Takes socket for communication as a parameter and registers some important events on it. From 8ee5d62157e4f9e5b16c033c49aee680bcd7a33c Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Tue, 3 Sep 2024 10:08:14 +0530 Subject: [PATCH 202/328] feat: initalize socket listen for listSelector --- server/src/workflow-management/classes/Generator.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/src/workflow-management/classes/Generator.ts b/server/src/workflow-management/classes/Generator.ts index df94578e..197cd8ab 100644 --- a/server/src/workflow-management/classes/Generator.ts +++ b/server/src/workflow-management/classes/Generator.ts @@ -106,6 +106,9 @@ export class WorkflowGenerator { this.socket.on('setGetList', (data: { getList: boolean }) => { this.getList = data.getList; }); + this.socket.on('listSelector', (data: { selector: string }) => { + this.listSelector = data.selector; + }) } /** From 46f1947bcfca3c5e1be6f376291df5149af2152d Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Tue, 3 Sep 2024 10:08:42 +0530 Subject: [PATCH 203/328] chore: lint --- server/src/workflow-management/classes/Generator.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/workflow-management/classes/Generator.ts b/server/src/workflow-management/classes/Generator.ts index 197cd8ab..8bc83967 100644 --- a/server/src/workflow-management/classes/Generator.ts +++ b/server/src/workflow-management/classes/Generator.ts @@ -108,7 +108,7 @@ export class WorkflowGenerator { }); this.socket.on('listSelector', (data: { selector: string }) => { this.listSelector = data.selector; - }) + }) } /** From d42e8f13dcf59ce3a6f111bd53d7c12dfaee9cbb Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Tue, 3 Sep 2024 10:19:18 +0530 Subject: [PATCH 204/328] feat: generate childSelectors based on listSelector --- server/src/workflow-management/classes/Generator.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server/src/workflow-management/classes/Generator.ts b/server/src/workflow-management/classes/Generator.ts index 8bc83967..7d91eaf9 100644 --- a/server/src/workflow-management/classes/Generator.ts +++ b/server/src/workflow-management/classes/Generator.ts @@ -519,8 +519,10 @@ export class WorkflowGenerator { const elementInfo = await getElementInformation(page, coordinates); if (rect) { if (this.getList === true) { - const childSelectors = await getChildSelectors(page, displaySelector || ''); - this.socket.emit('highlighter', { rect, selector: displaySelector, elementInfo, childSelectors }) + if (this.listSelector !== '') { + const childSelectors = await getChildSelectors(page, this.listSelector || ''); + this.socket.emit('highlighter', { rect, selector: displaySelector, elementInfo, childSelectors }) + } } else { this.socket.emit('highlighter', { rect, selector: displaySelector, elementInfo }); From 061a73603a22415a1b2126bb03d1af3ec20570da Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Tue, 3 Sep 2024 10:19:42 +0530 Subject: [PATCH 205/328] chore: lint --- server/src/workflow-management/classes/Generator.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/server/src/workflow-management/classes/Generator.ts b/server/src/workflow-management/classes/Generator.ts index 7d91eaf9..1f59b3f8 100644 --- a/server/src/workflow-management/classes/Generator.ts +++ b/server/src/workflow-management/classes/Generator.ts @@ -525,9 +525,7 @@ export class WorkflowGenerator { } } else { this.socket.emit('highlighter', { rect, selector: displaySelector, elementInfo }); - } - } // reset getList after usage this.getList = false; From 691c90fdb0eddd14d5fa9315d54fa5a72198714f Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Tue, 3 Sep 2024 10:20:07 +0530 Subject: [PATCH 206/328] feat: emit listSelector via socket --- src/components/organisms/BrowserWindow.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index b840bb86..14515420 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -100,6 +100,12 @@ export const BrowserWindow = () => { const highlighterHandler = useCallback((data: { rect: DOMRect, selector: string, elementInfo: ElementInfo | null, childSelectors?: string }) => { if (getList === true) { socket?.emit('setGetList', { getList: true }); + // console.log('Child Selectors are:', data.childSelectors) + + if (listSelector) { + socket?.emit('listSelector', { selector: listSelector }); + } + console.log('Child Selectors are:', data.childSelectors) } setHighlighterData(data); From 1a1ead572ef819844e67e1945b3c142430bd1bba Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Tue, 3 Sep 2024 10:20:32 +0530 Subject: [PATCH 207/328] fix: code cleanup --- src/components/organisms/BrowserWindow.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index 14515420..4ff3ecb9 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -100,13 +100,11 @@ export const BrowserWindow = () => { const highlighterHandler = useCallback((data: { rect: DOMRect, selector: string, elementInfo: ElementInfo | null, childSelectors?: string }) => { if (getList === true) { socket?.emit('setGetList', { getList: true }); - // console.log('Child Selectors are:', data.childSelectors) if (listSelector) { socket?.emit('listSelector', { selector: listSelector }); } - console.log('Child Selectors are:', data.childSelectors) } setHighlighterData(data); }, [highlighterData, getList, socket]); From f5b9b31fad98fc6aa027e6fcd80ed22a3cebb1ca Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Tue, 3 Sep 2024 10:57:43 +0530 Subject: [PATCH 208/328] feat: allow selection of only child elements in case of getList --- src/components/organisms/BrowserWindow.tsx | 27 +++++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index 4ff3ecb9..45a4c2d8 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -50,7 +50,7 @@ const getAttributeOptions = (tagName: string, elementInfo: ElementInfo | null): export const BrowserWindow = () => { const [canvasRef, setCanvasReference] = useState | undefined>(undefined); const [screenShot, setScreenShot] = useState(""); - const [highlighterData, setHighlighterData] = useState<{ rect: DOMRect, selector: string, elementInfo: ElementInfo | null, childSelectors?: string } | null>(null); + const [highlighterData, setHighlighterData] = useState<{ rect: DOMRect, selector: string, elementInfo: ElementInfo | null, childSelectors?: string[] } | null>(null); const [showAttributeModal, setShowAttributeModal] = useState(false); const [attributeOptions, setAttributeOptions] = useState([]); const [selectedElement, setSelectedElement] = useState<{ selector: string, info: ElementInfo | null } | null>(null); @@ -97,17 +97,25 @@ export const BrowserWindow = () => { } }, [screenShot, canvasRef, socket, screencastHandler]); - const highlighterHandler = useCallback((data: { rect: DOMRect, selector: string, elementInfo: ElementInfo | null, childSelectors?: string }) => { + const highlighterHandler = useCallback((data: { rect: DOMRect, selector: string, elementInfo: ElementInfo | null, childSelectors?: string[] }) => { if (getList === true) { socket?.emit('setGetList', { getList: true }); - + if (listSelector) { socket?.emit('listSelector', { selector: listSelector }); + + if (data.childSelectors && data.childSelectors.includes(data.selector)) { + setHighlighterData(data); + } else { + setHighlighterData(null); // Clear highlighter if not a valid child selector + } + } else { + setHighlighterData(data); } - + } else { + setHighlighterData(data); } - setHighlighterData(data); - }, [highlighterData, getList, socket]); + }, [highlighterData, getList, socket, listSelector]); useEffect(() => { document.addEventListener('mousemove', onMouseMove, false); @@ -133,6 +141,13 @@ export const BrowserWindow = () => { clickY >= highlightRect.top && clickY <= highlightRect.bottom ) { + // Check if the selected element is one of the childSelectors (if applicable) + if (highlighterData.childSelectors && highlighterData.childSelectors.length > 0) { + if (!highlighterData.childSelectors.includes(highlighterData.selector)) { + return; + } + } + const options = getAttributeOptions(highlighterData.elementInfo?.tagName || '', highlighterData.elementInfo); if (isSelectingPagination) { From 7021aa3c0a483ee8db8f86c3e75279c4282c3844 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Tue, 3 Sep 2024 10:58:40 +0530 Subject: [PATCH 209/328] chore: lint --- src/components/organisms/BrowserWindow.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index 45a4c2d8..bb7b5bd3 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -100,10 +100,10 @@ export const BrowserWindow = () => { const highlighterHandler = useCallback((data: { rect: DOMRect, selector: string, elementInfo: ElementInfo | null, childSelectors?: string[] }) => { if (getList === true) { socket?.emit('setGetList', { getList: true }); - + if (listSelector) { socket?.emit('listSelector', { selector: listSelector }); - + if (data.childSelectors && data.childSelectors.includes(data.selector)) { setHighlighterData(data); } else { @@ -141,12 +141,12 @@ export const BrowserWindow = () => { clickY >= highlightRect.top && clickY <= highlightRect.bottom ) { - // Check if the selected element is one of the childSelectors (if applicable) - if (highlighterData.childSelectors && highlighterData.childSelectors.length > 0) { - if (!highlighterData.childSelectors.includes(highlighterData.selector)) { - return; + // Check if the selected element is one of the childSelectors (if applicable) + if (highlighterData.childSelectors && highlighterData.childSelectors.length > 0) { + if (!highlighterData.childSelectors.includes(highlighterData.selector)) { + return; + } } - } const options = getAttributeOptions(highlighterData.elementInfo?.tagName || '', highlighterData.elementInfo); From 001286f5c66a5d479196efbf38e8313a58083824 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Tue, 3 Sep 2024 22:25:54 +0530 Subject: [PATCH 210/328] 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 && <> - - + + } From 38d83bd6a90f78af9d581fac032b21e790c9a105 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Tue, 3 Sep 2024 22:26:22 +0530 Subject: [PATCH 211/328] feat: -rm useEffect --- src/components/organisms/RightSidePanel.tsx | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index ef720c50..344ee164 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -173,14 +173,6 @@ export const RightSidePanel = () => { stopGetScreenshot(); }; - useEffect(() => { - socket?.on('paginationSelected', handlePaginationSelection); - - return () => { - socket?.off('paginationSelected', handlePaginationSelection); - }; - }, [socket]); - return ( From c007d2713d6034c66355401fcbecf0f239ab23ba Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Tue, 3 Sep 2024 22:26:40 +0530 Subject: [PATCH 212/328] chore: lint --- src/components/organisms/RightSidePanel.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 344ee164..202e0ee3 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -150,7 +150,7 @@ export const RightSidePanel = () => { const handlePaginationSettingSelect = (option: string) => { setSelectedPaginationSetting(option); if (['clickNext', 'clickLoadMore'].includes(option)) { - } + } }; const handleStartPaginationSelection = () => { @@ -200,7 +200,7 @@ export const RightSidePanel = () => { )} - + {!getText && !getScreenshot && !getList && } {getText && From 9115f46e4fd0efecc2bae0908396d45dfba50d7b Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Tue, 3 Sep 2024 22:31:08 +0530 Subject: [PATCH 213/328] fix: remove null --- src/components/organisms/RightSidePanel.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 202e0ee3..a3434ffe 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -144,7 +144,6 @@ export const RightSidePanel = () => { stopCaptureAndEmitGetListSettings(); setShowPaginationOptions(false); setSelectedPaginationSetting(null); - (null); }, [selectedPaginationSetting, stopCaptureAndEmitGetListSettings, notify]); const handlePaginationSettingSelect = (option: string) => { From 35e13baec0dc054fc59af576ceb0c5999f6aeac0 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Tue, 3 Sep 2024 23:40:03 +0530 Subject: [PATCH 214/328] fix: whitespace --- server/src/workflow-management/selector.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/server/src/workflow-management/selector.ts b/server/src/workflow-management/selector.ts index dfd4c452..0ef42c0c 100644 --- a/server/src/workflow-management/selector.ts +++ b/server/src/workflow-management/selector.ts @@ -581,8 +581,6 @@ export const getSelectors = async (page: Page, coordinates: Coordinates) => { return output; } - - const genSelectors = (element: HTMLElement | null) => { if (element == null) { return null; From eaa63e2139731d1d53f97cae67aa68d1846237f7 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Wed, 4 Sep 2024 04:26:53 +0530 Subject: [PATCH 215/328] feat: -rm pagination --- src/components/organisms/BrowserWindow.tsx | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index bb7b5bd3..b685281e 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -54,8 +54,6 @@ export const BrowserWindow = () => { const [showAttributeModal, setShowAttributeModal] = useState(false); const [attributeOptions, setAttributeOptions] = useState([]); const [selectedElement, setSelectedElement] = useState<{ selector: string, info: ElementInfo | null } | null>(null); - const [isSelectingPagination, setIsSelectingPagination] = useState(false); - const [listSelector, setListSelector] = useState(null); const [fields, setFields] = useState>({}); @@ -150,11 +148,6 @@ export const BrowserWindow = () => { const options = getAttributeOptions(highlighterData.elementInfo?.tagName || '', highlighterData.elementInfo); - if (isSelectingPagination) { - socket?.emit('paginationSelected', { selector: highlighterData.selector }); - setIsSelectingPagination(false); - } - if (getText === true) { if (options.length === 1) { // Directly use the available attribute if only one option is present @@ -273,18 +266,6 @@ export const BrowserWindow = () => { setShowAttributeModal(false); }; - useEffect(() => { - const handleStartPaginationSelection = () => { - setIsSelectingPagination(true); - }; - - socket?.on('startPaginationSelection', handleStartPaginationSelection); - - return () => { - socket?.off('startPaginationSelection', handleStartPaginationSelection); - }; - }, [socket]); - return (
{ From 036673e5ed75721cc17f8de11812d7f23b548f3f Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Wed, 4 Sep 2024 05:31:31 +0530 Subject: [PATCH 216/328] feat: create ids for each list step --- src/context/browserSteps.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/context/browserSteps.tsx b/src/context/browserSteps.tsx index 59cdb546..d09da443 100644 --- a/src/context/browserSteps.tsx +++ b/src/context/browserSteps.tsx @@ -33,7 +33,7 @@ export interface SelectorObject { interface BrowserStepsContextType { browserSteps: BrowserStep[]; addTextStep: (label: string, data: string, selectorObj: SelectorObject) => void; - addListStep: (listSelector: string, fields: { [key: string]: TextStep }) => void + addListStep: (listSelector: string, fields: { [key: string]: TextStep }, listId: number) => void addScreenshotStep: (fullPage: boolean) => void; deleteBrowserStep: (id: number) => void; updateBrowserTextStepLabel: (id: number, newLabel: string) => void; @@ -51,10 +51,10 @@ export const BrowserStepsProvider: React.FC<{ children: React.ReactNode }> = ({ ]); }; - const addListStep = (listSelector: string, newFields: { [key: string]: TextStep }) => { + const addListStep = (listSelector: string, newFields: { [key: string]: TextStep }, listId: number) => { setBrowserSteps(prevSteps => { const existingListStepIndex = prevSteps.findIndex( - step => step.type === 'list' && step.listSelector === listSelector + step => step.type === 'list' && step.id === listId ); if (existingListStepIndex !== -1) { // Update the existing ListStep with new fields @@ -69,7 +69,7 @@ export const BrowserStepsProvider: React.FC<{ children: React.ReactNode }> = ({ // Create a new ListStep return [ ...prevSteps, - { id: Date.now(), type: 'list', listSelector, fields: newFields } + { id: listId, type: 'list', listSelector, fields: newFields } ]; } }); From c594633b74a6346ab94d7fd1843420a32df41193 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Wed, 4 Sep 2024 05:32:39 +0530 Subject: [PATCH 217/328] feat: reset getList state after emitting settings --- src/components/organisms/BrowserWindow.tsx | 31 +++++++++++++++------ src/components/organisms/RightSidePanel.tsx | 10 +++++++ 2 files changed, 32 insertions(+), 9 deletions(-) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index b685281e..ab532320 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -54,6 +54,8 @@ export const BrowserWindow = () => { const [showAttributeModal, setShowAttributeModal] = useState(false); const [attributeOptions, setAttributeOptions] = useState([]); const [selectedElement, setSelectedElement] = useState<{ selector: string, info: ElementInfo | null } | null>(null); + const [currentListId, setCurrentListId] = useState(null); + const [listSelector, setListSelector] = useState(null); const [fields, setFields] = useState>({}); @@ -77,6 +79,18 @@ export const BrowserWindow = () => { } }; + const resetListState = useCallback(() => { + setListSelector(null); + setFields({}); + setCurrentListId(null); + }, []); + + useEffect(() => { + if (!getList) { + resetListState(); + } + }, [getList, resetListState]); + const screencastHandler = useCallback((data: string) => { setScreenShot(data); }, [screenShot]); @@ -139,12 +153,6 @@ export const BrowserWindow = () => { clickY >= highlightRect.top && clickY <= highlightRect.bottom ) { - // Check if the selected element is one of the childSelectors (if applicable) - if (highlighterData.childSelectors && highlighterData.childSelectors.length > 0) { - if (!highlighterData.childSelectors.includes(highlighterData.selector)) { - return; - } - } const options = getAttributeOptions(highlighterData.elementInfo?.tagName || '', highlighterData.elementInfo); @@ -174,7 +182,10 @@ export const BrowserWindow = () => { if (getList === true && !listSelector) { setListSelector(highlighterData.selector); - } else if (getList === true && listSelector) { + console.log('After set',listSelector) + setCurrentListId(Date.now()); + setFields({}); + } else if (getList === true && listSelector && currentListId) { if (options.length === 1) { // Handle directly without showing the modal const attribute = options[0].value; @@ -199,8 +210,10 @@ export const BrowserWindow = () => { }); if (listSelector) { - addListStep(listSelector, { ...fields, [newField.label]: newField }); + addListStep(listSelector, { ...fields, [newField.label]: newField }, currentListId || 0); } + + console.log('end',listSelector) } else { // Show the modal if there are multiple options setAttributeOptions(options); @@ -258,7 +271,7 @@ export const BrowserWindow = () => { }); if (listSelector) { - addListStep(listSelector, { ...fields, [newField.label]: newField }); + addListStep(listSelector, { ...fields, [newField.label]: newField }, currentListId || 0); } } } diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index a3434ffe..ee8dce7b 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -121,6 +121,16 @@ export const RightSidePanel = () => { return settings; }, [browserSteps, selectedPaginationSetting]); + const resetListState = useCallback(() => { + setShowPaginationOptions(false); + setSelectedPaginationSetting(null); + }, []); + + const handleStopGetList = useCallback(() => { + stopGetList(); + resetListState(); + }, [stopGetList, resetListState]); + const stopCaptureAndEmitGetListSettings = useCallback(() => { stopGetList(); From b3f1e5f385958fcfe2eaece592c4e40d0f0de002 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Wed, 4 Sep 2024 05:34:56 +0530 Subject: [PATCH 218/328] feat: call handleStopGetList() --- src/components/organisms/RightSidePanel.tsx | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index ee8dce7b..7dc12e2a 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -122,14 +122,14 @@ export const RightSidePanel = () => { }, [browserSteps, selectedPaginationSetting]); const resetListState = useCallback(() => { - setShowPaginationOptions(false); - setSelectedPaginationSetting(null); - }, []); + setShowPaginationOptions(false); + setSelectedPaginationSetting(null); +}, []); - const handleStopGetList = useCallback(() => { - stopGetList(); - resetListState(); - }, [stopGetList, resetListState]); +const handleStopGetList = useCallback(() => { + stopGetList(); + resetListState(); +}, [stopGetList, resetListState]); const stopCaptureAndEmitGetListSettings = useCallback(() => { @@ -140,7 +140,8 @@ export const RightSidePanel = () => { } else { notify('error', 'Unable to create list settings. Make sure you have defined a field for the list.'); } - }, [stopGetList, getListSettingsObject, socket, notify]); + handleStopGetList(); + }, [stopGetList, getListSettingsObject, socket, notify, handleStopGetList]); const handleConfirmListCapture = useCallback(() => { if (!selectedPaginationSetting) { From 97658fc9a143d431d9248e0f205cac83ae38f604 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Wed, 4 Sep 2024 05:35:16 +0530 Subject: [PATCH 219/328] chore: lint --- src/components/organisms/RightSidePanel.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 7dc12e2a..cf76f739 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -124,12 +124,12 @@ export const RightSidePanel = () => { const resetListState = useCallback(() => { setShowPaginationOptions(false); setSelectedPaginationSetting(null); -}, []); + }, []); -const handleStopGetList = useCallback(() => { + const handleStopGetList = useCallback(() => { stopGetList(); resetListState(); -}, [stopGetList, resetListState]); + }, [stopGetList, resetListState]); const stopCaptureAndEmitGetListSettings = useCallback(() => { From 5149af870eb9eb53f894c559e953a19ea5b253c6 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Wed, 4 Sep 2024 05:35:45 +0530 Subject: [PATCH 220/328] chore: lint --- src/components/organisms/BrowserWindow.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index ab532320..db474ae0 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -182,7 +182,7 @@ export const BrowserWindow = () => { if (getList === true && !listSelector) { setListSelector(highlighterData.selector); - console.log('After set',listSelector) + console.log('After set', listSelector) setCurrentListId(Date.now()); setFields({}); } else if (getList === true && listSelector && currentListId) { @@ -213,7 +213,7 @@ export const BrowserWindow = () => { addListStep(listSelector, { ...fields, [newField.label]: newField }, currentListId || 0); } - console.log('end',listSelector) + console.log('end', listSelector) } else { // Show the modal if there are multiple options setAttributeOptions(options); From ae6a069e8c2007d36489c249b18c73b0afc62654 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Wed, 4 Sep 2024 05:36:21 +0530 Subject: [PATCH 221/328] fix: -rm pagination start --- src/components/organisms/RightSidePanel.tsx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index cf76f739..606aad01 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -163,10 +163,6 @@ export const RightSidePanel = () => { } }; - const handleStartPaginationSelection = () => { - // Start the process of selecting the pagination element - socket?.emit('action', { action: 'startPaginationSelection' }); - }; const captureScreenshot = (fullPage: boolean) => { From 0ba8e957038df7815e0392c9f857165163d0bfae Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Wed, 4 Sep 2024 05:36:35 +0530 Subject: [PATCH 222/328] fix: whitespace --- src/components/organisms/RightSidePanel.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 606aad01..45f1b697 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -163,8 +163,6 @@ export const RightSidePanel = () => { } }; - - const captureScreenshot = (fullPage: boolean) => { const screenshotSettings: ScreenshotSettings = { fullPage, From d06d4a5c2823420d2e1e5a0ca9df46b94dcb3cfd Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Wed, 4 Sep 2024 05:37:10 +0530 Subject: [PATCH 223/328] feat: call handle stop get list to discard --- src/components/organisms/RightSidePanel.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 45f1b697..2fc17999 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -189,7 +189,7 @@ export const RightSidePanel = () => { <> - + } From 4522e75ff999e74c5b7f1c69362087e120739101 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Wed, 4 Sep 2024 05:38:01 +0530 Subject: [PATCH 224/328] fix: whitespace --- src/components/organisms/RightSidePanel.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 2fc17999..5d2422bb 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -131,7 +131,6 @@ export const RightSidePanel = () => { resetListState(); }, [stopGetList, resetListState]); - const stopCaptureAndEmitGetListSettings = useCallback(() => { stopGetList(); const settings = getListSettingsObject(); @@ -205,7 +204,6 @@ export const RightSidePanel = () => { )} - {!getText && !getScreenshot && !getList && } {getText && <> From eaaaec7b1ad6fa2ac940367f34a0d8898709af24 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Wed, 4 Sep 2024 05:38:24 +0530 Subject: [PATCH 225/328] chore: -rm useEffect --- src/components/organisms/RightSidePanel.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 5d2422bb..da38c83b 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -1,4 +1,4 @@ -import React, { useState, useCallback, useEffect } from 'react'; +import React, { useState, useCallback } from 'react'; import { Button, Paper, Box, TextField } from "@mui/material"; import EditIcon from '@mui/icons-material/Edit'; import TextFieldsIcon from '@mui/icons-material/TextFields'; From 2f33b304a8cda9238ccb52b12b3d6470f586ce7f Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Wed, 4 Sep 2024 05:38:48 +0530 Subject: [PATCH 226/328] chore: remove unused browser steps --- src/components/organisms/RightSidePanel.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index da38c83b..332a1a70 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -7,7 +7,7 @@ import { SimpleBox } from "../atoms/Box"; import Typography from "@mui/material/Typography"; import { useGlobalInfoStore } from "../../context/globalInfo"; import { useActionContext } from '../../context/browserActions'; -import { useBrowserSteps, ListStep, TextStep, SelectorObject } from '../../context/browserSteps'; +import { useBrowserSteps } from '../../context/browserSteps'; import { useSocketStore } from '../../context/socket'; import { ScreenshotSettings } from '../../shared/types'; import InputAdornment from '@mui/material/InputAdornment'; From b3a0fb1e4aac74dd1d573f4ec1b2ecaa22835d60 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Wed, 4 Sep 2024 23:59:09 +0530 Subject: [PATCH 227/328] feat: pagination mode state --- src/components/organisms/BrowserWindow.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index db474ae0..41931828 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -55,6 +55,8 @@ export const BrowserWindow = () => { const [attributeOptions, setAttributeOptions] = useState([]); const [selectedElement, setSelectedElement] = useState<{ selector: string, info: ElementInfo | null } | null>(null); const [currentListId, setCurrentListId] = useState(null); + const [paginationMode, setPaginationMode] = useState(false); + const [paginationSelector, setPaginationSelector] = useState(null); const [listSelector, setListSelector] = useState(null); const [fields, setFields] = useState>({}); From cf2c2b8a8ee290ae52f3d2f701ce079f00668e86 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 5 Sep 2024 02:35:38 +0530 Subject: [PATCH 228/328] feat: emit listSelector socket event when !paginationMode --- src/components/organisms/BrowserWindow.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index 41931828..3951144d 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -115,7 +115,7 @@ export const BrowserWindow = () => { if (getList === true) { socket?.emit('setGetList', { getList: true }); - if (listSelector) { + if (listSelector && !paginationMode) { socket?.emit('listSelector', { selector: listSelector }); if (data.childSelectors && data.childSelectors.includes(data.selector)) { From e7b2a53fc9a72d967d3ed43234de1fae5eb26cf0 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 5 Sep 2024 20:52:20 +0530 Subject: [PATCH 229/328] feat: pagination mode --- src/context/browserActions.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/context/browserActions.tsx b/src/context/browserActions.tsx index 5a7c12b5..449abdff 100644 --- a/src/context/browserActions.tsx +++ b/src/context/browserActions.tsx @@ -4,6 +4,7 @@ interface ActionContextProps { getText: boolean; getList: boolean; getScreenshot: boolean; + paginationMode: boolean; startGetText: () => void; stopGetText: () => void; startGetList: () => void; @@ -18,6 +19,7 @@ export const ActionProvider = ({ children }: { children: ReactNode }) => { const [getText, setGetText] = useState(false); const [getList, setGetList] = useState(false); const [getScreenshot, setGetScreenshot] = useState(false); + const [paginationMode, setPaginationMode] = useState(false); const startGetText = () => setGetText(true); const stopGetText = () => setGetText(false); @@ -29,7 +31,7 @@ export const ActionProvider = ({ children }: { children: ReactNode }) => { const stopGetScreenshot = () => setGetScreenshot(false); return ( - + {children} ); From 916468a2139037953f24f220915e3f447e02cddb Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 5 Sep 2024 20:55:14 +0530 Subject: [PATCH 230/328] chore: rollback --- src/components/organisms/BrowserWindow.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index 3951144d..db474ae0 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -55,8 +55,6 @@ export const BrowserWindow = () => { const [attributeOptions, setAttributeOptions] = useState([]); const [selectedElement, setSelectedElement] = useState<{ selector: string, info: ElementInfo | null } | null>(null); const [currentListId, setCurrentListId] = useState(null); - const [paginationMode, setPaginationMode] = useState(false); - const [paginationSelector, setPaginationSelector] = useState(null); const [listSelector, setListSelector] = useState(null); const [fields, setFields] = useState>({}); @@ -115,7 +113,7 @@ export const BrowserWindow = () => { if (getList === true) { socket?.emit('setGetList', { getList: true }); - if (listSelector && !paginationMode) { + if (listSelector) { socket?.emit('listSelector', { selector: listSelector }); if (data.childSelectors && data.childSelectors.includes(data.selector)) { From 4435ddb75c2de8c0b0467eb265cb1f4ce614776a Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 5 Sep 2024 20:55:49 +0530 Subject: [PATCH 231/328] feat: import pagination mode from context --- src/components/organisms/BrowserWindow.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index db474ae0..76be0cf6 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -61,7 +61,7 @@ export const BrowserWindow = () => { const { socket } = useSocketStore(); const { width, height } = useBrowserDimensionsStore(); - const { getText, getList } = useActionContext(); + const { getText, getList, paginationMode } = useActionContext(); const { addTextStep, addListStep } = useBrowserSteps(); const onMouseMove = (e: MouseEvent) => { From f1bb6301d3b519af7c7b70b7c26b2687ffa6edd6 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 5 Sep 2024 21:38:28 +0530 Subject: [PATCH 232/328] feat: show highlighter when not in pagination mode --- src/components/organisms/BrowserWindow.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index 76be0cf6..ed005096 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -116,7 +116,7 @@ export const BrowserWindow = () => { if (listSelector) { socket?.emit('listSelector', { selector: listSelector }); - if (data.childSelectors && data.childSelectors.includes(data.selector)) { + if (data.childSelectors && data.childSelectors.includes(data.selector) && !paginationMode) { setHighlighterData(data); } else { setHighlighterData(null); // Clear highlighter if not a valid child selector From e200816f1b556a9dc2bb23031c7727474aac3960 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 5 Sep 2024 21:41:17 +0530 Subject: [PATCH 233/328] chore: remove console.log() --- src/components/organisms/BrowserWindow.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index ed005096..c033c7fa 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -182,7 +182,6 @@ export const BrowserWindow = () => { if (getList === true && !listSelector) { setListSelector(highlighterData.selector); - console.log('After set', listSelector) setCurrentListId(Date.now()); setFields({}); } else if (getList === true && listSelector && currentListId) { From 87075abcd08140b919038135b767316318707e6d Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 5 Sep 2024 21:52:02 +0530 Subject: [PATCH 234/328] chore: remove console.log() --- src/components/organisms/BrowserWindow.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index c033c7fa..d9d2a290 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -211,8 +211,6 @@ export const BrowserWindow = () => { if (listSelector) { addListStep(listSelector, { ...fields, [newField.label]: newField }, currentListId || 0); } - - console.log('end', listSelector) } else { // Show the modal if there are multiple options setAttributeOptions(options); From 8ea44ebab0da06f2da2582f42fc1da381c2c1f0f Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 5 Sep 2024 22:42:34 +0530 Subject: [PATCH 235/328] feat: start pagination mode --- src/context/browserActions.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/context/browserActions.tsx b/src/context/browserActions.tsx index 449abdff..57f59f3a 100644 --- a/src/context/browserActions.tsx +++ b/src/context/browserActions.tsx @@ -5,6 +5,7 @@ interface ActionContextProps { getList: boolean; getScreenshot: boolean; paginationMode: boolean; + startPaginationMode: () => void; startGetText: () => void; stopGetText: () => void; startGetList: () => void; @@ -21,6 +22,8 @@ export const ActionProvider = ({ children }: { children: ReactNode }) => { const [getScreenshot, setGetScreenshot] = useState(false); const [paginationMode, setPaginationMode] = useState(false); + const startPaginationMode = () => setPaginationMode(true); + const startGetText = () => setGetText(true); const stopGetText = () => setGetText(false); @@ -31,7 +34,7 @@ export const ActionProvider = ({ children }: { children: ReactNode }) => { const stopGetScreenshot = () => setGetScreenshot(false); return ( - + {children} ); From f8361c25fdb4f494136a760499b5c5ac76172612 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 5 Sep 2024 22:42:57 +0530 Subject: [PATCH 236/328] feat: stop pagination mode --- src/context/browserActions.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/context/browserActions.tsx b/src/context/browserActions.tsx index 57f59f3a..64c771b8 100644 --- a/src/context/browserActions.tsx +++ b/src/context/browserActions.tsx @@ -12,6 +12,7 @@ interface ActionContextProps { stopGetList: () => void; startGetScreenshot: () => void; stopGetScreenshot: () => void; + stopPaginationMode: () => void; } const ActionContext = createContext(undefined); @@ -23,6 +24,7 @@ export const ActionProvider = ({ children }: { children: ReactNode }) => { const [paginationMode, setPaginationMode] = useState(false); const startPaginationMode = () => setPaginationMode(true); + const stopPaginationMode = () => setPaginationMode(false); const startGetText = () => setGetText(true); const stopGetText = () => setGetText(false); @@ -33,8 +35,10 @@ export const ActionProvider = ({ children }: { children: ReactNode }) => { const startGetScreenshot = () => setGetScreenshot(true); const stopGetScreenshot = () => setGetScreenshot(false); + + return ( - + {children} ); From dbccf23970d3908369c02272e9bfcf9b59ebd413 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 5 Sep 2024 22:43:14 +0530 Subject: [PATCH 237/328] chore: lint --- src/context/browserActions.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/context/browserActions.tsx b/src/context/browserActions.tsx index 64c771b8..06e903b8 100644 --- a/src/context/browserActions.tsx +++ b/src/context/browserActions.tsx @@ -35,8 +35,6 @@ export const ActionProvider = ({ children }: { children: ReactNode }) => { const startGetScreenshot = () => setGetScreenshot(true); const stopGetScreenshot = () => setGetScreenshot(false); - - return ( {children} From 9124ca0ab026bfbb4294b27112036544b8c97877 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 5 Sep 2024 22:44:25 +0530 Subject: [PATCH 238/328] feat: start pagination after list capture --- src/components/organisms/RightSidePanel.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 332a1a70..0b2cbce9 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -26,7 +26,7 @@ export const RightSidePanel = () => { const [selectedPaginationSetting, setSelectedPaginationSetting] = useState(null); const { lastAction, notify } = useGlobalInfoStore(); - const { getText, startGetText, stopGetText, getScreenshot, startGetScreenshot, stopGetScreenshot, getList, startGetList, stopGetList } = useActionContext(); + const { getText, startGetText, stopGetText, getScreenshot, startGetScreenshot, stopGetScreenshot, paginationMode, getList, startGetList, stopGetList, startPaginationMode } = useActionContext(); const { browserSteps, updateBrowserTextStepLabel, deleteBrowserStep, addScreenshotStep } = useBrowserSteps(); const { socket } = useSocketStore(); @@ -143,6 +143,9 @@ export const RightSidePanel = () => { }, [stopGetList, getListSettingsObject, socket, notify, handleStopGetList]); const handleConfirmListCapture = useCallback(() => { + if (!paginationMode) { + startPaginationMode(); + } if (!selectedPaginationSetting) { setShowPaginationOptions(true); return; From 6d6b37f1b646e396b3130bf2cbf90c93ed8536c6 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 5 Sep 2024 22:44:59 +0530 Subject: [PATCH 239/328] feat: stop pagination before emitting list settings --- src/components/organisms/RightSidePanel.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 0b2cbce9..d11c3e2a 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -26,7 +26,7 @@ export const RightSidePanel = () => { const [selectedPaginationSetting, setSelectedPaginationSetting] = useState(null); const { lastAction, notify } = useGlobalInfoStore(); - const { getText, startGetText, stopGetText, getScreenshot, startGetScreenshot, stopGetScreenshot, paginationMode, getList, startGetList, stopGetList, startPaginationMode } = useActionContext(); + const { getText, startGetText, stopGetText, getScreenshot, startGetScreenshot, stopGetScreenshot, paginationMode, getList, startGetList, stopGetList, startPaginationMode, stopPaginationMode } = useActionContext(); const { browserSteps, updateBrowserTextStepLabel, deleteBrowserStep, addScreenshotStep } = useBrowserSteps(); const { socket } = useSocketStore(); @@ -132,6 +132,7 @@ export const RightSidePanel = () => { }, [stopGetList, resetListState]); const stopCaptureAndEmitGetListSettings = useCallback(() => { + stopPaginationMode(); stopGetList(); const settings = getListSettingsObject(); if (settings) { From a24e45412e947e9c500b6fe736a092b74e63e960 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 6 Sep 2024 09:22:15 +0530 Subject: [PATCH 240/328] feat: include pagination in ListStep --- src/context/browserSteps.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/context/browserSteps.tsx b/src/context/browserSteps.tsx index d09da443..a42abfa0 100644 --- a/src/context/browserSteps.tsx +++ b/src/context/browserSteps.tsx @@ -19,6 +19,10 @@ export interface ListStep { type: 'list'; listSelector: string; fields: { [key: string]: TextStep }; + pagination?: { + type: string; + selector: string; + } } type BrowserStep = TextStep | ScreenshotStep | ListStep; From 8381941358d7dfe30b47a6c65a63709c510350bf Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 6 Sep 2024 09:25:44 +0530 Subject: [PATCH 241/328] feat: include pagination in addListStep --- src/context/browserSteps.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/context/browserSteps.tsx b/src/context/browserSteps.tsx index a42abfa0..bdb0d298 100644 --- a/src/context/browserSteps.tsx +++ b/src/context/browserSteps.tsx @@ -55,7 +55,7 @@ export const BrowserStepsProvider: React.FC<{ children: React.ReactNode }> = ({ ]); }; - const addListStep = (listSelector: string, newFields: { [key: string]: TextStep }, listId: number) => { + const addListStep = (listSelector: string, newFields: { [key: string]: TextStep }, listId: number, pagination?: { type: string; selector: string}) => { setBrowserSteps(prevSteps => { const existingListStepIndex = prevSteps.findIndex( step => step.type === 'list' && step.id === listId From 81d9982ea562a719b5dcd8283842a876155a7ee1 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 6 Sep 2024 09:31:53 +0530 Subject: [PATCH 242/328] feat: include pagination in addListStep --- src/context/browserSteps.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/context/browserSteps.tsx b/src/context/browserSteps.tsx index bdb0d298..d348ff35 100644 --- a/src/context/browserSteps.tsx +++ b/src/context/browserSteps.tsx @@ -66,14 +66,15 @@ export const BrowserStepsProvider: React.FC<{ children: React.ReactNode }> = ({ const existingListStep = updatedSteps[existingListStepIndex] as ListStep; updatedSteps[existingListStepIndex] = { ...existingListStep, - fields: { ...existingListStep.fields, ...newFields } + fields: { ...existingListStep.fields, ...newFields }, + pagination: pagination }; return updatedSteps; } else { // Create a new ListStep return [ ...prevSteps, - { id: listId, type: 'list', listSelector, fields: newFields } + { id: listId, type: 'list', listSelector, fields: newFields, pagination } ]; } }); From d2ed149f800d3b530569375d9f25e9be7beecfc7 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 6 Sep 2024 09:32:07 +0530 Subject: [PATCH 243/328] chore: lint --- src/context/browserSteps.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/context/browserSteps.tsx b/src/context/browserSteps.tsx index d348ff35..d1c91bb6 100644 --- a/src/context/browserSteps.tsx +++ b/src/context/browserSteps.tsx @@ -55,7 +55,7 @@ export const BrowserStepsProvider: React.FC<{ children: React.ReactNode }> = ({ ]); }; - const addListStep = (listSelector: string, newFields: { [key: string]: TextStep }, listId: number, pagination?: { type: string; selector: string}) => { + const addListStep = (listSelector: string, newFields: { [key: string]: TextStep }, listId: number, pagination?: { type: string; selector: string }) => { setBrowserSteps(prevSteps => { const existingListStepIndex = prevSteps.findIndex( step => step.type === 'list' && step.id === listId @@ -80,7 +80,6 @@ export const BrowserStepsProvider: React.FC<{ children: React.ReactNode }> = ({ }); }; - const addScreenshotStep = (fullPage: boolean) => { setBrowserSteps(prevSteps => [ ...prevSteps, From e4bb50e03df9c1fce3e35b100ea20005505688a0 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 6 Sep 2024 09:40:00 +0530 Subject: [PATCH 244/328] fix: add missing pagination type in addListStep --- src/context/browserSteps.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/context/browserSteps.tsx b/src/context/browserSteps.tsx index d1c91bb6..9ca92bb1 100644 --- a/src/context/browserSteps.tsx +++ b/src/context/browserSteps.tsx @@ -37,7 +37,7 @@ export interface SelectorObject { interface BrowserStepsContextType { browserSteps: BrowserStep[]; addTextStep: (label: string, data: string, selectorObj: SelectorObject) => void; - addListStep: (listSelector: string, fields: { [key: string]: TextStep }, listId: number) => void + addListStep: (listSelector: string, fields: { [key: string]: TextStep }, listId: number, pagination?: { type: string; selector: string }) => void addScreenshotStep: (fullPage: boolean) => void; deleteBrowserStep: (id: number) => void; updateBrowserTextStepLabel: (id: number, newLabel: string) => void; From b97d62d41e82e7dab7ef3eabf07e51a08f78c3cb Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 6 Sep 2024 10:44:27 +0530 Subject: [PATCH 245/328] feat: emit pagination for list settings --- src/components/organisms/RightSidePanel.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index d11c3e2a..eeea5648 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -110,9 +110,7 @@ export const RightSidePanel = () => { settings = { listSelector: step.listSelector, fields: fields, - pagination: { - type: selectedPaginationSetting || '', - } + pagination: step.pagination }; } From e2f78ccfa00b6aebf6487c5ec8ee116c4fec46ed Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 6 Sep 2024 10:45:44 +0530 Subject: [PATCH 246/328] fix: do not return --- src/components/organisms/RightSidePanel.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index eeea5648..c9dd8577 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -151,7 +151,6 @@ export const RightSidePanel = () => { } if (['clickNext', 'clickLoadMore'].includes(selectedPaginationSetting)) { notify('error', 'Please select the pagination element first.'); - return; } stopCaptureAndEmitGetListSettings(); setShowPaginationOptions(false); From 0ff70d4b207c4cf4a3ee4cb1719cc0ae716ae415 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 6 Sep 2024 11:04:22 +0530 Subject: [PATCH 247/328] feat: handle pagination selection --- src/components/organisms/BrowserWindow.tsx | 32 ++++++++++++++-------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index d9d2a290..546501c8 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -180,13 +180,24 @@ export const BrowserWindow = () => { } } + if (paginationMode && getList) { + // Set the pagination selector + const paginationType = 'clickNext'; // You can get this from user selection or UI + addListStep(listSelector!, fields, currentListId || 0, { type: paginationType, selector: highlighterData.selector }); + console.log( + `Pagination mode: ${paginationType} with selector: ${highlighterData.selector}` + ); + return; + } + if (getList === true && !listSelector) { + // Set listSelector setListSelector(highlighterData.selector); setCurrentListId(Date.now()); setFields({}); } else if (getList === true && listSelector && currentListId) { + // Add fields to the list if (options.length === 1) { - // Handle directly without showing the modal const attribute = options[0].value; const newField: TextStep = { id: Date.now(), @@ -199,20 +210,17 @@ export const BrowserWindow = () => { attribute } }; - - setFields(prevFields => { - const updatedFields = { - ...prevFields, - [newField.label]: newField - }; - return updatedFields; - }); - + + setFields(prevFields => ({ + ...prevFields, + [newField.label]: newField + })); + if (listSelector) { - addListStep(listSelector, { ...fields, [newField.label]: newField }, currentListId || 0); + addListStep(listSelector, { ...fields, [newField.label]: newField }, currentListId, { type: 'clickNext', selector: highlighterData.selector }); } + } else { - // Show the modal if there are multiple options setAttributeOptions(options); setSelectedElement({ selector: highlighterData.selector, From 147d0f796f2e8e23e302526a2ee81f6399205e0a Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 6 Sep 2024 11:04:59 +0530 Subject: [PATCH 248/328] feat: pagination in highligherHandler --- src/components/organisms/BrowserWindow.tsx | 27 ++++++++++++---------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index 546501c8..0db265f7 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -110,24 +110,27 @@ export const BrowserWindow = () => { }, [screenShot, canvasRef, socket, screencastHandler]); const highlighterHandler = useCallback((data: { rect: DOMRect, selector: string, elementInfo: ElementInfo | null, childSelectors?: string[] }) => { - if (getList === true) { - socket?.emit('setGetList', { getList: true }); + if (getList === true) { + socket?.emit('setGetList', { getList: true }); - if (listSelector) { - socket?.emit('listSelector', { selector: listSelector }); + if (listSelector) { + socket?.emit('listSelector', { selector: listSelector }); - if (data.childSelectors && data.childSelectors.includes(data.selector) && !paginationMode) { - setHighlighterData(data); - } else { - setHighlighterData(null); // Clear highlighter if not a valid child selector - } - } else { + if (paginationMode) { setHighlighterData(data); + } else if (data.childSelectors && data.childSelectors.includes(data.selector)) { + setHighlighterData(data); + } else { + setHighlighterData(null); } } else { - setHighlighterData(data); + setHighlighterData(data); } - }, [highlighterData, getList, socket, listSelector]); + } else { + setHighlighterData(data); + } +}, [highlighterData, getList, socket, listSelector, paginationMode]); + useEffect(() => { document.addEventListener('mousemove', onMouseMove, false); From 219d3700f700bc7e6a1e7f8ec88a32e99c3558f4 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 6 Sep 2024 11:05:52 +0530 Subject: [PATCH 249/328] docs: explain highlighter handling --- src/components/organisms/BrowserWindow.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index 0db265f7..ae402082 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -117,17 +117,20 @@ export const BrowserWindow = () => { socket?.emit('listSelector', { selector: listSelector }); if (paginationMode) { + // In pagination mode, we want to set the highlighterData regardless of childSelectors setHighlighterData(data); } else if (data.childSelectors && data.childSelectors.includes(data.selector)) { + // !Pagination mode: highlight only valid child elements within the listSelector setHighlighterData(data); } else { + // If not a valid child in normal mode, clear the highlighter setHighlighterData(null); } } else { - setHighlighterData(data); + setHighlighterData(data); // Set highlighterData for the initial listSelector selection } } else { - setHighlighterData(data); + setHighlighterData(data); // For non-list steps } }, [highlighterData, getList, socket, listSelector, paginationMode]); From d630da6e60875eaab70296e381c1dd26706db0f3 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 6 Sep 2024 11:06:44 +0530 Subject: [PATCH 250/328] chore: lint --- src/components/organisms/BrowserWindow.tsx | 44 +++++++++++----------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index ae402082..307931f2 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -110,29 +110,27 @@ export const BrowserWindow = () => { }, [screenShot, canvasRef, socket, screencastHandler]); const highlighterHandler = useCallback((data: { rect: DOMRect, selector: string, elementInfo: ElementInfo | null, childSelectors?: string[] }) => { - if (getList === true) { - socket?.emit('setGetList', { getList: true }); - - if (listSelector) { - socket?.emit('listSelector', { selector: listSelector }); - - if (paginationMode) { - // In pagination mode, we want to set the highlighterData regardless of childSelectors - setHighlighterData(data); - } else if (data.childSelectors && data.childSelectors.includes(data.selector)) { - // !Pagination mode: highlight only valid child elements within the listSelector - setHighlighterData(data); + if (getList === true) { + socket?.emit('setGetList', { getList: true }); + if (listSelector) { + socket?.emit('listSelector', { selector: listSelector }); + if (paginationMode) { + // In pagination mode, we want to set the highlighterData regardless of childSelectors + setHighlighterData(data); + } else if (data.childSelectors && data.childSelectors.includes(data.selector)) { + // !Pagination mode: highlight only valid child elements within the listSelector + setHighlighterData(data); + } else { + // If not a valid child in normal mode, clear the highlighter + setHighlighterData(null); + } } else { - // If not a valid child in normal mode, clear the highlighter - setHighlighterData(null); + setHighlighterData(data); // Set highlighterData for the initial listSelector selection } } else { - setHighlighterData(data); // Set highlighterData for the initial listSelector selection + setHighlighterData(data); // For non-list steps } - } else { - setHighlighterData(data); // For non-list steps - } -}, [highlighterData, getList, socket, listSelector, paginationMode]); + }, [highlighterData, getList, socket, listSelector, paginationMode]); useEffect(() => { @@ -191,11 +189,11 @@ export const BrowserWindow = () => { const paginationType = 'clickNext'; // You can get this from user selection or UI addListStep(listSelector!, fields, currentListId || 0, { type: paginationType, selector: highlighterData.selector }); console.log( - `Pagination mode: ${paginationType} with selector: ${highlighterData.selector}` + `Pagination mode: ${paginationType} with selector: ${highlighterData.selector}` ); return; } - + if (getList === true && !listSelector) { // Set listSelector setListSelector(highlighterData.selector); @@ -216,12 +214,12 @@ export const BrowserWindow = () => { attribute } }; - + setFields(prevFields => ({ ...prevFields, [newField.label]: newField })); - + if (listSelector) { addListStep(listSelector, { ...fields, [newField.label]: newField }, currentListId, { type: 'clickNext', selector: highlighterData.selector }); } From f6edb4830492e88423f105bbed2363be92af5f40 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 6 Sep 2024 11:33:47 +0530 Subject: [PATCH 251/328] feat: set paginationType empty --- src/components/organisms/BrowserWindow.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index 307931f2..b25ce5fe 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -187,7 +187,7 @@ export const BrowserWindow = () => { if (paginationMode && getList) { // Set the pagination selector const paginationType = 'clickNext'; // You can get this from user selection or UI - addListStep(listSelector!, fields, currentListId || 0, { type: paginationType, selector: highlighterData.selector }); + addListStep(listSelector!, fields, currentListId || 0, { type: '', selector: highlighterData.selector }); console.log( `Pagination mode: ${paginationType} with selector: ${highlighterData.selector}` ); @@ -221,7 +221,7 @@ export const BrowserWindow = () => { })); if (listSelector) { - addListStep(listSelector, { ...fields, [newField.label]: newField }, currentListId, { type: 'clickNext', selector: highlighterData.selector }); + addListStep(listSelector, { ...fields, [newField.label]: newField }, currentListId, { type: '', selector: highlighterData.selector }); } } else { From cfc7a92dab6228382ae807d770b49fc4a93b5aa7 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 6 Sep 2024 11:34:24 +0530 Subject: [PATCH 252/328] feat: !hard-coded pagination type --- src/components/organisms/BrowserWindow.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index b25ce5fe..689e29f2 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -185,8 +185,6 @@ export const BrowserWindow = () => { } if (paginationMode && getList) { - // Set the pagination selector - const paginationType = 'clickNext'; // You can get this from user selection or UI addListStep(listSelector!, fields, currentListId || 0, { type: '', selector: highlighterData.selector }); console.log( `Pagination mode: ${paginationType} with selector: ${highlighterData.selector}` From 3f328f047210a696436ff5bd3b782dc92656ade6 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 6 Sep 2024 11:40:59 +0530 Subject: [PATCH 253/328] chore: remove console.log --- src/components/organisms/BrowserWindow.tsx | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index 689e29f2..83e0bf2b 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -186,9 +186,6 @@ export const BrowserWindow = () => { if (paginationMode && getList) { addListStep(listSelector!, fields, currentListId || 0, { type: '', selector: highlighterData.selector }); - console.log( - `Pagination mode: ${paginationType} with selector: ${highlighterData.selector}` - ); return; } From 37242d8ec60a8e419b614587fe7b8a840f995bef Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 6 Sep 2024 11:42:12 +0530 Subject: [PATCH 254/328] chore: -rm comment --- src/components/organisms/BrowserWindow.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index 83e0bf2b..a58dc869 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -190,7 +190,6 @@ export const BrowserWindow = () => { } if (getList === true && !listSelector) { - // Set listSelector setListSelector(highlighterData.selector); setCurrentListId(Date.now()); setFields({}); From 3be74a969e1a548f0348ba3cf1498d9f8dd553bc Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 6 Sep 2024 11:43:51 +0530 Subject: [PATCH 255/328] docs: pagination --- src/components/organisms/BrowserWindow.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index a58dc869..d146a7b7 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -115,7 +115,7 @@ export const BrowserWindow = () => { if (listSelector) { socket?.emit('listSelector', { selector: listSelector }); if (paginationMode) { - // In pagination mode, we want to set the highlighterData regardless of childSelectors + // Pagination mode: set the highlighterData regardless of childSelectors setHighlighterData(data); } else if (data.childSelectors && data.childSelectors.includes(data.selector)) { // !Pagination mode: highlight only valid child elements within the listSelector From 0bf9acfc08c8062837e5536c2989ef1d38164570 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 6 Sep 2024 12:07:19 +0530 Subject: [PATCH 256/328] feat: use selectedPaginationSetting --- src/components/organisms/RightSidePanel.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index c9dd8577..84f44ab2 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -110,7 +110,7 @@ export const RightSidePanel = () => { settings = { listSelector: step.listSelector, fields: fields, - pagination: step.pagination + pagination: { type: selectedPaginationSetting, selector: step.pagination?.selector }, }; } From e90c095bae4a36823ac247ae632cd089e078993f Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 6 Sep 2024 12:12:32 +0530 Subject: [PATCH 257/328] fix: proper type for selected pagination type --- src/components/organisms/RightSidePanel.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 84f44ab2..e5e57170 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -23,7 +23,7 @@ export const RightSidePanel = () => { const [errors, setErrors] = useState<{ [id: number]: string }>({}); const [confirmedTextSteps, setConfirmedTextSteps] = useState<{ [id: number]: boolean }>({}); const [showPaginationOptions, setShowPaginationOptions] = useState(false); - const [selectedPaginationSetting, setSelectedPaginationSetting] = useState(null); + const [selectedPaginationSetting, setSelectedPaginationSetting] = useState(''); const { lastAction, notify } = useGlobalInfoStore(); const { getText, startGetText, stopGetText, getScreenshot, startGetScreenshot, stopGetScreenshot, paginationMode, getList, startGetList, stopGetList, startPaginationMode, stopPaginationMode } = useActionContext(); @@ -121,7 +121,7 @@ export const RightSidePanel = () => { const resetListState = useCallback(() => { setShowPaginationOptions(false); - setSelectedPaginationSetting(null); + setSelectedPaginationSetting(''); }, []); const handleStopGetList = useCallback(() => { @@ -154,7 +154,7 @@ export const RightSidePanel = () => { } stopCaptureAndEmitGetListSettings(); setShowPaginationOptions(false); - setSelectedPaginationSetting(null); + setSelectedPaginationSetting(''); }, [selectedPaginationSetting, stopCaptureAndEmitGetListSettings, notify]); const handlePaginationSettingSelect = (option: string) => { From 4d9208a128fbfd54130ceaa9b0a75e89979fc8b8 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 6 Sep 2024 12:23:50 +0530 Subject: [PATCH 258/328] feat: show error if paginationSetting emppty --- src/components/organisms/RightSidePanel.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index e5e57170..84138bd6 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -150,7 +150,9 @@ export const RightSidePanel = () => { return; } if (['clickNext', 'clickLoadMore'].includes(selectedPaginationSetting)) { - notify('error', 'Please select the pagination element first.'); + if (selectedPaginationSetting === '') { + notify('error', 'Please select the pagination element first.'); + } } stopCaptureAndEmitGetListSettings(); setShowPaginationOptions(false); From 25abded2da4fc6906d75b921e80d9802b030a1c1 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 6 Sep 2024 20:55:05 +0530 Subject: [PATCH 259/328] feat: notify if selector empty --- src/components/organisms/RightSidePanel.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 84138bd6..5ff7df10 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -149,8 +149,10 @@ export const RightSidePanel = () => { setShowPaginationOptions(true); return; } + const settings = getListSettingsObject(); + const paginationSelector = settings.pagination?.selector if (['clickNext', 'clickLoadMore'].includes(selectedPaginationSetting)) { - if (selectedPaginationSetting === '') { + if (paginationSelector === '') { notify('error', 'Please select the pagination element first.'); } } From c6539b9c9cc99280c767a41ac6bef4b551e30f8a Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 6 Sep 2024 21:00:32 +0530 Subject: [PATCH 260/328] feat: create pagination selector state --- src/components/organisms/BrowserWindow.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index d146a7b7..6e8a1bba 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -58,6 +58,7 @@ export const BrowserWindow = () => { const [listSelector, setListSelector] = useState(null); const [fields, setFields] = useState>({}); + const [paginationSelector, setPaginationSelector] = useState(null); const { socket } = useSocketStore(); const { width, height } = useBrowserDimensionsStore(); From af49c9ef80f8d4231087749047b1aa98872fd9d2 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 6 Sep 2024 21:02:31 +0530 Subject: [PATCH 261/328] feat: set current selector as pagination selector if in pagination mode --- src/components/organisms/BrowserWindow.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index 6e8a1bba..79a99a76 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -185,8 +185,13 @@ export const BrowserWindow = () => { } } - if (paginationMode && getList) { - addListStep(listSelector!, fields, currentListId || 0, { type: '', selector: highlighterData.selector }); + // if (paginationMode && getList) { + // addListStep(listSelector!, fields, currentListId || 0, { type: '', selector: highlighterData.selector }); + // return; + // } + + if (paginationMode && getList && !paginationSelector) { + setPaginationSelector(highlighterData.selector); return; } From 48a7cf890b9b8d9cd335c724d5d373133366b916 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 6 Sep 2024 21:04:24 +0530 Subject: [PATCH 262/328] feat: use local paginationSelector --- src/components/organisms/BrowserWindow.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index 79a99a76..ca420119 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -58,7 +58,7 @@ export const BrowserWindow = () => { const [listSelector, setListSelector] = useState(null); const [fields, setFields] = useState>({}); - const [paginationSelector, setPaginationSelector] = useState(null); + const [paginationSelector, setPaginationSelector] = useState(''); const { socket } = useSocketStore(); const { width, height } = useBrowserDimensionsStore(); @@ -221,7 +221,7 @@ export const BrowserWindow = () => { })); if (listSelector) { - addListStep(listSelector, { ...fields, [newField.label]: newField }, currentListId, { type: '', selector: highlighterData.selector }); + addListStep(listSelector, { ...fields, [newField.label]: newField }, currentListId, { type: '', selector: paginationSelector }); } } else { From c1eb611fa46cf99d1abe4eed7e5e4f0cfed2cb6f Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 6 Sep 2024 21:08:22 +0530 Subject: [PATCH 263/328] feat: reset pagination selector --- src/components/organisms/BrowserWindow.tsx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index ca420119..828535f8 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -288,6 +288,17 @@ export const BrowserWindow = () => { setShowAttributeModal(false); }; + const resetPaginationSelector = useCallback(() => { + setPaginationSelector(''); + }, []); + + useEffect(() => { + if (!paginationMode) { + resetPaginationSelector(); + } + }, [paginationMode, resetPaginationSelector]); + + return (
{ From 893d29b3402e2fcf25566c8264743729f1b84775 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 6 Sep 2024 21:09:10 +0530 Subject: [PATCH 264/328] fix: return if !paginationSelector --- src/components/organisms/RightSidePanel.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 5ff7df10..5ac4fdbd 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -154,6 +154,7 @@ export const RightSidePanel = () => { if (['clickNext', 'clickLoadMore'].includes(selectedPaginationSetting)) { if (paginationSelector === '') { notify('error', 'Please select the pagination element first.'); + return; } } stopCaptureAndEmitGetListSettings(); From e9de537afb62466335cf757256153e77d24d30a8 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 6 Sep 2024 21:54:30 +0530 Subject: [PATCH 265/328] feat: update paginationSelector in pagination mode --- src/components/organisms/BrowserWindow.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index 828535f8..baf57375 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -190,9 +190,11 @@ export const BrowserWindow = () => { // return; // } - if (paginationMode && getList && !paginationSelector) { - setPaginationSelector(highlighterData.selector); - return; + if (paginationMode && getList) { + setPaginationSelector(highlighterData.selector) + // In pagination mode, treat any selection as the pagination selector + addListStep(listSelector!, fields, currentListId || 0, { type: '', selector: paginationSelector }); + return; } if (getList === true && !listSelector) { From 66e0461cff491f76bbf31941bf6bccca6358e5c6 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 6 Sep 2024 22:06:45 +0530 Subject: [PATCH 266/328] chore: remove unused cod --- src/components/organisms/BrowserWindow.tsx | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index baf57375..a1c7ea82 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -185,11 +185,6 @@ export const BrowserWindow = () => { } } - // if (paginationMode && getList) { - // addListStep(listSelector!, fields, currentListId || 0, { type: '', selector: highlighterData.selector }); - // return; - // } - if (paginationMode && getList) { setPaginationSelector(highlighterData.selector) // In pagination mode, treat any selection as the pagination selector From 5cc42dbfc3e92bfde2b48f177edabd1cc6cec8d0 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 6 Sep 2024 22:07:00 +0530 Subject: [PATCH 267/328] chore: lint --- src/components/organisms/BrowserWindow.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index a1c7ea82..6508a770 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -189,7 +189,7 @@ export const BrowserWindow = () => { setPaginationSelector(highlighterData.selector) // In pagination mode, treat any selection as the pagination selector addListStep(listSelector!, fields, currentListId || 0, { type: '', selector: paginationSelector }); - return; + return; } if (getList === true && !listSelector) { @@ -288,14 +288,14 @@ export const BrowserWindow = () => { const resetPaginationSelector = useCallback(() => { setPaginationSelector(''); }, []); - + useEffect(() => { if (!paginationMode) { resetPaginationSelector(); } }, [paginationMode, resetPaginationSelector]); - + return (
{ From b8984a9018be1ba99131a59c9936bf9ba0c9b995 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 6 Sep 2024 22:55:54 +0530 Subject: [PATCH 268/328] feat: pagination type ocal state --- src/components/organisms/BrowserWindow.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index 6508a770..75b463de 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -59,6 +59,8 @@ export const BrowserWindow = () => { const [listSelector, setListSelector] = useState(null); const [fields, setFields] = useState>({}); const [paginationSelector, setPaginationSelector] = useState(''); + const [paginationType, setPaginationType] = useState(''); + const { socket } = useSocketStore(); const { width, height } = useBrowserDimensionsStore(); From 7fa01d97a106dcd937d1d9b58d5ad170ee6f03bc Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 6 Sep 2024 23:08:01 +0530 Subject: [PATCH 269/328] feat: create PaginationType --- src/context/browserActions.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/context/browserActions.tsx b/src/context/browserActions.tsx index 06e903b8..1e0a5f49 100644 --- a/src/context/browserActions.tsx +++ b/src/context/browserActions.tsx @@ -1,5 +1,7 @@ import React, { createContext, useContext, useState, ReactNode } from 'react'; +type PaginationType = 'scrollDown' | 'scrollUp' | 'clickNext' | 'clickLoadMore' | ''; + interface ActionContextProps { getText: boolean; getList: boolean; From 3e2a47e0b3d07a315ba2da5f9ec1d65ef6b66bd0 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 6 Sep 2024 23:08:47 +0530 Subject: [PATCH 270/328] feat: create pagination type & update pagination type --- src/context/browserActions.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/context/browserActions.tsx b/src/context/browserActions.tsx index 1e0a5f49..b1d8e1ae 100644 --- a/src/context/browserActions.tsx +++ b/src/context/browserActions.tsx @@ -7,6 +7,7 @@ interface ActionContextProps { getList: boolean; getScreenshot: boolean; paginationMode: boolean; + paginationType: PaginationType; startPaginationMode: () => void; startGetText: () => void; stopGetText: () => void; @@ -15,6 +16,7 @@ interface ActionContextProps { startGetScreenshot: () => void; stopGetScreenshot: () => void; stopPaginationMode: () => void; + updatePaginationType: (type: PaginationType) => void; } const ActionContext = createContext(undefined); From 45d52ab1f13fa7de87a275d03f39e38f921efb79 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 6 Sep 2024 23:09:35 +0530 Subject: [PATCH 271/328] feat: export pagination related actions --- src/context/browserActions.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/context/browserActions.tsx b/src/context/browserActions.tsx index b1d8e1ae..21f4754d 100644 --- a/src/context/browserActions.tsx +++ b/src/context/browserActions.tsx @@ -40,7 +40,7 @@ export const ActionProvider = ({ children }: { children: ReactNode }) => { const stopGetScreenshot = () => setGetScreenshot(false); return ( - + {children} ); From d819e6c5ddda014cad02070cc13148c2b8f68cff Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 6 Sep 2024 23:10:06 +0530 Subject: [PATCH 272/328] feat: pagination type local state --- src/context/browserActions.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/context/browserActions.tsx b/src/context/browserActions.tsx index 21f4754d..0918c24f 100644 --- a/src/context/browserActions.tsx +++ b/src/context/browserActions.tsx @@ -26,6 +26,7 @@ export const ActionProvider = ({ children }: { children: ReactNode }) => { const [getList, setGetList] = useState(false); const [getScreenshot, setGetScreenshot] = useState(false); const [paginationMode, setPaginationMode] = useState(false); + const [paginationType, setPaginationType] = useState(''); const startPaginationMode = () => setPaginationMode(true); const stopPaginationMode = () => setPaginationMode(false); From b02a818951fd2754351a23e58fba78095e16667e Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 6 Sep 2024 23:10:53 +0530 Subject: [PATCH 273/328] feat: update start/stop pagination mode --- src/context/browserActions.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/context/browserActions.tsx b/src/context/browserActions.tsx index 0918c24f..5ee62e77 100644 --- a/src/context/browserActions.tsx +++ b/src/context/browserActions.tsx @@ -28,8 +28,14 @@ export const ActionProvider = ({ children }: { children: ReactNode }) => { const [paginationMode, setPaginationMode] = useState(false); const [paginationType, setPaginationType] = useState(''); - const startPaginationMode = () => setPaginationMode(true); - const stopPaginationMode = () => setPaginationMode(false); + const startPaginationMode = (type: PaginationType) => { + setPaginationMode(true); + setPaginationType(type); + }; + const stopPaginationMode = () => { + setPaginationMode(false); + setPaginationType(''); + }; const startGetText = () => setGetText(true); const stopGetText = () => setGetText(false); From 0261204e157db259cff28502137330c63ac1fb91 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 6 Sep 2024 23:12:13 +0530 Subject: [PATCH 274/328] feat: update pagination type --- src/context/browserActions.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/context/browserActions.tsx b/src/context/browserActions.tsx index 5ee62e77..d5d1e7ee 100644 --- a/src/context/browserActions.tsx +++ b/src/context/browserActions.tsx @@ -27,6 +27,7 @@ export const ActionProvider = ({ children }: { children: ReactNode }) => { const [getScreenshot, setGetScreenshot] = useState(false); const [paginationMode, setPaginationMode] = useState(false); const [paginationType, setPaginationType] = useState(''); + const updatePaginationType = (type: PaginationType) => setPaginationType(type); const startPaginationMode = (type: PaginationType) => { setPaginationMode(true); From a7a6bce9a8b77c81d27f2fb775848437ade0bc89 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 6 Sep 2024 23:13:42 +0530 Subject: [PATCH 275/328] fix: revert start/stop pagination mode --- src/context/browserActions.tsx | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/context/browserActions.tsx b/src/context/browserActions.tsx index d5d1e7ee..0918c24f 100644 --- a/src/context/browserActions.tsx +++ b/src/context/browserActions.tsx @@ -27,16 +27,9 @@ export const ActionProvider = ({ children }: { children: ReactNode }) => { const [getScreenshot, setGetScreenshot] = useState(false); const [paginationMode, setPaginationMode] = useState(false); const [paginationType, setPaginationType] = useState(''); - const updatePaginationType = (type: PaginationType) => setPaginationType(type); - const startPaginationMode = (type: PaginationType) => { - setPaginationMode(true); - setPaginationType(type); - }; - const stopPaginationMode = () => { - setPaginationMode(false); - setPaginationType(''); - }; + const startPaginationMode = () => setPaginationMode(true); + const stopPaginationMode = () => setPaginationMode(false); const startGetText = () => setGetText(true); const stopGetText = () => setGetText(false); From db73f014bd0209f6d5ca7c206f5a186ad1f09a07 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 6 Sep 2024 23:14:12 +0530 Subject: [PATCH 276/328] fix: re-add updatePaginationType --- src/context/browserActions.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/context/browserActions.tsx b/src/context/browserActions.tsx index 0918c24f..eb3465cd 100644 --- a/src/context/browserActions.tsx +++ b/src/context/browserActions.tsx @@ -28,6 +28,8 @@ export const ActionProvider = ({ children }: { children: ReactNode }) => { const [paginationMode, setPaginationMode] = useState(false); const [paginationType, setPaginationType] = useState(''); + const updatePaginationType = (type: PaginationType) => setPaginationType(type); + const startPaginationMode = () => setPaginationMode(true); const stopPaginationMode = () => setPaginationMode(false); From 5d0fa963438f2bd826cb93a37e1c1d86cba92c31 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 6 Sep 2024 23:14:41 +0530 Subject: [PATCH 277/328] feat: handle highlighter based on pagination type --- src/components/organisms/BrowserWindow.tsx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index 75b463de..5706c51f 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -118,8 +118,12 @@ export const BrowserWindow = () => { if (listSelector) { socket?.emit('listSelector', { selector: listSelector }); if (paginationMode) { - // Pagination mode: set the highlighterData regardless of childSelectors - setHighlighterData(data); + // Pagination mode: only set highlighterData if type is not empty, 'scrollDown', or 'scrollUp' + if (paginationType !== '' && paginationType !== 'scrollDown' && paginationType !== 'scrollUp') { + setHighlighterData(data); + } else { + setHighlighterData(null); + } } else if (data.childSelectors && data.childSelectors.includes(data.selector)) { // !Pagination mode: highlight only valid child elements within the listSelector setHighlighterData(data); @@ -133,7 +137,7 @@ export const BrowserWindow = () => { } else { setHighlighterData(data); // For non-list steps } - }, [highlighterData, getList, socket, listSelector, paginationMode]); + }, [highlighterData, getList, socket, listSelector, paginationMode, paginationType]); useEffect(() => { @@ -190,7 +194,7 @@ export const BrowserWindow = () => { if (paginationMode && getList) { setPaginationSelector(highlighterData.selector) // In pagination mode, treat any selection as the pagination selector - addListStep(listSelector!, fields, currentListId || 0, { type: '', selector: paginationSelector }); + addListStep(listSelector!, fields, currentListId || 0, { type: paginationType, selector: paginationSelector }); return; } @@ -289,6 +293,7 @@ export const BrowserWindow = () => { const resetPaginationSelector = useCallback(() => { setPaginationSelector(''); + setPaginationType(''); }, []); useEffect(() => { From d22621106ccaf374691e6f2e16a2d103e06e001d Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 6 Sep 2024 23:15:50 +0530 Subject: [PATCH 278/328] feat: import paginationType from global context --- src/components/organisms/BrowserWindow.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index 5706c51f..532fd9d7 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -59,12 +59,11 @@ export const BrowserWindow = () => { const [listSelector, setListSelector] = useState(null); const [fields, setFields] = useState>({}); const [paginationSelector, setPaginationSelector] = useState(''); - const [paginationType, setPaginationType] = useState(''); const { socket } = useSocketStore(); const { width, height } = useBrowserDimensionsStore(); - const { getText, getList, paginationMode } = useActionContext(); + const { getText, getList, paginationMode, paginationType } = useActionContext(); const { addTextStep, addListStep } = useBrowserSteps(); const onMouseMove = (e: MouseEvent) => { From 9708948756f26052580497e6b48ff8a7133b730b Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 6 Sep 2024 23:16:22 +0530 Subject: [PATCH 279/328] fix: -rm local paginationType code --- src/components/organisms/BrowserWindow.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index 532fd9d7..c5d29bfa 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -292,7 +292,6 @@ export const BrowserWindow = () => { const resetPaginationSelector = useCallback(() => { setPaginationSelector(''); - setPaginationType(''); }, []); useEffect(() => { From 11cd8a266b16d290eb90676b2087d3e36c0e2345 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 6 Sep 2024 23:18:49 +0530 Subject: [PATCH 280/328] feat: check for paginationType in handleClick --- src/components/organisms/BrowserWindow.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index c5d29bfa..5ea5fbd7 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -191,9 +191,11 @@ export const BrowserWindow = () => { } if (paginationMode && getList) { - setPaginationSelector(highlighterData.selector) - // In pagination mode, treat any selection as the pagination selector - addListStep(listSelector!, fields, currentListId || 0, { type: paginationType, selector: paginationSelector }); + // Only allow selection in pagination mode if type is not empty, 'scrollDown', or 'scrollUp' + if (paginationType !== '' && paginationType !== 'scrollDown' && paginationType !== 'scrollUp') { + setPaginationSelector(highlighterData.selector); + addListStep(listSelector!, fields, currentListId || 0, { type: paginationType, selector: highlighterData.selector }); + } return; } From 3e14fee663966235544b5540be6842b7f42c23a2 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 6 Sep 2024 23:19:21 +0530 Subject: [PATCH 281/328] chore: lint --- src/components/organisms/BrowserWindow.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index 5ea5fbd7..724ec56f 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -60,7 +60,6 @@ export const BrowserWindow = () => { const [fields, setFields] = useState>({}); const [paginationSelector, setPaginationSelector] = useState(''); - const { socket } = useSocketStore(); const { width, height } = useBrowserDimensionsStore(); const { getText, getList, paginationMode, paginationType } = useActionContext(); From 75582c34269a526e8a1e989fc169697eabc8df03 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 6 Sep 2024 23:42:26 +0530 Subject: [PATCH 282/328] feat: use pagination type from global context --- src/components/organisms/RightSidePanel.tsx | 29 ++++++++++----------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 5ac4fdbd..622f4455 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -23,10 +23,9 @@ export const RightSidePanel = () => { const [errors, setErrors] = useState<{ [id: number]: string }>({}); const [confirmedTextSteps, setConfirmedTextSteps] = useState<{ [id: number]: boolean }>({}); const [showPaginationOptions, setShowPaginationOptions] = useState(false); - const [selectedPaginationSetting, setSelectedPaginationSetting] = useState(''); const { lastAction, notify } = useGlobalInfoStore(); - const { getText, startGetText, stopGetText, getScreenshot, startGetScreenshot, stopGetScreenshot, paginationMode, getList, startGetList, stopGetList, startPaginationMode, stopPaginationMode } = useActionContext(); + const { getText, startGetText, stopGetText, getScreenshot, startGetScreenshot, stopGetScreenshot, paginationMode, getList, startGetList, stopGetList, startPaginationMode, stopPaginationMode, paginationType, updatePaginationType } = useActionContext(); const { browserSteps, updateBrowserTextStepLabel, deleteBrowserStep, addScreenshotStep } = useBrowserSteps(); const { socket } = useSocketStore(); @@ -110,18 +109,18 @@ export const RightSidePanel = () => { settings = { listSelector: step.listSelector, fields: fields, - pagination: { type: selectedPaginationSetting, selector: step.pagination?.selector }, + pagination: { type: paginationType, selector: step.pagination?.selector }, }; } }); return settings; - }, [browserSteps, selectedPaginationSetting]); + }, [browserSteps, paginationType]); const resetListState = useCallback(() => { setShowPaginationOptions(false); - setSelectedPaginationSetting(''); + updatePaginationType(''); }, []); const handleStopGetList = useCallback(() => { @@ -145,13 +144,13 @@ export const RightSidePanel = () => { if (!paginationMode) { startPaginationMode(); } - if (!selectedPaginationSetting) { + if (!paginationType) { setShowPaginationOptions(true); return; } const settings = getListSettingsObject(); const paginationSelector = settings.pagination?.selector - if (['clickNext', 'clickLoadMore'].includes(selectedPaginationSetting)) { + if (['clickNext', 'clickLoadMore'].includes(paginationType)) { if (paginationSelector === '') { notify('error', 'Please select the pagination element first.'); return; @@ -159,11 +158,11 @@ export const RightSidePanel = () => { } stopCaptureAndEmitGetListSettings(); setShowPaginationOptions(false); - setSelectedPaginationSetting(''); - }, [selectedPaginationSetting, stopCaptureAndEmitGetListSettings, notify]); + updatePaginationType(''); + }, [paginationType, stopCaptureAndEmitGetListSettings, notify]); const handlePaginationSettingSelect = (option: string) => { - setSelectedPaginationSetting(option); + updatePaginationType(option); if (['clickNext', 'clickLoadMore'].includes(option)) { } }; @@ -202,11 +201,11 @@ export const RightSidePanel = () => { {showPaginationOptions && ( How can we find the next list item on the page? - - - - - + + + + + )} From 95fcdeb4974c78722eefb50b774837652a744b0d Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 6 Sep 2024 23:56:53 +0530 Subject: [PATCH 283/328] feat: add none type --- src/context/browserActions.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/context/browserActions.tsx b/src/context/browserActions.tsx index eb3465cd..4cbec7d0 100644 --- a/src/context/browserActions.tsx +++ b/src/context/browserActions.tsx @@ -1,6 +1,6 @@ import React, { createContext, useContext, useState, ReactNode } from 'react'; -type PaginationType = 'scrollDown' | 'scrollUp' | 'clickNext' | 'clickLoadMore' | ''; +type PaginationType = 'scrollDown' | 'scrollUp' | 'clickNext' | 'clickLoadMore' | 'none' | ''; interface ActionContextProps { getText: boolean; From c41df0cd96834d61796dd86737bb86010dcc07af Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 6 Sep 2024 23:58:22 +0530 Subject: [PATCH 284/328] feat: export pagination type --- src/context/browserActions.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/context/browserActions.tsx b/src/context/browserActions.tsx index 4cbec7d0..f65e7399 100644 --- a/src/context/browserActions.tsx +++ b/src/context/browserActions.tsx @@ -1,6 +1,6 @@ import React, { createContext, useContext, useState, ReactNode } from 'react'; -type PaginationType = 'scrollDown' | 'scrollUp' | 'clickNext' | 'clickLoadMore' | 'none' | ''; +export type PaginationType = 'scrollDown' | 'scrollUp' | 'clickNext' | 'clickLoadMore' | 'none' | ''; interface ActionContextProps { getText: boolean; From a91220f0d4f4f634ea559a169ecacd0ee1109485 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 6 Sep 2024 23:59:41 +0530 Subject: [PATCH 285/328] fix(ts): use PaginationType instead of string --- src/components/organisms/RightSidePanel.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 622f4455..3989286c 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -6,7 +6,7 @@ import DocumentScannerIcon from '@mui/icons-material/DocumentScanner'; import { SimpleBox } from "../atoms/Box"; import Typography from "@mui/material/Typography"; import { useGlobalInfoStore } from "../../context/globalInfo"; -import { useActionContext } from '../../context/browserActions'; +import { PaginationType, useActionContext } from '../../context/browserActions'; import { useBrowserSteps } from '../../context/browserSteps'; import { useSocketStore } from '../../context/socket'; import { ScreenshotSettings } from '../../shared/types'; @@ -25,7 +25,7 @@ export const RightSidePanel = () => { const [showPaginationOptions, setShowPaginationOptions] = useState(false); const { lastAction, notify } = useGlobalInfoStore(); - const { getText, startGetText, stopGetText, getScreenshot, startGetScreenshot, stopGetScreenshot, paginationMode, getList, startGetList, stopGetList, startPaginationMode, stopPaginationMode, paginationType, updatePaginationType } = useActionContext(); + const { getText, startGetText, stopGetText, getScreenshot, startGetScreenshot, stopGetScreenshot, paginationMode, getList, startGetList, stopGetList, startPaginationMode, stopPaginationMode, paginationType, updatePaginationType, PaginationType } = useActionContext(); const { browserSteps, updateBrowserTextStepLabel, deleteBrowserStep, addScreenshotStep } = useBrowserSteps(); const { socket } = useSocketStore(); @@ -161,7 +161,7 @@ export const RightSidePanel = () => { updatePaginationType(''); }, [paginationType, stopCaptureAndEmitGetListSettings, notify]); - const handlePaginationSettingSelect = (option: string) => { + const handlePaginationSettingSelect = (option: PaginationType) => { updatePaginationType(option); if (['clickNext', 'clickLoadMore'].includes(option)) { } From 9a3888cf50aa6107641e52fc29f283c8cbe35efb Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 7 Sep 2024 00:00:18 +0530 Subject: [PATCH 286/328] fix: remove destructured import of PaginationType --- src/components/organisms/RightSidePanel.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 3989286c..3167b3e6 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -25,7 +25,7 @@ export const RightSidePanel = () => { const [showPaginationOptions, setShowPaginationOptions] = useState(false); const { lastAction, notify } = useGlobalInfoStore(); - const { getText, startGetText, stopGetText, getScreenshot, startGetScreenshot, stopGetScreenshot, paginationMode, getList, startGetList, stopGetList, startPaginationMode, stopPaginationMode, paginationType, updatePaginationType, PaginationType } = useActionContext(); + const { getText, startGetText, stopGetText, getScreenshot, startGetScreenshot, stopGetScreenshot, paginationMode, getList, startGetList, stopGetList, startPaginationMode, stopPaginationMode, paginationType, updatePaginationType } = useActionContext(); const { browserSteps, updateBrowserTextStepLabel, deleteBrowserStep, addScreenshotStep } = useBrowserSteps(); const { socket } = useSocketStore(); From 40dde683fd17e6101ee1f785cc2b7a435eecdbce Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 7 Sep 2024 00:01:26 +0530 Subject: [PATCH 287/328] chore: lint --- src/components/organisms/RightSidePanel.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 3167b3e6..340916a3 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -149,7 +149,7 @@ export const RightSidePanel = () => { return; } const settings = getListSettingsObject(); - const paginationSelector = settings.pagination?.selector + const paginationSelector = settings.pagination?.selector if (['clickNext', 'clickLoadMore'].includes(paginationType)) { if (paginationSelector === '') { notify('error', 'Please select the pagination element first.'); From 7a21bd061137193f648c830280355b14a22f0b34 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 7 Sep 2024 00:36:12 +0530 Subject: [PATCH 288/328] feat: handle non pagination type --- src/components/organisms/BrowserWindow.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index 724ec56f..20500e47 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -117,7 +117,7 @@ export const BrowserWindow = () => { socket?.emit('listSelector', { selector: listSelector }); if (paginationMode) { // Pagination mode: only set highlighterData if type is not empty, 'scrollDown', or 'scrollUp' - if (paginationType !== '' && paginationType !== 'scrollDown' && paginationType !== 'scrollUp') { + if (paginationType !== '' && paginationType !== 'scrollDown' && paginationType !== 'scrollUp' && paginationType !== 'none') { setHighlighterData(data); } else { setHighlighterData(null); @@ -191,7 +191,7 @@ export const BrowserWindow = () => { if (paginationMode && getList) { // Only allow selection in pagination mode if type is not empty, 'scrollDown', or 'scrollUp' - if (paginationType !== '' && paginationType !== 'scrollDown' && paginationType !== 'scrollUp') { + if (paginationType !== '' && paginationType !== 'scrollDown' && paginationType !== 'scrollUp' paginationType !== 'none') { setPaginationSelector(highlighterData.selector); addListStep(listSelector!, fields, currentListId || 0, { type: paginationType, selector: highlighterData.selector }); } From 54c9d4528880527f4ba9a9f103bfddf72106f6db Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 7 Sep 2024 00:36:39 +0530 Subject: [PATCH 289/328] fix: add missing && --- src/components/organisms/BrowserWindow.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index 20500e47..90d19a10 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -191,7 +191,7 @@ export const BrowserWindow = () => { if (paginationMode && getList) { // Only allow selection in pagination mode if type is not empty, 'scrollDown', or 'scrollUp' - if (paginationType !== '' && paginationType !== 'scrollDown' && paginationType !== 'scrollUp' paginationType !== 'none') { + if (paginationType !== '' && paginationType !== 'scrollDown' && paginationType !== 'scrollUp' && paginationType !== 'none') { setPaginationSelector(highlighterData.selector); addListStep(listSelector!, fields, currentListId || 0, { type: paginationType, selector: highlighterData.selector }); } From eae619774b0c88b2f5f444bd2de0d85565c94a3a Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 7 Sep 2024 01:59:14 +0530 Subject: [PATCH 290/328] feat: show confirm button based iff paginationType is selected --- src/components/organisms/RightSidePanel.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 340916a3..f925c53c 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -192,7 +192,14 @@ export const RightSidePanel = () => { {getList && <> - + { + paginationMode ? + paginationType !== "" ? + + : "" + : + + } From 685266cefbb3ae400257b8d43ad5d95107f3f602 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 7 Sep 2024 02:00:10 +0530 Subject: [PATCH 291/328] chore: lint --- src/components/organisms/RightSidePanel.tsx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index f925c53c..d323d5d4 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -193,13 +193,12 @@ export const RightSidePanel = () => { <> { - paginationMode ? - paginationType !== "" ? - - : "" - : - - } + paginationMode ? + paginationType !== "" ? + + : "" + : + } From 99f843286b44384b91b9f751747e5019e74f588a Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 7 Sep 2024 02:00:34 +0530 Subject: [PATCH 292/328] feat: use null --- src/components/organisms/RightSidePanel.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index d323d5d4..e391c86d 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -196,7 +196,7 @@ export const RightSidePanel = () => { paginationMode ? paginationType !== "" ? - : "" + : null : } From a4bc07fba58f8b82832968c504f5a6210dd5e612 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 7 Sep 2024 06:43:43 +0530 Subject: [PATCH 293/328] feat: introduce limit for list step --- src/context/browserSteps.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/context/browserSteps.tsx b/src/context/browserSteps.tsx index 9ca92bb1..35c7a212 100644 --- a/src/context/browserSteps.tsx +++ b/src/context/browserSteps.tsx @@ -22,7 +22,8 @@ export interface ListStep { pagination?: { type: string; selector: string; - } + }; + limit?: number; } type BrowserStep = TextStep | ScreenshotStep | ListStep; @@ -37,7 +38,7 @@ export interface SelectorObject { interface BrowserStepsContextType { browserSteps: BrowserStep[]; addTextStep: (label: string, data: string, selectorObj: SelectorObject) => void; - addListStep: (listSelector: string, fields: { [key: string]: TextStep }, listId: number, pagination?: { type: string; selector: string }) => void + addListStep: (listSelector: string, fields: { [key: string]: TextStep }, listId: number, pagination?: { type: string; selector: string }, limit?: number) => void addScreenshotStep: (fullPage: boolean) => void; deleteBrowserStep: (id: number) => void; updateBrowserTextStepLabel: (id: number, newLabel: string) => void; @@ -55,7 +56,7 @@ export const BrowserStepsProvider: React.FC<{ children: React.ReactNode }> = ({ ]); }; - const addListStep = (listSelector: string, newFields: { [key: string]: TextStep }, listId: number, pagination?: { type: string; selector: string }) => { + const addListStep = (listSelector: string, newFields: { [key: string]: TextStep }, listId: number, pagination?: { type: string; selector: string }, limit?: number) => { setBrowserSteps(prevSteps => { const existingListStepIndex = prevSteps.findIndex( step => step.type === 'list' && step.id === listId From 1c88a3390ea748a3f158723b1d9edc193964b423 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 7 Sep 2024 06:44:39 +0530 Subject: [PATCH 294/328] feat: use limit in addListStep --- src/context/browserSteps.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/context/browserSteps.tsx b/src/context/browserSteps.tsx index 35c7a212..1c9dbf34 100644 --- a/src/context/browserSteps.tsx +++ b/src/context/browserSteps.tsx @@ -68,14 +68,15 @@ export const BrowserStepsProvider: React.FC<{ children: React.ReactNode }> = ({ updatedSteps[existingListStepIndex] = { ...existingListStep, fields: { ...existingListStep.fields, ...newFields }, - pagination: pagination + pagination: pagination, + limit: limit, }; return updatedSteps; } else { // Create a new ListStep return [ ...prevSteps, - { id: listId, type: 'list', listSelector, fields: newFields, pagination } + { id: listId, type: 'list', listSelector, fields: newFields, pagination, limit } ]; } }); From 48ec26e0bf76fe70f1cc14777d70a4c3add1566c Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 7 Sep 2024 08:38:00 +0530 Subject: [PATCH 295/328] feat: use side panel header --- src/components/organisms/RightSidePanel.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index e391c86d..0ef73628 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -11,6 +11,7 @@ import { useBrowserSteps } from '../../context/browserSteps'; import { useSocketStore } from '../../context/socket'; import { ScreenshotSettings } from '../../shared/types'; import InputAdornment from '@mui/material/InputAdornment'; +import { SidePanelHeader } from '../molecules/SidePanelHeader'; // TODO: // 1. Handle field label update @@ -187,6 +188,8 @@ export const RightSidePanel = () => { Last action: {` ${lastAction}`} + + {!getText && !getScreenshot && !getList && } {getList && From 555737c488161d0063b6e0f0bec5da63b3093aac Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 7 Sep 2024 10:09:28 +0530 Subject: [PATCH 296/328] fix: -rm unused getList action --- src/components/molecules/InterpretationLog.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index aa7a34df..c51c7115 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -48,7 +48,6 @@ export const InterpretationLog = () => { const logEndRef = useRef(null); const { width } = useBrowserDimensionsStore(); - const { getList } = useActionContext(); const toggleDrawer = (newOpen: boolean) => (event: React.KeyboardEvent | React.MouseEvent) => { if ( From 9eb6f77e944511bbaba7fb69a960ac92ee01d3fb Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 7 Sep 2024 10:09:49 +0530 Subject: [PATCH 297/328] fix: -rm action context import --- src/components/molecules/InterpretationLog.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index c51c7115..e16a9314 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -11,7 +11,6 @@ import Highlight from 'react-highlight'; import { useCallback, useEffect, useRef, useState } from "react"; import { useSocketStore } from "../../context/socket"; import { useBrowserDimensionsStore } from "../../context/browserDimensions"; -import { useActionContext } from '../../context/browserActions'; import Table from '@mui/material/Table'; import TableBody from '@mui/material/TableBody'; import TableCell from '@mui/material/TableCell'; From 3e3ab584b3c2365b3235c9dd647cd8f043cc306d Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 7 Sep 2024 22:02:06 +0530 Subject: [PATCH 298/328] feat: create data var for getList --- src/components/organisms/BrowserWindow.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index 90d19a10..33deca13 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -206,7 +206,9 @@ export const BrowserWindow = () => { // Add fields to the list if (options.length === 1) { const attribute = options[0].value; - const newField: TextStep = { + const data = attribute === 'href' ? highlighterData.elementInfo?.url || '' : + attribute === 'src' ? highlighterData.elementInfo?.imageUrl || '' : + highlighterData.elementInfo?.innerText || ''; const newField: TextStep = { id: Date.now(), type: 'text', label: `Label ${Object.keys(fields).length + 1}`, From da88618aa9b90573f6b833449c54449aec753dc2 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 7 Sep 2024 22:02:30 +0530 Subject: [PATCH 299/328] feat: use data --- src/components/organisms/BrowserWindow.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index 33deca13..4535fbdd 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -212,7 +212,7 @@ export const BrowserWindow = () => { id: Date.now(), type: 'text', label: `Label ${Object.keys(fields).length + 1}`, - data: highlighterData.elementInfo?.innerText || '', + data: data, selectorObj: { selector: highlighterData.selector, tag: highlighterData.elementInfo?.tagName, From 9c2e42af0bc1685fc9a9234521c12dfec56b00a0 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 7 Sep 2024 22:03:23 +0530 Subject: [PATCH 300/328] chore: lint --- src/components/organisms/BrowserWindow.tsx | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index 4535fbdd..08c2d674 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -208,17 +208,17 @@ export const BrowserWindow = () => { const attribute = options[0].value; const data = attribute === 'href' ? highlighterData.elementInfo?.url || '' : attribute === 'src' ? highlighterData.elementInfo?.imageUrl || '' : - highlighterData.elementInfo?.innerText || ''; const newField: TextStep = { - id: Date.now(), - type: 'text', - label: `Label ${Object.keys(fields).length + 1}`, - data: data, - selectorObj: { - selector: highlighterData.selector, - tag: highlighterData.elementInfo?.tagName, - attribute - } - }; + highlighterData.elementInfo?.innerText || ''; const newField: TextStep = { + id: Date.now(), + type: 'text', + label: `Label ${Object.keys(fields).length + 1}`, + data: data, + selectorObj: { + selector: highlighterData.selector, + tag: highlighterData.elementInfo?.tagName, + attribute + } + }; setFields(prevFields => ({ ...prevFields, From 8584690c3268dc691b94d83721d8757719a7e12e Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 7 Sep 2024 22:19:58 +0530 Subject: [PATCH 301/328] fix: handle attribute selection in getList --- src/components/organisms/BrowserWindow.tsx | 39 ++++++++++++---------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index 08c2d674..5abd81d3 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -203,27 +203,32 @@ export const BrowserWindow = () => { setCurrentListId(Date.now()); setFields({}); } else if (getList === true && listSelector && currentListId) { + const attribute = options[0].value; + const data = attribute === 'href' ? highlighterData.elementInfo?.url || '' : + attribute === 'src' ? highlighterData.elementInfo?.imageUrl || '' : + highlighterData.elementInfo?.innerText || ''; // Add fields to the list if (options.length === 1) { const attribute = options[0].value; - const data = attribute === 'href' ? highlighterData.elementInfo?.url || '' : - attribute === 'src' ? highlighterData.elementInfo?.imageUrl || '' : - highlighterData.elementInfo?.innerText || ''; const newField: TextStep = { - id: Date.now(), - type: 'text', - label: `Label ${Object.keys(fields).length + 1}`, - data: data, - selectorObj: { - selector: highlighterData.selector, - tag: highlighterData.elementInfo?.tagName, - attribute - } - }; + const newField: TextStep = { + id: Date.now(), + type: 'text', + label: `Label ${Object.keys(fields).length + 1}`, + data: data, + selectorObj: { + selector: highlighterData.selector, + tag: highlighterData.elementInfo?.tagName, + attribute + } + }; - setFields(prevFields => ({ - ...prevFields, - [newField.label]: newField - })); + setFields(prevFields => { + const updatedFields = { + ...prevFields, + [newField.label]: newField + }; + return updatedFields; + }); if (listSelector) { addListStep(listSelector, { ...fields, [newField.label]: newField }, currentListId, { type: '', selector: paginationSelector }); From 919053446408f185127200e677bd2fe7252b5508 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 7 Sep 2024 22:20:53 +0530 Subject: [PATCH 302/328] fix: add list step --- src/components/organisms/BrowserWindow.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index 5abd81d3..7d44edc9 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -268,7 +268,7 @@ export const BrowserWindow = () => { attribute: attribute }); } - if (getList === true) { + if (getList === true && listSelector && currentListId) { const newField: TextStep = { id: Date.now(), type: 'text', @@ -290,8 +290,9 @@ export const BrowserWindow = () => { }); if (listSelector) { - addListStep(listSelector, { ...fields, [newField.label]: newField }, currentListId || 0); + addListStep(listSelector, { ...fields, [newField.label]: newField }, currentListId, { type: '', selector: paginationSelector }); } + } } } From 72fc92f3473bcaa7039d44315a2b264c6f05a76f Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sun, 8 Sep 2024 01:06:08 +0530 Subject: [PATCH 303/328] feat: display serializable data in table --- .../molecules/InterpretationLog.tsx | 84 ++++++++----------- 1 file changed, 34 insertions(+), 50 deletions(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index e16a9314..5fe30d2e 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -20,33 +20,17 @@ import TableRow from '@mui/material/TableRow'; import Paper from '@mui/material/Paper'; import StorageIcon from '@mui/icons-material/Storage'; -function createData( - name: string, - calories: number, - fat: number, - carbs: number, - protein: number, -) { - return { name, calories, fat, carbs, protein }; -} - -const rows = [ - createData('Frozen yoghurt', 159, 6.0, 24, 4.0), - createData('Ice cream sandwich', 237, 9.0, 37, 4.3), - createData('Eclair', 262, 16.0, 24, 6.0), - createData('Cupcake', 305, 3.7, 67, 4.3), - createData('Gingerbread', 356, 16.0, 49, 3.9), -]; - export const InterpretationLog = () => { const [open, setOpen] = useState(false); const [log, setLog] = useState(''); const [selectedOption, setSelectedOption] = useState('10'); const [customValue, setCustomValue] = useState(''); + const [tableData, setTableData] = useState([]); // State for table data const logEndRef = useRef(null); const { width } = useBrowserDimensionsStore(); + const { socket } = useSocketStore(); const toggleDrawer = (newOpen: boolean) => (event: React.KeyboardEvent | React.MouseEvent) => { if ( @@ -59,8 +43,6 @@ export const InterpretationLog = () => { setOpen(newOpen); }; - const { socket } = useSocketStore(); - const scrollLogToBottom = () => { if (logEndRef.current) { logEndRef.current.scrollIntoView({ behavior: "smooth" }); @@ -76,10 +58,16 @@ export const InterpretationLog = () => { scrollLogToBottom(); }, [log, scrollLogToBottom]); - const handleSerializableCallback = useCallback((data: string) => { + const handleSerializableCallback = useCallback((data: any) => { setLog((prevState) => prevState + '\n' + '---------- Serializable output data received ----------' + '\n' + JSON.stringify(data, null, 2) + '\n' + '--------------------------------------------------'); + + // Set table data + if (Array.isArray(data)) { + setTableData(data); + } + scrollLogToBottom(); }, [log, scrollLogToBottom]); @@ -108,8 +96,11 @@ export const InterpretationLog = () => { socket?.off('serializableCallback', handleSerializableCallback); socket?.off('binaryCallback', handleBinaryCallback); }; - }, [socket, handleLog]); + }, [socket, handleLog, handleSerializableCallback, handleBinaryCallback]); + // Extract columns dynamically from the first item of tableData + const columns = tableData.length > 0 ? Object.keys(tableData[0]) : []; + return (