From 8cddfc27fb398da82158a6c2977161ae46b4ac1a Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Sat, 18 May 2024 10:54:46 -0600 Subject: [PATCH] UI fixes (#11417) * Set max width on the problems area in status bar and use unique keys so they do not duplicate * Fix possibly missing media info * Show full row of items on tablet * remove debugging logic --- web/src/components/Statusbar.tsx | 10 +++++----- web/src/hooks/use-stats.ts | 2 +- web/src/types/live.ts | 8 ++++---- web/src/views/live/LiveCameraView.tsx | 7 ++++--- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/web/src/components/Statusbar.tsx b/web/src/components/Statusbar.tsx index 9fb45ba42..d0c142b32 100644 --- a/web/src/components/Statusbar.tsx +++ b/web/src/components/Statusbar.tsx @@ -116,7 +116,7 @@ export default function Statusbar() { ); })} -
+
{Object.entries(messages).length === 0 ? (
@@ -125,11 +125,11 @@ export default function Statusbar() { ) : ( Object.entries(messages).map(([key, messageArray]) => (
- {messageArray.map(({ id, text, color, link }: StatusMessage) => { + {messageArray.map(({ text, color, link }: StatusMessage) => { const message = (
+ {message} ); diff --git a/web/src/hooks/use-stats.ts b/web/src/hooks/use-stats.ts index bafc9e538..d381a6b48 100644 --- a/web/src/hooks/use-stats.ts +++ b/web/src/hooks/use-stats.ts @@ -51,7 +51,7 @@ export default function useStats(stats: FrigateStats | undefined) { return; } - if (config.cameras[name].enabled && cam["camera_fps"] == 0) { + if (config.cameras[name].enabled && (cam["camera_fps"] == 0)) { problems.push({ text: `${capitalizeFirstLetter(name.replaceAll("_", " "))} is offline`, color: "text-danger", diff --git a/web/src/types/live.ts b/web/src/types/live.ts index 451e4506c..6b34c0e5b 100644 --- a/web/src/types/live.ts +++ b/web/src/types/live.ts @@ -10,8 +10,8 @@ type LiveProducerMetadata = { remote_addr: string; user_agent: string; sdp: string; - medias: string[]; - receivers: string[]; + medias?: string[]; + receivers?: string[]; recv: number; }; @@ -21,8 +21,8 @@ type LiveConsumerMetadata = { remote_addr: string; user_agent: string; sdp: string; - medias: string[]; - senders: string[]; + medias?: string[]; + senders?: string[]; send: number; }; diff --git a/web/src/views/live/LiveCameraView.tsx b/web/src/views/live/LiveCameraView.tsx index 9ec3800e2..a599151df 100644 --- a/web/src/views/live/LiveCameraView.tsx +++ b/web/src/views/live/LiveCameraView.tsx @@ -36,6 +36,7 @@ import { isIOS, isMobile, isSafari, + isTablet, useMobileOrientation, } from "react-device-detect"; import { BsThreeDotsVertical } from "react-icons/bs"; @@ -100,7 +101,7 @@ export default function LiveCameraView({ camera }: LiveCameraViewProps) { return ( cameraMetadata.producers.find( (prod) => - prod.medias.find((media) => media.includes("audio, sendonly")) != undefined, + prod.medias && prod.medias.find((media) => media.includes("audio, sendonly")) != undefined, ) != undefined ); }, [cameraMetadata]); @@ -112,7 +113,7 @@ export default function LiveCameraView({ camera }: LiveCameraViewProps) { return ( cameraMetadata.producers.find( (prod) => - prod.medias.find((media) => media.includes("audio, recvonly")) != undefined, + prod.medias && prod.medias.find((media) => media.includes("audio, recvonly")) != undefined, ) != undefined ); }, [cameraMetadata]) @@ -622,7 +623,7 @@ function FrigateCameraFeatures({ useAutotrackingState(camera); // desktop shows icons part of row - if (isDesktop) { + if (isDesktop || isTablet) { return ( <>