homeflowjs 0.12.17 → 0.12.18
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.
- package/actions/properties.actions.js +22 -7
- package/app/hf-initialize.jsx +11 -7
- package/branches/branches-search-form/branches-search-input.component.jsx +1 -0
- package/cookie-consent/cookie-consent.js +3 -3
- package/package.json +5 -2
- package/properties/properties-map/draggable-map.js +106 -68
- package/properties/properties-map/drawable-map.js +5 -6
- package/properties/property-streetview/property-streetview.component.jsx +4 -14
- package/properties/remove-saved-property-button/remove-saved-property-button.component.jsx +4 -2
- package/properties/save-property-button/save-property-button.component.jsx +4 -2
- package/reducers/search.reducer.js +6 -2
- package/search/search-form/search-form.component.jsx +1 -0
@@ -14,7 +14,18 @@ export const setPropertyLinksAsync = () => (dispatch) => {
|
|
14
14
|
const searchHistory = localStorage.getItem('searchHistory');
|
15
15
|
if (!searchHistory) return null;
|
16
16
|
|
17
|
-
const
|
17
|
+
const parsedSearchHistory = JSON.parse(searchHistory);
|
18
|
+
if (!Array.isArray(parsedSearchHistory)) return null;
|
19
|
+
|
20
|
+
const validateSearch = (search) =>
|
21
|
+
(!search.isQuerySearch && search?.q)
|
22
|
+
|| search?.place
|
23
|
+
|| (search.isQuerySearch && search?.placeId)
|
24
|
+
|| (search.isQuerySearch && search?.poly);
|
25
|
+
|
26
|
+
const filteredSearchHistory = parsedSearchHistory.filter(validateSearch)
|
27
|
+
if (!filteredSearchHistory?.length) return null;
|
28
|
+
const lastSearch = filteredSearchHistory[0];
|
18
29
|
const { place, ...restOfSearch } = lastSearch;
|
19
30
|
const searchURL = `/search.ljson?${buildQueryString(restOfSearch)}`;
|
20
31
|
|
@@ -23,14 +34,18 @@ export const setPropertyLinksAsync = () => (dispatch) => {
|
|
23
34
|
prev: '',
|
24
35
|
};
|
25
36
|
|
37
|
+
const getPropertyUrl = (property) => property?.property_url || property?.url;
|
38
|
+
|
26
39
|
fetch(searchURL)
|
27
40
|
.then((response) => response.json())
|
28
41
|
.then(({ properties }) => {
|
42
|
+
if (!properties) return;
|
43
|
+
|
29
44
|
const index = properties.findIndex((prop) => prop.property_id === Homeflow.get('property').property_id);
|
30
45
|
// if there is a next and previous property in page, set those
|
31
46
|
if (properties[index + 1] && properties[index - 1]) {
|
32
|
-
propertyLinks.next = properties[index + 1]
|
33
|
-
propertyLinks.prev = properties[index - 1]
|
47
|
+
propertyLinks.next = getPropertyUrl(properties[index + 1]);
|
48
|
+
propertyLinks.prev = getPropertyUrl(properties[index - 1]);
|
34
49
|
|
35
50
|
return dispatch(setPropertyLinks(propertyLinks));
|
36
51
|
}
|
@@ -38,7 +53,7 @@ export const setPropertyLinksAsync = () => (dispatch) => {
|
|
38
53
|
// if there is no next but there is a previous, conduct search for next page
|
39
54
|
// but use previous
|
40
55
|
if (!properties[index + 1] && properties[index - 1]) {
|
41
|
-
propertyLinks.prev = properties[index - 1]
|
56
|
+
propertyLinks.prev = getPropertyUrl(properties[index - 1]);
|
42
57
|
|
43
58
|
const nextSearch = {
|
44
59
|
...restOfSearch,
|
@@ -52,7 +67,7 @@ export const setPropertyLinksAsync = () => (dispatch) => {
|
|
52
67
|
if (!properties) {
|
53
68
|
propertyLinks.next = '';
|
54
69
|
} else {
|
55
|
-
propertyLinks.next = properties[0]
|
70
|
+
propertyLinks.next = getPropertyUrl(properties[0]);
|
56
71
|
}
|
57
72
|
|
58
73
|
return dispatch(setPropertyLinks(propertyLinks));
|
@@ -62,7 +77,7 @@ export const setPropertyLinksAsync = () => (dispatch) => {
|
|
62
77
|
// if there is no previous but there is a next, conduct search for previous page
|
63
78
|
// but use next
|
64
79
|
if (!properties[index - 1] && properties[index + 1]) {
|
65
|
-
propertyLinks.next = properties[index + 1]
|
80
|
+
propertyLinks.next = getPropertyUrl(properties[index + 1]);
|
66
81
|
|
67
82
|
const nextSearch = {
|
68
83
|
...restOfSearch,
|
@@ -83,7 +98,7 @@ export const setPropertyLinksAsync = () => (dispatch) => {
|
|
83
98
|
if (!properties) {
|
84
99
|
propertyLinks.prev = '';
|
85
100
|
} else {
|
86
|
-
propertyLinks.prev = properties[properties.length - 1]
|
101
|
+
propertyLinks.prev = getPropertyUrl(properties[properties.length - 1]);
|
87
102
|
}
|
88
103
|
|
89
104
|
return dispatch(setPropertyLinks(propertyLinks));
|
package/app/hf-initialize.jsx
CHANGED
@@ -105,11 +105,14 @@ const hfInitialize = () => {
|
|
105
105
|
store.dispatch(setArticles(Homeflow.get('articles')));
|
106
106
|
}
|
107
107
|
|
108
|
+
// all property results routes
|
108
109
|
if (pageRoute === 'properties#index'
|
109
110
|
|| pageRoute === 'counties#show'
|
110
111
|
|| pageRoute === 'postcodes#show'
|
111
112
|
|| pageRoute === 'locations#show'
|
112
|
-
|
113
|
+
|| pageRoute === 'countries#show'
|
114
|
+
|| pageRoute === 'branches#properties'
|
115
|
+
) {
|
113
116
|
const searchFromFragment = parseFragment(window.location.pathname);
|
114
117
|
const defaultStatus = store.getState().app.themePreferences.default_search_status;
|
115
118
|
|
@@ -123,17 +126,18 @@ const hfInitialize = () => {
|
|
123
126
|
|
124
127
|
store.dispatch(setInitialSearch(searchFromFragment));
|
125
128
|
store.dispatch(setSearch(searchFromFragment));
|
126
|
-
} else {
|
127
|
-
if (defaultStatus && !search.status) store.dispatch(setSearchField({ status: defaultStatus }));
|
128
129
|
}
|
129
130
|
|
130
131
|
const place = Homeflow.get('place');
|
131
132
|
if (place) {
|
133
|
+
const initialSearchSet = Object.keys(store.getState().search?.initialSearch)?.length;
|
132
134
|
store.dispatch(setPlace(place));
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
135
|
+
if (!initialSearchSet) {
|
136
|
+
store.dispatch(setInitialSearch({
|
137
|
+
q: place.name + (place.county_name ? `, ${place.county_name}` : ''),
|
138
|
+
place,
|
139
|
+
}));
|
140
|
+
}
|
137
141
|
}
|
138
142
|
const expandedPolygon = Homeflow.get('expanded_polygon');
|
139
143
|
if (expandedPolygon) {
|
@@ -3,7 +3,7 @@ const initCookieConsent = () => {
|
|
3
3
|
const defaultMessage = 'This website uses cookies to improve your experience.';
|
4
4
|
// appends the 'decline' and 'learn more' links to the message
|
5
5
|
const ccFullscreenMessage = (message = defaultMessage, href) => {
|
6
|
-
let newMessage = `${message}<a aria-label="learn more about cookies" tabindex="0" class="cc-link" href="${href}" target="_blank">
|
6
|
+
let newMessage = `${message}<a aria-label="learn more about cookies" tabindex="0" class="cc-link" href="${href}" target="_blank">View cookie policy</a>`;
|
7
7
|
newMessage += ' or <a aria-label="deny cookies" role="button" tabindex="0" class="cc-btn cc-deny cc-deny-link">decline</a>';
|
8
8
|
return newMessage;
|
9
9
|
};
|
@@ -56,8 +56,8 @@ const initCookieConsent = () => {
|
|
56
56
|
message: ccFullscreenMessage(message, href),
|
57
57
|
},
|
58
58
|
elements: {
|
59
|
-
deny: '<a style="display: none;"></a>',
|
60
|
-
link: '<a style="display: none;"></a>',
|
59
|
+
deny: '<a style="display: none;" href="#"></a>',
|
60
|
+
link: '<a style="display: none;" href="#"></a>',
|
61
61
|
},
|
62
62
|
};
|
63
63
|
}
|
package/package.json
CHANGED
@@ -1,11 +1,14 @@
|
|
1
1
|
{
|
2
2
|
"name": "homeflowjs",
|
3
|
-
"version": "0.12.
|
3
|
+
"version": "0.12.18",
|
4
4
|
"sideEffects": [
|
5
5
|
"modal/**/*",
|
6
|
+
"user/default-profile/**/*",
|
7
|
+
"instant-valuation/**/*",
|
6
8
|
"properties/properties-map/**/*",
|
7
9
|
"properties/property-map/**/*",
|
8
|
-
"properties/property-streetview/**/*"
|
10
|
+
"properties/property-streetview/**/*",
|
11
|
+
"properties/stamp-duty-calculator/**/*"
|
9
12
|
],
|
10
13
|
"description": "JavaScript toolkit for Homeflow themes",
|
11
14
|
"main": "index.js",
|
@@ -29,8 +29,8 @@ export default class DraggableMap {
|
|
29
29
|
this.selectedMarker = null;
|
30
30
|
store.subscribe(() => {
|
31
31
|
const newSelectedMarker = store.getState().properties.selectedMarker;
|
32
|
-
const newSelectedPropertyID = newSelectedMarker
|
33
|
-
const stateSelectedPropertyID = this.
|
32
|
+
const newSelectedPropertyID = this.markerPropertyIdOrGeonameId(newSelectedMarker);
|
33
|
+
const stateSelectedPropertyID = this.markerPropertyIdOrGeonameId(this.selectedMarker);
|
34
34
|
|
35
35
|
if (newSelectedPropertyID !== stateSelectedPropertyID) {
|
36
36
|
this.activateMarker(newSelectedMarker);
|
@@ -59,7 +59,7 @@ export default class DraggableMap {
|
|
59
59
|
this.buildPolygon();
|
60
60
|
this.setMarkers();
|
61
61
|
if (this.noLocationfound || Homeflow.get('breadcrumbs_map')) { this.setToMarkeredBounds(); }
|
62
|
-
if (Homeflow.get('custom_map_zoom')
|
62
|
+
if (Homeflow.get('custom_map_zoom')) {
|
63
63
|
this.map.setZoom(Homeflow.get('custom_map_zoom'));
|
64
64
|
}
|
65
65
|
}
|
@@ -75,7 +75,7 @@ export default class DraggableMap {
|
|
75
75
|
// }
|
76
76
|
|
77
77
|
this.generateMap();
|
78
|
-
if (!Homeflow.get('free_text_search')
|
78
|
+
if (!Homeflow.get('free_text_search')) {
|
79
79
|
this.map.on('zoomend', () => (this.onMapDrag()));
|
80
80
|
}
|
81
81
|
this.map.on('dragend', () => (this.onMapDrag()));
|
@@ -97,6 +97,12 @@ export default class DraggableMap {
|
|
97
97
|
}
|
98
98
|
this.selectedMarker = marker;
|
99
99
|
if (this.selectedMarker) this.selectedMarker.setIcon(this.generateMarkerIcon(marker.property));
|
100
|
+
|
101
|
+
if (marker.property.geoname_id && marker.property.viewport) {
|
102
|
+
this.bounds = this.getViewportBounds(marker.property.viewport);
|
103
|
+
this.map.fitBounds(this.bounds, Homeflow.get('custom_map_bounds_padding'));
|
104
|
+
this.onMapDrag();
|
105
|
+
}
|
100
106
|
}
|
101
107
|
|
102
108
|
generateMarkerIcon(property) {
|
@@ -281,7 +287,7 @@ export default class DraggableMap {
|
|
281
287
|
const layer = Homeflow.get('pin_clustering') ? this.clusteringMarkerLayer : this.nonClusteringMarkerLayer;
|
282
288
|
|
283
289
|
if (property.property_id === null || property.lat === 0 || property.lng === 0) return;
|
284
|
-
if (geonameId && Homeflow.get('breadcrumbs_map') && geonameId !== currentGeonameId()) return;
|
290
|
+
if (geonameId && Homeflow.get('breadcrumbs_map') && geonameId !== currentGeonameId() && !this.isDisplayProperties()) return;
|
285
291
|
|
286
292
|
layer.addLayer(this.generateMarker(property));
|
287
293
|
}
|
@@ -293,6 +299,12 @@ export default class DraggableMap {
|
|
293
299
|
}
|
294
300
|
|
295
301
|
setToMarkeredBounds() {
|
302
|
+
const viewport = store.getState().search.currentSearch.place?.viewport;
|
303
|
+
|
304
|
+
if (viewport && this.viewport !== viewport) {
|
305
|
+
this.viewport = viewport;
|
306
|
+
}
|
307
|
+
|
296
308
|
const options = Homeflow.get('custom_map_bounds_padding');
|
297
309
|
const bounds = this.getMarkerBounds();
|
298
310
|
|
@@ -311,27 +323,39 @@ export default class DraggableMap {
|
|
311
323
|
if (this.bounds && this.bounds.isValid()) {
|
312
324
|
return this.bounds;
|
313
325
|
} else {
|
314
|
-
|
315
|
-
|
326
|
+
if (Homeflow.get('breadcrumbs_map') && this.viewport) {
|
327
|
+
const viewportBounds = this.getViewportBounds();
|
328
|
+
if (viewportBounds.flat().find(coordinate => coordinate === Infinity)) return null;
|
316
329
|
|
317
|
-
|
330
|
+
return L.latLngBounds(...viewportBounds.map(bound => L.latLng(...bound)));
|
331
|
+
} else {
|
332
|
+
const bounds = [this.getTopRightMarkerCoordinates(), this.getBottomLeftMarkerCoordinates()];
|
333
|
+
if (bounds.flat().find(coordinate => coordinate === Infinity)) return null;
|
334
|
+
|
335
|
+
return L.latLngBounds(...bounds.map(bound => L.latLng(...bound)));
|
336
|
+
}
|
318
337
|
}
|
319
338
|
}
|
320
339
|
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
Math.min(...this.parseCoordinateArray([this.properties, this.breadcrumbs].flat(), 'lng'))
|
325
|
-
];
|
340
|
+
getViewportBounds(viewport) {
|
341
|
+
viewport = viewport || this.viewport;
|
342
|
+
return [...viewport[0].filter((coords, index) => index === 0 || index === 2).map(coords => [...coords.toReversed()])];
|
326
343
|
}
|
327
344
|
|
328
|
-
|
345
|
+
getTopRightMarkerCoordinates() {
|
329
346
|
return [
|
330
347
|
Math.max(...this.parseCoordinateArray([this.properties, this.breadcrumbs].flat(), 'lat')),
|
331
348
|
Math.max(...this.parseCoordinateArray([this.properties, this.breadcrumbs].flat(), 'lng'))
|
332
349
|
];
|
333
350
|
}
|
334
351
|
|
352
|
+
getBottomLeftMarkerCoordinates() {
|
353
|
+
return [
|
354
|
+
Math.min(...this.parseCoordinateArray([this.properties, this.breadcrumbs].flat(), 'lat')),
|
355
|
+
Math.min(...this.parseCoordinateArray([this.properties, this.breadcrumbs].flat(), 'lng'))
|
356
|
+
];
|
357
|
+
}
|
358
|
+
|
335
359
|
parseCoordinateArray(items, coordinateType) {
|
336
360
|
if (!items) return [];
|
337
361
|
|
@@ -341,7 +365,7 @@ export default class DraggableMap {
|
|
341
365
|
isDisplayProperties() {
|
342
366
|
const { properties: { pagination: { total_count: totalCount } } } = store.getState();
|
343
367
|
|
344
|
-
if (!this.breadcrumbs || !Homeflow.get('breadcrumbs_map')) {
|
368
|
+
if (!this.breadcrumbs || this.breadcrumbs?.length === 0 || !Homeflow.get('breadcrumbs_map')) {
|
345
369
|
return true;
|
346
370
|
} else if (this.properties && totalCount <= this.properties.length) {
|
347
371
|
return true;
|
@@ -425,7 +449,7 @@ export default class DraggableMap {
|
|
425
449
|
const placeBounds = this.buildSubPolygons(place.polygon)
|
426
450
|
return this.map.fitBounds(placeBounds);
|
427
451
|
|
428
|
-
} else {
|
452
|
+
} else if (!search.place?.viewport) {
|
429
453
|
center = new L.LatLng(place.lat, place.lng);
|
430
454
|
const bounds = this.getMarkerBounds();
|
431
455
|
if (bounds && bounds.isValid()) return;
|
@@ -439,46 +463,57 @@ export default class DraggableMap {
|
|
439
463
|
|
440
464
|
|
441
465
|
onMapDrag() {
|
442
|
-
if (
|
443
|
-
let url;
|
444
|
-
const bounds = this.getSearchableBounds();
|
445
|
-
const has_expanded = this.getSearch().expandedPolygon;
|
446
|
-
if (this.mapLoadedTimes === 1 || has_expanded ) {
|
447
|
-
url = `/search.ljson?${buildQueryString(this.getSearch())}/view-${bounds.toBBoxString()}&count=50`;
|
448
|
-
} else {
|
449
|
-
// unset place
|
450
|
-
store.dispatch(setPlace(null));
|
451
|
-
const newSearch = this.getSearch();
|
452
|
-
newSearch.place = null;
|
453
|
-
url = `/search.ljson?${buildQueryString(newSearch)}/view-${bounds.toBBoxString()}&count=50`;
|
454
|
-
}
|
455
|
-
if (Homeflow.get('get_geo_features')) {
|
456
|
-
const geo_url = Homeflow.get('root_url') + `geo_features.ljson?${Ctesius.getSearch().toGetParams(false)}/view-${bounds.toBBoxString()}&count=50`;
|
457
|
-
$.get(geo_url, (res, status, xhr) => {
|
458
|
-
this._running_update = false;
|
459
|
-
if (this.geo_marker_layer != null) { this.map.removeLayer(this.geo_marker_layer); }
|
460
|
-
return this.addGeoMarkers(res);
|
461
|
-
});
|
462
|
-
}
|
463
|
-
if (Homeflow.get('map_branch_id') != null) {
|
464
|
-
url = url + "&branch_id=" + Homeflow.get('map_branch_id');
|
465
|
-
}
|
466
|
-
Homeflow.kickEvent('before_draggable_map_updated');
|
467
|
-
return fetch(url)
|
468
|
-
.then((response) => response.json())
|
469
|
-
.then(json => {
|
470
|
-
Homeflow.kickEvent('draggable_map_updated', json);
|
471
|
-
store.dispatch(setProperties(json.properties))
|
472
|
-
this._running_update = false;
|
466
|
+
if (Homeflow.get('disable_draggable_map') || this.drawableMapInitialized) return;
|
473
467
|
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
468
|
+
let url;
|
469
|
+
const bounds = this.getSearchableBounds();
|
470
|
+
const has_expanded = this.getSearch().expandedPolygon;
|
471
|
+
if (this.mapLoadedTimes === 1 || has_expanded ) {
|
472
|
+
url = `/search.ljson?${buildQueryString(this.getSearch())}/view-${bounds.toBBoxString()}&count=50`;
|
473
|
+
} else {
|
474
|
+
// unset place
|
475
|
+
// Leaving this commented as it may be needed
|
476
|
+
// It is causing issues as the place state is never reset after the request
|
477
|
+
// so the place is just empty
|
478
|
+
// Not sure it has to be set to null for the request to work
|
479
|
+
// store.dispatch(setPlace(null));
|
480
|
+
const newSearch = this.getSearch();
|
481
|
+
url = `/search.ljson?${buildQueryString(newSearch)}/view-${bounds.toBBoxString()}&count=50`;
|
482
|
+
}
|
483
|
+
if (Homeflow.get('get_geo_features')) {
|
484
|
+
const geo_url = Homeflow.get('root_url') + `geo_features.ljson?${Ctesius.getSearch().toGetParams(false)}/view-${bounds.toBBoxString()}&count=50`;
|
485
|
+
$.get(geo_url, (res, status, xhr) => {
|
486
|
+
this._running_update = false;
|
487
|
+
if (this.geo_marker_layer != null) { this.map.removeLayer(this.geo_marker_layer); }
|
488
|
+
return this.addGeoMarkers(res);
|
489
|
+
});
|
481
490
|
}
|
491
|
+
if (Homeflow.get('map_branch_id') != null) {
|
492
|
+
url = url + "&branch_id=" + Homeflow.get('map_branch_id');
|
493
|
+
}
|
494
|
+
Homeflow.kickEvent('before_draggable_map_updated');
|
495
|
+
url = url + '&zoom_level=' + this.map.getZoom();
|
496
|
+
|
497
|
+
return fetch(url)
|
498
|
+
.then((response) => response.json())
|
499
|
+
.then(json => {
|
500
|
+
Homeflow.kickEvent('draggable_map_updated', json);
|
501
|
+
store.dispatch(setProperties(json.properties))
|
502
|
+
this._running_update = false;
|
503
|
+
|
504
|
+
if (json.breadcrumbs) {
|
505
|
+
this.breadcrumbs = this.concatenateDistinctObjects('geoname_id', this.breadcrumbs, json.breadcrumbs);
|
506
|
+
this.properties = [];
|
507
|
+
} else if (json.properties) {
|
508
|
+
this.properties = this.concatenateDistinctObjects('property_id', this.properties, json.properties);
|
509
|
+
this.breadcrumbs = [];
|
510
|
+
}
|
511
|
+
// TODO: figure out what 'tile view' is
|
512
|
+
// if (this.tile_view != null) {
|
513
|
+
// this.tile_view = new Ctesius.Views.Tiles({ collection: this.collection });
|
514
|
+
// }
|
515
|
+
return this.setMarkers();
|
516
|
+
});
|
482
517
|
}
|
483
518
|
|
484
519
|
// this method was copied directly from transpiled ES5 from the browser as it's the only
|
@@ -691,26 +726,29 @@ export default class DraggableMap {
|
|
691
726
|
return new L.LatLng(y, x);
|
692
727
|
}
|
693
728
|
|
694
|
-
propertiesOrBreadcrumbs() {
|
695
|
-
const breadcrumbs = this.breadcrumbs;
|
696
|
-
const properties = this.properties;
|
697
|
-
if (breadcrumbs && breadcrumbs.length) {
|
698
|
-
return breadcrumbs;
|
699
|
-
} else if (breadcrumbs && !breadcrumbs.length) {
|
700
|
-
return properties;
|
701
|
-
} else if (properties !== null && !Homeflow.get('breadcrumbs_map')) {
|
702
|
-
return properties;
|
703
|
-
} else {
|
704
|
-
return null;
|
705
|
-
}
|
706
|
-
}
|
707
|
-
|
708
729
|
handleBreadcrumbsInit() {
|
730
|
+
if (this.breadcrumbsInitialized) return;
|
731
|
+
|
709
732
|
const { properties: { breadcrumbs } } = store.getState();
|
710
733
|
|
711
734
|
if (breadcrumbs && this.breadcrumbs !== breadcrumbs) {
|
712
735
|
this.breadcrumbs = breadcrumbs;
|
713
736
|
this.setMarkers();
|
737
|
+
this.setToMarkeredBounds();
|
714
738
|
}
|
739
|
+
|
740
|
+
this.breadcrumbsInitialized = true;
|
741
|
+
}
|
742
|
+
|
743
|
+
concatenateDistinctObjects(key, array, otherArray) {
|
744
|
+
return [...new Map((array || []).concat(otherArray || []).map((object) => [object[key], object])).values()];
|
745
|
+
}
|
746
|
+
|
747
|
+
markerPropertyIdOrGeonameId(marker) {
|
748
|
+
if (!marker) return null;
|
749
|
+
if (marker?.property?.property_id) return marker.property.property_id;
|
750
|
+
if (marker?.property?.geoname_id) return marker.property.geoname_id;
|
751
|
+
|
752
|
+
return null;
|
715
753
|
}
|
716
754
|
}
|
@@ -20,7 +20,11 @@ export default class DrawableMap extends DraggableMap {
|
|
20
20
|
Homeflow.kickEvent('editbanner', this);
|
21
21
|
Homeflow.kickEvent('deletebanner', this);
|
22
22
|
this.repositionDrawControls();
|
23
|
-
|
23
|
+
// note: I'm not 100% sure this is will ever be required if super.init() is called
|
24
|
+
// something to review in homeflow_next
|
25
|
+
if (!Homeflow.get('breadcrumbs_map')) {
|
26
|
+
return this.onMapDrag();
|
27
|
+
}
|
24
28
|
}
|
25
29
|
|
26
30
|
onMapDrag() {
|
@@ -142,11 +146,6 @@ export default class DrawableMap extends DraggableMap {
|
|
142
146
|
if (!this.first) { return this.onMapDrag(); }
|
143
147
|
});
|
144
148
|
|
145
|
-
this.map.on('dragend', () => {
|
146
|
-
return this.onMapDrag();
|
147
|
-
});
|
148
|
-
|
149
|
-
|
150
149
|
this.map.on("draw:drawstart", e => {
|
151
150
|
this.first = false;
|
152
151
|
this.map.removeLayer(this.marker_layer);
|
@@ -8,20 +8,10 @@ const PropertyStreetview = ({ initGoogleMaps, ...otherProps }) => {
|
|
8
8
|
const initializeMap = () => {
|
9
9
|
// Should this be added to Redux?
|
10
10
|
const property = Homeflow.get('property');
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
if (property.streetview) {
|
16
|
-
const { pitch, heading } = property.streetview.orientation;
|
17
|
-
const { lat, lng } = property.streetview.position;
|
18
|
-
|
19
|
-
panorama.setPosition(new google.maps.LatLng(lat, lng));
|
20
|
-
panorama.setPov({ heading, pitch });
|
21
|
-
} else {
|
22
|
-
panorama.setPosition(new google.maps.LatLng(property.lat, property.lng));
|
23
|
-
}
|
24
|
-
|
11
|
+
const panorama = new google.maps.StreetViewPanorama(document.getElementById('hfjs-property-streetview'), {
|
12
|
+
position: {lat: property.lat, lng: property.lng},
|
13
|
+
pov: {heading: 0, pitch: 0}
|
14
|
+
});
|
25
15
|
panorama.setVisible(true);
|
26
16
|
};
|
27
17
|
|
@@ -20,12 +20,14 @@ const RemoveSavedPropertyButton = (props) => {
|
|
20
20
|
};
|
21
21
|
|
22
22
|
return (
|
23
|
-
<
|
23
|
+
<button
|
24
|
+
type="button"
|
24
25
|
onClick={removeProperty}
|
25
26
|
{...otherProps}
|
27
|
+
aria-label="Remove saved property"
|
26
28
|
>
|
27
29
|
{children}
|
28
|
-
</
|
30
|
+
</button>
|
29
31
|
);
|
30
32
|
};
|
31
33
|
|
@@ -38,13 +38,15 @@ const SavePropertyButton = (props) => {
|
|
38
38
|
|
39
39
|
return (
|
40
40
|
// eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/anchor-is-valid
|
41
|
-
<
|
41
|
+
<button
|
42
|
+
type="button"
|
42
43
|
style={style}
|
43
44
|
onClick={toggleProperty}
|
44
45
|
className={`${className} ${isSaved ? 'saved' : ''}`}
|
46
|
+
aria-label="Save"
|
45
47
|
>
|
46
48
|
{isSaved ? SavedComponent : UnsavedComponent}
|
47
|
-
</
|
49
|
+
</button>
|
48
50
|
);
|
49
51
|
};
|
50
52
|
|
@@ -11,6 +11,7 @@ const INITIAL_STATE = {
|
|
11
11
|
tags: [],
|
12
12
|
poly: '',
|
13
13
|
auctionDate: '',
|
14
|
+
viewport: [],
|
14
15
|
},
|
15
16
|
initialSearch: {}, // original search when the page first loads
|
16
17
|
savedSearches: [],
|
@@ -120,8 +121,11 @@ const searchReducer = (state = INITIAL_STATE, action) => {
|
|
120
121
|
if (!place) {
|
121
122
|
return {
|
122
123
|
...state,
|
123
|
-
|
124
|
-
|
124
|
+
currentSearch: {
|
125
|
+
...state.currentSearch,
|
126
|
+
place: null,
|
127
|
+
placeId: null,
|
128
|
+
}
|
125
129
|
};
|
126
130
|
}
|
127
131
|
|
@@ -28,6 +28,7 @@ class SearchForm extends Component {
|
|
28
28
|
}
|
29
29
|
} else {
|
30
30
|
if (defaultSort && !search.sorted) setSearchField({ sorted: defaultSort });
|
31
|
+
if (defaultStatus && !search.status) setSearchField({ status: defaultStatus });
|
31
32
|
}
|
32
33
|
|
33
34
|
if (defaultChannel) setSearchField({ channel: defaultChannel });
|