Files
parcer/src/components/molecules/ActionDescriptionBox.tsx

78 lines
2.6 KiB
TypeScript
Raw Normal View History

2024-10-19 06:07:56 +05:30
import React, { ReactNode } from 'react';
import styled from 'styled-components';
2024-10-19 06:45:10 +05:30
import { PaginationType, useActionContext, LimitType } from '../../context/browserActions';
2024-10-19 06:48:13 +05:30
import Typography from "@mui/material/Typography";
2024-10-19 06:07:56 +05:30
const CustomBoxContainer = styled.div`
position: relative;
2024-10-19 06:23:41 +05:30
width: 300px; /* Adjust width as needed */
2024-10-19 06:07:56 +05:30
height: 200px; /* Adjust height as needed */
2024-10-19 06:23:41 +05:30
border: 2px solid #ff00c3;
2024-10-19 06:07:56 +05:30
background-color: white;
2024-10-19 06:23:41 +05:30
margin: 30px auto;
2024-10-19 06:07:56 +05:30
`;
const Triangle = styled.div`
position: absolute;
top: -20px; /* Adjust this value to control the height of the triangle */
left: 50%;
transform: translateX(-50%);
width: 0;
height: 0;
border-left: 20px solid transparent;
border-right: 20px solid transparent;
2024-10-19 06:23:41 +05:30
border-bottom: 20px solid #ff00c3;
2024-10-19 06:07:56 +05:30
`;
const Content = styled.div`
padding: 20px;
text-align: center;
`;
2024-10-19 06:45:10 +05:30
const ActionDescriptionBox = () => {
const { getText, startGetText, stopGetText, getScreenshot, startGetScreenshot, stopGetScreenshot, getList, startGetList, stopGetList, startPaginationMode, stopPaginationMode, paginationType, updatePaginationType, limitType, customLimit, updateLimitType, updateCustomLimit, stopLimitMode, startLimitMode } = useActionContext();
const renderActionDescription = () => {
if (getText) {
2024-10-19 06:48:13 +05:30
return (
<>
2024-10-19 06:52:41 +05:30
<Typography variant="h6" gutterBottom>Capture Text</Typography>
<Typography variant="body1" gutterBottom>Hover over the texts you want to extract and click to select them</Typography>
2024-10-19 06:48:13 +05:30
</>
)
2024-10-19 06:45:10 +05:30
} else if (getScreenshot) {
2024-10-19 06:51:53 +05:30
return (
<>
2024-10-19 06:52:41 +05:30
<Typography variant="h6" gutterBottom>Capture Screenshot</Typography>
<Typography variant="body1" gutterBottom>Capture a partial or full page screenshot of the current page. </Typography>
2024-10-19 06:51:53 +05:30
</>
)
2024-10-19 06:45:10 +05:30
} else if (getList) {
2024-10-19 06:50:27 +05:30
return (
<>
2024-10-19 06:52:41 +05:30
<Typography variant="h6" gutterBottom>Capture List</Typography>
<Typography variant="body1" gutterBottom>Hover over the list you want to extract. Once selected, you can hover over all texts inside the list you selected. Click to select them. </Typography>
2024-10-19 06:50:27 +05:30
</>
)
2024-10-19 06:45:10 +05:30
} else {
return (
2024-10-19 06:58:31 +05:30
<>
<Typography variant="h6" gutterBottom>What data do you want to extract?</Typography>
<Typography variant="body1" gutterBottom>A robot is designed to perform one action at a time. You can choose any of the options below.</Typography>
</>
)
2024-10-19 06:45:10 +05:30
}
}
2024-10-19 06:52:41 +05:30
return (
<CustomBoxContainer>
<Triangle />
<Content>
{renderActionDescription()}
</Content>
</CustomBoxContainer>
);
2024-10-19 06:07:56 +05:30
};
export default ActionDescriptionBox;