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 }));
};
const handlePairDelete = () => {}
const handlePairDelete = () => { }
const handleTextLabelChange = (id: number, label: string, listId?: number, fieldKey?: string) => {
if (listId !== undefined && fieldKey !== undefined) {
@@ -452,135 +452,135 @@ export const RightSidePanel: React.FC<RightSidePanelProps> = ({ onFinishCapture
)}
</Box>
{
workflow.workflow.map((pair, i, workflow) => (
<Box key={workflow.length - i} sx={{ mb: 2 }}>
{browserSteps.filter(step => {
if (step.type === 'text') {
return confirmedTextSteps[step.id]; // Check if text step is confirmed
} else if (step.type === 'list') {
return Object.values(confirmedListTextFields[step.id] || {}).some(Boolean); // Check if any list fields are confirmed
} else if (step.type === 'screenshot') {
return true; // Assuming all screenshot steps are considered confirmed by default
}
return false; // Default case
}).map((step) => (
<Box
key={step.id}
sx={{
boxShadow: 5,
padding: '10px',
margin: '13px',
borderRadius: '4px',
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>
),
workflow.workflow.map((pair, i, workflow) => (
<Box key={workflow.length - i} sx={{ mb: 2 }}>
{browserSteps.filter(step => {
if (step.type === 'text') {
return confirmedTextSteps[step.id]; // Check if text step is confirmed
} else if (step.type === 'list') {
return Object.values(confirmedListTextFields[step.id] || {}).some(Boolean); // Check if any list fields are confirmed
} else if (step.type === 'screenshot') {
return true; // Assuming all screenshot steps are considered confirmed by default
}
return false; // Default case
}).map((step) => (
<Box
key={step.id}
sx={{
boxShadow: 5,
padding: '10px',
margin: '13px',
borderRadius: '4px',
position: 'relative',
}}
/>
<TextField
label="Data"
value={step.data}
fullWidth
margin="normal"
InputProps={{
readOnly: confirmedTextSteps[step.id],
startAdornment: (
<InputAdornment position="start">
<TextFieldsIcon />
</InputAdornment>
),
}}
/>
</>
)}
{step.type === 'screenshot' && (
<Box display="flex" alignItems="center">
<DocumentScannerIcon sx={{ mr: 1 }} />
<Typography>
{`Take ${step.fullPage ? 'Fullpage' : 'Visible Part'} Screenshot`}
</Typography>
</Box>
)}
{step.type === 'list' && (
<>
<Typography>List Selected Successfully</Typography>
{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>
))}
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>
),
}}
/>
<TextField
label="Data"
value={step.data}
fullWidth
margin="normal"
InputProps={{
readOnly: confirmedTextSteps[step.id],
startAdornment: (
<InputAdornment position="start">
<TextFieldsIcon />
</InputAdornment>
),
}}
/>
</>
)}
{step.type === 'screenshot' && (
<Box display="flex" alignItems="center">
<DocumentScannerIcon sx={{ mr: 1 }} />
<Typography>
{`Take ${step.fullPage ? 'Fullpage' : 'Visible Part'} Screenshot`}
</Typography>
</Box>
)}
{step.type === 'list' && (
<>
<Typography>List Selected Successfully</Typography>
{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>
);