From d81e2684ce38e1d9a9731b8176b57440ab5d99e1 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 10 Oct 2024 16:27:38 +0530 Subject: [PATCH] fix: revert changes --- src/components/organisms/RightSidePanel.tsx | 216 ++++++++++---------- 1 file changed, 107 insertions(+), 109 deletions(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 2e46d323..110bdce8 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -120,7 +120,7 @@ export const RightSidePanel: React.FC = ({ 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) { @@ -451,137 +451,135 @@ export const RightSidePanel: React.FC = ({ onFinishCapture )} - { - workflow.workflow.map((pair, i, workflow) => ( - - {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) => ( - handleMouseEnter(step.id)} - onMouseLeave={() => handleMouseLeave(step.id)} - > - {step.type === 'text' && ( - <> - {hoverStates[step.id] && ( - handlePairDelete()} - sx={{ - position: 'absolute', - top: -15, - right: -15, - color: 'red', - p: 0, - zIndex: 1, - boxShadow: '5px', - backgroundColor: 'white', - borderRadius: '50%', - }} - > - - - )} + + {browserSteps.map(step => ( + handleMouseEnter(step.id)} onMouseLeave={() => handleMouseLeave(step.id)}> + { + step.type === 'text' && ( + <> + {confirmedTextSteps[step.id] && hoverStates[step.id] && ( + handlePairDelete()} + sx={{ + position: 'absolute', + top: -15, + right: -15, + color: 'red', + p: 0, + zIndex: 1, + boxShadow: '5px', + backgroundColor: 'white', + borderRadius: '50%', + }} + > + + + )} + handleTextLabelChange(step.id, e.target.value)} + fullWidth + margin="normal" + error={!!errors[step.id]} + helperText={errors[step.id]} + InputProps={{ + readOnly: confirmedTextSteps[step.id], + startAdornment: ( + + + + ) + }} + /> + + + + ) + }} + /> + {!confirmedTextSteps[step.id] && ( + + + + + )} + + )} + {step.type === 'screenshot' && ( + + + + {`Take ${step.fullPage ? 'Fullpage' : 'Visible Part'} Screenshot`} + + + )} + {step.type === 'list' && ( + <> + List Selected Successfully + {Object.entries(step.fields).map(([key, field]) => ( + handleTextLabelChange(step.id, e.target.value)} + label="Field Label" + value={field.label || ''} + onChange={(e) => handleTextLabelChange(field.id, e.target.value, step.id, key)} fullWidth margin="normal" - error={!!errors[step.id]} - helperText={errors[step.id]} InputProps={{ - readOnly: confirmedTextSteps[step.id], + readOnly: confirmedListTextFields[field.id]?.[key], startAdornment: ( - ), + ) }} /> - ), + ) }} /> - - )} - {step.type === 'screenshot' && ( - - - - {`Take ${step.fullPage ? 'Fullpage' : 'Visible Part'} Screenshot`} - - - )} - {step.type === 'list' && ( - <> - List Selected Successfully - {Object.entries(step.fields).map(([key, field]) => ( - - - handleTextLabelChange(field.id, e.target.value, step.id, key) - } - fullWidth - margin="normal" - InputProps={{ - readOnly: confirmedListTextFields[field.id]?.[key], - startAdornment: ( - - - - ), - }} - /> - - - - ), - }} - /> + {!confirmedListTextFields[step.id]?.[key] && ( + + + - ))} - - )} - - ))} + )} + + ))} + + )} ))} - + ); }; \ No newline at end of file