diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index b4fe8795..27dffaea 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -1,4 +1,4 @@ -import React, { useEffect, useState } from 'react'; +import React, { useState } from 'react'; import { Button, MenuItem, Paper, Box, TextField } from "@mui/material"; import { Dropdown as MuiDropdown } from '../atoms/DropdownMui'; import styled from "styled-components"; @@ -26,6 +26,7 @@ export const RightSidePanel = ({ pairForEdit }: RightSidePanelProps) => { const [isSettingsDisplayed, setIsSettingsDisplayed] = useState(false); const [browserSteps, setBrowserSteps] = useState([]); const [stepLabel, setStepLabel] = useState(''); + const [stepDescription, setStepDescription] = useState(''); const { lastAction } = useGlobalInfoStore(); const { getText, getScreenshot, startGetText, stopGetText, startGetScreenshot, stopGetScreenshot } = useActionContext(); @@ -40,24 +41,18 @@ export const RightSidePanel = ({ pairForEdit }: RightSidePanelProps) => { setIsSettingsDisplayed(true); }; - useEffect(() => { - if (content !== 'detail' && pairForEdit.pair !== null) { - setContent('detail'); - } - }, [pairForEdit]); - - const addBrowserStep = () => { - setBrowserSteps([...browserSteps, { id: Date.now(), label: stepLabel, description: 'Description of the step' }]); + const confirmStep = () => { + setBrowserSteps([ + ...browserSteps, + { id: Date.now(), label: stepLabel, description: stepDescription } + ]); setStepLabel(''); + setStepDescription(''); }; - const confirmStep = (id: number) => { - console.log(`Step with ID ${id} confirmed.`); - // Implement your logic here - }; - - const discardStep = (id: number) => { - setBrowserSteps(browserSteps.filter(step => step.id !== id)); + const discardStep = () => { + setStepLabel(''); + setStepDescription(''); }; return ( @@ -127,22 +122,30 @@ export const RightSidePanel = ({ pairForEdit }: RightSidePanelProps) => { setStepLabel(e.target.value)} /> - + setStepDescription(e.target.value)} + /> + + + + {browserSteps.map(step => ( - {step.label} + {step.label} {step.description} - - ))}