Skip to content
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

Merged
merged 3 commits into from
Dec 2, 2020
Merged

Conversation

vt90
Copy link
Contributor

@vt90 vt90 commented Nov 27, 2020

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

Describe the purpose of this PR along with any background information and the impacts of the proposed change. For the benefit of the community, please do not assume prior context.

Provide details that support your chosen implementation, including: breaking changes, alternatives considered, changes to the API, etc.

References

Include any links supporting this change such as a:

  • GitHub Issue/PR number addressed or fixed
  • StackOverflow post
  • Support forum thread
  • Related pull requests/issues from other repos

If there are no references, simply delete this section.

Testing

Describe how this can be tested by reviewers. Be specific about anything not tested and reasons why. If this library has unit and/or integration testing, tests should be added for new functionality and existing tests should complete without errors.

Please include any manual steps for testing end-to-end or functionality not covered by unit/integration tests.

Also include details of the environment this PR was developed in (language/platform/browser version).

  • This change adds test coverage for new/changed/fixed functionality

Checklist

  • I have added documentation for new/changed functionality in this PR or in /docs
  • All active GitHub checks for tests, formatting, and security are passing
  • The correct base branch is being used, if not master

extractCoordinatesFromUrl,
isValidUrlCoordinateGroup,
IUrlCoordinates,
} from '../../utils/map';
Copy link
Contributor

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'

zoom: number;
}

export const toUrlCoordinateNumber = (value) => Number(parseFloat(value).toFixed(7));
Copy link
Contributor

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

Copy link
Contributor

@ancashoria ancashoria left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Impressive stuff. 👏

Comment on lines 41 to 45
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,
Copy link
Contributor

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?

Suggested change
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

Copy link
Contributor Author

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>
@vt90 vt90 merged commit 2c8cec8 into develop Dec 2, 2020
genodeploy pushed a commit that referenced this pull request Dec 17, 2020
# [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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants