chore: lint

This commit is contained in:
karishmas6
2024-10-10 16:21:39 +05:30
parent cb418f9824
commit 11974a52f1

View File

@@ -120,7 +120,7 @@ export const RightSidePanel: React.FC<RightSidePanelProps> = ({ onFinishCapture
setHoverStates(prev => ({ ...prev, [id]: false })); setHoverStates(prev => ({ ...prev, [id]: false }));
}; };
const handlePairDelete = () => {} const handlePairDelete = () => { }
const handleTextLabelChange = (id: number, label: string, listId?: number, fieldKey?: string) => { const handleTextLabelChange = (id: number, label: string, listId?: number, fieldKey?: string) => {
if (listId !== undefined && fieldKey !== undefined) { if (listId !== undefined && fieldKey !== undefined) {
@@ -452,135 +452,135 @@ export const RightSidePanel: React.FC<RightSidePanelProps> = ({ onFinishCapture
)} )}
</Box> </Box>
{ {
workflow.workflow.map((pair, i, workflow) => ( workflow.workflow.map((pair, i, workflow) => (
<Box key={workflow.length - i} sx={{ mb: 2 }}> <Box key={workflow.length - i} sx={{ mb: 2 }}>
{browserSteps.filter(step => { {browserSteps.filter(step => {
if (step.type === 'text') { if (step.type === 'text') {
return confirmedTextSteps[step.id]; // Check if text step is confirmed return confirmedTextSteps[step.id]; // Check if text step is confirmed
} else if (step.type === 'list') { } else if (step.type === 'list') {
return Object.values(confirmedListTextFields[step.id] || {}).some(Boolean); // Check if any list fields are confirmed return Object.values(confirmedListTextFields[step.id] || {}).some(Boolean); // Check if any list fields are confirmed
} else if (step.type === 'screenshot') { } else if (step.type === 'screenshot') {
return true; // Assuming all screenshot steps are considered confirmed by default return true; // Assuming all screenshot steps are considered confirmed by default
} }
return false; // Default case return false; // Default case
}).map((step) => ( }).map((step) => (
<Box <Box
key={step.id} key={step.id}
sx={{ sx={{
boxShadow: 5, boxShadow: 5,
padding: '10px', padding: '10px',
margin: '13px', margin: '13px',
borderRadius: '4px', borderRadius: '4px',
position: 'relative', position: 'relative',
}}
onMouseEnter={() => handleMouseEnter(step.id)}
onMouseLeave={() => handleMouseLeave(step.id)}
>
{step.type === 'text' && (
<>
{hoverStates[step.id] && (
<IconButton
onClick={() => handlePairDelete()}
sx={{
position: 'absolute',
top: -15,
right: -15,
color: 'red',
p: 0,
zIndex: 1,
boxShadow: '5px',
backgroundColor: 'white',
borderRadius: '50%',
}}
>
<DeleteIcon sx={{ fontSize: 40 }} />
</IconButton>
)}
<TextField
label="Label"
value={textLabels[step.id] || step.label || ''}
onChange={(e) => handleTextLabelChange(step.id, e.target.value)}
fullWidth
margin="normal"
error={!!errors[step.id]}
helperText={errors[step.id]}
InputProps={{
readOnly: confirmedTextSteps[step.id],
startAdornment: (
<InputAdornment position="start">
<EditIcon />
</InputAdornment>
),
}} }}
/> onMouseEnter={() => handleMouseEnter(step.id)}
<TextField onMouseLeave={() => handleMouseLeave(step.id)}
label="Data" >
value={step.data} {step.type === 'text' && (
fullWidth <>
margin="normal" {hoverStates[step.id] && (
InputProps={{ <IconButton
readOnly: confirmedTextSteps[step.id], onClick={() => handlePairDelete()}
startAdornment: ( sx={{
<InputAdornment position="start"> position: 'absolute',
<TextFieldsIcon /> top: -15,
</InputAdornment> right: -15,
), color: 'red',
}} p: 0,
/> zIndex: 1,
</> boxShadow: '5px',
)} backgroundColor: 'white',
{step.type === 'screenshot' && ( borderRadius: '50%',
<Box display="flex" alignItems="center"> }}
<DocumentScannerIcon sx={{ mr: 1 }} /> >
<Typography> <DeleteIcon sx={{ fontSize: 40 }} />
{`Take ${step.fullPage ? 'Fullpage' : 'Visible Part'} Screenshot`} </IconButton>
</Typography> )}
</Box> <TextField
)} label="Label"
{step.type === 'list' && ( value={textLabels[step.id] || step.label || ''}
<> onChange={(e) => handleTextLabelChange(step.id, e.target.value)}
<Typography>List Selected Successfully</Typography> fullWidth
{Object.entries(step.fields).map(([key, field]) => ( margin="normal"
<Box key={key}> error={!!errors[step.id]}
<TextField helperText={errors[step.id]}
label="Field Label" InputProps={{
value={field.label || ''} readOnly: confirmedTextSteps[step.id],
onChange={(e) => startAdornment: (
handleTextLabelChange(field.id, e.target.value, step.id, key) <InputAdornment position="start">
} <EditIcon />
fullWidth </InputAdornment>
margin="normal" ),
InputProps={{ }}
readOnly: confirmedListTextFields[field.id]?.[key], />
startAdornment: ( <TextField
<InputAdornment position="start"> label="Data"
<EditIcon /> value={step.data}
</InputAdornment> fullWidth
), margin="normal"
}} InputProps={{
/> readOnly: confirmedTextSteps[step.id],
<TextField startAdornment: (
label="Field Data" <InputAdornment position="start">
value={field.data || ''} <TextFieldsIcon />
fullWidth </InputAdornment>
margin="normal" ),
InputProps={{ }}
readOnly: true, />
startAdornment: ( </>
<InputAdornment position="start"> )}
<TextFieldsIcon /> {step.type === 'screenshot' && (
</InputAdornment> <Box display="flex" alignItems="center">
), <DocumentScannerIcon sx={{ mr: 1 }} />
}} <Typography>
/> {`Take ${step.fullPage ? 'Fullpage' : 'Visible Part'} Screenshot`}
</Box> </Typography>
))} </Box>
</> )}
)} {step.type === 'list' && (
</Box> <>
))} <Typography>List Selected Successfully</Typography>
</Box> {Object.entries(step.fields).map(([key, field]) => (
))} <Box key={key}>
<TextField
label="Field Label"
value={field.label || ''}
onChange={(e) =>
handleTextLabelChange(field.id, e.target.value, step.id, key)
}
fullWidth
margin="normal"
InputProps={{
readOnly: confirmedListTextFields[field.id]?.[key],
startAdornment: (
<InputAdornment position="start">
<EditIcon />
</InputAdornment>
),
}}
/>
<TextField
label="Field Data"
value={field.data || ''}
fullWidth
margin="normal"
InputProps={{
readOnly: true,
startAdornment: (
<InputAdornment position="start">
<TextFieldsIcon />
</InputAdornment>
),
}}
/>
</Box>
))}
</>
)}
</Box>
))}
</Box>
))}
</Paper> </Paper>
); );