From 59bcb3c45b79c6fd9bf4e9c691e0abf9e905a3f7 Mon Sep 17 00:00:00 2001 From: Toba Ojo Date: Wed, 3 Dec 2025 13:39:18 +0000 Subject: [PATCH] - Enhance layout and responsiveness of camera components - update system health hook for periodic refetching --- .../cameras/components/CameraGrid.tsx | 2 +- .../CameraSettings/CameraSettings.tsx | 2 +- .../CameraSettings/RegionSelector.tsx | 23 ------------------- .../components/PlatePatch/SightingPatch.tsx | 2 +- .../components/Video/VideoFeedGridPainter.tsx | 4 ++-- .../components/systemHealth/SystemHealth.tsx | 6 ++--- .../dashboard/hooks/useGetSystemHealth.ts | 1 + 7 files changed, 9 insertions(+), 31 deletions(-) diff --git a/src/features/cameras/components/CameraGrid.tsx b/src/features/cameras/components/CameraGrid.tsx index 07fc554..0551d11 100644 --- a/src/features/cameras/components/CameraGrid.tsx +++ b/src/features/cameras/components/CameraGrid.tsx @@ -9,7 +9,7 @@ const CameraGrid = () => { const [tabIndex, setTabIndex] = useState(0); return ( -
+
diff --git a/src/features/cameras/components/CameraSettings/CameraSettings.tsx b/src/features/cameras/components/CameraSettings/CameraSettings.tsx index e0be2f8..b6fdaab 100644 --- a/src/features/cameras/components/CameraSettings/CameraSettings.tsx +++ b/src/features/cameras/components/CameraSettings/CameraSettings.tsx @@ -10,7 +10,7 @@ type CameraSettingsProps = { const CameraSettings = ({ tabIndex, setTabIndex }: CameraSettingsProps) => { return ( - + { - const regionName = `Region ${regions.length + 1}`; - dispatch({ - type: "ADD_NEW_REGION", - payload: { cameraFeedID: cameraFeedID, regionName: regionName, brushColour: "#ffffff" }, - }); - }; - const handleResetRegion = () => { dispatch({ type: "RESET_PAINTED_CELLS", @@ -34,13 +26,6 @@ const RegionSelector = ({ regions, selectedRegionIndex, mode, cameraFeedID }: Re }); }; - const handleRemoveClick = () => { - dispatch({ - type: "REMOVE_REGION", - payload: { cameraFeedID: cameraFeedID, regionName: regions[selectedRegionIndex].name }, - }); - }; - const handleModeChange = (newMode: string) => { dispatch({ type: "CHANGE_MODE", payload: { cameraFeedID: cameraFeedID, mode: newMode } }); }; @@ -177,14 +162,6 @@ const RegionSelector = ({ regions, selectedRegionIndex, mode, cameraFeedID }: Re ); })} -
- - -
diff --git a/src/features/cameras/components/PlatePatch/SightingPatch.tsx b/src/features/cameras/components/PlatePatch/SightingPatch.tsx index 052e72b..c4ffbde 100644 --- a/src/features/cameras/components/PlatePatch/SightingPatch.tsx +++ b/src/features/cameras/components/PlatePatch/SightingPatch.tsx @@ -6,7 +6,7 @@ import SightingExitTable from "./SightingExitTable"; const PlatePatch = () => { return ( - + diff --git a/src/features/cameras/components/Video/VideoFeedGridPainter.tsx b/src/features/cameras/components/Video/VideoFeedGridPainter.tsx index a58f2f8..f415eec 100644 --- a/src/features/cameras/components/Video/VideoFeedGridPainter.tsx +++ b/src/features/cameras/components/Video/VideoFeedGridPainter.tsx @@ -93,7 +93,7 @@ const VideoFeedGridPainter = () => { const width = window.innerWidth; const aspectRatio = BACKEND_WIDTH / BACKEND_HEIGHT; - const newWidth = width * 0.39; + const newWidth = width * 0.55; const newHeight = newWidth / aspectRatio; setStageSize({ width: newWidth, height: newHeight }); }; @@ -107,7 +107,7 @@ const VideoFeedGridPainter = () => { if (image === null || isloading) return Loading Video feed…; return (
diff --git a/src/features/dashboard/components/systemHealth/SystemHealth.tsx b/src/features/dashboard/components/systemHealth/SystemHealth.tsx index 3331bba..9e5aa62 100644 --- a/src/features/dashboard/components/systemHealth/SystemHealth.tsx +++ b/src/features/dashboard/components/systemHealth/SystemHealth.tsx @@ -38,7 +38,7 @@ const SystemHealth = ({ startTime, uptime, statuses, isLoading, isError, dateUpd return Loading system health…; } return ( -
+

Start Time

{startTime} @@ -50,8 +50,8 @@ const SystemHealth = ({ startTime, uptime, statuses, isLoading, isError, dateUpd
-
- {`Last refeshed ${updatedDate}`} +
+ {`Last refeshed ${updatedDate}`}
); diff --git a/src/features/dashboard/hooks/useGetSystemHealth.ts b/src/features/dashboard/hooks/useGetSystemHealth.ts index afbbc3b..130370f 100644 --- a/src/features/dashboard/hooks/useGetSystemHealth.ts +++ b/src/features/dashboard/hooks/useGetSystemHealth.ts @@ -11,6 +11,7 @@ export const useGetSystemHealth = () => { const query = useQuery({ queryKey: ["fetchSystemData"], queryFn: fetchData, + refetchInterval: 300000, }); return { query }; }; -- 2.25.1