diff --git a/web/src/routes/Birdseye.jsx b/web/src/routes/Birdseye.jsx index 6d5df85e8..d41e04b04 100644 --- a/web/src/routes/Birdseye.jsx +++ b/web/src/routes/Birdseye.jsx @@ -6,7 +6,7 @@ import Heading from '../components/Heading'; import WebRtcPlayer from '../components/WebRtcPlayer'; import '../components/MsePlayer'; import useSWR from 'swr'; -import { useMemo, useState } from 'preact/hooks'; +import { useMemo } from 'preact/hooks'; import CameraControlPanel from '../components/CameraControlPanel'; import { baseUrl } from '../api/baseUrl'; @@ -26,19 +26,19 @@ export default function Birdseye() { .map(([_, camera]) => camera.name); }, [config]); - const [isMaxWidth, setIsMaxWidth] = useState(false); + const [isMaxWidth, setIsMaxWidth] = usePersistence('birdseye-width', false); if (!config || !sourceIsLoaded) { return ; } let player; - const playerClass = isMaxWidth ? 'max-w-5xl xl:w-1/2' : 'w-full'; + const playerClass = ptzCameras.length || isMaxWidth ? 'w-full' : 'max-w-5xl xl:w-1/2'; if (viewSource == 'mse' && config.birdseye.restream) { if ('MediaSource' in window) { player = ( - + ); } - } else if (viewSource == 'webrtc' ) { + } else if (viewSource == 'webrtc') { player = ( - + @@ -66,7 +66,7 @@ export default function Birdseye() { } else { player = ( - + @@ -80,12 +80,14 @@ export default function Birdseye() { Birdseye - setIsMaxWidth(!isMaxWidth)} - > - Toggle width - + {!ptzCameras.length && ( + setIsMaxWidth(!isMaxWidth)} + > + Toggle width + + )} {config.birdseye.restream && ( ))} - )} - {/* Use dynamic class */} + + {' '} + {/* Use dynamic class */} {player} {ptzCameras.length ? ( - + Control Panel {ptzCameras.map((camera) => (