From 48eee8061a63db1d36684c6ad57e673d5fc46b32 Mon Sep 17 00:00:00 2001 From: Aja Beckett Date: Wed, 22 Nov 2023 10:10:38 -0800 Subject: [PATCH] chore: move lat/lon checks to client-shared --- package-lock.json | 7 +++---- package.json | 2 +- src/gis/gisUtils.js | 4 +--- src/landscape/components/LandscapeListMap.js | 2 +- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index ccbcff889..1d2d96ef5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -50,7 +50,7 @@ "slate-hyperscript": "^0.100.0", "slate-react": "^0.101.0", "source-map-explorer": "^2.5.3", - "terraso-client-shared": "github:techmatters/terraso-client-shared#7c31557", + "terraso-client-shared": "github:techmatters/terraso-client-shared#96c5ddb", "use-debounce": "^9.0.4", "uuid": "^9.0.1", "web-vitals": "^3.5.0", @@ -28808,15 +28808,14 @@ }, "node_modules/terraso-client-shared": { "version": "0.1.0", - "resolved": "git+ssh://git@github.com/techmatters/terraso-client-shared.git#a9035d030c90d0b0c0e38e263e9b8cc58e85e1b1", - "integrity": "sha512-AbzrNQn9hxjS9xMdHt7hDVYBmcnNm4C/GaAxf86N9b9uJkKKO0x8y9H6b2hetO9FiqIMRVTfD2GYBk/1FQ2ujw==", + "resolved": "git+ssh://git@github.com/techmatters/terraso-client-shared.git#96c5ddbd9c60023dcd25256c98459498e91a4722", "dependencies": { "@reduxjs/toolkit": "^1.9.7", "jwt-decode": "^4.0.0", "lodash": "^4.17.21", "react": "^18.2.0", "react-redux": "^8.1.3", - "terraso-backend": "github:techmatters/terraso-backend#6d71a63854511f6bad35163dfbad89008dda5a51", + "terraso-backend": "github:techmatters/terraso-backend#2162f0e", "uuid": "^9.0.1" } }, diff --git a/package.json b/package.json index 2bbeafaf7..f376efff6 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "slate-hyperscript": "^0.100.0", "slate-react": "^0.101.0", "source-map-explorer": "^2.5.3", - "terraso-client-shared": "github:techmatters/terraso-client-shared#7c31557", + "terraso-client-shared": "github:techmatters/terraso-client-shared#96c5ddb", "use-debounce": "^9.0.4", "uuid": "^9.0.1", "web-vitals": "^3.5.0", diff --git a/src/gis/gisUtils.js b/src/gis/gisUtils.js index 0a4205976..cf85d59ac 100644 --- a/src/gis/gisUtils.js +++ b/src/gis/gisUtils.js @@ -16,9 +16,7 @@ */ import bbox from '@turf/bbox'; import _ from 'lodash/fp'; - -export const isValidLatitude = lat => lat >= -90 && lat <= 90; -export const isValidLongitude = lng => lng >= -180 && lng <= 180; +import { isValidLatitude, isValidLongitude } from 'terraso-client-shared/utils'; // From: https://gis.stackexchange.com/a/303362 export const normalizeLongitude = lng => (((lng % 360) + 540) % 360) - 180; diff --git a/src/landscape/components/LandscapeListMap.js b/src/landscape/components/LandscapeListMap.js index afc06d259..acbe3b1a1 100644 --- a/src/landscape/components/LandscapeListMap.js +++ b/src/landscape/components/LandscapeListMap.js @@ -24,6 +24,7 @@ import { getLandscapePin } from 'landscape/landscapeUtils'; import './LandscapeListMap.css'; import { useTranslation } from 'react-i18next'; +import { isValidLatitude, isValidLongitude } from 'terraso-client-shared/utils'; import { Typography } from '@mui/material'; import RouterLink from 'common/components/RouterLink'; @@ -31,7 +32,6 @@ import { countryNameForCode } from 'common/countries'; import Map, { useMap as useMapboxContext } from 'gis/components/Map'; import MapControls from 'gis/components/MapControls'; import MapStyleSwitcher from 'gis/components/MapStyleSwitcher'; -import { isValidLatitude, isValidLongitude } from 'gis/gisUtils'; import { MAPBOX_LANDSCAPE_DIRECTORY_STYLE } from 'config';