diff --git a/src/components/molecules/NavBar.tsx b/src/components/molecules/NavBar.tsx new file mode 100644 index 00000000..011277c1 --- /dev/null +++ b/src/components/molecules/NavBar.tsx @@ -0,0 +1,110 @@ +import React from 'react'; +import styled from "styled-components"; +import { stopRecording } from "../../api/recording"; +import { useGlobalInfoStore } from "../../context/globalInfo"; +import { Button, IconButton } from "@mui/material"; +import { RecordingIcon } from "../atoms/RecorderIcon"; +import { SaveRecording } from "./SaveRecording"; +import { Circle } from "@mui/icons-material"; +import MeetingRoomIcon from '@mui/icons-material/MeetingRoom'; + +interface NavBarProps { + newRecording: () => void; + recordingName: string; + isRecording: boolean; +} + +export const NavBar = ({newRecording, recordingName, isRecording}:NavBarProps) => { + + const { notify, browserId, setBrowserId, recordingLength } = useGlobalInfoStore(); + + // If recording is in progress, the resources and change page view by setting browserId to null + // else it won't affect the page + const goToMainMenu = async() => { + if (browserId) { + await stopRecording(browserId); + notify('warning', 'Current Recording was terminated'); + setBrowserId(null); + } + }; + + const handleNewRecording = async () => { + if (browserId) { + setBrowserId(null); + await stopRecording(browserId); + } + newRecording(); + notify('info', 'New Recording started'); + } + + return ( + +
+ +
Browser Recorder
+
+
+ + {isRecording ? 'NEW' : 'RECORD'} + + { + recordingLength > 0 + ? + :null + } + { isRecording ? + : null } +
+ +
+ ); +}; + +const NavBarWrapper = styled.div` + grid-area: navbar; + background-color: #3f4853; + padding:5px; + display: flex; + justify-content: space-between; +`; + +const ProjectName = styled.b` + color: white; + font-size: 1.3em; +`;