diff --git a/src/components/Identify.jsx b/src/components/Identify.jsx index 1fee4ee..a4f8853 100644 --- a/src/components/Identify.jsx +++ b/src/components/Identify.jsx @@ -6,7 +6,7 @@ import { faExternalLinkAlt } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { Col, Container } from 'reactstrap'; -import { toQueryString } from '@ugrc/utilities'; +import { toQueryString } from '@ugrc/utilities/src'; import ky from 'ky'; import './Identify.css'; @@ -181,7 +181,7 @@ const IdentifyInformation = ({ apiKey, wkid = 3857, location }) => { }, ], ], - [] + [], ); const reverseGeocode = useCallback( @@ -208,7 +208,7 @@ const IdentifyInformation = ({ apiKey, wkid = 3857, location }) => { console.warn(ex); } }, - [wkid, apiKey] + [wkid, apiKey], ); const get = useCallback( @@ -243,14 +243,14 @@ const IdentifyInformation = ({ apiKey, wkid = 3857, location }) => { } catch (error) { console.warn(error); } - }) + }), ); await reverseGeocode(mapPoint); controller.current = null; }, - [apiKey, wkid, reverseGeocode] + [apiKey, wkid, reverseGeocode], ); useEffect(() => { diff --git a/src/components/MapView.jsx b/src/components/MapView.jsx index 11feb11..79b30b8 100644 --- a/src/components/MapView.jsx +++ b/src/components/MapView.jsx @@ -53,7 +53,7 @@ const MapComponent = ({ zoomToGraphic, onClick }) => { mapView.current.on('click', onClick); }); - setSelectorOptions({ + const selectorOptions = { view: mapView.current, quadWord: import.meta.env.VITE_DISCOVER, baseLayers: ['Hybrid', 'Lite', 'Terrain', 'Topo', 'Color IR'], @@ -67,7 +67,16 @@ const MapComponent = ({ zoomToGraphic, onClick }) => { }, ], position: 'top-right', - }); + }; + + // select a random index from baseLayers and convert the string to an object + const randomBaseMapIndex = Math.floor(Math.random() * selectorOptions.baseLayers.length); + selectorOptions.baseLayers[randomBaseMapIndex] = { + token: selectorOptions.baseLayers[randomBaseMapIndex], + selected: true, + }; + + setSelectorOptions(selectorOptions); return () => { mapView.current.destroy(); @@ -76,7 +85,7 @@ const MapComponent = ({ zoomToGraphic, onClick }) => { }, [setMapView, onClick]); return ( -