diff --git a/src/App.tsx b/src/App.tsx index aeca601..67ea871 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -17,7 +17,7 @@ function App() { }> } /> - } /> + } /> } /> } /> } /> diff --git a/src/components/CameraOverview/SnapshotContainer.tsx b/src/components/CameraOverview/SnapshotContainer.tsx index 1ad72e2..e5ad76b 100644 --- a/src/components/CameraOverview/SnapshotContainer.tsx +++ b/src/components/CameraOverview/SnapshotContainer.tsx @@ -10,10 +10,10 @@ export const SnapshotContainer = ({ side, settingsPage, }: SnapshotContainerProps) => { - const { canvasRef, isError, isPending } = useGetOverviewSnapshot(side); + const { canvasRef, isError, isPending } = useGetOverviewSnapshot(); - if (isError) return <>An error occurred; - if (isPending) return <>Loading...; + if (isError) return

An error occurred

; + if (isPending) return

Loading...

; const handleZoomClick = (event: React.MouseEvent) => { const bounds = canvasRef.current?.getBoundingClientRect(); diff --git a/src/components/FrontCameraOverview/FrontCameraOverviewCard.tsx b/src/components/FrontCameraOverview/FrontCameraOverviewCard.tsx index 3c2a540..6c449dd 100644 --- a/src/components/FrontCameraOverview/FrontCameraOverviewCard.tsx +++ b/src/components/FrontCameraOverview/FrontCameraOverviewCard.tsx @@ -9,7 +9,7 @@ const FrontCameraOverviewCard = () => { useOverviewVideo(); const navigate = useNavigate(); const handlers = useSwipeable({ - onSwipedRight: () => navigate("/front-camera-settings"), + onSwipedRight: () => navigate("/camera-settings"), trackMouse: true, }); diff --git a/src/components/SightingOverview/SightingOverview.tsx b/src/components/SightingOverview/SightingOverview.tsx index 222ff11..14b012b 100644 --- a/src/components/SightingOverview/SightingOverview.tsx +++ b/src/components/SightingOverview/SightingOverview.tsx @@ -22,9 +22,10 @@ const SightingOverview = () => { const { sync } = useHiDPICanvas(imgRef, canvasRef); - if (isLoading) return

Loading

; + if (isLoading) return

Loading

; - if (isError) return

An error occurred, Cannot display footage

; + if (isError) + return

An error occurred, Cannot display footage

; return (
diff --git a/src/hooks/useCameraBlackboard.ts b/src/hooks/useCameraBlackboard.ts index 187b084..d8cd31b 100644 --- a/src/hooks/useCameraBlackboard.ts +++ b/src/hooks/useCameraBlackboard.ts @@ -1,9 +1,9 @@ import { useMutation, useQuery } from "@tanstack/react-query"; -import { OUTSIDE_CAM_BASE } from "../utils/config"; +import { CAM_BASE } from "../utils/config"; import type { CameraBlackBoardOptions } from "../types/types"; const getBlackboardData = async () => { - const response = await fetch(`${OUTSIDE_CAM_BASE}/api/blackboard`); + const response = await fetch(`${CAM_BASE}/api/blackboard`); if (!response.ok) { throw new Error("Failed to fetch blackboard data"); } @@ -11,7 +11,7 @@ const getBlackboardData = async () => { }; const viewBlackboardData = async (options: CameraBlackBoardOptions) => { - const response = await fetch(`${OUTSIDE_CAM_BASE}/api/blackboard`, { + const response = await fetch(`${CAM_BASE}/api/blackboard`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(options), diff --git a/src/hooks/useCameraConfig.ts b/src/hooks/useCameraConfig.ts index 8601bab..284468f 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 { OUTSIDE_CAM_BASE } from "../utils/config"; +import { CAM_BASE } from "../utils/config"; -const base_url = `${OUTSIDE_CAM_BASE}/api`; +const base_url = `${CAM_BASE}/api`; console.log(base_url); const fetchCameraSideConfig = async ({ queryKey }: { queryKey: string[] }) => { diff --git a/src/hooks/useGetOverviewSnapshot.ts b/src/hooks/useGetOverviewSnapshot.ts index 1cbaff0..5bf7e51 100644 --- a/src/hooks/useGetOverviewSnapshot.ts +++ b/src/hooks/useGetOverviewSnapshot.ts @@ -1,11 +1,11 @@ import { useRef, useCallback, useEffect } from "react"; import { useQuery } from "@tanstack/react-query"; -import { OUTSIDE_CAM_BASE } from "../utils/config"; +import { CAM_BASE } from "../utils/config"; -const apiUrl = OUTSIDE_CAM_BASE; +const apiUrl = CAM_BASE; -async function fetchSnapshot(cameraSide: string) { - const response = await fetch(`${apiUrl}/${cameraSide}-preview`); +async function fetchSnapshot() { + const response = await fetch(`${apiUrl}/CameraA-preview`); if (!response.ok) { throw new Error("Cannot reach endpoint"); } @@ -13,7 +13,7 @@ async function fetchSnapshot(cameraSide: string) { return await response.blob(); } -export function useGetOverviewSnapshot(cameraSide: string) { +export function useGetOverviewSnapshot() { const latestUrlRef = useRef(null); const canvasRef = useRef(null); const imageRef = useRef(null); @@ -37,8 +37,8 @@ export function useGetOverviewSnapshot(cameraSide: string) { error, isPending, } = useQuery({ - queryKey: ["overviewSnapshot", cameraSide], - queryFn: () => fetchSnapshot(cameraSide), + queryKey: ["overviewSnapshot"], + queryFn: () => fetchSnapshot(), refetchOnWindowFocus: false, refetchInterval: 250, }); diff --git a/src/pages/Dashboard.tsx b/src/pages/Dashboard.tsx index 7dad655..92a8efe 100644 --- a/src/pages/Dashboard.tsx +++ b/src/pages/Dashboard.tsx @@ -1,13 +1,12 @@ import FrontCameraOverviewCard from "../components/FrontCameraOverview/FrontCameraOverviewCard"; import SightingHistoryWidget from "../components/SightingsWidget/SightingWidget"; import { SightingFeedProvider } from "../context/providers/SightingFeedProvider"; -import { OUTSIDE_CAM_BASE } from "../utils/config"; +import { CAM_BASE } from "../utils/config"; const Dashboard = () => { - const dev_OUTSIDE_URL = `${OUTSIDE_CAM_BASE}/SightingListFront/sightingSummary?mostRecentRef=`; - // const folkestone_OUTSIDE_URL = `http://100.116.253.81/mergedHistory/sightingSummary?mostRecentRef=`; + const base_url = `${CAM_BASE}/SightingList/sightingSummary?mostRecentRef=`; return ( - +