Skip to content

Commit 71200de

Browse files
committed
ui: use <Marker> instead of <Circlr>
1 parent ba72e0b commit 71200de

File tree

3 files changed

+11
-20
lines changed

3 files changed

+11
-20
lines changed

ui/src/containers/Services/Log/GoogleMap/GoogleMap.js

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
33
import { compose, withProps, withStateHandlers } from 'recompose';
4-
import { withScriptjs, withGoogleMap, GoogleMap, Circle, Polyline, InfoWindow } from 'react-google-maps';
4+
import { withScriptjs, withGoogleMap, GoogleMap, Marker, Polyline, InfoWindow } from 'react-google-maps';
55

66
import styles from './GoogleMap.module.scss';
77
import { GOOGLE_MAP_API_KEY } from '../../../../constants';
@@ -34,7 +34,7 @@ const Map = compose(
3434
withProps({
3535
googleMapURL: `https://maps.googleapis.com/maps/api/js?key=${GOOGLE_MAP_API_KEY}&v=3.exp&libraries=geometry,drawing,places`,
3636
loadingElement: <div style={{ height: '100%' }}/>,
37-
containerElement: <div style={{ height: '500px' }}/>,
37+
containerElement: <div style={{ height: '650px' }}/>,
3838
mapElement: <div style={{ height: '100%' }}/>,
3939
}),
4040
withStateHandlers(() => ({
@@ -64,17 +64,16 @@ const Map = compose(
6464
defaultCenter={defaultCenter}
6565
>
6666
{ips.map((item, index) =>
67-
<Circle
67+
<Marker
6868
key={index}
6969
onClick={() => onToggleInfoWindow(infoWindow.display, item)}
7070
options={{
71-
center: { lat: item.lat, lng: item.lng },
72-
radius: 30000,
73-
fillColor: item.self ? '#ff0000' : '#0000ff',
74-
fillOpacity: 0.6,
75-
strokeWeight: 1,
76-
strokeOpacity: 0.8,
77-
strokeColor: item.self ? '#ff0000' : '#0000ff',
71+
position: { lat: item.lat, lng: item.lng },
72+
icon: item.self ? '' : {
73+
url: require('./destination.png'),
74+
scaledSize: { width: 16, height: 16 },
75+
anchor: { x: 8, y: 8 },
76+
},
7877
}}
7978
/>
8079
)}
@@ -84,8 +83,7 @@ const Map = compose(
8483
options={{
8584
path: [defaultCenter, { lat: item.lat, lng: item.lng }],
8685
strokeWeight: 1,
87-
strokeOpacity: 0.8,
88-
strokeColor: item.inbound ? '#FFC940' : '#669EFF',
86+
strokeColor: item.inbound ? '#ff8d1f' : '#6b6d70',
8987
}}
9088
/>
9189
)}
@@ -125,7 +123,7 @@ export default class _GoogleMap extends React.Component {
125123

126124
render() {
127125
const { ips } = this.state;
128-
const self = ips.filter(({ self }) => self)[0] || { lat: 0, lng: 0 };
126+
const self = ips.filter(({ self }) => self)[0] || { lat: 21.289, lng: -175.253 };
129127
return (
130128
<div className={styles.container}>
131129
<Map

ui/src/containers/Services/Log/GoogleMap/GoogleMap.module.scss

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
.container {
22

3-
.circle {
4-
width: 30px;
5-
height: 30px;
6-
border-radius: 50%;
7-
background-color: red;
8-
}
9-
103
.infoWindow {
114
list-style: none;
125
margin: 0;
2.01 KB
Loading

0 commit comments

Comments
 (0)