-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(map): keep map coordinates in url #331
Conversation
extractCoordinatesFromUrl, | ||
isValidUrlCoordinateGroup, | ||
IUrlCoordinates, | ||
} from '../../utils/map'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls use absolute path, there 'utils/map'
packages/earth-map/src/utils/map.ts
Outdated
zoom: number; | ||
} | ||
|
||
export const toUrlCoordinateNumber = (value) => Number(parseFloat(value).toFixed(7)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls add types to all the function arguments here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Impressive stuff. 👏
latitude: isValidLatitude(urlParams.latitude) ? urlParams.latitude : INITIAL_VIEW_PORT.latitude, | ||
longitude: isValidLongitude(urlParams.longitude) | ||
? urlParams.longitude | ||
: INITIAL_VIEW_PORT.longitude, | ||
zoom: isValidZoom(urlParams.zoom) ? urlParams.zoom : INITIAL_VIEW_PORT.zoom, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about using isValidUrlCoordinateGroup
and have it fail as a whole (latitude, longitude and zoom) instead of checking individually?
latitude: isValidLatitude(urlParams.latitude) ? urlParams.latitude : INITIAL_VIEW_PORT.latitude, | |
longitude: isValidLongitude(urlParams.longitude) | |
? urlParams.longitude | |
: INITIAL_VIEW_PORT.longitude, | |
zoom: isValidZoom(urlParams.zoom) ? urlParams.zoom : INITIAL_VIEW_PORT.zoom, | |
... isValidUrlCoordinateGroup(urlParams) && urlParams |
Also I would rename urlParams
to coordinatesFromUrl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion 👍
Signed-off-by: vt90 <tomsavlad90@gmail.com>
# [1.16.0](v1.15.0...v1.16.0) (2020-12-17) ### Bug Fixes * **admin:** Fix scrolling while in edit mode [EP-3146] ([1f3be9d](1f3be9d)) * **admin:** fix sidenav search box styling ([#346](#346)) ([1afcb1a](1afcb1a)) * **admin:** handle SSR request for window usage ([1d67f43](1d67f43)) * **admin:** hide collections from places ([#351](#351)) ([613994b](613994b)) * **admin:** loading indicator on user role [EP-3424] ([c9d5dec](c9d5dec)) * **admin:** place edit reset geojson on cancel [EP-3025] ([047af4b](047af4b)) * **auth:** Error message is not displayed when a invalid link from the email is clicked [EP-3443] ([#338](#338)) ([1ed7fe5](1ed7fe5)) * **map:** collection long name overlap [EP-3595] ([a4c906b](a4c906b)) * **map:** preserve language on refresh or app change ([#345](#345)) ([32294bb](32294bb)) * **map:** support for decodeFunction on layers ([b6b98ed](b6b98ed)) * **profile:** split profile fetching and display a visual loading ind… ([#340](#340)) ([9b1d1fa](9b1d1fa)) ### Features * **map:** Clip and export layers [EP-3594] ([7a118c8](7a118c8)) * **map:** download collection metrics [EP-3002] ([#328](#328)) ([7815e82](7815e82)) * **map:** download collection metrics [EP-3002] ([#333](#333)) ([cbc780c](cbc780c)) * **map:** keep map coordinates in url ([#331](#331)) ([2c8cec8](2c8cec8)) * **map:** weglot support [EP-3441] ([#341](#341)) ([5905af3](5905af3)) ### Reverts * Revert "feat(map): download collection metrics [EP-3002] (#328)" (#332) ([a6da184](a6da184)), closes [#328](#328) [#332](#332)
By submitting a PR to this repository, you agree to the terms within the Code of Conduct. Please see the contributing guidelines for how to create and submit a high-quality PR for this repo.
Description
References
Testing
Checklist
master