File tree Expand file tree Collapse file tree 3 files changed +17
-6
lines changed
public/assets/images/icons
src/features/projectsV2/ProjectDetails Expand file tree Collapse file tree 3 files changed +17
-6
lines changed Original file line number Diff line number Diff line change 2
2
3
3
4
4
import React from 'react' ;
5
- import { IconProps } from '../../../../src/features/common/types/common' ;
6
5
7
6
function InterventionIcon ( ) {
8
7
return (
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ const OtherInterventionInfo = ({
52
52
plantLocationInfo . plantedSpecies &&
53
53
plantLocationInfo . plantedSpecies . length > 0
54
54
? plantLocationInfo . plantedSpecies . reduce (
55
- ( sum : any , species : { treeCount : any ; } ) => sum + species . treeCount ,
55
+ ( sum , species : { treeCount : number } ) => sum + species . treeCount ,
56
56
0
57
57
)
58
58
: 0 ;
@@ -64,7 +64,7 @@ const OtherInterventionInfo = ({
64
64
} , [ plantLocationInfo ?. geometry , plantLocationInfo ?. type ] ) ;
65
65
66
66
const sampleInterventionSpeciesImages = useMemo ( ( ) => {
67
- if ( plantLocationInfo && plantLocationInfo . sampleInterventions . length > 0 ) {
67
+ if ( plantLocationInfo && plantLocationInfo . sampleInterventions . length > 0 ) {
68
68
const result = plantLocationInfo . sampleInterventions && plantLocationInfo . sampleInterventions . map ( ( item ) => {
69
69
return {
70
70
id : item . coordinates [ 0 ] . id ,
Original file line number Diff line number Diff line change @@ -126,9 +126,21 @@ const ProjectDetails = ({
126
126
( hoveredPlantLocation ?. type === 'multi-tree-registration' ||
127
127
selectedPlantLocation ?. type === 'multi-tree-registration' ) &&
128
128
! isMobile ;
129
- const PLANTATION_TYPES = [ 'multi-tree-registration' , 'single-tree-registration' ]
130
- const shouldShowOtherIntervention = ( hoveredPlantLocation !== null && ! PLANTATION_TYPES . includes ( hoveredPlantLocation . type ) ) || ( selectedPlantLocation !== null && ! PLANTATION_TYPES . includes ( selectedPlantLocation . type ) ) &&
131
- ! isMobile ;
129
+
130
+ const PLANTATION_TYPES = [ 'multi-tree-registration' , 'single-tree-registration' ] as const ;
131
+
132
+ // Helper function with proper type checking
133
+ const isNonPlantationType = ( location : PlantLocation | null ) : boolean => {
134
+ return location !== null && ! PLANTATION_TYPES . includes ( location . type ) ;
135
+ } ;
136
+
137
+
138
+ const shouldShowOtherIntervention = (
139
+ isNonPlantationType ( hoveredPlantLocation ) ||
140
+ ( isNonPlantationType ( selectedPlantLocation ) && ! isMobile )
141
+ ) ;
142
+
143
+
132
144
const shouldShowSinglePlantInfo =
133
145
( hoveredPlantLocation ?. type === 'single-tree-registration' ||
134
146
selectedPlantLocation ?. type === 'single-tree-registration' ||
You can’t perform that action at this time.
0 commit comments