import React from 'react';
import styled from 'styled-components';
import { Typography, FormControlLabel, Checkbox, Box } from '@mui/material';
import { useActionContext } from '../../context/browserActions';
const CustomBoxContainer = styled.div`
position: relative;
min-width: 250px;
width: auto;
min-height: 100px;
height: auto;
// border: 2px solid #ff00c3;
border-radius: 5px;
background-color: white;
margin: 80px 13px 25px 13px;
`;
const Triangle = styled.div`
position: absolute;
top: -15px;
left: 50%;
transform: translateX(-50%);
width: 0;
height: 0;
border-left: 20px solid transparent;
border-right: 20px solid transparent;
border-bottom: 20px solid white;
`;
const Logo = styled.img`
position: absolute;
top: -80px;
left: 50%;
transform: translateX(-50%);
width: 70px;
height: auto;
border-radius: 5px;
`;
const Content = styled.div`
padding: 20px;
text-align: left;
`;
const ActionDescriptionBox = () => {
const { getText, getScreenshot, getList, captureStage } = useActionContext() as {
getText: boolean;
getScreenshot: boolean;
getList: boolean;
captureStage: 'initial' | 'pagination' | 'limit' | 'complete';
};
const messages = [
{ stage: 'initial' as const, text: 'Select the list you want to extract along with the texts inside it' },
{ stage: 'pagination' as const, text: 'Select how the robot can capture the rest of the list' },
{ stage: 'limit' as const, text: 'Choose the number of items to extract' },
{ stage: 'complete' as const, text: 'Capture is complete' },
];
const stages = messages.map(({ stage }) => stage); // Create a list of stages
const currentStageIndex = stages.indexOf(captureStage); // Get the index of the current stage
const renderActionDescription = () => {
if (getText) {
return (
<>
Capture Text
Hover over the texts you want to extract and click to select them
>
);
} else if (getScreenshot) {
return (
<>
Capture Screenshot
Capture a partial or full page screenshot of the current page.
>
);
} else if (getList) {
return (
<>
Capture List
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.
{messages.map(({ stage, text }, index) => (
}
label={{text}}
/>
))}
>
);
} else {
return (
<>
What data do you want to extract?
A robot is designed to perform one action at a time. You can choose any of the options below.
>
);
}
};
return (
{renderActionDescription()}
);
};
export default ActionDescriptionBox;