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

Feature/add contributions to map #742

Merged
merged 18 commits into from
Sep 25, 2020
Merged

Conversation

phylum
Copy link
Collaborator

@phylum phylum commented Sep 25, 2020

Screen Shot 2020-09-25 at 10 46 33 AM

Why

To allow contributions with locations to be plotted on the map view dynamically on the contributions page so that users can see the Asks/Offers closest to them.

References 708

Pre-Merge Checklist

All these boxes should be checked off before any pull request is merged!

  • All new features have been described in the pull request
  • Security & accessibility have been considered
  • All outstanding questions and concerns have been resolved
  • Any next steps that seem like a good ideas have been created as issues for future discussion & implementation
  • High quality tests have been added, or an explanation has been given why the features cannot be tested
  • New features have been documented, and the code is understandable and well commented
  • Entry added to CHANGELOG.md if appropriate

How

Here's a list of APIs used for the Maps:
mapbox-gl-vue
mapbox-sdk-js

Next Steps

  • Build a more complete location data for Asks/Offers to include City, State, Zipcode, if privacy concerns allow
  • Implement clustering so that as we zoom in/out we can see how many Asks/Offers are available
  • Dynamically centering on the top-level Service Area

Outstanding Questions, Concerns and Other Notes

Security

  • FIXME for Mapbox Access Token should be addressed to pull it from an ENV variable
  • Location data mentioned above in Next Steps

Copy link
Collaborator

@maebeale maebeale left a comment

Choose a reason for hiding this comment

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

LGTM, folks! WOO HOOOO!!!!! SUCH a huge addition to this app. Thank you!!!

@@ -18,7 +18,7 @@
<section>
<BrowserSelector :browser="browser" @clicked="browser = $event" />
</section>
<component :is="browser" :contributions="activeContributions" class="row" />
<component :is="browser" :contributions="activeContributions" class="row" accessToken="pk.eyJ1IjoibXV0dWFsLWFpZC1hcHAiLCJhIjoiY2tmZTBvd3UwMDBhbTJ4cDlic2JmMWZoaiJ9.rWscBjdl1SMT5N0yekIJYg"/>
Copy link
Collaborator

@indiebrain indiebrain Sep 25, 2020

Choose a reason for hiding this comment

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

A series of questions:

  • Is accesToken a credential to the maps API?
  • Is this a sensitive credential? Does this get served down to the client? Is there any amount of armoring necessary to protect it?

EDIT: Next time, I shall read the full PR description first...

FIXME for Mapbox Access Token should be addressed to pull it from an ENV variable

Copy link
Collaborator

Choose a reason for hiding this comment

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

This also seems to be copy-pasta'd in pp/javascript/pages/browse/MapBrowser.vue. Channeling Dave Thomas and Andy Hunt: "There should exist a single authoritative source of knowledge within a system - IE Do not repeat yourself."

Had you considered the case where we need to change the Map API credential? It seems likely that we might miss one or more instances with the current design.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@indiebrain yup, i believe we agreed to go with this path for this week, but that there's a ticket to move this out asap

Copy link
Collaborator

Choose a reason for hiding this comment

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

@indiebrain I agree that this should be DRYed up a bit. Given the time we've spent thus far and familiarity with given clientside tech, I think everyone did a fantastic job!

All things are possible with enough time and money.. whiskey helps.

@maebeale
Copy link
Collaborator

here's the circleci error

Uploading Screen Shot 2020-09-25 at 11.35.16 AM.png…

Copy link
Collaborator

@thestephenmarshall thestephenmarshall left a comment

Choose a reason for hiding this comment

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

Looks pretty awesome so far. Thanks for all the hard work! There are a couple of comments to address. 🎸

@@ -8,6 +8,7 @@
@import './listings'; // TODO: remove this once listings/new is refactored

@import './mapbox-gl';
@import './maps';
Copy link
Collaborator

Choose a reason for hiding this comment

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

