Add eslint

This commit is contained in:
uwap 2017-11-06 11:53:07 +01:00
parent 3cd2062ebf
commit d32ee5ac36
10 changed files with 585 additions and 85 deletions

View file

@ -1,17 +1,14 @@
// @flow
import React from "react";
import { Map, ImageOverlay, Marker, Popup, LayersControl } from "react-leaflet";
import { Map, ImageOverlay, Marker, LayersControl } from "react-leaflet";
import Leaflet from "leaflet";
import R from "ramda";
import Config from "./config";
import { Actions } from "./state";
import { keyOf } from "./util";
import { store } from "./state";
import ReactDOM from "react-dom";
// convert width/height coordinates to -height/width coordinates
const c = (p) => [-p[1], p[0]]
const c = (p) => [-p[1], p[0]];
const color = (iconColor, state: State) => {
// TODO: give iconColor not only internal but also actual values
@ -20,11 +17,11 @@ const color = (iconColor, state: State) => {
R.map(x => x.internal == null ?
x.actual : x.internal, state.values == null ? {} : state.values)
);
}
};
const iconHtml = (el, state: State) =>
"<i class=\"mdi mdi-" + el.icon + " mdi-36px\" style=\""
+ "color:" + color(el.iconColor, state) + ";\">"
+ "</i>"
+ "</i>";
const Markers = (props) => R.values(R.mapObjIndexed((el,key) => (
<Marker position={c(el.position)} key={el.name}
@ -49,7 +46,7 @@ class SpaceMap extends React.Component<{state: State, width: number, height: num
const props = this.props;
return (
<Map center={c([props.width / 2, props.height / 2])} zoom={props.zoom}
crs={Leaflet.CRS.Simple}>
crs={Leaflet.CRS.Simple}>
{Markers(props)}
<LayersControl position='topright'>
{Config.layers.map(x => this.renderLayer(x, [c([0,0]), c([props.width, props.height])]))}
@ -62,7 +59,7 @@ class SpaceMap extends React.Component<{state: State, width: number, height: num
const LayersControlType = layer.baseLayer ? LayersControl.BaseLayer : LayersControl.Overlay;
return (
<LayersControlType name={layer.name}
checked={layer.defaultVisibility == "visible"}>
checked={layer.defaultVisibility == "visible"}>
<ImageOverlay url={layer.image} bounds={bounds} opacity={layer.opacity} />
</LayersControlType>
);