diff --git a/src/components/CameraSettings/CameraSettingFields.tsx b/src/components/CameraSettings/CameraSettingFields.tsx index d39a4ce..2d1b0d7 100644 --- a/src/components/CameraSettings/CameraSettingFields.tsx +++ b/src/components/CameraSettings/CameraSettingFields.tsx @@ -44,7 +44,7 @@ const CameraSettingFields = ({ userName: parsed?.username ?? "", password: parsed?.password ?? "", id: initialData?.id, - mode: cameraMode ?? "day", + mode: cameraMode ?? "", zoom: apiZoom, }), diff --git a/src/components/SightingsWidget/SightingWidget.tsx b/src/components/SightingsWidget/SightingWidget.tsx index 4c35e38..8cf5d9a 100644 --- a/src/components/SightingsWidget/SightingWidget.tsx +++ b/src/components/SightingsWidget/SightingWidget.tsx @@ -186,7 +186,6 @@ export default function SightingHistoryWidget({ className, title }: SightingHist const isNPEDHitC = cat === "C"; const isNPEDHitD = cat === "D"; if (isNPEDHitA || isNPEDHitB || isNPEDHitC || isNPEDHitD) { - console.log("first"); dispatch({ type: "ADD", payload: obj, diff --git a/src/components/UI/Header.tsx b/src/components/UI/Header.tsx index e7e6cc2..9b8c74a 100644 --- a/src/components/UI/Header.tsx +++ b/src/components/UI/Header.tsx @@ -13,11 +13,8 @@ import { import { useState } from "react"; import SoundBtn from "./SoundBtn"; import { useIntegrationsContext } from "../../context/IntegrationsContext"; -import { useInfoBarSocket } from "../../context/WebsocketContext"; export default function Header() { - const { data: stats } = useInfoBarSocket(); - console.log(stats); const [isFullscreen, setIsFullscreen] = useState(false); const [isMenuOpen, setIsMenuOpen] = useState(false); const { state } = useIntegrationsContext(); diff --git a/src/context/WebsocketContext.ts b/src/context/WebsocketContext.ts index ec9a200..9463b02 100644 --- a/src/context/WebsocketContext.ts +++ b/src/context/WebsocketContext.ts @@ -9,8 +9,16 @@ type InfoSocketState = { send?: (msg: string) => void; }; +type heatmapSocketState = { + data: null; + readyState: ReadyState; + sendJson: (msg: unknown) => void; + send?: (msg: string) => void; +}; + export type WebsocketContextValue = { info: InfoSocketState; + heatmap?: heatmapSocketState; }; export const WebsocketContext = createContext(null); @@ -22,3 +30,4 @@ const useWebSocketContext = () => { }; export const useInfoBarSocket = () => useWebSocketContext().info; +export const useHeatmapSocket = () => useWebSocketContext().heatmap; diff --git a/src/context/providers/WebSocketProvider.tsx b/src/context/providers/WebSocketProvider.tsx index 5f6e0e0..6b448a8 100644 --- a/src/context/providers/WebSocketProvider.tsx +++ b/src/context/providers/WebSocketProvider.tsx @@ -32,7 +32,7 @@ const WebSocketProvider = ({ children }: WebSocketProviderProps) => { sendJson: infoSocket.sendJsonMessage, }, }), - [infoSocket.readyState, infoSocket.sendJsonMessage, systemData] + [systemData, infoSocket.readyState, infoSocket.sendJsonMessage] ); return {children}; }; diff --git a/src/utils/ws_config.ts b/src/utils/ws_config.ts index 18ec132..6f928c5 100644 --- a/src/utils/ws_config.ts +++ b/src/utils/ws_config.ts @@ -2,4 +2,5 @@ import { CAM_BASE } from "./config"; export const ws_config = { infoBar: `${CAM_BASE.replace("http", "ws")}/websocket-infobar`, + heatmap: `${CAM_BASE.replace("http", "ws")}/websocket-SystemConfig`, };