From c74eb755541726acb7d5eb1717de4eae66372e9a Mon Sep 17 00:00:00 2001
From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com>
Date: Sun, 3 Mar 2024 10:32:47 -0600
Subject: [PATCH] Update camera activity indicator (#10208)
* new indicator
* create indicators directory and update imports
* create indicators directory and update imports
* remove vite
---
web/src/components/bar/TimelineBar.tsx | 2 +-
web/src/components/camera/CameraImage.tsx | 2 +-
.../components/camera/ResizingCameraImage.tsx | 2 +-
web/src/components/card/ExportCard.tsx | 2 +-
.../indicators/CameraActivityIndicator.tsx | 33 +++++++++++++++++
web/src/components/{ => indicators}/Chip.tsx | 0
.../{ui => indicators}/activity-indicator.tsx | 0
.../components/player/BirdseyeLivePlayer.tsx | 2 +-
.../components/player/DynamicVideoPlayer.tsx | 2 +-
web/src/components/player/LivePlayer.tsx | 37 +++++--------------
.../player/PreviewThumbnailPlayer.tsx | 2 +-
.../components/settings/SettingsNavItems.tsx | 2 +-
web/src/pages/ConfigEditor.tsx | 2 +-
web/src/pages/Storage.tsx | 2 +-
web/src/pages/UIPlayground.tsx | 6 ++-
web/src/views/events/EventView.tsx | 2 +-
web/tailwind.config.js | 26 +++++++++++++
17 files changed, 85 insertions(+), 39 deletions(-)
create mode 100644 web/src/components/indicators/CameraActivityIndicator.tsx
rename web/src/components/{ => indicators}/Chip.tsx (100%)
rename web/src/components/{ui => indicators}/activity-indicator.tsx (100%)
diff --git a/web/src/components/bar/TimelineBar.tsx b/web/src/components/bar/TimelineBar.tsx
index 6b1b87ce3..cd168f3cd 100644
--- a/web/src/components/bar/TimelineBar.tsx
+++ b/web/src/components/bar/TimelineBar.tsx
@@ -2,7 +2,7 @@ import { FrigateConfig } from "@/types/frigateConfig";
import { GraphDataPoint } from "@/types/graph";
import { formatUnixTimestampToDateTime } from "@/utils/dateUtil";
import useSWR from "swr";
-import ActivityIndicator from "../ui/activity-indicator";
+import ActivityIndicator from "../indicators/activity-indicator";
type TimelineBarProps = {
startTime: number;
diff --git a/web/src/components/camera/CameraImage.tsx b/web/src/components/camera/CameraImage.tsx
index b4c32e014..be978f7a5 100644
--- a/web/src/components/camera/CameraImage.tsx
+++ b/web/src/components/camera/CameraImage.tsx
@@ -1,7 +1,7 @@
import { useApiHost } from "@/api";
import { useEffect, useRef, useState } from "react";
import useSWR from "swr";
-import ActivityIndicator from "../ui/activity-indicator";
+import ActivityIndicator from "../indicators/activity-indicator";
type CameraImageProps = {
className?: string;
diff --git a/web/src/components/camera/ResizingCameraImage.tsx b/web/src/components/camera/ResizingCameraImage.tsx
index d098b46d5..b7a9b8369 100644
--- a/web/src/components/camera/ResizingCameraImage.tsx
+++ b/web/src/components/camera/ResizingCameraImage.tsx
@@ -1,7 +1,7 @@
import { useApiHost } from "@/api";
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import useSWR from "swr";
-import ActivityIndicator from "../ui/activity-indicator";
+import ActivityIndicator from "../indicators/activity-indicator";
import { useResizeObserver } from "@/hooks/resize-observer";
type CameraImageProps = {
diff --git a/web/src/components/card/ExportCard.tsx b/web/src/components/card/ExportCard.tsx
index 9596f729c..3d374b859 100644
--- a/web/src/components/card/ExportCard.tsx
+++ b/web/src/components/card/ExportCard.tsx
@@ -1,5 +1,5 @@
import { baseUrl } from "@/api/baseUrl";
-import ActivityIndicator from "../ui/activity-indicator";
+import ActivityIndicator from "../indicators/activity-indicator";
import { Card } from "../ui/card";
import { LuPlay, LuTrash } from "react-icons/lu";
import { Button } from "../ui/button";
diff --git a/web/src/components/indicators/CameraActivityIndicator.tsx b/web/src/components/indicators/CameraActivityIndicator.tsx
new file mode 100644
index 000000000..77a87477d
--- /dev/null
+++ b/web/src/components/indicators/CameraActivityIndicator.tsx
@@ -0,0 +1,33 @@
+function CameraActivityIndicator() {
+ return (
+
+ );
+}
+
+export default CameraActivityIndicator;
diff --git a/web/src/components/Chip.tsx b/web/src/components/indicators/Chip.tsx
similarity index 100%
rename from web/src/components/Chip.tsx
rename to web/src/components/indicators/Chip.tsx
diff --git a/web/src/components/ui/activity-indicator.tsx b/web/src/components/indicators/activity-indicator.tsx
similarity index 100%
rename from web/src/components/ui/activity-indicator.tsx
rename to web/src/components/indicators/activity-indicator.tsx
diff --git a/web/src/components/player/BirdseyeLivePlayer.tsx b/web/src/components/player/BirdseyeLivePlayer.tsx
index 2c742ee1c..7ab4c92d7 100644
--- a/web/src/components/player/BirdseyeLivePlayer.tsx
+++ b/web/src/components/player/BirdseyeLivePlayer.tsx
@@ -1,6 +1,6 @@
import WebRtcPlayer from "./WebRTCPlayer";
import { BirdseyeConfig } from "@/types/frigateConfig";
-import ActivityIndicator from "../ui/activity-indicator";
+import ActivityIndicator from "../indicators/activity-indicator";
import JSMpegPlayer from "./JSMpegPlayer";
import MSEPlayer from "./MsePlayer";
diff --git a/web/src/components/player/DynamicVideoPlayer.tsx b/web/src/components/player/DynamicVideoPlayer.tsx
index 05ac7c0ed..3ce3ba032 100644
--- a/web/src/components/player/DynamicVideoPlayer.tsx
+++ b/web/src/components/player/DynamicVideoPlayer.tsx
@@ -12,7 +12,7 @@ import TimelineEventOverlay from "../overlay/TimelineDataOverlay";
import { useApiHost } from "@/api";
import useSWR from "swr";
import { FrigateConfig } from "@/types/frigateConfig";
-import ActivityIndicator from "../ui/activity-indicator";
+import ActivityIndicator from "../indicators/activity-indicator";
import useKeyboardListener from "@/hooks/use-keyboard-listener";
import { Recording } from "@/types/record";
import { Preview } from "@/types/preview";
diff --git a/web/src/components/player/LivePlayer.tsx b/web/src/components/player/LivePlayer.tsx
index 663e60808..2de13e802 100644
--- a/web/src/components/player/LivePlayer.tsx
+++ b/web/src/components/player/LivePlayer.tsx
@@ -1,18 +1,17 @@
import WebRtcPlayer from "./WebRTCPlayer";
import { CameraConfig } from "@/types/frigateConfig";
import AutoUpdatingCameraImage from "../camera/AutoUpdatingCameraImage";
-import ActivityIndicator from "../ui/activity-indicator";
+import ActivityIndicator from "../indicators/activity-indicator";
import { useEffect, useMemo, useState } from "react";
import MSEPlayer from "./MsePlayer";
import JSMpegPlayer from "./JSMpegPlayer";
-import { MdCircle, MdLeakAdd } from "react-icons/md";
-import { BsSoundwave } from "react-icons/bs";
-import Chip from "../Chip";
+import { MdCircle } from "react-icons/md";
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";
+import CameraActivityIndicator from "../indicators/CameraActivityIndicator";
type LivePlayerProps = {
className?: string;
@@ -159,35 +158,19 @@ export default function LivePlayer({
/>
-
-
-
- Motion
-
-
- {cameraConfig.audio.enabled_in_config && (
-
-
- Sound
-
+
+ {(activeMotion ||
+ (cameraConfig.audio.enabled_in_config && activeAudio)) && (
+
)}
{isDesktop && (
-
+
{recording == "ON" && (
-
+
)}
-
- {cameraConfig.name.replaceAll("_", " ")}
-
-
+
)}
);
diff --git a/web/src/components/player/PreviewThumbnailPlayer.tsx b/web/src/components/player/PreviewThumbnailPlayer.tsx
index 2e3a9cd96..6908aec81 100644
--- a/web/src/components/player/PreviewThumbnailPlayer.tsx
+++ b/web/src/components/player/PreviewThumbnailPlayer.tsx
@@ -14,7 +14,7 @@ import TimeAgo from "../dynamic/TimeAgo";
import useSWR from "swr";
import { FrigateConfig } from "@/types/frigateConfig";
import { isFirefox, isMobile, isSafari } from "react-device-detect";
-import Chip from "../Chip";
+import Chip from "@/components/indicators/Chip";
import { useFormattedTimestamp } from "@/hooks/use-date-utils";
import useImageLoaded from "@/hooks/use-image-loaded";
import { Skeleton } from "../ui/skeleton";
diff --git a/web/src/components/settings/SettingsNavItems.tsx b/web/src/components/settings/SettingsNavItems.tsx
index db42775d3..a43c7bb91 100644
--- a/web/src/components/settings/SettingsNavItems.tsx
+++ b/web/src/components/settings/SettingsNavItems.tsx
@@ -57,7 +57,7 @@ import {
TooltipContent,
TooltipTrigger,
} from "@/components/ui/tooltip";
-import ActivityIndicator from "../ui/activity-indicator";
+import ActivityIndicator from "../indicators/activity-indicator";
type SettingsNavItemsProps = {
className?: string;
diff --git a/web/src/pages/ConfigEditor.tsx b/web/src/pages/ConfigEditor.tsx
index 0319e81c4..8537c6aff 100644
--- a/web/src/pages/ConfigEditor.tsx
+++ b/web/src/pages/ConfigEditor.tsx
@@ -4,7 +4,7 @@ import { configureMonacoYaml } from "monaco-yaml";
import { useCallback, useEffect, useRef, useState } from "react";
import { useApiHost } from "@/api";
import Heading from "@/components/ui/heading";
-import ActivityIndicator from "@/components/ui/activity-indicator";
+import ActivityIndicator from "@/components/indicators/activity-indicator";
import { Button } from "@/components/ui/button";
import axios from "axios";
import copy from "copy-to-clipboard";
diff --git a/web/src/pages/Storage.tsx b/web/src/pages/Storage.tsx
index 4f4c62b4e..ad0d7774d 100644
--- a/web/src/pages/Storage.tsx
+++ b/web/src/pages/Storage.tsx
@@ -1,5 +1,5 @@
import { useWs } from "@/api/ws";
-import ActivityIndicator from "@/components/ui/activity-indicator";
+import ActivityIndicator from "@/components/indicators/activity-indicator";
import { Button } from "@/components/ui/button";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import Heading from "@/components/ui/heading";
diff --git a/web/src/pages/UIPlayground.tsx b/web/src/pages/UIPlayground.tsx
index 003787b9c..d91c3d137 100644
--- a/web/src/pages/UIPlayground.tsx
+++ b/web/src/pages/UIPlayground.tsx
@@ -2,10 +2,11 @@ import { useMemo, useRef, useState } from "react";
import Heading from "@/components/ui/heading";
import useSWR from "swr";
import { FrigateConfig } from "@/types/frigateConfig";
-import ActivityIndicator from "@/components/ui/activity-indicator";
+import ActivityIndicator from "@/components/indicators/activity-indicator";
import EventReviewTimeline from "@/components/timeline/EventReviewTimeline";
import { ReviewData, ReviewSegment, ReviewSeverity } from "@/types/review";
import { Button } from "@/components/ui/button";
+import CameraActivityIndicator from "@/components/indicators/CameraActivityIndicator";
// Color data
const colors = [
@@ -174,6 +175,9 @@ function UIPlayground() {
Handlebar is dragging: {isDragging ? "yes" : "no"}
+
+
+