Skip to content

Commit

Permalink
chore: move lat/lon checks to client-shared
Browse files Browse the repository at this point in the history
  • Loading branch information
ajabeckett committed Nov 22, 2023
1 parent 5a80eb7 commit 48eee80
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
7 changes: 3 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 1 addition & 3 deletions src/gis/gisUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/landscape/components/LandscapeListMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ 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';
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';

Expand Down

0 comments on commit 48eee80

Please sign in to comment.