homeflowjs 0.9.6 → 0.9.7
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/README.md
CHANGED
|
@@ -55,3 +55,6 @@ success Using linked package for "react".
|
|
|
55
55
|
You may need to repeat this for `react-dom`.
|
|
56
56
|
|
|
57
57
|
This is a known issue with peer dependencies, see this comment and containing thread for more info: https://github.com/facebook/react/issues/14257#issuecomment-439967377
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
Temp commit for to publish last PR to Jenkins
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { connect } from 'react-redux';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
|
|
5
|
+
import { initGoogleMaps } from '../../actions/app.actions';
|
|
6
|
+
|
|
7
|
+
const BranchStreetview = ({ initGoogleMaps, ...otherProps }) => {
|
|
8
|
+
const initializeMap = () => {
|
|
9
|
+
const branch = Homeflow.get('branch');
|
|
10
|
+
|
|
11
|
+
const panorama = new google.maps.StreetViewPanorama(document.getElementById('hfjs-branch-streetview'));
|
|
12
|
+
panorama.setPosition(new google.maps.LatLng(branch.lat, branch.lng));
|
|
13
|
+
|
|
14
|
+
if (branch.streetview) {
|
|
15
|
+
const { pitch, heading } = branch.streetview.orientation;
|
|
16
|
+
const { lat, lng } = branch.streetview.position;
|
|
17
|
+
|
|
18
|
+
panorama.setPosition(new google.maps.LatLng(lat, lng));
|
|
19
|
+
panorama.setPov({ heading, pitch });
|
|
20
|
+
} else {
|
|
21
|
+
panorama.setPosition(new google.maps.LatLng(branch.lat, branch.lng));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
panorama.setVisible(true);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
initGoogleMaps().then(() => initializeMap());
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<div id="hfjs-branch-streetview" style={{ height: '100%' }} {...otherProps} />
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
BranchStreetview.propTypes = {
|
|
37
|
+
initGoogleMaps: PropTypes.func.isRequired,
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const mapDispatchToProps = {
|
|
41
|
+
initGoogleMaps,
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export default connect(
|
|
45
|
+
null,
|
|
46
|
+
mapDispatchToProps,
|
|
47
|
+
)(BranchStreetview);
|
package/branches/index.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import BranchesMap from './branches-map/branches-map.component';
|
|
2
2
|
import BranchMap from './branch-map/branch-map.component';
|
|
3
|
+
import BranchStreetview from './branch-streetview/branch-streetview.component';
|
|
3
4
|
import BranchesSearchForm from './branches-search-form/branches-search-form.component';
|
|
4
5
|
import BranchesSearchInput from './branches-search-form/branches-search-input.component';
|
|
5
6
|
|
|
6
7
|
export {
|
|
7
8
|
BranchesMap,
|
|
8
9
|
BranchMap,
|
|
10
|
+
BranchStreetview,
|
|
9
11
|
BranchesSearchForm,
|
|
10
12
|
BranchesSearchInput,
|
|
11
13
|
};
|