From 4a49517b3aa3aa0793bcff7af12673ec696699c1 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 13 Sep 2024 23:32:42 +0530 Subject: [PATCH] feat: handle text label change --- src/components/organisms/RightSidePanel.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 44bad7a3..daf11f3f 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -40,8 +40,14 @@ export const RightSidePanel: React.FC = ({ onFinishCapture const { browserSteps, updateBrowserTextStepLabel, deleteBrowserStep, addScreenshotStep, updateListTextFieldLabel } = useBrowserSteps(); const { socket } = useSocketStore(); - const handleTextLabelChange = (id: number, label: string) => { - setTextLabels(prevLabels => ({ ...prevLabels, [id]: label })); + const handleTextLabelChange = (id: number, label: string, listId?: number, fieldKey?: string) => { + if (listId !== undefined && fieldKey !== undefined) { + // This is a text field within a list step + updateListTextFieldLabel(listId, fieldKey, label); + } else { + // This is a standalone text step + setTextLabels(prevLabels => ({ ...prevLabels, [id]: label })); + } if (!label.trim()) { setErrors(prevErrors => ({ ...prevErrors, [id]: 'Label cannot be empty' })); } else {