- updated websocket context and add heatmap support; refactor CameraSettingFields and SightingWidget components

This commit is contained in:
2025-12-16 12:17:31 +00:00
parent 555330991d
commit 29e9086d5a
6 changed files with 12 additions and 6 deletions

View File

@@ -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<WebsocketContextValue | null>(null);
@@ -22,3 +30,4 @@ const useWebSocketContext = () => {
};
export const useInfoBarSocket = () => useWebSocketContext().info;
export const useHeatmapSocket = () => useWebSocketContext().heatmap;

View File

@@ -32,7 +32,7 @@ const WebSocketProvider = ({ children }: WebSocketProviderProps) => {
sendJson: infoSocket.sendJsonMessage,
},
}),
[infoSocket.readyState, infoSocket.sendJsonMessage, systemData]
[systemData, infoSocket.readyState, infoSocket.sendJsonMessage]
);
return <WebsocketContext.Provider value={value}>{children}</WebsocketContext.Provider>;
};