From 3b0f9988df225ada4498e360fb1f24268e79b8a8 Mon Sep 17 00:00:00 2001
From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com>
Date: Fri, 19 Apr 2024 12:17:23 -0500
Subject: [PATCH] UI tweaks (#11036)
* spacing, mobile navbar, and minor color updates
* tab scrolling behavior
---
web/src/components/settings/MotionTuner.tsx | 2 +-
web/src/pages/Logs.tsx | 2 +-
web/src/pages/Settings.tsx | 71 +++++++++++++--------
web/src/pages/System.tsx | 2 +-
web/src/views/events/EventView.tsx | 8 ++-
web/src/views/events/RecordingView.tsx | 4 +-
6 files changed, 56 insertions(+), 33 deletions(-)
diff --git a/web/src/components/settings/MotionTuner.tsx b/web/src/components/settings/MotionTuner.tsx
index fce762df5..584eab83e 100644
--- a/web/src/components/settings/MotionTuner.tsx
+++ b/web/src/components/settings/MotionTuner.tsx
@@ -154,7 +154,7 @@ export default function MotionTuner({
return (
-
+
Motion Detection Tuner
diff --git a/web/src/pages/Logs.tsx b/web/src/pages/Logs.tsx
index a12f2d162..867f8b512 100644
--- a/web/src/pages/Logs.tsx
+++ b/web/src/pages/Logs.tsx
@@ -352,7 +352,7 @@ function Logs() {
{Object.values(logTypes).map((item) => (
diff --git a/web/src/pages/Settings.tsx b/web/src/pages/Settings.tsx
index c6a509f90..9d22e534d 100644
--- a/web/src/pages/Settings.tsx
+++ b/web/src/pages/Settings.tsx
@@ -20,7 +20,7 @@ import { Drawer, DrawerContent, DrawerTrigger } from "@/components/ui/drawer";
import MotionTuner from "@/components/settings/MotionTuner";
import MasksAndZones from "@/components/settings/MasksAndZones";
import { Button } from "@/components/ui/button";
-import { useCallback, useEffect, useMemo, useState } from "react";
+import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import useOptimisticState from "@/hooks/use-optimistic-state";
import { isMobile } from "react-device-detect";
import { FaVideo } from "react-icons/fa";
@@ -31,6 +31,8 @@ import FilterSwitch from "@/components/filter/FilterSwitch";
import { ZoneMaskFilterButton } from "@/components/filter/ZoneMaskFilter";
import { PolygonType } from "@/types/canvas";
import ObjectSettings from "@/components/settings/ObjectSettings";
+import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
+import scrollIntoView from "scroll-into-view-if-needed";
export default function Settings() {
const settingsViews = [
@@ -43,6 +45,7 @@ export default function Settings() {
type SettingsType = (typeof settingsViews)[number];
const [page, setPage] = useState("general");
const [pageToggle, setPageToggle] = useOptimisticState(page, setPage, 100);
+ const tabsRef = useRef(null);
const { data: config } = useSWR("config");
@@ -83,33 +86,51 @@ export default function Settings() {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
+ useEffect(() => {
+ if (tabsRef.current) {
+ const element = tabsRef.current.querySelector(
+ `[data-nav-item="${pageToggle}"]`,
+ );
+ if (element instanceof HTMLElement) {
+ scrollIntoView(element, {
+ behavior: "smooth",
+ inline: "start",
+ });
+ }
+ }
+ }, [tabsRef, pageToggle]);
+
return (
-
-
{
- if (value) {
- setPageToggle(value);
- }
- }}
- >
- {Object.values(settingsViews).map((item) => (
-
- {item}
-
- ))}
-
-
+
+
+
{
+ if (value) {
+ setPageToggle(value);
+ }
+ }}
+ >
+ {Object.values(settingsViews).map((item) => (
+
+ {item}
+
+ ))}
+
+
+
+
{(page == "objects" ||
page == "masks / zones" ||
page == "motion tuner") && (
diff --git a/web/src/pages/System.tsx b/web/src/pages/System.tsx
index 8693a30b1..5d296f053 100644
--- a/web/src/pages/System.tsx
+++ b/web/src/pages/System.tsx
@@ -52,7 +52,7 @@ function System() {
{Object.values(metrics).map((item) => (
diff --git a/web/src/views/events/EventView.tsx b/web/src/views/events/EventView.tsx
index c6736e3a4..2540efc79 100644
--- a/web/src/views/events/EventView.tsx
+++ b/web/src/views/events/EventView.tsx
@@ -228,7 +228,7 @@ export default function EventView({
} // don't allow the severity to be unselected
>
@@ -238,7 +238,7 @@ export default function EventView({
@@ -250,7 +250,9 @@ export default function EventView({
Timeline