homeflowjs 0.12.17 → 0.12.19

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.
@@ -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 lastSearch = JSON.parse(searchHistory)[0];
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].property_url;
33
- propertyLinks.prev = properties[index - 1].property_url;
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].property_url;
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].property_url;
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].property_url;
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].property_url;
101
+ propertyLinks.prev = getPropertyUrl(properties[properties.length - 1]);
87
102
  }
88
103
 
89
104
  return dispatch(setPropertyLinks(propertyLinks));
@@ -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
- store.dispatch(setInitialSearch({
134
- q: place.name + (place.county_name ? `, ${place.county_name}` : ''),
135
- place,
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) {
@@ -124,6 +124,7 @@ const BranchesSearchInput = ({
124
124
  inputProps={{
125
125
  placeholder,
126
126
  name: 'react-autosuggest__input',
127
+ id: 'react-autosuggest__input',
127
128
  required: isRequired,
128
129
  value: branchesSearch,
129
130
  // eslint-disable-next-line no-unused-vars
@@ -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">Learn more</a>`;
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.17",
3
+ "version": "0.12.19",
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 ? newSelectedMarker.property.property_id : null;
33
- const stateSelectedPropertyID = this.selectedMarker ? this.selectedMarker.property.property_id : null;
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') !== null) {
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') && !Homeflow.get('breadcrumbs_map')) {
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({ markerPlaceId: marker.property.geoname_id });
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
- const bounds = [this.getTopLeftMarkerCoordinates(), this.getBottomRightMarkerCoordinates()];
315
- if (bounds.flat().find(coordinate => coordinate === Infinity)) return null;
326
+ if (Homeflow.get('breadcrumbs_map') && this.viewport) {
327
+ const viewportBounds = this.getViewportBounds();
328
+ if (viewportBounds.flat().find(coordinate => coordinate === Infinity)) return null;
329
+
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;
316
334
 
317
- return L.latLngBounds(...bounds.map(bound => L.latLng(...bound)));
335
+ return L.latLngBounds(...bounds.map(bound => L.latLng(...bound)));
336
+ }
318
337
  }
319
338
  }
320
339
 
321
- getTopLeftMarkerCoordinates() {
322
- return [
323
- Math.min(...this.parseCoordinateArray([this.properties, this.breadcrumbs].flat(), 'lat')),
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
- getBottomRightMarkerCoordinates() {
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;
@@ -438,47 +462,62 @@ export default class DraggableMap {
438
462
  }
439
463
 
440
464
 
441
- onMapDrag() {
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;
465
+ onMapDrag({ markerPlaceId } = { markerPlaceId: null }) {
466
+ if (Homeflow.get('disable_draggable_map') || this.drawableMapInitialized) return;
473
467
 
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
- });
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
+ if (markerPlaceId) {
498
+ url = url + `&marker_place_id=${markerPlaceId}`;
499
+ }
500
+
501
+ return fetch(url)
502
+ .then((response) => response.json())
503
+ .then(json => {
504
+ Homeflow.kickEvent('draggable_map_updated', json);
505
+ store.dispatch(setProperties(json.properties))
506
+ this._running_update = false;
507
+
508
+ if (json.breadcrumbs) {
509
+ this.breadcrumbs = this.concatenateDistinctObjects('geoname_id', this.breadcrumbs, json.breadcrumbs);
510
+ this.properties = [];
511
+ } else if (json.properties) {
512
+ this.properties = this.concatenateDistinctObjects('property_id', this.properties, json.properties);
513
+ this.breadcrumbs = [];
514
+ }
515
+ // TODO: figure out what 'tile view' is
516
+ // if (this.tile_view != null) {
517
+ // this.tile_view = new Ctesius.Views.Tiles({ collection: this.collection });
518
+ // }
519
+ return this.setMarkers();
520
+ });
482
521
  }
483
522
 
484
523
  // this method was copied directly from transpiled ES5 from the browser as it's the only
@@ -691,26 +730,29 @@ export default class DraggableMap {
691
730
  return new L.LatLng(y, x);
692
731
  }
693
732
 
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
733
  handleBreadcrumbsInit() {
734
+ if (this.breadcrumbsInitialized) return;
735
+
709
736
  const { properties: { breadcrumbs } } = store.getState();
710
737
 
711
738
  if (breadcrumbs && this.breadcrumbs !== breadcrumbs) {
712
739
  this.breadcrumbs = breadcrumbs;
713
740
  this.setMarkers();
741
+ this.setToMarkeredBounds();
714
742
  }
743
+
744
+ this.breadcrumbsInitialized = true;
745
+ }
746
+
747
+ concatenateDistinctObjects(key, array, otherArray) {
748
+ return [...new Map((array || []).concat(otherArray || []).map((object) => [object[key], object])).values()];
749
+ }
750
+
751
+ markerPropertyIdOrGeonameId(marker) {
752
+ if (!marker) return null;
753
+ if (marker?.property?.property_id) return marker.property.property_id;
754
+ if (marker?.property?.geoname_id) return marker.property.geoname_id;
755
+
756
+ return null;
715
757
  }
716
758
  }
@@ -20,12 +20,16 @@ export default class DrawableMap extends DraggableMap {
20
20
  Homeflow.kickEvent('editbanner', this);
21
21
  Homeflow.kickEvent('deletebanner', this);
22
22
  this.repositionDrawControls();
23
- return this.onMapDrag();
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
- onMapDrag() {
30
+ onMapDrag({ markerPlaceId } = { markerPlaceId: null }) {
27
31
  if (this.drawnItems.getLayers().length === 0) {
28
- return super.onMapDrag();
32
+ return super.onMapDrag({ markerPlaceId });
29
33
  } else {
30
34
  return this.onPolygonDrawn(this.drawnItems.getLayers()[0], false);
31
35
  }
@@ -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
- 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
-
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
- <a
23
+ <button
24
+ type="button"
24
25
  onClick={removeProperty}
25
26
  {...otherProps}
27
+ aria-label="Remove saved property"
26
28
  >
27
29
  {children}
28
- </a>
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
- <a
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
- </a>
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
- place: null,
124
- placeId: null,
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 });