(null);
if (!API_KEY) {
return (
Set NEXT_PUBLIC_GOOGLE_MAPS_API_KEY in .env to enable the map.
);
}
// A point can be re-fetched (new object identity) between renders; keep the
// InfoWindow anchored to the latest copy of the same point by id. The live
// marker's "point" is synthesized fresh from liveStatus each time.
const selectedCurrent = (() => {
if (!selected) {
return null;
}
if (selected.id.startsWith('live-')) {
return liveStatus ? liveStatusToMapPoint(liveStatus) : null;
}
return points.find((p) => p.id === selected.id) ?? selected;
})();
return (
setSelected(null)}
>
{selectedCurrent && setSelected(null)} />}
);
}