homeflowjs 0.7.23 → 0.7.27

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 CHANGED
@@ -39,6 +39,8 @@ pipeline {
39
39
 
40
40
  stage('Publish Verification') {
41
41
  when {
42
+ branch 'master'
43
+
42
44
  anyOf {
43
45
  triggeredBy 'BitBucketPushCause'
44
46
  triggeredBy 'UserIdCause'
@@ -1,17 +1,18 @@
1
1
  import React from 'react';
2
+ import PropTypes from 'prop-types';
2
3
  import L from 'leaflet';
3
4
  import { MapContainer, TileLayer, Marker } from 'react-leaflet';
4
5
 
5
- const BranchLeafletMap = () => {
6
+ const BranchLeafletMap = ({ iconConfig }) => {
6
7
  const branch = Homeflow.get('branch');
7
8
 
8
- const defaultIcon = L.icon({
9
+ const defaultIconConfig = {
9
10
  iconRetinaUrl: '/assets/marker-icon.png',
10
11
  iconUrl: '/assets/marker-icon.png',
11
12
  shadowUrl: '/assets/marker-shadow.png',
12
- });
13
+ };
13
14
 
14
- // debugger;
15
+ const icon = L.icon(iconConfig || defaultIconConfig);
15
16
 
16
17
  return (
17
18
  <MapContainer
@@ -24,9 +25,17 @@ const BranchLeafletMap = () => {
24
25
  attribution='&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
25
26
  url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
26
27
  />
27
- <Marker position={[branch.lat, branch.lng]} icon={defaultIcon} />
28
+ <Marker position={[branch.lat, branch.lng]} icon={icon} />
28
29
  </MapContainer>
29
30
  );
30
31
  };
31
32
 
33
+ BranchLeafletMap.propTypes = {
34
+ iconConfig: PropTypes.object,
35
+ };
36
+
37
+ BranchLeafletMap.defaultProps = {
38
+ iconConfig: null,
39
+ };
40
+
32
41
  export default BranchLeafletMap;
@@ -59,10 +59,10 @@ class BranchMap extends React.Component {
59
59
  }
60
60
 
61
61
  render() {
62
- const { google } = this.props;
62
+ const { google, iconConfig } = this.props;
63
63
 
64
64
  if (!google) {
65
- return <LazyLeafletMap />;
65
+ return <LazyLeafletMap iconConfig={iconConfig} />;
66
66
  }
67
67
 
68
68
  return (
@@ -79,6 +79,7 @@ BranchMap.propTypes = {
79
79
  disableStreetview: PropTypes.bool,
80
80
  initGoogleMaps: PropTypes.func.isRequired,
81
81
  google: PropTypes.bool,
82
+ iconConfig: PropTypes.object,
82
83
  };
83
84
 
84
85
  BranchMap.defaultProps = {
@@ -88,6 +89,7 @@ BranchMap.defaultProps = {
88
89
  zoom: 15,
89
90
  disableStreetview: false,
90
91
  google: false,
92
+ iconConfig: null,
91
93
  };
92
94
 
93
95
  const mapDispatchToProps = {
@@ -12,8 +12,17 @@ import ReactLeafletGoogleLayer from 'react-leaflet-google-layer';
12
12
 
13
13
  import 'leaflet/dist/leaflet.css';
14
14
 
15
- const BranchesMap = ({ CustomPopup, google, gmapsKey, iconConfig }) => {
16
- const branches = Homeflow.get('branches');
15
+ const BranchesMap = ({
16
+ CustomPopup, google, gmapsKey, iconConfig, fallbackLatLng,
17
+ }) => {
18
+ let branches = Homeflow.get('branches');
19
+ let showMarkers = true;
20
+
21
+ // If no branches found use fallback lat, long and set showMarkers to false
22
+ if (!branches) {
23
+ branches = [fallbackLatLng];
24
+ showMarkers = false;
25
+ }
17
26
 
18
27
  const defaultIconConfig = {
19
28
  iconRetinaUrl: '/assets/marker-icon.png',
@@ -79,7 +88,7 @@ const BranchesMap = ({ CustomPopup, google, gmapsKey, iconConfig }) => {
79
88
  url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
80
89
  />
81
90
  )}
82
- {markers}
91
+ {showMarkers && markers}
83
92
  </MapContainer>
84
93
  );
85
94
  };
@@ -89,6 +98,7 @@ BranchesMap.propTypes = {
89
98
  CustomPopup: PropTypes.elementType,
90
99
  gmapsKey: PropTypes.string,
91
100
  iconConfig: PropTypes.object,
101
+ fallbackLatLng: PropTypes.object,
92
102
  };
93
103
 
94
104
  BranchesMap.defaultProps = {
@@ -96,6 +106,7 @@ BranchesMap.defaultProps = {
96
106
  CustomPopup: null,
97
107
  gmapsKey: null,
98
108
  iconConfig: null,
109
+ fallbackLatLng: { lat: 51.509865, lng: -0.118092 },
99
110
  };
100
111
 
101
112
  const mapStateToProps = (state) => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homeflowjs",
3
- "version": "0.7.23",
3
+ "version": "0.7.27",
4
4
  "description": "JavaScript toolkit for Homeflow themes",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -56,6 +56,8 @@ const searchReducer = (state = INITIAL_STATE, action) => {
56
56
  currentSearch: {
57
57
  ...state.currentSearch,
58
58
  ...action.payload,
59
+ // delete poly if user enters new search query
60
+ poly: action.payload.q ? null : state.currentSearch.poly,
59
61
  },
60
62
  };
61
63
  case SearchActionTypes.ADD_TAG: {