homeflowjs 0.12.18 → 0.12.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -151,6 +151,28 @@ export const loadNext = () => (dispatch, getState) => {
151
151
  });
152
152
  };
153
153
 
154
+ export const loadPage = (payload) => (dispatch, getState) => {
155
+ dispatch(setLoading({ properties: true }));
156
+ // set page on search to page + 1
157
+ let newProperties = [...getState().properties.properties];
158
+ const newSearch = { ...getState().search.currentSearch };
159
+ newSearch.page = payload;
160
+ // conduct search ljson
161
+ return fetch(`/search.ljson?${buildQueryString(newSearch)}`)
162
+ .then((response) => response.json())
163
+ .then((json) => {
164
+ if (json.properties) {
165
+ // add the page number to each new property for dividing properties into per-page divs
166
+ const addedProperties = json.properties.map((property) => (
167
+ { ...property, resultPage: newSearch.page }
168
+ ));
169
+ newProperties = [...addedProperties, ...newProperties];
170
+ dispatch(setProperties(newProperties));
171
+ dispatch(setLoading({ properties: false }));
172
+ }
173
+ });
174
+ };
175
+
154
176
  export const toggleSavedProperty = (payload) => ({
155
177
  type: PropertiesActionTypes.TOGGLE_SAVED_PROPERTY,
156
178
  payload,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homeflowjs",
3
- "version": "0.12.18",
3
+ "version": "0.12.20",
4
4
  "sideEffects": [
5
5
  "modal/**/*",
6
6
  "user/default-profile/**/*",
@@ -101,7 +101,7 @@ export default class DraggableMap {
101
101
  if (marker.property.geoname_id && marker.property.viewport) {
102
102
  this.bounds = this.getViewportBounds(marker.property.viewport);
103
103
  this.map.fitBounds(this.bounds, Homeflow.get('custom_map_bounds_padding'));
104
- this.onMapDrag();
104
+ this.onMapDrag({ markerPlaceId: marker.property.geoname_id });
105
105
  }
106
106
  }
107
107
 
@@ -462,7 +462,7 @@ export default class DraggableMap {
462
462
  }
463
463
 
464
464
 
465
- onMapDrag() {
465
+ onMapDrag({ markerPlaceId } = { markerPlaceId: null }) {
466
466
  if (Homeflow.get('disable_draggable_map') || this.drawableMapInitialized) return;
467
467
 
468
468
  let url;
@@ -494,6 +494,10 @@ export default class DraggableMap {
494
494
  Homeflow.kickEvent('before_draggable_map_updated');
495
495
  url = url + '&zoom_level=' + this.map.getZoom();
496
496
 
497
+ if (markerPlaceId) {
498
+ url = url + `&marker_place_id=${markerPlaceId}`;
499
+ }
500
+
497
501
  return fetch(url)
498
502
  .then((response) => response.json())
499
503
  .then(json => {
@@ -27,9 +27,9 @@ export default class DrawableMap extends DraggableMap {
27
27
  }
28
28
  }
29
29
 
30
- onMapDrag() {
30
+ onMapDrag({ markerPlaceId } = { markerPlaceId: null }) {
31
31
  if (this.drawnItems.getLayers().length === 0) {
32
- return super.onMapDrag();
32
+ return super.onMapDrag({ markerPlaceId });
33
33
  } else {
34
34
  return this.onPolygonDrawn(this.drawnItems.getLayers()[0], false);
35
35
  }