feat: alter capture list loader
This commit is contained in:
@@ -166,7 +166,7 @@ export const BrowserWindow = () => {
|
|||||||
const [viewportInfo, setViewportInfo] = useState<ViewportInfo>({ width: browserWidth, height: browserHeight });
|
const [viewportInfo, setViewportInfo] = useState<ViewportInfo>({ width: browserWidth, height: browserHeight });
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
const [cachedChildSelectors, setCachedChildSelectors] = useState<string[]>([]);
|
const [cachedChildSelectors, setCachedChildSelectors] = useState<string[]>([]);
|
||||||
|
const [processingGroupCoordinates, setProcessingGroupCoordinates] = useState<Array<{ element: HTMLElement; rect: DOMRect }>>([]);
|
||||||
const [listSelector, setListSelector] = useState<string | null>(null);
|
const [listSelector, setListSelector] = useState<string | null>(null);
|
||||||
const [fields, setFields] = useState<Record<string, TextStep>>({});
|
const [fields, setFields] = useState<Record<string, TextStep>>({});
|
||||||
const [paginationSelector, setPaginationSelector] = useState<string>('');
|
const [paginationSelector, setPaginationSelector] = useState<string>('');
|
||||||
@@ -787,6 +787,15 @@ export const BrowserWindow = () => {
|
|||||||
!listSelector &&
|
!listSelector &&
|
||||||
highlighterData.groupInfo?.isGroupElement
|
highlighterData.groupInfo?.isGroupElement
|
||||||
) {
|
) {
|
||||||
|
if (highlighterData?.groupInfo.groupElements) {
|
||||||
|
setProcessingGroupCoordinates(
|
||||||
|
highlighterData.groupInfo.groupElements.map((element) => ({
|
||||||
|
element,
|
||||||
|
rect: element.getBoundingClientRect(),
|
||||||
|
}))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
let cleanedSelector = highlighterData.selector;
|
let cleanedSelector = highlighterData.selector;
|
||||||
|
|
||||||
setListSelector(cleanedSelector);
|
setListSelector(cleanedSelector);
|
||||||
@@ -1503,6 +1512,8 @@ export const BrowserWindow = () => {
|
|||||||
|
|
||||||
{/* Loading overlay positioned specifically over DOM content */}
|
{/* Loading overlay positioned specifically over DOM content */}
|
||||||
{isCachingChildSelectors && (
|
{isCachingChildSelectors && (
|
||||||
|
<>
|
||||||
|
{/* Background overlay */}
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
@@ -1511,26 +1522,126 @@ export const BrowserWindow = () => {
|
|||||||
width: "100%",
|
width: "100%",
|
||||||
height: "100%",
|
height: "100%",
|
||||||
background: "rgba(255, 255, 255, 0.8)",
|
background: "rgba(255, 255, 255, 0.8)",
|
||||||
display: "flex",
|
|
||||||
alignItems: "center",
|
|
||||||
justifyContent: "center",
|
|
||||||
zIndex: 9999,
|
zIndex: 9999,
|
||||||
pointerEvents: "none",
|
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) => (
|
||||||
|
<React.Fragment key={`group-highlight-${index}`}>
|
||||||
|
{/* Original highlight box */}
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
position: "absolute",
|
||||||
|
left: groupElement.rect.x,
|
||||||
|
top: groupElement.rect.y,
|
||||||
|
width: groupElement.rect.width,
|
||||||
|
height: groupElement.rect.height,
|
||||||
|
background: "rgba(255, 0, 195, 0.15)",
|
||||||
|
border: "2px dashed #ff00c3",
|
||||||
|
borderRadius: "3px",
|
||||||
|
pointerEvents: "none",
|
||||||
|
zIndex: 10000,
|
||||||
|
boxShadow: "0 0 0 1px rgba(255, 255, 255, 0.8)",
|
||||||
|
transition: "all 0.1s ease-out",
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{/* Label */}
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
position: "absolute",
|
||||||
|
left: groupElement.rect.x,
|
||||||
|
top: groupElement.rect.y - 20,
|
||||||
|
background: "#ff00c3",
|
||||||
|
color: "white",
|
||||||
|
padding: "2px 6px",
|
||||||
|
fontSize: "10px",
|
||||||
|
fontWeight: "bold",
|
||||||
|
borderRadius: "2px",
|
||||||
|
pointerEvents: "none",
|
||||||
|
zIndex: 10001,
|
||||||
|
whiteSpace: "nowrap",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
List item {index + 1}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Scanning animation */}
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
position: "absolute",
|
||||||
|
left: groupElement.rect.x,
|
||||||
|
top: groupElement.rect.y,
|
||||||
|
width: groupElement.rect.width,
|
||||||
|
height: groupElement.rect.height,
|
||||||
|
overflow: "hidden",
|
||||||
|
zIndex: 10002,
|
||||||
|
pointerEvents: "none",
|
||||||
|
borderRadius: "3px",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
position: "absolute",
|
||||||
|
left: 0,
|
||||||
|
width: "100%",
|
||||||
|
height: "8px",
|
||||||
|
background:
|
||||||
|
"linear-gradient(90deg, transparent 0%, rgba(255, 0, 195, 0.6) 50%, transparent 100%)",
|
||||||
|
animation: `scanDown-${index} 2s ease-in-out infinite`,
|
||||||
|
willChange: "transform",
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>{`
|
||||||
|
@keyframes scanDown-${index} {
|
||||||
|
0% {
|
||||||
|
transform: translateY(-8px);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: translateY(${groupElement.rect.height}px);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`}</style>
|
||||||
|
</React.Fragment>
|
||||||
|
))}
|
||||||
|
|
||||||
|
{/* Fallback loader */}
|
||||||
|
{processingGroupCoordinates.length === 0 && (
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
width: "40px",
|
position: "absolute",
|
||||||
height: "40px",
|
top: 0,
|
||||||
border: "4px solid #f3f3f3",
|
left: 0,
|
||||||
borderTop: "4px solid #ff00c3",
|
width: "100%",
|
||||||
borderRadius: "50%",
|
height: "100%",
|
||||||
animation: "spin 1s linear infinite",
|
background: "rgba(255, 255, 255, 0.8)",
|
||||||
|
display: "flex",
|
||||||
|
alignItems: "center",
|
||||||
|
justifyContent: "center",
|
||||||
|
zIndex: 9999,
|
||||||
|
pointerEvents: "none",
|
||||||
|
borderRadius: "0px 0px 5px 5px",
|
||||||
}}
|
}}
|
||||||
/>
|
>
|
||||||
</div>
|
<div
|
||||||
)}
|
style={{
|
||||||
|
width: "40px",
|
||||||
|
height: "40px",
|
||||||
|
border: "4px solid #f3f3f3",
|
||||||
|
borderTop: "4px solid #ff00c3",
|
||||||
|
borderRadius: "50%",
|
||||||
|
animation: "spin 1s linear infinite",
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
/* Screenshot mode canvas */
|
/* Screenshot mode canvas */
|
||||||
|
|||||||
Reference in New Issue
Block a user