feat(warehousing): ppoo monitoring added

this will monitor ppoo every 45 seconds as long as someone is on the page.

closes #13
This commit is contained in:
2026-05-27 20:52:34 -05:00
parent 6d0fb8aee4
commit 8b076949a7
11 changed files with 425 additions and 210 deletions

View File

@@ -13,6 +13,7 @@ type RoomErrorPayload = {
export function useSocketRoom<T>(
roomId: string,
enabled = true,
getKey?: (item: T) => string | number,
) {
const [data, setData] = useState<T[]>([]);
@@ -35,6 +36,7 @@ export function useSocketRoom<T>(
);
useEffect(() => {
if (!roomId || !enabled) return;
function handleConnect() {
socket.emit("join-room", roomId);
setInfo(`Joined room: ${roomId}`);
@@ -74,7 +76,18 @@ export function useSocketRoom<T>(
socket.off("room-update", handleUpdate);
socket.off("room-error", handleError);
};
}, [roomId]);
}, [roomId, enabled]);
return { data, info, clearRoom };
}
/*
const isDockDoorPage = location.pathname.startsWith("/dockdoor");
useSocketRoom(
dockId ? `dockdoor:${dockId}` : null,
isDockDoorPage,
);
*/