@maebeale as time goes on, we will want to consider splitting packs up and this would likely be either: a) it's own pack or b) imported on a more view-specific pack. /randomthoughts

@@ -18,7 +18,7 @@
<section>
<BrowserSelector :browser="browser" @clicked="browser = $event" />
</section>
<component :is="browser" :contributions="activeContributions" class="row" />
<component :is="browser" :contributions="activeContributions" class="row" accessToken="pk.eyJ1IjoibXV0dWFsLWFpZC1hcHAiLCJhIjoiY2tmZTBvd3UwMDBhbTJ4cDlic2JmMWZoaiJ9.rWscBjdl1SMT5N0yekIJYg"/>
Copy link
Collaborator

Choose a reason for hiding this comment

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

@indiebrain I agree that this should be DRYed up a bit. Given the time we've spent thus far and familiarity with given clientside tech, I think everyone did a fantastic job!

All things are possible with enough time and money.. whiskey helps.

@geolocate-error="geolocateError"
@geolocate-geolocate="geolocate"
/>
:access-token= this.accessToken
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

Copy link
Collaborator

Choose a reason for hiding this comment

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

Nitpick: i don't think this. is necessary here.

console.log(title)
},
geolocateError(control, positionError) {
console.log(positionError)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we might want to remove these console.log statements, but I will defer to what MA desires here.

@@ -69,6 +69,7 @@ def peer_to_peer?
# confirmation_page_text_footer :string
# confirmation_page_text_header :string
# confirmation_page_text_link_header :string
# display_navbar :boolean default(FALSE)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are these supposed to be checked in?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, we have a gem that automatically inserts these comments and keeps them up to date with new migrations.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for the clarification @exbinary !

@@ -17,6 +17,7 @@
# confirmation_page_text_footer :string
# confirmation_page_text_header :string
# confirmation_page_text_link_header :string
# display_navbar :boolean default(FALSE)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Check this in or no?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@thestephenmarshall Looks like this was inserted automatically. We didn't add the change manually so we should probably defer to @maebeale @exbinary @h-m-m for this.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Annotate adds these schema details for both models and factories after migrations are applied. I think it's okay to check this in unless mutual-aid folks say otherwise.

Copy link
Collaborator

@solebared solebared left a comment

Choose a reason for hiding this comment

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

Looks good to me! TBH i can't provide a meaningful review of the mapbox related code but the general shape of things look good (a couple of very minor notes inline).

@@ -1,7 +1,7 @@
class ServiceAreaBlueprint < Blueprinter::Base
identifier :id

fields :name, :description
fields :name, :description, :location
Copy link
Collaborator

Choose a reason for hiding this comment

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

We probably don't want location to be a default field since its also available via the :with_location view (see 'Views' section in docs here).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks, that was a minor oversight by us while we were learning our way around Blueprint

@geolocate-error="geolocateError"
@geolocate-geolocate="geolocate"
/>
:access-token= this.accessToken
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nitpick: i don't think this. is necessary here.

},
components: { Mapbox },
methods: {
loaded(map) {
Copy link
Collaborator

@solebared solebared Sep 25, 2020

Choose a reason for hiding this comment

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

This looks great. On a second pass in the future, it could be worth trying to extract some of the sdk functions out into a separate module. There's a bit going on in this loaded method :).

Copy link
Collaborator Author

@phylum phylum Sep 25, 2020

Choose a reason for hiding this comment

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

this. is necessary because we are accessing MapBrowse's props and {{ accessToken }} didn't pass the token at all. Given more time to explore Vue.js we might be able to improve on this, however.

@@ -69,6 +69,7 @@ def peer_to_peer?
# confirmation_page_text_footer :string
# confirmation_page_text_header :string
# confirmation_page_text_link_header :string
# display_navbar :boolean default(FALSE)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, we have a gem that automatically inserts these comments and keeps them up to date with new migrations.

@phylum phylum merged commit cf9093d into main Sep 25, 2020
@phylum phylum deleted the feature/add-contributions-to-map branch September 25, 2020 17:28
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.

8 participants