From 7745313cdcbea3ac455886826b051eae469f1455 Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Mon, 29 Apr 2024 16:23:14 -0500 Subject: [PATCH] add chips for active objects on live dashboard (#11162) --- web/src/components/player/LivePlayer.tsx | 53 +++++++++++++++++++++++- web/src/hooks/use-camera-activity.ts | 28 +++++++++---- 2 files changed, 71 insertions(+), 10 deletions(-) diff --git a/web/src/components/player/LivePlayer.tsx b/web/src/components/player/LivePlayer.tsx index 16a66a67c..d42ecb3a0 100644 --- a/web/src/components/player/LivePlayer.tsx +++ b/web/src/components/player/LivePlayer.tsx @@ -6,9 +6,14 @@ import { useEffect, useMemo, useState } from "react"; import MSEPlayer from "./MsePlayer"; import JSMpegPlayer from "./JSMpegPlayer"; import { MdCircle } from "react-icons/md"; +import { Tooltip, TooltipContent, TooltipTrigger } from "../ui/tooltip"; import { useCameraActivity } from "@/hooks/use-camera-activity"; import { LivePlayerMode } from "@/types/live"; import useCameraLiveMode from "@/hooks/use-camera-live-mode"; +import { getIconForLabel } from "@/utils/iconUtil"; +import Chip from "../indicators/Chip"; +import { isMobile } from "react-device-detect"; +import { capitalizeFirstLetter } from "@/utils/stringUtil"; type LivePlayerProps = { cameraRef?: (ref: HTMLDivElement | null) => void; @@ -37,9 +42,12 @@ export default function LivePlayer({ pip, onClick, }: LivePlayerProps) { + const [cameraHovered, setCameraHovered] = useState(false); + // camera activity - const { activeMotion, activeTracking } = useCameraActivity(cameraConfig); + const { activeMotion, activeTracking, activeObjects } = + useCameraActivity(cameraConfig); const cameraActive = useMemo( () => @@ -148,11 +156,54 @@ export default function LivePlayer({ : "outline-0 outline-background" } transition-all duration-500 ${className}`} onClick={onClick} + onMouseEnter={() => setCameraHovered(true)} + onMouseLeave={() => setCameraHovered(false)} >
{player} + {activeObjects.length > 0 && ( +