diff --git a/web/src/components/player/LivePlayer.tsx b/web/src/components/player/LivePlayer.tsx index 10133244a..ec0e3c211 100644 --- a/web/src/components/player/LivePlayer.tsx +++ b/web/src/components/player/LivePlayer.tsx @@ -12,6 +12,7 @@ import useCameraActivity from "@/hooks/use-camera-activity"; import { useRecordingsState } from "@/api/ws"; import { LivePlayerMode } from "@/types/live"; import useCameraLiveMode from "@/hooks/use-camera-live-mode"; +import { isDesktop } from "react-device-detect"; type LivePlayerProps = { className?: string; @@ -153,7 +154,7 @@ export default function LivePlayer({ className={`bg-gradient-to-br from-gray-400 to-gray-500 bg-gray-500`} > -
Motion
+
Motion
{cameraConfig.audio.enabled_in_config && ( @@ -162,19 +163,21 @@ export default function LivePlayer({ className={`bg-gradient-to-br from-gray-400 to-gray-500 bg-gray-500`} > -
Sound
+
Sound
)} - - {recording == "ON" && ( - - )} -
- {cameraConfig.name.replaceAll("_", " ")} -
-
+ {isDesktop && ( + + {recording == "ON" && ( + + )} +
+ {cameraConfig.name.replaceAll("_", " ")} +
+
+ )} ); } diff --git a/web/src/pages/Live.tsx b/web/src/pages/Live.tsx index 5a968e740..4472be6ad 100644 --- a/web/src/pages/Live.tsx +++ b/web/src/pages/Live.tsx @@ -1,17 +1,27 @@ import { useFrigateEvents } from "@/api/ws"; +import Logo from "@/components/Logo"; import { AnimatedEventThumbnail } from "@/components/image/AnimatedEventThumbnail"; import LivePlayer from "@/components/player/LivePlayer"; +import { Button } from "@/components/ui/button"; import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area"; import { TooltipProvider } from "@/components/ui/tooltip"; import { Event as FrigateEvent } from "@/types/event"; import { FrigateConfig } from "@/types/frigateConfig"; import { useCallback, useEffect, useMemo, useState } from "react"; -import { isSafari } from "react-device-detect"; +import { isDesktop, isMobile, isSafari } from "react-device-detect"; +import { LuGrid } from "react-icons/lu"; +import { CiGrid2V, CiGrid31 } from "react-icons/ci"; import useSWR from "swr"; function Live() { const { data: config } = useSWR("config"); + // layout + + const [layout, setLayout] = useState<"grid" | "list">( + isDesktop ? "grid" : "list" + ); + // recent events const { payload: eventUpdate } = useFrigateEvents(); const { data: allEvents, mutate: updateEvents } = useSWR([ @@ -80,6 +90,31 @@ function Live() { return (
+ {isMobile && ( +
+ +
+
+ + +
+
+ )} + {events && events.length > 0 && ( @@ -93,21 +128,23 @@ function Live() { )} -
+
{cameras.map((camera) => { let grow; let aspectRatio = camera.detect.width / camera.detect.height; if (aspectRatio > 2) { - grow = "md:col-span-2 aspect-wide"; + grow = `${layout == "grid" ? "col-span-2" : ""} aspect-wide`; } else if (aspectRatio < 1) { - grow = `md:row-span-2 aspect-tall md:h-full`; + grow = `${layout == "grid" ? "row-span-2 aspect-tall md:h-full" : ""} aspect-tall`; } else { grow = "aspect-video"; } return (