-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
Conversation
- added ask and offer image - move styles to its own maps stylesheet - updated geojson properties needed for pin rendering
- added descriptions of properties that can be pulled from contributions.json - removed text-field from layout: the pin would suffice - add styles for pin popup
…good/mutual-aid into feature/add-contributions-to-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.
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"/> |
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.
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
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.
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.
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.
@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
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.
@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.
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.
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'; |
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.
@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"/> |
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.
@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 |
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.
👍
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.
Nitpick: i don't think this.
is necessary here.
console.log(title) | ||
}, | ||
geolocateError(control, positionError) { | ||
console.log(positionError) |
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.
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) |
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.
Are these supposed to be checked in?
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.
Yes, we have a gem that automatically inserts these comments and keeps them up to date with new migrations.
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 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) |
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.
Check this in or no?
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.
@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.
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.
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.
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.
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 |
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.
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).
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, 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 |
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.
Nitpick: i don't think this.
is necessary here.
}, | ||
components: { Mapbox }, | ||
methods: { | ||
loaded(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.
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 :).
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.
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) |
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.
Yes, we have a gem that automatically inserts these comments and keeps them up to date with new migrations.
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!
How
Here's a list of APIs used for the Maps:
mapbox-gl-vue
mapbox-sdk-js
Next Steps
Outstanding Questions, Concerns and Other Notes
Security