From 5c12762cb5bec01b2851c55ce35d248acaf02e32 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Fri, 14 Jul 2023 05:29:57 -0600 Subject: [PATCH] Fix Birdseye Width & PTZ control panel (#7118) * Cleanup birdseye UI * Cleanup * Fix reversed condition --- web/src/routes/Birdseye.jsx | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) 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 - + {!ptzCameras.length && ( + + )} {config.birdseye.restream && ( )}
-
{/* Use dynamic class */} +
+ {' '} + {/* Use dynamic class */} {player}
{ptzCameras.length ? ( -
+
Control Panel {ptzCameras.map((camera) => (