diff --git a/public/assets/images/icons/InterventionIcon.tsx b/public/assets/images/icons/InterventionIcon.tsx index 14440fb66..603b79d66 100644 --- a/public/assets/images/icons/InterventionIcon.tsx +++ b/public/assets/images/icons/InterventionIcon.tsx @@ -2,7 +2,6 @@ import React from 'react'; -import { IconProps } from '../../../../src/features/common/types/common'; function InterventionIcon() { return ( diff --git a/src/features/projectsV2/ProjectDetails/components/OtherInterventionInfo.tsx b/src/features/projectsV2/ProjectDetails/components/OtherInterventionInfo.tsx index 8fe6fda09..f419714f1 100644 --- a/src/features/projectsV2/ProjectDetails/components/OtherInterventionInfo.tsx +++ b/src/features/projectsV2/ProjectDetails/components/OtherInterventionInfo.tsx @@ -52,7 +52,7 @@ const OtherInterventionInfo = ({ plantLocationInfo.plantedSpecies && plantLocationInfo.plantedSpecies.length > 0 ? plantLocationInfo.plantedSpecies.reduce( - (sum: any, species: { treeCount: any; }) => sum + species.treeCount, + (sum, species: { treeCount: number }) => sum + species.treeCount, 0 ) : 0; @@ -64,7 +64,7 @@ const OtherInterventionInfo = ({ }, [plantLocationInfo?.geometry, plantLocationInfo?.type]); const sampleInterventionSpeciesImages = useMemo(() => { - if (plantLocationInfo && plantLocationInfo.sampleInterventions.length>0) { + if (plantLocationInfo && plantLocationInfo.sampleInterventions.length > 0) { const result = plantLocationInfo.sampleInterventions && plantLocationInfo.sampleInterventions.map((item) => { return { id: item.coordinates[0].id, diff --git a/src/features/projectsV2/ProjectDetails/index.tsx b/src/features/projectsV2/ProjectDetails/index.tsx index c8426b785..e3deeaf30 100644 --- a/src/features/projectsV2/ProjectDetails/index.tsx +++ b/src/features/projectsV2/ProjectDetails/index.tsx @@ -126,9 +126,21 @@ const ProjectDetails = ({ (hoveredPlantLocation?.type === 'multi-tree-registration' || selectedPlantLocation?.type === 'multi-tree-registration') && !isMobile; - const PLANTATION_TYPES = ['multi-tree-registration', 'single-tree-registration'] - const shouldShowOtherIntervention = (hoveredPlantLocation !== null && !PLANTATION_TYPES.includes(hoveredPlantLocation.type)) || (selectedPlantLocation !== null && !PLANTATION_TYPES.includes(selectedPlantLocation.type)) && - !isMobile; + + const PLANTATION_TYPES = ['multi-tree-registration', 'single-tree-registration'] as const; + + // Helper function with proper type checking + const isNonPlantationType = (location: PlantLocation | null): boolean => { + return location !== null && !PLANTATION_TYPES.includes(location.type); + }; + + + const shouldShowOtherIntervention = ( + isNonPlantationType(hoveredPlantLocation) || + (isNonPlantationType(selectedPlantLocation) && !isMobile) + ); + + const shouldShowSinglePlantInfo = (hoveredPlantLocation?.type === 'single-tree-registration' || selectedPlantLocation?.type === 'single-tree-registration' ||