community-platform icon indicating copy to clipboard operation
community-platform copied to clipboard

feat: load map pins from API endpoint

Open thisislawatts opened this issue 2 months ago • 1 comments

PR Checklist

PR Type

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)
  • [ ] Developer experience (improves developer workflows for contributing to the project)

Description

What this PR does

Git Issues

Closes #

Screenshots/Videos

If useful, provide screenshot or capture to highlight main changes


What happens next?

Thanks for the contribution! We try to make sure all PRs are reviewed ahead of our monthly maintainers call (first Monday of the month)

If the PR is working as intended it'll be merged and included in the next platform release, if not changes will be requested and re-reviewed once updated.

If you need more immediate feedback you can try reaching out on Discord in the Community Platform development channel.

thisislawatts avatar Apr 25 '24 19:04 thisislawatts

1 flaky test on run #5500 ↗︎

0 86 3 0 Flakiness 1

Details:

test: remove high level tests in favour of unit tests
Project: onearmy-community-platform Commit: 481ebf89e7
Status: Passed Duration: 04:19 💡
Started: May 5, 2024 8:43 PM Ended: May 5, 2024 8:47 PM
Flakiness  src/integration/profile.spec.ts • 1 flaky test • ci-chrome

View Output Video

Test Artifacts
[Profile] > [By User] > [Can contact profiles by default] Test Replay Screenshots Video

Review all test suite changes for PR #3480 ↗︎

cypress[bot] avatar Apr 25 '24 20:04 cypress[bot]

We can improve the Maps component logic if we simply use the url hash to manage the loaded pin state (we already do it on showPinFromURL). MapView would navigate to the hash when a pin is clicked, and not export onPinClicked anymore.

mariojsnunes avatar Apr 30 '24 02:04 mariojsnunes

Just to make sure... the pin list we get from the API doesn't have all the info, so we need to load them individually on click?

@mariojsnunes we are currently loading the map pin details from the user profile https://github.com/ONEARMY/community-platform/blob/156674420491c15f70d000ee9d5ea9a239bb0f44/src/stores/Maps/maps.store.ts#L142

Historically we used to store the information on the map pin under the detail property but at some point we dropped that in favour of having a single source of truth.

thisislawatts avatar May 02 '24 18:05 thisislawatts

We can improve the Maps component logic if we simply use the url hash to manage the loaded pin state (we already do it on showPinFromURL). MapView would navigate to the hash when a pin is clicked, and not export onPinClicked anymore.

I've done some refactoring here so that we now use the onPinClicked method for mutating state. As a result the only component that knows we are using the location.hash to manage state is Maps. The aim of this change was to simplify MapView and centralise state in one place.

Generally across the application we use MobX or React for state management so we should aim to isolate deviation from this pattern (here it was using window.location) to a single component (Maps.tsx) in an effort to reduce maintenance costs. Before location.hash introduced non-obvious coupling between the two components.

thisislawatts avatar May 04 '24 09:05 thisislawatts

Codecov Report

Attention: Patch coverage is 75.55556% with 22 lines in your changes are missing coverage. Please review.

Project coverage is 66.80%. Comparing base (4363d69) to head (481ebf8).

Files Patch % Lines
src/pages/Maps/Maps.tsx 70.58% 15 Missing :warning:
src/pages/Maps/map.service.ts 82.14% 5 Missing :warning:
src/pages/Maps/Content/Controls/Controls.tsx 75.00% 1 Missing :warning:
src/pages/Maps/Content/MapView/MapView.tsx 75.00% 1 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3480      +/-   ##
==========================================
+ Coverage   66.65%   66.80%   +0.15%     
==========================================
  Files         427      428       +1     
  Lines       13466    13513      +47     
  Branches     2431     2437       +6     
==========================================
+ Hits         8976     9028      +52     
+ Misses       4444     4439       -5     
  Partials       46       46              

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar May 05 '24 20:05 codecov[bot]

Visit the preview URL for this PR (updated for commit 481ebf8):

https://onearmy-next--pr3480-feat-load-mappins-fr-fyvrmw26.web.app

(expires Fri, 07 Jun 2024 13:26:19 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 6d65e4f8fee2f6ab2da0c1c3b85b8797d66afa59

github-actions[bot] avatar May 05 '24 21:05 github-actions[bot]

:tada: This PR is included in version 1.177.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket:

onearmy-bot avatar May 08 '24 13:05 onearmy-bot

:tada: This PR is included in version 1.179.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket:

onearmy-bot avatar May 09 '24 10:05 onearmy-bot