When the user logs in and views all the campgrounds he will have a button in the /campgrounds route (which has all the campgrounds) to sort all of them from his current location. This will be handy as he/she won't have to look through the map to find the closest campgrounds.
šØ Changes Made
Fixes #18
Created a route called /nearest that will be called along with query params of latitude and longitude on clicking the button using the geolocation API. Subsequent function called showNearestCampgrounds is in the controller directory of campgrounds that sorts the campgrounds based on latitudes and longitudes using turf package.
ā Checklist
Before submitting the PR, please make sure you have completed the following:
[ā ] My code follows the style guidelines of this project.
[ā ] I have performed a self-review of my own code.
[ā ] I have commented my code, particularly in hard-to-understand areas.
[ā ] I have made corresponding changes to the documentation (if applicable).
[ā ] My changes generate no new warnings.
[ā ] I have tested it locally and it works fine.
[ā ] Any dependent changes have been merged and published in downstream modules.
š·ļø Types of Changes
What type of changes does your code introduce? (Check all that apply)
[ ] Bug fix (non-breaking change which fixes an issue) š
[ā ] New feature (non-breaking change which adds functionality) āØ
[ā ] UI enhancement (non-breaking change which enhances UI) šØ
[ ] Documentation update š
š¤ Related Issues
Fixes #18
šø Screenshots (if applicable)
Reminder:
Please ensure your pull request is made to the test branch, not main.
Thank you for contributing to VigneshDevHub! We look forward to reviewing your PR and getting it merged!
š Description
When the user logs in and views all the campgrounds he will have a button in the /campgrounds route (which has all the campgrounds) to sort all of them from his current location. This will be handy as he/she won't have to look through the map to find the closest campgrounds.
šØ Changes Made
Fixes #18
Created a route called /nearest that will be called along with query params of latitude and longitude on clicking the button using the geolocation API. Subsequent function called showNearestCampgrounds is in the controller directory of campgrounds that sorts the campgrounds based on latitudes and longitudes using turf package.
ā Checklist
Before submitting the PR, please make sure you have completed the following:
š·ļø Types of Changes
What type of changes does your code introduce? (Check all that apply)
š¤ Related Issues
šø Screenshots (if applicable)
Reminder:
Please ensure your pull request is made to the
test
branch, notmain
.Thank you for contributing to VigneshDevHub! We look forward to reviewing your PR and getting it merged!