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