From 2a86ad87e156327784953aae01e9513f2de5d1f8 Mon Sep 17 00:00:00 2001 From: Rohit Date: Mon, 28 Jul 2025 16:31:21 +0530 Subject: [PATCH] feat: alter capture list loader --- src/components/browser/BrowserWindow.tsx | 141 ++++++++++++++++++++--- 1 file changed, 126 insertions(+), 15 deletions(-) diff --git a/src/components/browser/BrowserWindow.tsx b/src/components/browser/BrowserWindow.tsx index 9f5cedc2..31d96bc9 100644 --- a/src/components/browser/BrowserWindow.tsx +++ b/src/components/browser/BrowserWindow.tsx @@ -166,7 +166,7 @@ export const BrowserWindow = () => { const [viewportInfo, setViewportInfo] = useState({ width: browserWidth, height: browserHeight }); const [isLoading, setIsLoading] = useState(false); const [cachedChildSelectors, setCachedChildSelectors] = useState([]); - + const [processingGroupCoordinates, setProcessingGroupCoordinates] = useState>([]); const [listSelector, setListSelector] = useState(null); const [fields, setFields] = useState>({}); const [paginationSelector, setPaginationSelector] = useState(''); @@ -787,6 +787,15 @@ export const BrowserWindow = () => { !listSelector && highlighterData.groupInfo?.isGroupElement ) { + if (highlighterData?.groupInfo.groupElements) { + setProcessingGroupCoordinates( + highlighterData.groupInfo.groupElements.map((element) => ({ + element, + rect: element.getBoundingClientRect(), + })) + ); + } + let cleanedSelector = highlighterData.selector; setListSelector(cleanedSelector); @@ -1503,6 +1512,8 @@ export const BrowserWindow = () => { {/* Loading overlay positioned specifically over DOM content */} {isCachingChildSelectors && ( + <> + {/* Background overlay */}
{ width: "100%", height: "100%", background: "rgba(255, 255, 255, 0.8)", - display: "flex", - alignItems: "center", - justifyContent: "center", zIndex: 9999, pointerEvents: "none", - borderRadius: "0px 0px 5px 5px", // Match the DOM renderer border radius + borderRadius: "0px 0px 5px 5px", }} - > + /> + + {/* Use processing coordinates captured before listSelector was set */} + {processingGroupCoordinates.map((groupElement, index) => ( + + {/* Original highlight box */} +
+ + {/* Label */} +
+ List item {index + 1} +
+ + {/* Scanning animation */} +
+
+
+ + + + ))} + + {/* Fallback loader */} + {processingGroupCoordinates.length === 0 && (
-
- )} + > +
+
+ )} + + )}
) : ( /* Screenshot mode canvas */