diff --git a/src/frontend/src/components/MapComponent/OpenLayersComponent/Layers/VectorLayer.js b/src/frontend/src/components/MapComponent/OpenLayersComponent/Layers/VectorLayer.js index 4a1efb3e86..c84f0b7671 100644 --- a/src/frontend/src/components/MapComponent/OpenLayersComponent/Layers/VectorLayer.js +++ b/src/frontend/src/components/MapComponent/OpenLayersComponent/Layers/VectorLayer.js @@ -190,7 +190,7 @@ const VectorLayer = ({ }, [map, vectorLayer, getTaskStatusStyle]); useEffect(() => { - if (!vectorLayer || !style.visibleOnMap) return; + if (!vectorLayer || !style.visibleOnMap || setStyle) return; vectorLayer.setStyle((feature, resolution) => [ new Style({ image: new CircleStyle({ @@ -207,7 +207,7 @@ const VectorLayer = ({ }), getStyles({ style, feature, resolution }), ]); - }, [vectorLayer, style]); + }, [vectorLayer, style, setStyle]); useEffect(() => { if (!vectorLayer) return; diff --git a/src/frontend/src/components/ProjectInfo/ProjectInfoMapLegend.jsx b/src/frontend/src/components/ProjectInfo/ProjectInfoMapLegend.jsx new file mode 100644 index 0000000000..088f83da32 --- /dev/null +++ b/src/frontend/src/components/ProjectInfo/ProjectInfoMapLegend.jsx @@ -0,0 +1,38 @@ +import React from 'react'; + +const colorCodes = [ + { color: '#0062AC', min: 130, max: 160 }, + { color: '#4A90D9', min: 100, max: 130 }, + { color: '#7CB2E8', min: 50, max: 100 }, + { color: '#A9D2F3', min: 10, max: 50 }, + { color: '#FF4538', min: 0, max: 0 }, +]; + +const LegendListItem = ({ code }) => ( +
+
+
+ {code.min !== code.max ? ( +

+ {code.min} - {code.max} +

+ ) : ( +

{code.min}

+ )} +
+
+); + +const ProjectInfoMapLegend = () => { + return ( +
+
+ {colorCodes.map((code) => ( + + ))} +
+
+ ); +}; + +export default ProjectInfoMapLegend; diff --git a/src/frontend/src/components/ProjectInfo/ProjectInfomap.jsx b/src/frontend/src/components/ProjectInfo/ProjectInfomap.jsx index 73b08b6974..4b306a51be 100644 --- a/src/frontend/src/components/ProjectInfo/ProjectInfomap.jsx +++ b/src/frontend/src/components/ProjectInfo/ProjectInfomap.jsx @@ -13,6 +13,8 @@ import environment from '../../environment'; import { getStyles } from '../MapComponent/OpenLayersComponent/helpers/styleUtils'; import { ProjectActions } from '../../store/slices/ProjectSlice'; import { basicGeojsonTemplate } from '../../utilities/mapUtils'; +import ProjectInfoMapLegend from './ProjectInfoMapLegend'; +import Accordion from '../common/Accordion'; export const defaultStyles = { lineColor: '#000000', @@ -68,7 +70,6 @@ const colorCodes = { function colorRange(data, noOfRange) { if (data?.length === 0) return []; const actualCodes = [{ min: 0, max: 0, color: '#605f5e' }]; - console.log(data, 'data'); const maxVal = Math.max(...data?.map((d) => d.count)); const maxValue = maxVal <= noOfRange ? 10 : maxVal; // const minValue = Math.min(...data?.map((d) => d.count)) 0; @@ -114,6 +115,7 @@ const ProjectInfomap = () => { const projectBuildingGeojson = CoreModules.useAppSelector((state) => state.project.projectBuildingGeojson); const selectedTask = CoreModules.useAppSelector((state) => state.task.selectedTask); + const defaultTheme = CoreModules.useAppSelector((state) => state.theme.hotTheme); const params = CoreModules.useParams(); const encodedId = params.projectId; const decodedId = environment.decode(encodedId); @@ -272,6 +274,19 @@ const ProjectInfomap = () => { zIndex={5} /> )} +
+ } + header={ +

+ No. of Submissions +

+ } + onToggle={() => {}} + className="fmtm-py-0 !fmtm-pb-0 fmtm-rounded-lg hover:fmtm-bg-gray-50" + collapsed={true} + /> +
{buildingGeojson && }