homeflowjs 0.11.0 → 0.11.2
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/branches/branch-map/branch-leaflet-map.component.jsx +11 -3
- package/branches/branch-map/branch-map.component.jsx +26 -7
- package/package.json +1 -1
- package/properties/property-map/property-leaflet-map.component.jsx +18 -3
- package/properties/property-map/property-map.component.jsx +21 -3
- package/user/default-profile/account/account-edit.component.jsx +1 -1
@@ -1,9 +1,9 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import PropTypes from 'prop-types';
|
3
3
|
import L from 'leaflet';
|
4
|
-
import { MapContainer, TileLayer, Marker } from 'react-leaflet';
|
4
|
+
import { MapContainer, TileLayer, Marker, Popup } from 'react-leaflet';
|
5
5
|
|
6
|
-
const BranchLeafletMap = ({ iconConfig }) => {
|
6
|
+
const BranchLeafletMap = ({ iconConfig, CustomPopup }) => {
|
7
7
|
const branch = Homeflow.get('branch');
|
8
8
|
|
9
9
|
const defaultIconConfig = {
|
@@ -25,17 +25,25 @@ const BranchLeafletMap = ({ iconConfig }) => {
|
|
25
25
|
attribution='© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
|
26
26
|
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
|
27
27
|
/>
|
28
|
-
<Marker position={[branch.lat, branch.lng]} icon={icon}
|
28
|
+
<Marker position={[branch.lat, branch.lng]} icon={icon}>
|
29
|
+
{CustomPopup && (
|
30
|
+
<Popup>
|
31
|
+
<CustomPopup branch={branch} />
|
32
|
+
</Popup>
|
33
|
+
)}
|
34
|
+
</Marker>
|
29
35
|
</MapContainer>
|
30
36
|
);
|
31
37
|
};
|
32
38
|
|
33
39
|
BranchLeafletMap.propTypes = {
|
34
40
|
iconConfig: PropTypes.object,
|
41
|
+
CustomPopup: PropTypes.elementType,
|
35
42
|
};
|
36
43
|
|
37
44
|
BranchLeafletMap.defaultProps = {
|
38
45
|
iconConfig: null,
|
46
|
+
CustomPopup: null,
|
39
47
|
};
|
40
48
|
|
41
49
|
export default BranchLeafletMap;
|
@@ -33,21 +33,20 @@ class BranchMap extends React.Component {
|
|
33
33
|
custom,
|
34
34
|
iconConfig,
|
35
35
|
fullscreenControl,
|
36
|
+
zoomControl,
|
36
37
|
} = this.props;
|
37
38
|
|
38
39
|
// Should this be added to Redux?
|
39
40
|
const branch = Homeflow.get('branch');
|
40
41
|
|
41
|
-
// debugger;
|
42
|
-
|
43
42
|
const options = {
|
44
43
|
center: new google.maps.LatLng(branch.lat, branch.lng),
|
45
44
|
mapTypeControl,
|
46
45
|
scrollWheel,
|
47
46
|
zoom,
|
48
47
|
streetViewControl: !disableStreetview,
|
49
|
-
zoomControl: false,
|
50
48
|
fullscreenControl: false,
|
49
|
+
zoomControl,
|
51
50
|
};
|
52
51
|
|
53
52
|
if (custom === 'simple_bw') {
|
@@ -56,18 +55,34 @@ class BranchMap extends React.Component {
|
|
56
55
|
|
57
56
|
const map = new google.maps.Map(document.getElementById('hfjs-branch-map'), options);
|
58
57
|
|
59
|
-
new google.maps.Marker({
|
58
|
+
const marker = new google.maps.Marker({
|
60
59
|
position: { lat: branch.lat, lng: branch.lng },
|
61
60
|
map,
|
62
61
|
...(iconConfig && { icon: iconConfig.iconUrl }),
|
63
62
|
});
|
63
|
+
|
64
|
+
const branchPopupContent = document.getElementById('branch-map-popup-template')?.innerHTML;
|
65
|
+
|
66
|
+
if (branchPopupContent) {
|
67
|
+
const infoWindow = new google.maps.InfoWindow({
|
68
|
+
content: branchPopupContent,
|
69
|
+
ariaLabel: 'Custom Popup',
|
70
|
+
});
|
71
|
+
|
72
|
+
marker.addListener('click', () => {
|
73
|
+
infoWindow.open({
|
74
|
+
anchor: marker,
|
75
|
+
map,
|
76
|
+
});
|
77
|
+
});
|
78
|
+
}
|
64
79
|
}
|
65
80
|
|
66
81
|
render() {
|
67
|
-
const { google, iconConfig } = this.props;
|
82
|
+
const { google, iconConfig, CustomPopup } = this.props;
|
68
83
|
|
69
84
|
if (!google) {
|
70
|
-
return <LazyLeafletMap iconConfig={iconConfig} />;
|
85
|
+
return <LazyLeafletMap iconConfig={iconConfig} CustomPopup={CustomPopup} />;
|
71
86
|
}
|
72
87
|
|
73
88
|
return (
|
@@ -85,6 +100,8 @@ BranchMap.propTypes = {
|
|
85
100
|
initGoogleMaps: PropTypes.func.isRequired,
|
86
101
|
google: PropTypes.bool,
|
87
102
|
iconConfig: PropTypes.object,
|
103
|
+
CustomPopup: PropTypes.elementType,
|
104
|
+
zoomControl: PropTypes.bool,
|
88
105
|
};
|
89
106
|
|
90
107
|
BranchMap.defaultProps = {
|
@@ -95,6 +112,8 @@ BranchMap.defaultProps = {
|
|
95
112
|
disableStreetview: false,
|
96
113
|
google: false,
|
97
114
|
iconConfig: null,
|
115
|
+
CustomPopup: null,
|
116
|
+
zoomControl: false,
|
98
117
|
};
|
99
118
|
|
100
119
|
const mapDispatchToProps = {
|
@@ -104,4 +123,4 @@ const mapDispatchToProps = {
|
|
104
123
|
export default connect(
|
105
124
|
null,
|
106
125
|
mapDispatchToProps,
|
107
|
-
)(BranchMap);
|
126
|
+
)(BranchMap);
|
package/package.json
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
import React from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
2
3
|
import L from 'leaflet';
|
3
|
-
import { MapContainer, TileLayer, Marker } from 'react-leaflet';
|
4
|
+
import { MapContainer, TileLayer, Marker, Popup } from 'react-leaflet';
|
4
5
|
|
5
|
-
const PropertyLeafletMap = () => {
|
6
|
+
const PropertyLeafletMap = ({ CustomPopup }) => {
|
6
7
|
const property = Homeflow.get('property');
|
7
8
|
const customIcon = Homeflow.get('custom_map_icon');
|
8
9
|
|
@@ -23,9 +24,23 @@ const PropertyLeafletMap = () => {
|
|
23
24
|
attribution='© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
|
24
25
|
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
|
25
26
|
/>
|
26
|
-
<Marker position={[property.lat, property.lng]} icon={defaultIcon}
|
27
|
+
<Marker position={[property.lat, property.lng]} icon={defaultIcon}>
|
28
|
+
{CustomPopup && (
|
29
|
+
<Popup>
|
30
|
+
<CustomPopup property={property} />
|
31
|
+
</Popup>
|
32
|
+
)}
|
33
|
+
</Marker>
|
27
34
|
</MapContainer>
|
28
35
|
);
|
29
36
|
};
|
30
37
|
|
38
|
+
PropertyLeafletMap.propTypes = {
|
39
|
+
CustomPopup: PropTypes.elementType,
|
40
|
+
};
|
41
|
+
|
42
|
+
PropertyLeafletMap.defaultProps = {
|
43
|
+
CustomPopup: null,
|
44
|
+
};
|
45
|
+
|
31
46
|
export default PropertyLeafletMap;
|
@@ -55,13 +55,29 @@ class PropertyMap extends React.Component {
|
|
55
55
|
map,
|
56
56
|
...(iconConfig && { icon: iconConfig.iconUrl }),
|
57
57
|
});
|
58
|
+
|
59
|
+
const propertyPopupContent = document.getElementById('property-show-map-popup-template')?.innerHTML;
|
60
|
+
|
61
|
+
if (propertyPopupContent) {
|
62
|
+
const infoWindow = new google.maps.InfoWindow({
|
63
|
+
content: propertyPopupContent,
|
64
|
+
ariaLabel: 'Custom Popup',
|
65
|
+
});
|
66
|
+
|
67
|
+
marker.addListener('click', () => {
|
68
|
+
infoWindow.open({
|
69
|
+
anchor: marker,
|
70
|
+
map,
|
71
|
+
});
|
72
|
+
});
|
73
|
+
}
|
58
74
|
}
|
59
75
|
|
60
76
|
render() {
|
61
|
-
const { google, iconConfig } = this.props;
|
77
|
+
const { google, iconConfig, CustomPopup } = this.props;
|
62
78
|
|
63
79
|
if (!google) {
|
64
|
-
return <LazyLeafletMap iconConfig={iconConfig} />;
|
80
|
+
return <LazyLeafletMap iconConfig={iconConfig} CustomPopup={CustomPopup} />;
|
65
81
|
}
|
66
82
|
|
67
83
|
return (
|
@@ -79,6 +95,7 @@ PropertyMap.propTypes = {
|
|
79
95
|
initGoogleMaps: PropTypes.func.isRequired,
|
80
96
|
google: PropTypes.bool,
|
81
97
|
iconConfig: PropTypes.object,
|
98
|
+
CustomPopup: PropTypes.elementType,
|
82
99
|
};
|
83
100
|
|
84
101
|
PropertyMap.defaultProps = {
|
@@ -89,6 +106,7 @@ PropertyMap.defaultProps = {
|
|
89
106
|
disableStreetview: false,
|
90
107
|
google: false,
|
91
108
|
iconConfig: null,
|
109
|
+
CustomPopup: null,
|
92
110
|
};
|
93
111
|
|
94
112
|
const mapDispatchToProps = {
|
@@ -98,4 +116,4 @@ const mapDispatchToProps = {
|
|
98
116
|
export default connect(
|
99
117
|
null,
|
100
118
|
mapDispatchToProps,
|
101
|
-
)(PropertyMap);
|
119
|
+
)(PropertyMap);
|
@@ -28,7 +28,7 @@ const AccountEdit = ({ localUser, toggleEdit, updating }) => (
|
|
28
28
|
</div>
|
29
29
|
|
30
30
|
<div className="profile-edit-form__group">
|
31
|
-
<UserInput name="tel_home" required />
|
31
|
+
<UserInput name="tel_home" pattern="^[+]?[0-9]{9,12}$" required />
|
32
32
|
<label htmlFor="user-input-tel_home" className={localUser.tel_home ? 'shrink' : ''}>Phone</label>
|
33
33
|
</div>
|
34
34
|
|