From 6773b823499c1a03933ed9d9751f1904c9159330 Mon Sep 17 00:00:00 2001 From: Toba Ojo Date: Fri, 26 Sep 2025 13:38:47 +0100 Subject: [PATCH] redesigned camera settings page, left the minimum height at 100%, open to change --- .../CameraOverview/SnapshotContainer.tsx | 9 ++++++-- .../CameraSettings/CameraSettingFields.tsx | 2 +- .../CameraSettings/CameraSettings.tsx | 4 ++-- .../FrontCameraOverviewCard.tsx | 3 +-- .../OverviewVideoContainer.tsx | 15 ++++++++----- src/hooks/useCameraConfig.ts | 4 ++-- src/pages/FrontCamera.tsx | 22 +++++-------------- 7 files changed, 28 insertions(+), 31 deletions(-) diff --git a/src/components/CameraOverview/SnapshotContainer.tsx b/src/components/CameraOverview/SnapshotContainer.tsx index 0b92159..51a5821 100644 --- a/src/components/CameraOverview/SnapshotContainer.tsx +++ b/src/components/CameraOverview/SnapshotContainer.tsx @@ -16,9 +16,14 @@ export const SnapshotContainer = ({ if (isPending) return <>Loading...; return ( -
+
- +
+ +
); }; diff --git a/src/components/CameraSettings/CameraSettingFields.tsx b/src/components/CameraSettings/CameraSettingFields.tsx index 95d56b9..6f31f46 100644 --- a/src/components/CameraSettings/CameraSettingFields.tsx +++ b/src/components/CameraSettings/CameraSettingFields.tsx @@ -53,7 +53,7 @@ const CameraSettingFields = ({ enableReinitialize > {({ errors, touched }) => ( -
+
{touched.friendlyName && errors.friendlyName && ( diff --git a/src/components/CameraSettings/CameraSettings.tsx b/src/components/CameraSettings/CameraSettings.tsx index 32c18a6..19f1484 100644 --- a/src/components/CameraSettings/CameraSettings.tsx +++ b/src/components/CameraSettings/CameraSettings.tsx @@ -15,10 +15,10 @@ const CameraSettings = ({ title, side }: { title: string; side: string }) => { console.log(updateCameraConfigError); return ( - + {isPending && <>Loading camera config} {isError && <>Error fetching camera config} -
+
{ const navigate = useNavigate(); const handlers = useSwipeable({ onSwipedRight: () => navigate("/front-camera-settings"), - trackMouse: true, }); @@ -20,7 +19,7 @@ const FrontCameraOverviewCard = () => { "relative min-h-[40vh] md:min-h-[60vh] max-h-[80vh] lg:w-[70%] overflow-y-hidden" )} > -
+
diff --git a/src/components/FrontCameraSettings/OverviewVideoContainer.tsx b/src/components/FrontCameraSettings/OverviewVideoContainer.tsx index 90d8e61..7ed4c87 100644 --- a/src/components/FrontCameraSettings/OverviewVideoContainer.tsx +++ b/src/components/FrontCameraSettings/OverviewVideoContainer.tsx @@ -1,11 +1,10 @@ import clsx from "clsx"; import { SnapshotContainer } from "../CameraOverview/SnapshotContainer"; -import { faCamera } from "@fortawesome/free-regular-svg-icons"; import Card from "../UI/Card"; -import CardHeader from "../UI/CardHeader"; +import { useNavigate } from "react-router"; +import { useSwipeable } from "react-swipeable"; const OverviewVideoContainer = ({ - title, side, settingsPage, }: { @@ -13,14 +12,18 @@ const OverviewVideoContainer = ({ side: string; settingsPage?: boolean; }) => { + const navigate = useNavigate(); + const handlers = useSwipeable({ + onSwipedLeft: () => navigate("/"), + trackMouse: true, + }); return ( -
- +
diff --git a/src/hooks/useCameraConfig.ts b/src/hooks/useCameraConfig.ts index 284468f..8601bab 100644 --- a/src/hooks/useCameraConfig.ts +++ b/src/hooks/useCameraConfig.ts @@ -1,8 +1,8 @@ import { useMutation, useQuery } from "@tanstack/react-query"; import { toast } from "sonner"; -import { CAM_BASE } from "../utils/config"; +import { OUTSIDE_CAM_BASE } from "../utils/config"; -const base_url = `${CAM_BASE}/api`; +const base_url = `${OUTSIDE_CAM_BASE}/api`; console.log(base_url); const fetchCameraSideConfig = async ({ queryKey }: { queryKey: string[] }) => { diff --git a/src/pages/FrontCamera.tsx b/src/pages/FrontCamera.tsx index c665d0a..dd97803 100644 --- a/src/pages/FrontCamera.tsx +++ b/src/pages/FrontCamera.tsx @@ -1,25 +1,15 @@ import CameraSettings from "../components/CameraSettings/CameraSettings"; import OverviewVideoContainer from "../components/FrontCameraSettings/OverviewVideoContainer"; import { Toaster } from "sonner"; -import { useNavigate } from "react-router"; -import { useSwipeable } from "react-swipeable"; const FrontCamera = () => { - const navigate = useNavigate(); - const handlers = useSwipeable({ - onSwipedLeft: () => navigate("/"), - trackMouse: true, - }); - return ( -
-
- -
+
+