homeflowjs 0.13.3 → 0.13.5

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.
@@ -30,22 +30,24 @@ class BranchMap extends React.Component {
30
30
  const {
31
31
  mapTypeControl,
32
32
  scrollWheel,
33
- zoom,
33
+ defaultZoom,
34
34
  disableStreetview,
35
35
  custom,
36
36
  iconConfig,
37
37
  fullscreenControl,
38
38
  zoomControl,
39
+ googleMapsBranchZoomLevel,
39
40
  } = this.props;
40
41
 
41
42
  // Should this be added to Redux?
42
43
  const branch = Homeflow.get('branch');
44
+ const usedZoom = parseInt(googleMapsBranchZoomLevel || defaultZoom, 10);
43
45
 
44
46
  const options = {
45
47
  center: new google.maps.LatLng(branch.lat, branch.lng),
46
48
  mapTypeControl,
47
49
  scrollWheel,
48
- zoom,
50
+ zoom: usedZoom,
49
51
  streetViewControl: !disableStreetview,
50
52
  fullscreenControl: false,
51
53
  zoomControl,
@@ -110,7 +112,7 @@ BranchMap.defaultProps = {
110
112
  mapTypeControl: false,
111
113
  scrollWheel: false,
112
114
  custom: null,
113
- zoom: 15,
115
+ defaultZoom: 15,
114
116
  disableStreetview: false,
115
117
  google: false,
116
118
  iconConfig: null,
@@ -118,11 +120,15 @@ BranchMap.defaultProps = {
118
120
  zoomControl: false,
119
121
  };
120
122
 
123
+ const mapStateToProps = (state) => ({
124
+ googleMapsBranchZoomLevel: state.app.themePreferences.googleMapsBranchZoomLevel,
125
+ });
126
+
121
127
  const mapDispatchToProps = {
122
128
  initGoogleMaps,
123
129
  };
124
130
 
125
131
  export default connect(
126
- null,
132
+ mapStateToProps,
127
133
  mapDispatchToProps,
128
134
  )(BranchMap);
@@ -8,7 +8,6 @@ import { flatten } from 'q-flat';
8
8
 
9
9
  import IntroStep from '../intro-step/intro-step.component';
10
10
  import YourDetailsStep from '../your-details-step/your-details-step.component';
11
- import SimilarPropertiesStep from '../similar-properties-step/similar-properties-step.component';
12
11
  import ResultStep from '../result-step/result-step.component';
13
12
  import { DEBOUNCE_DELAY } from '../../utils';
14
13
 
@@ -19,7 +18,6 @@ const INITIAL_STATE = {
19
18
  loading: false,
20
19
  addresses: [],
21
20
  message: null,
22
- similarProperties: [],
23
21
  recentSales: [],
24
22
  search: {
25
23
  paon: '',
@@ -55,8 +53,7 @@ const INITIAL_STATE = {
55
53
  const stepComponents = {
56
54
  1: IntroStep,
57
55
  2: YourDetailsStep,
58
- 3: SimilarPropertiesStep,
59
- 4: ResultStep,
56
+ 3: ResultStep,
60
57
  };
61
58
 
62
59
  class InstantValuation extends Component {
@@ -80,8 +77,6 @@ class InstantValuation extends Component {
80
77
 
81
78
  this.updateState = this.updateState.bind(this);
82
79
  this.setStep = this.setStep.bind(this);
83
- this.getSimilarProperties = this.getSimilarProperties.bind(this);
84
- this.toggleSimilarProperty = this.toggleSimilarProperty.bind(this);
85
80
  this.getValuation = this.getValuation.bind(this);
86
81
  this.addressLookup = debounce(this.addressLookup, DEBOUNCE_DELAY).bind(this);
87
82
  this.reset = this.reset.bind(this);
@@ -92,14 +87,6 @@ class InstantValuation extends Component {
92
87
  this.setState({ step });
93
88
  }
94
89
 
95
- getSimilarProperties() {
96
- this.setState({ loading: true });
97
- const { search } = this.state;
98
- fetch(`/properties/similar_properties?bedrooms=${search.bedrooms}&postcode=${search.postcode}&channel=sales`)
99
- .then((response) => response.json())
100
- .then((json) => this.setState({ similarProperties: json, loading: false }));
101
- }
102
-
103
90
  getRecentSales() {
104
91
  const { search: { postcode, property_type } } = this.state;
105
92
 
@@ -252,7 +239,6 @@ class InstantValuation extends Component {
252
239
  search,
253
240
  lead,
254
241
  message,
255
- similarProperties,
256
242
  valuation,
257
243
  recentSales,
258
244
  loading,
@@ -267,7 +253,7 @@ class InstantValuation extends Component {
267
253
  return (
268
254
  <div
269
255
  className="instant-valuation hf-modal"
270
- style={step === 4 ? largeModalStyles : {}}
256
+ style={step === 3 ? largeModalStyles : {}}
271
257
  >
272
258
  <div id="valuation-section">
273
259
  <Link to="/" className="valuations-modal-close">
@@ -291,9 +277,6 @@ class InstantValuation extends Component {
291
277
  addressLookup={this.addressLookup}
292
278
  message={message}
293
279
  setStep={this.setStep}
294
- similarProperties={similarProperties}
295
- getSimilarProperties={this.getSimilarProperties}
296
- toggleSimilarProperty={this.toggleSimilarProperty}
297
280
  getValuation={this.getValuation}
298
281
  valuation={valuation}
299
282
  recentSales={recentSales}
@@ -290,7 +290,6 @@
290
290
  #valuation-section #price_1 {
291
291
  font-size: 3rem;
292
292
  margin: 20px 50px;
293
- background-color: white;
294
293
  }
295
294
 
296
295
  #valuation-section #valuation-wrapper {
@@ -149,7 +149,7 @@ const ResultStep = ({
149
149
  </div>
150
150
  )}
151
151
 
152
- <ValuationMap recentSales={recentSales} />
152
+ { recentSales && <ValuationMap recentSales={recentSales} /> }
153
153
 
154
154
  <div style={{ clear: 'both' }} />
155
155
 
@@ -158,7 +158,7 @@ const ResultStep = ({
158
158
  <p>These properties near you were sold recently.</p>
159
159
 
160
160
  <ul id="recently-sold-list">
161
- {recentSales.map((property) => recentSale(property))}
161
+ {recentSales?.map((property) => recentSale(property))}
162
162
  </ul>
163
163
  </div>
164
164
 
@@ -21,7 +21,7 @@ const ValuationMap = ({ recentSales }) => {
21
21
  parseFloat(recentSales[0].longitude),
22
22
  ]);
23
23
 
24
- const markers = recentSales.map((property) => {
24
+ const markers = recentSales?.map((property) => {
25
25
  bounds.extend([property.latitude, property.longitude]);
26
26
 
27
27
  return (
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homeflowjs",
3
- "version": "0.13.3",
3
+ "version": "0.13.5",
4
4
  "sideEffects": [
5
5
  "modal/**/*",
6
6
  "user/default-profile/**/*",
@@ -80,6 +80,14 @@ export default class GeonamesMap extends DraggableMap {
80
80
  */
81
81
  setTimeout(() => {
82
82
  if (!this.markersInitialized) {
83
+ const { geonames, properties } = store.getState().properties
84
+ if (!properties && !geonames?.length) {
85
+ const place = store.getState().search.currentSearch?.place;
86
+ const { lat, lng } = place;
87
+ this.map.setView(new L.LatLng(lat, lng), 14);
88
+ this.onMapDrag();
89
+ this.hideLoader();
90
+ }
83
91
  this.setMarkerTypeforZoomLevel();
84
92
  this.setMarkers();
85
93
  this.setToMarkeredBounds();
@@ -1,7 +1,7 @@
1
1
  export default `
2
2
  <div id="geonames-map-loader" class="js-geonames-map-loader geonames-map__loader-background">
3
3
  <div class="geonames-map__loader-inner">
4
- <svg width="38" height="38" viewBox="0 0 38 38" xmlns="http://www.w3.org/2000/svg" stroke="#fff">
4
+ <svg width="100" height="100" viewBox="0 0 38 38" xmlns="http://www.w3.org/2000/svg" stroke="gray">
5
5
  <g fill="none" fill-rule="evenodd">
6
6
  <g transform="translate(1 1)" stroke-width="2">
7
7
  <circle stroke-opacity=".5" cx="18" cy="18" r="18"/>