Skip to content

Commit

Permalink
make only maxele and obs layers visible by default
Browse files Browse the repository at this point in the history
this is accomplished by offloading the
determining of default layer state to a new function,
`newLayerDefaultState`, that looks at the layer object.
  • Loading branch information
mbwatson committed May 2, 2024
1 parent 5bceeaf commit 825a966
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/components/map/default-layers.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@ import { CircleMarker } from 'leaflet';
import { useLayers } from '@context';
import { markClicked } from '@utils/map-utils';

const newLayerDefaultState = layer => {
console.log(layer.properties.product_type)
const { product_type } = layer.properties

if (['obs', 'maxele63'].includes(product_type)) {
return ({
visible: true
})
}

return ({
visible: false
});
};


export const DefaultLayers = () => {

const [obsData, setObsData] = useState("");
Expand Down Expand Up @@ -92,9 +108,7 @@ export const DefaultLayers = () => {
if (layer)
layer_list.push({
...layer,
state: {
visible: true,
}
state: newLayerDefaultState(layer)
});

// TODO: do we really need to do this here??!
Expand Down

0 comments on commit 825a966

Please sign in to comment.