From db98639f67083c490e3d45bd6d15327385f5c97d Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 26 Jul 2024 09:29:14 +0530 Subject: [PATCH] feat(wip): browser steps --- src/components/organisms/RightSidePanel.tsx | 58 +++++++++++++++++---- 1 file changed, 49 insertions(+), 9 deletions(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 3c766520..b4fe8795 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -1,5 +1,5 @@ import React, { useEffect, useState } from 'react'; -import { Button, MenuItem, Paper, Stack, Tabs, Tab, Box } from "@mui/material"; +import { Button, MenuItem, Paper, Box, TextField } from "@mui/material"; import { Dropdown as MuiDropdown } from '../atoms/DropdownMui'; import styled from "styled-components"; import { ActionSettings } from "../molecules/ActionSettings"; @@ -14,11 +14,18 @@ interface RightSidePanelProps { pairForEdit: PairForEdit; } -export const RightSidePanel = ({ pairForEdit }: RightSidePanelProps) => { +interface BrowserStep { + id: number; + label: string; + description: string; +} +export const RightSidePanel = ({ pairForEdit }: RightSidePanelProps) => { const [content, setContent] = useState('action'); - const [action, setAction] = React.useState(''); - const [isSettingsDisplayed, setIsSettingsDisplayed] = React.useState(false); + const [action, setAction] = useState(''); + const [isSettingsDisplayed, setIsSettingsDisplayed] = useState(false); + const [browserSteps, setBrowserSteps] = useState([]); + const [stepLabel, setStepLabel] = useState(''); const { lastAction } = useGlobalInfoStore(); const { getText, getScreenshot, startGetText, stopGetText, startGetScreenshot, stopGetScreenshot } = useActionContext(); @@ -37,8 +44,21 @@ export const RightSidePanel = ({ pairForEdit }: RightSidePanelProps) => { if (content !== 'detail' && pairForEdit.pair !== null) { setContent('detail'); } - }, [pairForEdit]) + }, [pairForEdit]); + const addBrowserStep = () => { + setBrowserSteps([...browserSteps, { id: Date.now(), label: stepLabel, description: 'Description of the step' }]); + setStepLabel(''); + }; + + 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)); + }; return ( { } - ) - : null - } + ) : null} {!getText && !getScreenshot && ( @@ -106,6 +124,28 @@ export const RightSidePanel = ({ pairForEdit }: RightSidePanelProps) => { )} + + + setStepLabel(e.target.value)} + /> + + + + + {browserSteps.map(step => ( + + {step.label} + {step.description} + + + + ))} + ); }; @@ -120,4 +160,4 @@ const ActionTypeWrapper = styled.div` export const ActionDescription = styled.p` margin-left: 15px; -`; +`; \ No newline at end of file