Skip to content
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.

feat(geo): add refine on interaction [PART-3] #1192

Merged
merged 13 commits into from
Jun 20, 2018

Conversation

samouss
Copy link
Collaborator

@samouss samouss commented Apr 26, 2018

Summary

This is the third part of the GeoSearch widget. It implement the basic support of refine on map interaction. Every time the map move, we schedule a refinement on the next "idle" event. You can't control the behaviour of the refinement. It will comes after. I skip the support for the padding on refine because I didn't find a proper way to do it. Can be implement later.

untitled

This PR does not include new components:

  • <Provider>: expose the refine function to his render props
  • <GeoSearch>: provide the refine function to <GoogleMaps>
  • <GoogleMaps>: setup the listeners on the map and bind the call to refine with the map bounds

Result

You can use the widget in Storybook.

@algobot
Copy link
Contributor

algobot commented Apr 26, 2018

Deploy preview for react-instantsearch ready!

Built with commit f12a24d

https://deploy-preview-1192--react-instantsearch.netlify.com

Copy link
Contributor

@Haroenv Haroenv left a comment

Choose a reason for hiding this comment

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

some naming suggestions mostly

@@ -23,6 +24,10 @@ class GoogleMaps extends Component {
}),
};

isUserInteraction = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

not sure what these flags mean

Copy link
Collaborator Author

@samouss samouss Apr 26, 2018

Choose a reason for hiding this comment

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

The map can be updated by the user or programmatically. But the events are triggered in both cases. When we trigger programmatic events we need to "lock" the map to avoid to trigger event listeners.

@@ -66,23 +73,89 @@ class GoogleMaps extends Component {
position,
} = this.props;

const { isMapAlreadyRender } = this.state;

if (!isMapAlreadyRender || this.isPendingRefine) {
Copy link
Contributor

Choose a reason for hiding this comment

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

isMapRendered

);
};

lockUserInteration(functionThatAlterTheMapPosition) {
Copy link
Contributor

Choose a reason for hiding this comment

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

functionThatAltersTheMapPosition

{google => (
<GeoSearch google={google}>
{({ hits }) => (
<Fragment>
Copy link
Contributor

Choose a reason for hiding this comment

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

Since you can return an array, why is the Fragment still needed 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It not needed, but it's more convenient because the array still need to have key on their elements. I can even render inside a <div> it doesn't matter much.

@samouss samouss force-pushed the feat/geo-part-3-refine branch 2 times, most recently from 2562ba4 to 3f58bc8 Compare April 29, 2018 13:38
@samouss samouss force-pushed the feat/geo-part-2-simple-map branch from a3edc66 to 0af5667 Compare May 2, 2018 08:10
@samouss samouss force-pushed the feat/geo-part-3-refine branch from 3f58bc8 to 7daecb9 Compare May 2, 2018 08:10
@samouss samouss force-pushed the feat/geo-part-2-simple-map branch from 0af5667 to 3dc3e71 Compare May 4, 2018 08:41
@samouss samouss force-pushed the feat/geo-part-3-refine branch from 7daecb9 to c6644f2 Compare May 4, 2018 08:41
@samouss samouss force-pushed the feat/geo-part-2-simple-map branch from 3dc3e71 to f0cec76 Compare May 14, 2018 09:20
@samouss samouss force-pushed the feat/geo-part-3-refine branch from c6644f2 to d0be94c Compare May 14, 2018 09:21
@samouss samouss force-pushed the feat/geo-part-2-simple-map branch from f0cec76 to 05f6e6d Compare May 14, 2018 13:08
@samouss samouss force-pushed the feat/geo-part-3-refine branch from d0be94c to 7a85119 Compare May 14, 2018 13:08
@vvo
Copy link
Contributor

vvo commented May 15, 2018

This PR does not include new components:

Not sure that this is accurate given that you then list components and their behaviour.

@samouss samouss force-pushed the feat/geo-part-2-simple-map branch from 05f6e6d to 5d66ea9 Compare June 19, 2018 13:50
@samouss samouss force-pushed the feat/geo-part-3-refine branch from 7a85119 to a85b3df Compare June 19, 2018 13:57
@samouss samouss force-pushed the feat/geo-part-2-simple-map branch from 5d66ea9 to 479cdc1 Compare June 19, 2018 16:26
@samouss samouss force-pushed the feat/geo-part-3-refine branch from a85b3df to 678c09e Compare June 19, 2018 16:28
@samouss samouss force-pushed the feat/geo-part-2-simple-map branch from 125f026 to 7dfc345 Compare June 20, 2018 07:58
@samouss samouss force-pushed the feat/geo-part-3-refine branch from 678c09e to 6083a6c Compare June 20, 2018 08:05
* feat(geo): add Control component [PART-5] (#1205)

* feat(geo): refactor & external update [PART-6] (#1207)

* feat(geo): custom Marker [PART-7] (#1214)

* feat(geo): add Marker & HTMLMarker interactions [PART-8] (#1227)

* feat(geo): add stories [PART-9] (#1236)

* feat(geo): add docs [PART-10] (#1289)
@samouss samouss merged commit 387cd23 into feat/geo-part-2-simple-map Jun 20, 2018
@samouss samouss deleted the feat/geo-part-3-refine branch June 20, 2018 18:41
samouss added a commit that referenced this pull request Jun 20, 2018
* feat(geo): add refine on interaction [PART-3] (#1192)

* feat(geo): add Redo component [PART-4] (#1201)

* feat(geo): add Control component [PART-5] (#1205)

* feat(geo): refactor & external update [PART-6] (#1207)

* feat(geo): custom Marker [PART-7] (#1214)

* feat(geo): add Marker & HTMLMarker interactions [PART-8] (#1227)

* feat(geo): add stories [PART-9] (#1236)

* feat(geo): add docs [PART-10] (#1289)
samouss added a commit that referenced this pull request Jun 21, 2018
* feat(geo): add simple GoogleMaps widget [PART-2] (#1189)

* feat(geo): add refine on interaction [PART-3] (#1192)

* feat(geo): add Redo component [PART-4] (#1201)

* feat(geo): add Control component [PART-5] (#1205)

* feat(geo): refactor & external update [PART-6] (#1207)

* feat(geo): custom Marker [PART-7] (#1214)

* feat(geo): add Marker & HTMLMarker interactions [PART-8] (#1227)

* feat(geo): add stories [PART-9] (#1236)

* feat(geo): add docs [PART-10] (#1289)
samouss added a commit that referenced this pull request Jul 4, 2018
<a name="5.2.0"></a>
# [5.2.0](v5.2.0-beta.2...v5.2.0) (2018-07-04)

### Bug Fixes

* **translatable:** avoid create a new function on every render ([#1383](#1383)) ([1285b3b](1285b3b))

### Features

* **core:** export translatable ([#1351](#1351)) ([6d5a89d](6d5a89d))
* **maps:** add connector & widget ([#1171](#1171)) ([16e288a](16e288a)), closes [#1189](#1189) [#1192](#1192) [#1201](#1201) [#1205](#1205) [#1207](#1207) [#1214](#1214) [#1227](#1227) [#1236](#1236) [#1289](#1289)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants