Skip to content

Commit

Permalink
Merge pull request #2389 from Plant-for-the-Planet-org/hotfix/fires-l…
Browse files Browse the repository at this point in the history
…atlng-convention-fix

LatLng convention fixed.
  • Loading branch information
mariahosfeld authored Jan 29, 2025
2 parents 7690192 + 5692667 commit 33e442a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/features/projectsV2/ProjectsMap/FirePopup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ export default function FirePopup({ isOpen, feature }: Props) {
return { amount: `${days}`, unit: 'd' }; // 24 hours or more
}, [feature.properties.eventDate]);

const alertCoordinates = useMemo(() => {
const [lng, lat] = feature.geometry.coordinates;
const latString = lat >= 0 ? `${Math.abs(lat)}°N` : `${Math.abs(lat)}°S`;
const lngString = lng >= 0 ? `${Math.abs(lng)}°E` : `${Math.abs(lng)}°W`;
return `${latString}, ${lngString}`;
}, [feature.geometry.coordinates]);

const alertConfidence = useMemo(() => {
const confidenceMap: Record<string, string> = {
high: 'highAlertConfidenceText',
Expand Down Expand Up @@ -155,10 +162,7 @@ export default function FirePopup({ isOpen, feature }: Props) {
</p>
</header>
<div className={styles.popupText}>
<p className={styles.coordinates}>
{feature.geometry.coordinates[0]},{' '}
{feature.geometry.coordinates[1]}
</p>
<p className={styles.coordinates}>{alertCoordinates}</p>
<p>
{tProjectDetails.rich(alertConfidence, {
important: (chunks) => <span>{chunks}</span>,
Expand Down

0 comments on commit 33e442a

Please sign in to comment.