diff --git a/web/src/components/graph/CombinedStorageGraph.tsx b/web/src/components/graph/CombinedStorageGraph.tsx index ff605ac02..2a52d82b6 100644 --- a/web/src/components/graph/CombinedStorageGraph.tsx +++ b/web/src/components/graph/CombinedStorageGraph.tsx @@ -216,7 +216,7 @@ export function CombinedStorageGraph({ )} - {getUnitSize(item.usage)} + {getUnitSize(item.usage ?? 0)} {item.data[0].toFixed(2)}% {item.name === "Unused" diff --git a/web/src/components/mobile/MobilePage.tsx b/web/src/components/mobile/MobilePage.tsx index 52bc4d9fe..169b5e524 100644 --- a/web/src/components/mobile/MobilePage.tsx +++ b/web/src/components/mobile/MobilePage.tsx @@ -25,7 +25,13 @@ export function MobilePage({ const [uncontrolledOpen, setUncontrolledOpen] = useState(false); const open = controlledOpen ?? uncontrolledOpen; - const setOpen = onOpenChange ?? setUncontrolledOpen; + const setOpen = (value: boolean) => { + if (onOpenChange) { + onOpenChange(value); + } else { + setUncontrolledOpen(value); + } + }; return ( diff --git a/web/src/components/overlay/detail/ReviewDetailDialog.tsx b/web/src/components/overlay/detail/ReviewDetailDialog.tsx index 0b20ff9bc..2230046f3 100644 --- a/web/src/components/overlay/detail/ReviewDetailDialog.tsx +++ b/web/src/components/overlay/detail/ReviewDetailDialog.tsx @@ -13,7 +13,7 @@ import { getIconForLabel } from "@/utils/iconUtil"; import { useApiHost } from "@/api"; import { ReviewDetailPaneType, ReviewSegment } from "@/types/review"; import { Event } from "@/types/event"; -import { useEffect, useMemo, useRef, useState } from "react"; +import { useCallback, useEffect, useMemo, useRef, useState } from "react"; import { cn } from "@/lib/utils"; import { FrigatePlusDialog } from "../dialog/FrigatePlusDialog"; import ObjectLifecycle from "./ObjectLifecycle"; @@ -91,6 +91,22 @@ export default function ReviewDetailDialog({ review != undefined, ); + const handleOpenChange = useCallback( + (open: boolean) => { + setIsOpen(open); + if (!open) { + // short timeout to allow the mobile page animation + // to complete before updating the state + setTimeout(() => { + setReview(undefined); + setSelectedEvent(undefined); + setPane("overview"); + }, 300); + } + }, + [setReview, setIsOpen], + ); + useEffect(() => { setIsOpen(review != undefined); // we know that these deps are correct @@ -109,16 +125,7 @@ export default function ReviewDetailDialog({ return ( <> - { - if (!open) { - setReview(undefined); - setSelectedEvent(undefined); - setPane("overview"); - } - }} - > + setUpload(undefined)} @@ -140,7 +147,7 @@ export default function ReviewDetailDialog({ > {pane == "overview" && ( -
setIsOpen(false)}> +
Review Item Details Review item details
{ + setIsOpen(open); + if (!open) { + // short timeout to allow the mobile page animation + // to complete before updating the state + setTimeout(() => { + setSearch(undefined); + }, 300); + } + }, + [setSearch], + ); + useEffect(() => { if (search) { setIsOpen(search != undefined); @@ -158,14 +172,7 @@ export default function SearchDetailDialog({ const Description = isDesktop ? DialogDescription : MobilePageDescription; return ( - { - if (search) { - setSearch(undefined); - } - }} - > + -
setIsOpen(false)}> +
Tracked Object Details Tracked object details
diff --git a/web/src/components/player/HlsVideoPlayer.tsx b/web/src/components/player/HlsVideoPlayer.tsx index bb0c89802..0661fb0c9 100644 --- a/web/src/components/player/HlsVideoPlayer.tsx +++ b/web/src/components/player/HlsVideoPlayer.tsx @@ -190,6 +190,7 @@ export default function HlsVideoPlayer({ minScale={1.0} wheel={{ smoothStep: 0.005 }} onZoom={(zoom) => setZoomScale(zoom.state.scale)} + disabled={!frigateControls} > {frigateControls && (