Skip to main content
100%

Update path/map

✓ Published0🌍 Public
FFelipe Maion
Last edited Dec 5, 2023
Created on Dec 5, 2023
Forked from React Starter

This interactive map displays a factory floor with SVG path segments representing AGV routes. React components render the paths, while the app fetches real-time data from `/api/cards` and `/api/agvs` endpoints. When an AGV's current card matches a registered segment card, that segment’s stroke color changes from black to red. Users can click non-clean-room segments to register new card values via a prompt, which are sent to the server through a POST request to `/api/segmento`.

AI-generated description

The goal is to receive data from two endpoints real time/interval: fetch("/api/cards") and fetch("/api/agvs").

/api/cards will return something like: [ { "segmentId": "Caminho-24", "cardValue": "043389C25E7180", "created_at": "2023-12-05T02:47:18.317Z" }, { "segmentId": "Caminho-25", "cardValue": "044FA6C25E7180", "created_at": "2023-12-05T03:09:35.990Z" } ]

and /api/agvs should return something like: [{"IP":"192.168.15.15","CURRENT":"ffffffff","LAST":"ffffffff"},{"IP":"192.168.15.21","CURRENT":"044FA6C25E7180","LAST":"043389C25E7180"},{"IP":"192.168.15.4","CURRENT":"ffffffff","LAST":"ffffffff"}]

I want to check if any object of agvs list has the Current card === any of the cards, if so, the segmentId should change stroke from "black" to "red"

MIT Licensed

Similar vizzes