diff --git a/src/frontend/src/components/GenerateMbTiles.jsx b/src/frontend/src/components/GenerateMbTiles.jsx index fa3e4023a3..09060212a3 100644 --- a/src/frontend/src/components/GenerateMbTiles.jsx +++ b/src/frontend/src/components/GenerateMbTiles.jsx @@ -21,7 +21,6 @@ const GenerateMbTiles = ({ setToggleGenerateModal, toggleGenerateModal, projectI border: '1px solid ', padding: '16px 32px 24px 32px', }); - console.log(projectInfo, 'projectInfo'); const downloadMbTiles = (tileId) => { dispatch(DownloadTile(`${import.meta.env.VITE_API_URL}/projects/download_tiles/?tile_id=${tileId}`, projectInfo)); }; diff --git a/src/frontend/src/components/MapComponent/OpenLayersComponent/LayerSwitcher/index.js b/src/frontend/src/components/MapComponent/OpenLayersComponent/LayerSwitcher/index.js index dec28db24b..410a620dfb 100644 --- a/src/frontend/src/components/MapComponent/OpenLayersComponent/LayerSwitcher/index.js +++ b/src/frontend/src/components/MapComponent/OpenLayersComponent/LayerSwitcher/index.js @@ -7,8 +7,8 @@ import LayerTile from 'ol/layer/Tile'; import SourceOSM from 'ol/source/OSM'; import LayerSwitcher from 'ol-layerswitcher'; import React, { useEffect } from 'react'; - import { XYZ } from 'ol/source'; +import { useLocation } from 'react-router-dom'; // const mapboxOutdoors = new MapboxVector({ // styleUrl: 'mapbox://styles/geovation/ckpicg3of094w17nyqyd2ziie', @@ -147,6 +147,33 @@ const LayerSwitcherControl = ({ map, visible = 'osm' }) => { }; }, [map, visible]); + const location = useLocation(); + if (location.pathname.includes('project_details')) { + const olZoom = document.querySelector('.ol-zoom'); + const layerSwitcher = document.querySelector('.layer-switcher'); + + if (olZoom) { + olZoom.style.display = 'none'; + } + + if (layerSwitcher) { + layerSwitcher.style.right = '19px'; + layerSwitcher.style.top = '250px'; + layerSwitcher.style.zIndex = '1000'; + + const layerSwitcherButton = layerSwitcher.querySelector('button'); + if (layerSwitcherButton) { + layerSwitcherButton.style.width = '40px'; + layerSwitcherButton.style.height = '40px'; + } + + layerSwitcher.style.backgroundColor = 'white'; + layerSwitcher.style.display = 'flex'; + layerSwitcher.style.justifyContent = 'center'; + layerSwitcher.style.alignItems = 'center'; + } + } + return null; }; diff --git a/src/frontend/src/components/MapComponent/OpenLayersComponent/Layers/VectorLayer.js b/src/frontend/src/components/MapComponent/OpenLayersComponent/Layers/VectorLayer.js index aa6c761fd4..2bcc1bc2bd 100644 --- a/src/frontend/src/components/MapComponent/OpenLayersComponent/Layers/VectorLayer.js +++ b/src/frontend/src/components/MapComponent/OpenLayersComponent/Layers/VectorLayer.js @@ -47,6 +47,8 @@ const VectorLayer = ({ setStyle, onModify, onDraw, + getTaskStatusStyle, + layerProperties, }) => { const [vectorLayer, setVectorLayer] = useState(null); @@ -157,9 +159,8 @@ const VectorLayer = ({ // Perform an action if a feature is found if (feature) { // Do something with the feature - console.log('Clicked feature:', feature.getProperties()); // dispatch() - mapOnClick(feature.getProperties()); + mapOnClick(feature.getProperties(), feature); } }); setVectorLayer(vectorLyr); @@ -183,6 +184,11 @@ const VectorLayer = ({ vectorLayer.setStyle(setStyle); }, [map, setStyle, vectorLayer, visibleOnMap]); + useEffect(() => { + if (!map || !vectorLayer || !getTaskStatusStyle) return; + vectorLayer.setStyle((feature) => getTaskStatusStyle(feature)); + }, [map, vectorLayer, getTaskStatusStyle]); + useEffect(() => { if (!vectorLayer || !style.visibleOnMap) return; vectorLayer.setStyle((feature, resolution) => getStyles({ style, feature, resolution })); @@ -209,6 +215,11 @@ const VectorLayer = ({ }); }, [vectorLayer, properties]); + useEffect(() => { + if (!map || !vectorLayer || !layerProperties) return; + vectorLayer.setProperties(layerProperties); + }, [map, vectorLayer, layerProperties]); + // style on hover useEffect(() => { if (!map) return null; diff --git a/src/frontend/src/components/MapLegends.jsx b/src/frontend/src/components/MapLegends.jsx index 8da0e8c7f1..9361c9afa4 100755 --- a/src/frontend/src/components/MapLegends.jsx +++ b/src/frontend/src/components/MapLegends.jsx @@ -89,8 +89,8 @@ const MapLegends = ({ direction, spacing, iconBtnProps, defaultTheme, valueStatu // ); // })} // -
Map Legend
Legend
+