Skip to content

Commit c738143

Browse files
author
gondzo
committed
location history lint issues fix
1 parent 3b8c8fd commit c738143

File tree

6 files changed

+32
-22
lines changed

6 files changed

+32
-22
lines changed

src/components/MapHistory/MapHistory.jsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { PropTypes } from 'react';
1+
import React, {PropTypes} from 'react';
22
import CSSModules from 'react-css-modules';
33
import _ from 'lodash';
44
import moment from 'moment';
@@ -28,7 +28,9 @@ class MapHistory extends React.Component {
2828
}
2929

3030
componentDidMount() {
31-
if (this.props.locations.length === 0) return;
31+
if (this.props.locations.length === 0) {
32+
return;
33+
}
3234
const bounds = this.getBounds();
3335
const mapSettings = {
3436
center: bounds.getCenter(),
@@ -164,7 +166,9 @@ class MapHistory extends React.Component {
164166

165167
// clear exsiting markers
166168
if (this.markers) {
167-
_.each(this.markers, (m) => { m.setMap(null); });
169+
_.each(this.markers, (m) => {
170+
m.setMap(null);
171+
});
168172
}
169173

170174
// create markers based on filtered locations
@@ -206,7 +210,11 @@ class MapHistory extends React.Component {
206210
this.props.locations.length === 0 ?
207211
(<div styleName="no-history">No location history</div>) :
208212
(<div styleName="history-wrap">
209-
<div styleName="map-history" ref={(node) => { this.node = node; }} />
213+
<div
214+
styleName="map-history" ref={(node) => {
215+
this.node = node;
216+
}}
217+
/>
210218
<div styleName="history-toolbar">
211219
<div styleName="slider">
212220
<Slider

src/routes/DronesMap/components/DronesMapView.jsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { PropTypes } from 'react';
1+
import React, {PropTypes} from 'react';
22
import CSSModules from 'react-css-modules';
33
import MarkerClusterer from 'node-js-marker-clusterer';
44
import MapHistory from 'components/MapHistory';
@@ -20,7 +20,7 @@ const getIcon = (status) => {
2020

2121
const HIDE_INFO_DELAY = 500;
2222

23-
const getLatLng = ({ currentLocation }) => ({ lng: currentLocation[0], lat: currentLocation[1] });
23+
const getLatLng = ({currentLocation}) => ({lng: currentLocation[0], lat: currentLocation[1]});
2424

2525
const getMarkerPoint = (marker, overlay) => (overlay.getProjection().fromLatLngToContainerPixel(marker.getPosition()));
2626

@@ -35,12 +35,14 @@ class DronesMapView extends React.Component {
3535
}
3636

3737
componentDidMount() {
38-
const { drones, mapSettings, showInfo, hideInfo } = this.props;
38+
const {drones, mapSettings, showInfo, hideInfo} = this.props;
3939
this.map = new google.maps.Map(this.node, mapSettings);
4040
const overlay = new google.maps.OverlayView();
4141
overlay.draw = () => {};
4242
overlay.setMap(this.map);
43-
const hideInfoWindow = () => { this.props.infoDrone && hideInfo(); };
43+
const hideInfoWindow = () => {
44+
this.props.infoDrone && hideInfo();
45+
};
4446
this.map.addListener('zoom_changed', hideInfoWindow);
4547
this.map.addListener('dragstart', hideInfoWindow);
4648
const id2Marker = {};
@@ -73,11 +75,11 @@ class DronesMapView extends React.Component {
7375
return marker;
7476
});
7577
this.id2Marker = id2Marker;
76-
this.markerCluster = new MarkerClusterer(this.map, markers, { imagePath: '/img/m' });
78+
this.markerCluster = new MarkerClusterer(this.map, markers, {imagePath: '/img/m'});
7779
}
7880

7981
componentWillReceiveProps(nextProps) {
80-
const { drones } = nextProps;
82+
const {drones} = nextProps;
8183
drones.forEach((drone) => {
8284
const marker = this.id2Marker[drone.id];
8385
if (marker) {
@@ -114,7 +116,7 @@ class DronesMapView extends React.Component {
114116
<div styleName="map-view" ref={(node) => (this.node = node)} />
115117
{
116118
this.props.infoDrone ?
117-
(<div styleName="map-popover" onMouseEnter={this.cancelHideInfo} onMouseLeave={this.props.hideInfo} style={{ top: this.props.infoPos.y - 30, left: this.props.infoPos.x }}>
119+
(<div styleName="map-popover" onMouseEnter={this.cancelHideInfo} onMouseLeave={this.props.hideInfo} style={{top: this.props.infoPos.y - 30, left: this.props.infoPos.x}}>
118120
<Info drone={this.props.infoDrone} showHistory={this.showHistory} />
119121
</div>) : null
120122
}

src/routes/DronesMap/components/Info/Info.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import React, { PropTypes } from 'react';
1+
import React, {PropTypes} from 'react';
22
import CSSModules from 'react-css-modules';
33
import styles from './Info.scss';
44

5-
export const Info = ({ drone: { name, serialNumber }, showHistory }) => (
5+
export const Info = ({drone: {name, serialNumber}, showHistory}) => (
66
<div styleName="info">
77
<div styleName="group">
88
<div styleName="label">Drone Name</div>

src/routes/DronesMap/modules/DronesMap.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,23 +65,23 @@ export const disconnect = () => () => {
6565

6666
// get location history of drone
6767
export const getLocations = (id) => async(dispatch) => {
68-
const { body: { items: locations } } = await APIService.getLocations(id, LOCATION_LIMIT);
69-
dispatch({ type: LOCATIONS_LOADED, payload: { drone: id, locations: _.reverse(locations) } });
68+
const {body: {items: locations}} = await APIService.getLocations(id, LOCATION_LIMIT);
69+
dispatch({type: LOCATIONS_LOADED, payload: {drone: id, locations: _.reverse(locations)}});
7070
};
7171

7272
// clear location history of drone
7373
export const hideHistory = () => (dispatch) => {
74-
dispatch({ type: HIDE_HISTORY });
74+
dispatch({type: HIDE_HISTORY});
7575
};
7676

7777
// show info window of drone
7878
export const showInfo = (drone, pos) => (dispatch) => {
79-
dispatch({ type: SHOW_DRONE_INFO, payload: { drone, pos } });
79+
dispatch({type: SHOW_DRONE_INFO, payload: {drone, pos}});
8080
};
8181

8282
// hide info window of drone
8383
export const hideInfo = () => (dispatch) => {
84-
dispatch({ type: HIDE_DRONE_INFO });
84+
dispatch({type: HIDE_DRONE_INFO});
8585
};
8686

8787
export const actions = {
@@ -105,8 +105,8 @@ export default handleActions({
105105
return updated || drone;
106106
}),
107107
}),
108-
[LOCATIONS_LOADED]: (state, { payload: { drone, locations } }) => ({ ...state, historyDrone: drone, locations }),
109-
[SHOW_DRONE_INFO]: (state, { payload: { drone, pos } }) => ({
108+
[LOCATIONS_LOADED]: (state, {payload: {drone, locations}}) => ({...state, historyDrone: drone, locations}),
109+
[SHOW_DRONE_INFO]: (state, {payload: {drone, pos}}) => ({
110110
...state,
111111
infoDrone: drone,
112112
infoPos: pos,

src/services/APIService.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,6 @@ export default class APIService {
586586
* @returns {{total: Number, items: Array}} the result
587587
*/
588588
static getLocations(id, limit) {
589-
return request.get(`${config.api.basePath}/api/v1/droneposition/${id}`).query({ limit }).end();
589+
return request.get(`${config.api.basePath}/api/v1/droneposition/${id}`).query({limit}).end();
590590
}
591591
}

webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ module.exports = {
162162
loaders: ['style', 'css?modules'],
163163
include: /flexboxgrid/,
164164
}),
165-
fixStyleLoader({
165+
fixStyleLoader({
166166
test: /\.css$/,
167167
loaders: ['style', 'css'],
168168
include: /rc-slider/,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy