diff --git a/src/components/molecules/BrowserRecordingSave.tsx b/src/components/molecules/BrowserRecordingSave.tsx index 34fe0074..109c704b 100644 --- a/src/components/molecules/BrowserRecordingSave.tsx +++ b/src/components/molecules/BrowserRecordingSave.tsx @@ -25,18 +25,19 @@ const BrowserRecordingSave = () => {
- diff --git a/src/components/molecules/NavBar.tsx b/src/components/molecules/NavBar.tsx index dbbf2c1c..85b57b24 100644 --- a/src/components/molecules/NavBar.tsx +++ b/src/components/molecules/NavBar.tsx @@ -3,28 +3,23 @@ import axios from 'axios'; import styled from "styled-components"; import { stopRecording } from "../../api/recording"; import { useGlobalInfoStore } from "../../context/globalInfo"; -import { Button, IconButton, Typography } from "@mui/material"; +import { IconButton } from "@mui/material"; import { RecordingIcon } from "../atoms/RecorderIcon"; import { SaveRecording } from "./SaveRecording"; -import { Circle, Add, Logout, Clear } from "@mui/icons-material"; -import MeetingRoomIcon from '@mui/icons-material/MeetingRoom'; -import { Link, useLocation, useNavigate } from 'react-router-dom'; +import { Logout, Clear } from "@mui/icons-material"; +import { useNavigate } from 'react-router-dom'; import { AuthContext } from '../../context/auth'; -import { GenericModal } from '../atoms/GenericModal'; -import TextField from '@mui/material/TextField'; interface NavBarProps { - newRecording: () => void; recordingName: string; isRecording: boolean; } -export const NavBar: React.FC = ({ newRecording, recordingName, isRecording }) => { +export const NavBar: React.FC = ({ recordingName, isRecording }) => { - const { notify, browserId, setBrowserId, recordingLength, recordingUrl, setRecordingUrl } = useGlobalInfoStore(); + const { notify, browserId, setBrowserId, recordingUrl } = useGlobalInfoStore(); const { state, dispatch } = useContext(AuthContext); const { user } = state; - const [isModalOpen, setModalOpen] = useState(false); console.log(`Recording URL: ${recordingUrl}`) @@ -49,20 +44,6 @@ export const NavBar: React.FC = ({ newRecording, recordingName, isR navigate('/'); }; - const handleNewRecording = async () => { - if (browserId) { - setBrowserId(null); - await stopRecording(browserId); - } - setModalOpen(true); - }; - - const startRecording = () => { - setModalOpen(false); - newRecording(); - notify('info', 'New Recording started for ' + recordingUrl); - }; - return (
= ({ newRecording, recordingName, isR { !isRecording ? ( <> - - Create Robot - = ({ newRecording, recordingName, isR Logout - ) : - <> - - - Discard - - + ) : + <> + + + Discard + + }
- setModalOpen(false)}> -
- Enter URL To Extract Data - setRecordingUrl(e.target.value)} - style={{ marginBottom: '20px', marginTop: '20px' }} - /> - -
-
) : "" } diff --git a/src/components/molecules/RecordingsTable.tsx b/src/components/molecules/RecordingsTable.tsx index 4a3a61df..00386ca3 100644 --- a/src/components/molecules/RecordingsTable.tsx +++ b/src/components/molecules/RecordingsTable.tsx @@ -9,12 +9,16 @@ import TablePagination from '@mui/material/TablePagination'; import TableRow from '@mui/material/TableRow'; import { useEffect } from "react"; import { WorkflowFile } from "maxun-core"; -import { IconButton } from "@mui/material"; +import { IconButton, Button, Box, Typography, TextField } from "@mui/material"; import { Schedule, DeleteForever, Edit, PlayCircle } from "@mui/icons-material"; import LinkIcon from '@mui/icons-material/Link'; import { useGlobalInfoStore } from "../../context/globalInfo"; import { deleteRecordingFromStorage, getStoredRecordings } from "../../api/storage"; -import { Typography } from '@mui/material'; +import { Add } from "@mui/icons-material"; +import { useNavigate } from 'react-router-dom'; +import { stopRecording } from "../../api/recording"; +import { GenericModal } from '../atoms/GenericModal'; + /** TODO: * 1. allow editing existing robot after persisting browser steps @@ -86,8 +90,10 @@ export const RecordingsTable = ({ handleEditRecording, handleRunRecording, handl const [page, setPage] = React.useState(0); const [rowsPerPage, setRowsPerPage] = React.useState(10); const [rows, setRows] = React.useState([]); + const [isModalOpen, setModalOpen] = React.useState(false); - const { notify, setRecordings } = useGlobalInfoStore(); + const { notify, setRecordings, browserId, setBrowserId, recordingUrl, setRecordingUrl, recordingName, setRecordingName, recordingId, setRecordingId } = useGlobalInfoStore(); + const navigate = useNavigate(); const handleChangePage = (event: unknown, newPage: number) => { setPage(newPage); @@ -118,6 +124,27 @@ export const RecordingsTable = ({ handleEditRecording, handleRunRecording, handl } } + const handleNewRecording = async () => { + if (browserId) { + setBrowserId(null); + await stopRecording(browserId); + } + setModalOpen(true); + }; + + const handleStartRecording = () => { + setBrowserId('new-recording'); + setRecordingName(''); + setRecordingId(''); + navigate('/recording'); + } + + const startRecording = () => { + setModalOpen(false); + handleStartRecording(); + notify('info', 'New Recording started for ' + recordingUrl); + }; + useEffect(() => { if (rows.length === 0) { fetchRecordings(); @@ -126,9 +153,33 @@ export const RecordingsTable = ({ handleEditRecording, handleRunRecording, handl return ( - - My Robots - + + + My Robots + + + Create Robot + + @@ -226,6 +277,27 @@ export const RecordingsTable = ({ handleEditRecording, handleRunRecording, handl onPageChange={handleChangePage} onRowsPerPageChange={handleChangeRowsPerPage} /> + setModalOpen(false)}> +
+ Enter URL To Extract Data + setRecordingUrl(e.target.value)} + style={{ marginBottom: '20px', marginTop: '20px' }} + /> + +
+
); } diff --git a/src/components/organisms/Recordings.tsx b/src/components/organisms/Recordings.tsx index ec215b98..b90e3bdf 100644 --- a/src/components/organisms/Recordings.tsx +++ b/src/components/organisms/Recordings.tsx @@ -20,8 +20,6 @@ export const Recordings = ({ handleEditRecording, handleRunRecording, setRecordi const [params, setParams] = useState([]); const [selectedRecordingId, setSelectedRecordingId] = useState(''); - console.log(`Selected reocrding id: ${selectedRecordingId}`); - const handleSettingsAndIntegrate = (id: string, name: string, params: string[]) => { if (params.length === 0) { setIntegrateSettingsAreOpen(true); diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index fd51f287..9adfad10 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -375,9 +375,9 @@ export const RightSidePanel: React.FC = ({ onFinishCapture return ( - + {/* Last action: {` ${lastAction}`} - + */} {!getText && !getScreenshot && !getList && showCaptureList && } diff --git a/src/pages/PageWrappper.tsx b/src/pages/PageWrappper.tsx index 09b0106f..2b34e58c 100644 --- a/src/pages/PageWrappper.tsx +++ b/src/pages/PageWrappper.tsx @@ -20,13 +20,6 @@ export const PageWrapper = () => { const { browserId, setBrowserId, notification, recordingName, setRecordingName, recordingId, setRecordingId } = useGlobalInfoStore(); - const handleNewRecording = () => { - setBrowserId('new-recording'); - setRecordingName(''); - setRecordingId(''); - navigate('/recording'); - } - const handleEditRecording = (recordingId: string, fileName: string) => { setRecordingName(fileName); setRecordingId(recordingId); @@ -57,11 +50,7 @@ export const PageWrapper = () => { - { - !!browserId ? ( - "" - ) : - } + }> } />