Skip to content

Commit 9f9021c

Browse files
committed
unused code refactored
1 parent 43d3856 commit 9f9021c

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

public/assets/images/icons/InterventionIcon.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33

44
import React from 'react';
5-
import { IconProps } from '../../../../src/features/common/types/common';
65

76
function InterventionIcon() {
87
return (

src/features/projectsV2/ProjectDetails/components/OtherInterventionInfo.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const OtherInterventionInfo = ({
5252
plantLocationInfo.plantedSpecies &&
5353
plantLocationInfo.plantedSpecies.length > 0
5454
? plantLocationInfo.plantedSpecies.reduce(
55-
(sum: any, species: { treeCount: any; }) => sum + species.treeCount,
55+
(sum, species: { treeCount: number }) => sum + species.treeCount,
5656
0
5757
)
5858
: 0;
@@ -64,7 +64,7 @@ const OtherInterventionInfo = ({
6464
}, [plantLocationInfo?.geometry, plantLocationInfo?.type]);
6565

6666
const sampleInterventionSpeciesImages = useMemo(() => {
67-
if (plantLocationInfo && plantLocationInfo.sampleInterventions.length>0) {
67+
if (plantLocationInfo && plantLocationInfo.sampleInterventions.length > 0) {
6868
const result = plantLocationInfo.sampleInterventions && plantLocationInfo.sampleInterventions.map((item) => {
6969
return {
7070
id: item.coordinates[0].id,

src/features/projectsV2/ProjectDetails/index.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,21 @@ const ProjectDetails = ({
126126
(hoveredPlantLocation?.type === 'multi-tree-registration' ||
127127
selectedPlantLocation?.type === 'multi-tree-registration') &&
128128
!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+
132144
const shouldShowSinglePlantInfo =
133145
(hoveredPlantLocation?.type === 'single-tree-registration' ||
134146
selectedPlantLocation?.type === 'single-tree-registration' ||

0 commit comments

Comments
 (0)