Skip to content

Commit e1c75e7

Browse files
authored
Merge pull request #94 from OCA-UFCG/refact/states_data
refact: update states mapping data
2 parents fd95d21 + 7bdd9ea commit e1c75e7

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

src/components/MapPopup/MapPopup.tsx

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,10 @@ const MapPopup: React.FC<MapPopupProps> = ({
3030
fcMetadata,
3131
}) => {
3232
const areas = Array.from({ length: 6 }, (_, index) => ({
33-
area: fcMetadata[`Area_km2_${index + 1}`],
3433
color: colors[index],
35-
percent: fcMetadata[`Percent_${index + 1}`],
36-
}))
37-
.filter(({ percent }) => percent > 0)
38-
.map((areaInfo) => {
39-
const formattedArea =
40-
areaInfo.area > 1000
41-
? `${(areaInfo.area / 1000).toFixed(1)} Mil Km²`
42-
: `${areaInfo.area.toFixed(0)} Km²`;
43-
44-
return {
45-
color: areaInfo.color,
46-
area: formattedArea,
47-
percent: areaInfo.percent.toFixed(0),
48-
};
49-
});
34+
area: fcMetadata[`Area_info_${index + 1}`],
35+
percent: fcMetadata[`Percent_${index + 1}`]?.toFixed(2),
36+
})).filter((areaInfo) => areaInfo.area);
5037

5138
return (
5239
<PopupContent>

0 commit comments

Comments
 (0)