From fafe5623d1e3125413e85b07bdc2551c20ba14b8 Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Tue, 1 Oct 2024 08:01:45 -0500 Subject: [PATCH] UI tweaks (#14088) * fix squashed alert thumbnails in filmstrip * add genai debug logs * consistent themed image loading indicator background color * improve image loading skeleton in object lifecycle pane * less rounding when screen is smaller * use browser back button to dismiss review pane * initial state --- frigate/embeddings/maintainer.py | 7 +++++- web/src/components/card/AnimatedEventCard.tsx | 4 ++-- .../indicators/ImageLoadingIndicator.tsx | 2 +- .../overlay/detail/ObjectLifecycle.tsx | 23 +++++++++++++++++-- .../overlay/detail/ReviewDetailDialog.tsx | 10 ++++++-- web/src/views/explore/ExploreView.tsx | 2 +- 6 files changed, 39 insertions(+), 9 deletions(-) diff --git a/frigate/embeddings/maintainer.py b/frigate/embeddings/maintainer.py index ab60bd5ba..3c3d956c8 100644 --- a/frigate/embeddings/maintainer.py +++ b/frigate/embeddings/maintainer.py @@ -137,6 +137,9 @@ class EmbeddingMaintainer(threading.Thread): or set(event.zones) & set(camera_config.genai.required_zones) ) ): + logger.debug( + f"Description generation for {event}, has_snapshot: {event.has_snapshot}" + ) if event.has_snapshot and camera_config.genai.use_snapshot: with open( os.path.join(CLIPS_DIR, f"{event.camera}-{event.id}.jpg"), @@ -276,7 +279,9 @@ class EmbeddingMaintainer(threading.Thread): metadata = get_metadata(event) thumbnail = base64.b64decode(event.thumbnail) - logger.debug(f"Using ${source} regeneration for ${event}") + logger.debug( + f"Trying {source} regeneration for {event}, has_snapshot: {event.has_snapshot}" + ) if event.has_snapshot and source == "snapshot": with open( diff --git a/web/src/components/card/AnimatedEventCard.tsx b/web/src/components/card/AnimatedEventCard.tsx index a39ae5af0..021f38f2b 100644 --- a/web/src/components/card/AnimatedEventCard.tsx +++ b/web/src/components/card/AnimatedEventCard.tsx @@ -107,7 +107,7 @@ export function AnimatedEventCard({
{!alertVideos ? ( setIsLoaded(true)} diff --git a/web/src/components/indicators/ImageLoadingIndicator.tsx b/web/src/components/indicators/ImageLoadingIndicator.tsx index f9cd8e3bc..74002e917 100644 --- a/web/src/components/indicators/ImageLoadingIndicator.tsx +++ b/web/src/components/indicators/ImageLoadingIndicator.tsx @@ -14,7 +14,7 @@ export default function ImageLoadingIndicator({ } return isSafari ? ( -
+
) : ( ); diff --git a/web/src/components/overlay/detail/ObjectLifecycle.tsx b/web/src/components/overlay/detail/ObjectLifecycle.tsx index c2da8ec36..fb27966df 100644 --- a/web/src/components/overlay/detail/ObjectLifecycle.tsx +++ b/web/src/components/overlay/detail/ObjectLifecycle.tsx @@ -77,6 +77,17 @@ export default function ObjectLifecycle({ const [showControls, setShowControls] = useState(false); const [showZones, setShowZones] = useState(true); + const aspectRatio = useMemo(() => { + if (!config) { + return 16 / 9; + } + + return ( + config.cameras[event.camera].detect.width / + config.cameras[event.camera].detect.height + ); + }, [config, event]); + const getZoneColor = useCallback( (zoneName: string) => { const zoneColor = @@ -240,7 +251,15 @@ export default function ObjectLifecycle({
)} -
+
{ setIsOpen(review != undefined); + // we know that these deps are correct + // eslint-disable-next-line react-hooks/exhaustive-deps }, [review]); const Overlay = isDesktop ? Sheet : MobilePage; @@ -102,7 +108,7 @@ export default function ReviewDetailDialog({ return ( <> { if (!open) { setReview(undefined); diff --git a/web/src/views/explore/ExploreView.tsx b/web/src/views/explore/ExploreView.tsx index 8fd75ae49..e2c8e63bc 100644 --- a/web/src/views/explore/ExploreView.tsx +++ b/web/src/views/explore/ExploreView.tsx @@ -200,7 +200,7 @@ function ExploreThumbnailImage({