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

Generic location autocomplete #893

Merged
merged 12 commits into from
Aug 9, 2018
Merged

Generic location autocomplete #893

merged 12 commits into from
Aug 9, 2018

Conversation

kpuputti
Copy link
Contributor

@kpuputti kpuputti commented Aug 9, 2018

This PR generalises the LocationAutocompleteInput so that the geocoding implementation can be swapped.

Two geocoder implementation are provided, one for Google Maps Places API (default) and one for Mapbox Geocoding API. The Mapbox geocoder requires window.mapboxgl and window.mapboxSdk globals to be present.

@kpuputti kpuputti changed the title Generic location autocomplete with Google Maps Places API implementation Generic location autocomplete Aug 9, 2018
// `false` when using some other Geocoding API. Autocomplete
// predictions dropdown bottom padding might need adjusting as well to
// hide the space left for the logo.
const SHOW_POWERED_BY_GOOGLE = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be safer to use config.googleMapsAPIKey check somehow here? Especially if we end up making mapbox our default map provider? (Missing to turn this on/off is a clear violation of their terms.)

Copy link
Contributor

Choose a reason for hiding this comment

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

Even better would be that the whole div (or just the flag) is exported from Geocoder file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could be better but a config var might make customisers think that it is enough to change the provider.

I think a config still makes sense, then we can already adjust the predictions list paddings etc. based on that. We just have to mention that some imports have to be changes too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I moved the attribution element to the geocoder.

However, the predictions list leaves bottom padding for the attribution, and that padding is added in many places. I added a global var that can be used to set the padding when the map provider is changed.

Copy link
Contributor

@lyyder lyyder 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 👍
Check the comments and grep for the country occurrences so that references to it won't be left around.

* [change] Removed the `country` parameter from the search page as it
was not used anywhere.
[#893](https://github.com/sharetribe/flex-template-web/pull/893)

Copy link
Contributor

Choose a reason for hiding this comment

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

The changelog could contain even multiple entries for this PR. At least for adding the Mapbox geocoder and maybe also a note about the generalization of the geocoder.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is it ok not to advertise it yet? It's not usable without the script imports, and it would be a violation of the service terms to use the Mapbox geocoder without also using the Mapbox map (which isn't finished). We'll have a big major release when all the parts are ready.

Copy link
Contributor

Choose a reason for hiding this comment

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

Valid point. Let's add an entry when Mapbox can properly be taken into use.

The padding is set for the "Powered by Google" attribution, but that
might not be present e.g. with Mapbox.
@@ -50,7 +50,7 @@
.predictionsRoot {
position: absolute;
width: 100%;
padding-bottom: 98px;
padding-bottom: var(--locationAutocompleteBottomPadding);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the larger padding here was for the Mobile Safari bottom spacing, but it looked fine with 72px when I tested it.

@kpuputti kpuputti merged commit c5f3ce7 into master Aug 9, 2018
@kpuputti kpuputti deleted the generalised-geocoding branch August 9, 2018 12:27
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