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'; import { useNavigate } from "react-router-dom"; interface NavBarProps { newRecording: () => void; recordingName: string; isRecording: boolean; } export const NavBar = ({ newRecording, recordingName, isRecording }: NavBarProps) => { const { notify, browserId, setBrowserId, recordingLength } = useGlobalInfoStore(); const navigate = useNavigate(); // 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); } navigate('/'); }; const handleNewRecording = async () => { if (browserId) { setBrowserId(null); await stopRecording(browserId); } newRecording(); notify('info', 'New Recording started'); } return (
Maxun
{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; `;