From 1cfcea619688d45d6b5966046018a014f6ccb532 Mon Sep 17 00:00:00 2001 From: Trevor Gerhardt Date: Tue, 8 Aug 2017 15:37:30 +0100 Subject: [PATCH 1/5] style(format): Format all JS --- src/actions/browsochrones.js | 4 +- src/components/application.js | 35 +++----- src/components/form.js | 11 ++- src/components/icon.js | 3 +- src/components/log-item/index.js | 7 +- src/components/log/index.js | 3 +- src/components/map.js | 32 +++++--- src/components/route-card.js | 137 ++++++++++++++++++------------- src/utils/leaflet-icons/index.js | 3 +- 9 files changed, 127 insertions(+), 108 deletions(-) diff --git a/src/actions/browsochrones.js b/src/actions/browsochrones.js index 8d75c3c..e437d5d 100644 --- a/src/actions/browsochrones.js +++ b/src/actions/browsochrones.js @@ -36,9 +36,9 @@ export default function initialize ({ setEndLabel(qs.end), // may not exist ...origins.map( (origin, index) => - (qs.start + qs.start ? setAccessibilityToLoadingFor({index, name: origin.name}) - : setAccessibilityToEmptyFor({index, name: origin.name})) + : setAccessibilityToEmptyFor({index, name: origin.name}) ), geocodeQs({geocoder, qs}).then(([start, end]) => { const actions = [] diff --git a/src/components/application.js b/src/components/application.js index 0b9de8d..3d886ab 100644 --- a/src/components/application.js +++ b/src/components/application.js @@ -114,17 +114,10 @@ export default class Application extends Component { return markers } - _setStart = ({ - label, - latlng - }: { - label?: string, - latlng: Coordinate - }) => { + _setStart = ({label, latlng}: {label?: string, latlng: Coordinate}) => { const {browsochrones, map, mapMarkers, timeCutoff, updateStart} = this.props - const endLatlng = mapMarkers.end && mapMarkers.end.latlng - ? mapMarkers.end.latlng - : null + const endLatlng = + mapMarkers.end && mapMarkers.end.latlng ? mapMarkers.end.latlng : null updateStart({ browsochronesInstances: browsochrones.instances, @@ -153,13 +146,7 @@ export default class Application extends Component { } } - _setEnd = ({ - label, - latlng - }: { - label?: string, - latlng: Coordinate - }) => { + _setEnd = ({label, latlng}: {label?: string, latlng: Coordinate}) => { const {browsochrones, map, mapMarkers, updateEnd} = this.props updateEnd({ browsochronesInstances: browsochrones.instances, @@ -198,7 +185,8 @@ export default class Application extends Component { } _setActiveBrowsochronesInstance = memoize(index => () => - this.props.setActiveBrowsochronesInstance(index)) + this.props.setActiveBrowsochronesInstance(index) + ) count = 0 render () { @@ -238,8 +226,7 @@ export default class Application extends Component {
{ui.fetches > 0 ? - : } - {' '} + : }{' '} {messages.Title}
{ selectedTimeCutoff={timeCutoff.selected} start={geocoder.start} /> - {destinations.map((accessibility, index) => ( + {destinations.map((accessibility, index) => { > {accessibility.name} - ))} + )} {ui.showLog && actionLog && actionLog.length > 0 &&
-
{messages.Log.Title}
+
+ {messages.Log.Title} +
} diff --git a/src/components/form.js b/src/components/form.js index 523b616..79ad469 100644 --- a/src/components/form.js +++ b/src/components/form.js @@ -48,9 +48,11 @@ export default ({ pointsOfInterest, selectedTimeCutoff, start -}: Props) => ( +}: Props) =>
-
{messages.Geocoding.StartTitle}
+
+ {messages.Geocoding.StartTitle} +
{start &&
-
{messages.Geocoding.EndTitle}
+
+ {messages.Geocoding.EndTitle} +
}
-) diff --git a/src/components/icon.js b/src/components/icon.js index fea9982..e96caf3 100644 --- a/src/components/icon.js +++ b/src/components/icon.js @@ -7,6 +7,5 @@ type Props = { props?: any } -export default ({className = '', type, ...props}: Props) => ( +export default ({className = '', type, ...props}: Props) => -) diff --git a/src/components/log-item/index.js b/src/components/log-item/index.js index a243420..b00a428 100644 --- a/src/components/log-item/index.js +++ b/src/components/log-item/index.js @@ -6,11 +6,12 @@ import type {LogItem} from '../../types' const FORMAT = 'HH:mm:ss' -export default (props: LogItem) => ( +export default (props: LogItem) =>
{formatDate(props.createdAt, FORMAT)} - {props.text} + + {props.text} +
-) diff --git a/src/components/log/index.js b/src/components/log/index.js index 6b3b5d0..158c0f8 100644 --- a/src/components/log/index.js +++ b/src/components/log/index.js @@ -9,8 +9,7 @@ type Props = { items: LogItems } -export default (props: Props) => ( +export default (props: Props) =>
{props.items.map((item, index) => )}
-) diff --git a/src/components/map.js b/src/components/map.js index 60a87e7..e04cf1a 100644 --- a/src/components/map.js +++ b/src/components/map.js @@ -18,9 +18,10 @@ import transitiveStyle from '../transitive-style' import type {Coordinate, Feature, MapEvent, PointsOfInterest} from '../types' -const TILE_LAYER_URL = Browser.retina && process.env.LEAFLET_RETINA_URL - ? process.env.LEAFLET_RETINA_URL - : process.env.LEAFLET_TILE_URL +const TILE_LAYER_URL = + Browser.retina && process.env.LEAFLET_RETINA_URL + ? process.env.LEAFLET_RETINA_URL + : process.env.LEAFLET_TILE_URL const startIcon = leafletIcon({ icon: 'play', @@ -151,7 +152,7 @@ export default class Map extends PureComponent { onClick={this._clickPoi} />} - {markers.map((m, index) => ( + {markers.map((m, index) => { onDragEnd={m.onDragEnd} position={m.position} > - {m.label && {m.label}} + {m.label && + + + {m.label} + + } - ))} + )} {geojson.map(g => { return ( @@ -184,22 +190,22 @@ export default class Map extends PureComponent { {showSelectStartOrEnd &&
- {lastClickedLabel &&

{lastClickedLabel}

} + {lastClickedLabel && +

+ {lastClickedLabel} +

} {markers.length > 0 && } {markers.length > 0 && }
diff --git a/src/components/route-card.js b/src/components/route-card.js index 3fd0976..34bf1c6 100644 --- a/src/components/route-card.js +++ b/src/components/route-card.js @@ -34,12 +34,12 @@ export default ({ showComparison, travelTime, waitTime -}: Props) => ( +}: Props) =>
-) function TripDiff ({oldTravelTime, travelTime}) { const actualDiff = travelTime - oldTravelTime - const nume = actualDiff > 0 - ? travelTime - oldTravelTime - : oldTravelTime - travelTime + const nume = + actualDiff > 0 ? travelTime - oldTravelTime : oldTravelTime - travelTime const diff = parseInt((nume / oldTravelTime * 100).toFixed(1)) if (oldTravelTime === 255) { return ( - {messages.NewTrip}
+ {messages.NewTrip} +
) } else if (actualDiff > 0) { return ( - {diff}%
+ {diff}% +
) } else { @@ -109,8 +109,12 @@ function Journeys ({journeys, oldTravelTime, travelTime, waitTime}) { if (!travelTime || !journeys) { return (
-
{messages.Systems.TripsTitle}
-
{messages.Systems.SelectEnd}
+
+ {messages.Systems.TripsTitle} +
+
+ {messages.Systems.SelectEnd} +
) } @@ -118,8 +122,12 @@ function Journeys ({journeys, oldTravelTime, travelTime, waitTime}) { if (travelTime === 255 || journeys.length === 0) { return (
-
{messages.Systems.TripsTitle}
-
{messages.Systems.TripsEmpty}
+
+ {messages.Systems.TripsTitle} +
+
+ {messages.Systems.TripsEmpty} +
) } @@ -128,46 +136,51 @@ function Journeys ({journeys, oldTravelTime, travelTime, waitTime}) { return (
-
{messages.Systems.BestTripTitle}
+
+ {messages.Systems.BestTripTitle} +
-
{travelTime} {messages.Units.Mins}
+
+ {travelTime} {messages.Units.Mins} +
{oldTravelTime && oldTravelTime !== travelTime && }
- {waitTime} - {' '} - {messages.Units.Mins} - {' '} + {waitTime} {messages.Units.Mins}{' '} {messages.Systems.Waiting}
- {bestJourney.map((segment, index) => ( + {bestJourney.map((segment, index) => - ))} + )}
{journeys.length > 1 &&
-
{messages.Systems.AlternateTripsTitle}
+
+ {messages.Systems.AlternateTripsTitle} +
- {alternateJourneys.map((segments, jindex) => ( + {alternateJourneys.map((segments, jindex) =>
- {jindex + 1}. - {segments.map((segment, index) => ( + + {jindex + 1}. + + {segments.map((segment, index) => - ))} + )}
- ))} + )}
}
) } -const Segment = ({segment}) => ( +const Segment = ({segment}) => ( > {segment.name} -) function MetricIcon ({name}) { switch (name.toLowerCase()) { @@ -204,28 +216,32 @@ function ShowAccess ({ }) { return (
-
{messages.Systems.AccessTitle}
+
+ {messages.Systems.AccessTitle} +
{base === ACCESSIBILITY_IS_EMPTY - ? {messages.Systems.SelectStart} + ? + {messages.Systems.SelectStart} + : base === ACCESSIBILITY_IS_LOADING - ? {messages.Systems.CalculatingAccessibility} - : keys.map((k, i) => ( -
- - {(base[k] | 0).toLocaleString()} - {' '} - {toSpaceCase(k)} -
- ))} + ? + {messages.Systems.CalculatingAccessibility} + + : keys.map((k, i) => +
+ + {(base[k] | 0).toLocaleString()} {' '} + {toSpaceCase(k)} +
+ )}
) } function AccessDiffPercentage ({newAccess, originalAccess}) { const actualDiff = newAccess - originalAccess - const nume = actualDiff > 0 - ? newAccess - originalAccess - : originalAccess - newAccess + const nume = + actualDiff > 0 ? newAccess - originalAccess : originalAccess - newAccess const diff = parseInt((nume / originalAccess * 100).toFixed(1)) if (diff === 0 || isNaN(diff)) return else if (actualDiff > 0) { @@ -248,23 +264,28 @@ function AccessDiffPercentage ({newAccess, originalAccess}) { function ShowDiff ({keys, base, comparison}) { return (
-
{messages.Systems.AccessTitle}
+
+ {messages.Systems.AccessTitle} +
{base === ACCESSIBILITY_IS_EMPTY - ? {messages.Systems.SelectStart} + ? + {messages.Systems.SelectStart} + : base === ACCESSIBILITY_IS_LOADING - ? {messages.Systems.CalculatingAccessibility} - : keys.map((key, i) => ( -
- - {(base[key] | 0).toLocaleString()} - {' '} - {toSpaceCase(key)} - -
- ))} + ? + {messages.Systems.CalculatingAccessibility} + + : keys.map((key, i) => +
+ + {(base[key] | 0).toLocaleString()} {' '} + {toSpaceCase(key)} + +
+ )}
) } diff --git a/src/utils/leaflet-icons/index.js b/src/utils/leaflet-icons/index.js index c43cc91..f46053d 100644 --- a/src/utils/leaflet-icons/index.js +++ b/src/utils/leaflet-icons/index.js @@ -61,7 +61,8 @@ const Icon = L.Icon.extend({ const options = this.options if ( - options.icon.slice(0, options.prefix.length + 1) === options.prefix + '-' + options.icon.slice(0, options.prefix.length + 1) === + options.prefix + '-' ) { iconClass = options.icon } else { From b68d41cf2b65c67216daa58f058b13d07312f6fc Mon Sep 17 00:00:00 2001 From: Trevor Gerhardt Date: Thu, 21 Sep 2017 22:05:50 +0200 Subject: [PATCH 2/5] feat(location): Set zoom and map center based on URL --- src/actions/browsochrones.js | 9 +++++++-- src/components/map.js | 6 ++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/actions/browsochrones.js b/src/actions/browsochrones.js index e437d5d..aa79566 100644 --- a/src/actions/browsochrones.js +++ b/src/actions/browsochrones.js @@ -17,7 +17,8 @@ import { setEnd, setEndLabel, setStart, - setStartLabel + setStartLabel, + updateMap } from '../actions' import type {Store} from '../types' @@ -42,8 +43,12 @@ export default function initialize ({ ), geocodeQs({geocoder, qs}).then(([start, end]) => { const actions = [] - if (start) actions.push(setStart(start)) + if (start) { + actions.push(setStart(start)) + actions.push(updateMap({centerCoordinates: [start.latlng.lat, start.latlng.lon]})) + } if (end) actions.push(setEnd(end)) + if (qs.zoom) actions.push(updateMap({zoom: parseInt(qs.zoom, 10)})) actions.push( fetchGrids(browsochrones) .then(grids => diff --git a/src/components/map.js b/src/components/map.js index e04cf1a..17dc417 100644 --- a/src/components/map.js +++ b/src/components/map.js @@ -11,6 +11,7 @@ import { } from 'react-leaflet' import Icon from './icon' +import {setKeyTo} from '../utils/hash' import leafletIcon from '../utils/leaflet-icons' import messages from '../utils/messages' import TransitiveLayer from './transitive-map-layer' @@ -108,6 +109,10 @@ export default class Map extends PureComponent { }) } + _setZoom = (e: MapEvent) => { + setKeyTo('zoom', e.target._zoom) + } + render (): React$Element { const { centerCoordinates, @@ -135,6 +140,7 @@ export default class Map extends PureComponent { center={centerCoordinates} className='Taui-Map' ref='map' + onZoomend={this._setZoom} zoom={zoom} onClick={this._onMapClick} preferCanvas From 82330bf972d01dd2ea5557dd3d4b0758897689d1 Mon Sep 17 00:00:00 2001 From: Trevor Gerhardt Date: Thu, 21 Sep 2017 22:49:55 +0200 Subject: [PATCH 3/5] feat(isochrones): Show two isochrones at once --- src/actions/browsochrones.js | 2 +- src/components/application.js | 4 ++-- src/components/map.js | 37 ++++++++++++++++++++++------------- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/src/actions/browsochrones.js b/src/actions/browsochrones.js index aa79566..490c5b8 100644 --- a/src/actions/browsochrones.js +++ b/src/actions/browsochrones.js @@ -45,7 +45,7 @@ export default function initialize ({ const actions = [] if (start) { actions.push(setStart(start)) - actions.push(updateMap({centerCoordinates: [start.latlng.lat, start.latlng.lon]})) + actions.push(updateMap({centerCoordinates: lonlat.toLeaflet(start.latlng)})) } if (end) actions.push(setEnd(end)) if (qs.zoom) actions.push(updateMap({zoom: parseInt(qs.zoom, 10)})) diff --git a/src/components/application.js b/src/components/application.js index 3d886ab..9d79beb 100644 --- a/src/components/application.js +++ b/src/components/application.js @@ -209,10 +209,10 @@ export default class Application extends Component {
+) function TripDiff ({oldTravelTime, travelTime}) { const actualDiff = travelTime - oldTravelTime - const nume = - actualDiff > 0 ? travelTime - oldTravelTime : oldTravelTime - travelTime + const nume = actualDiff > 0 + ? travelTime - oldTravelTime + : oldTravelTime - travelTime const diff = parseInt((nume / oldTravelTime * 100).toFixed(1)) if (oldTravelTime === 255) { @@ -153,9 +155,9 @@ function Journeys ({journeys, oldTravelTime, travelTime, waitTime}) { {messages.Systems.Waiting}
{ render (): React$Element { const { + active, centerCoordinates, geojson, geojsonColor, + isochrones, markers, pointsOfInterest, transitive, @@ -135,6 +137,9 @@ export default class Map extends PureComponent { tileLayerProps.zoomOffset = -1 } + const baseIsochrone = isochrones[0] + const comparisonIsochrone = active !== 0 ? isochrones[active] : null + return ( { )} - {geojson.map(g => { - return ( - - ) - })} + {baseIsochrone && + } + + {comparisonIsochrone && + } {transitive && } @@ -221,6 +217,19 @@ export default class Map extends PureComponent { } } +function Isochrone ({isochrone, color}) { + return +} + class MapboxGeoJson extends GeoJson { componentWillMount () { const {mapbox} = require('mapbox.js') From bdf62042509e431302153c1244a65d9a351d2060 Mon Sep 17 00:00:00 2001 From: Trevor Gerhardt Date: Fri, 10 Nov 2017 08:19:35 +0000 Subject: [PATCH 4/5] test(snapshots): Fix tests and update snapshots --- index.html | 2 +- src/components/map.js | 6 +-- .../__tests__/__snapshots__/index.js.snap | 47 ++++++++++++++++++- src/index.css | 4 ++ src/index.js | 5 ++ src/types.js | 3 +- 6 files changed, 59 insertions(+), 8 deletions(-) diff --git a/index.html b/index.html index fb356a9..80d9543 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ - IndyConnect + Conveyal Analysis diff --git a/src/components/map.js b/src/components/map.js index 391cd0e..ced0b98 100644 --- a/src/components/map.js +++ b/src/components/map.js @@ -35,10 +35,10 @@ const endIcon = leafletIcon({ }) type Props = { + active: number, centerCoordinates: Coordinate, clearStartAndEnd(): void, - geojson: Feature[], - geojsonColor: string, + isochrones: any[], markers: any[], pointsOfInterest: PointsOfInterest, setEnd(any): void, @@ -117,8 +117,6 @@ export default class Map extends PureComponent { const { active, centerCoordinates, - geojson, - geojsonColor, isochrones, markers, pointsOfInterest, diff --git a/src/containers/__tests__/__snapshots__/index.js.snap b/src/containers/__tests__/__snapshots__/index.js.snap index fc075e1..3ffc7df 100644 --- a/src/containers/__tests__/__snapshots__/index.js.snap +++ b/src/containers/__tests__/__snapshots__/index.js.snap @@ -222,6 +222,7 @@ exports[`Taui render the application container 1`] = ` className="Fullscreen" > .CardTitle { cursor: inherit; } diff --git a/src/index.js b/src/index.js index 1bab882..94b9a04 100644 --- a/src/index.js +++ b/src/index.js @@ -3,7 +3,12 @@ import mount from '@conveyal/woonerf/mount' import Application from './containers/application' import reducers from './reducers' +import messages from './utils/messages' +// Set the title +document.title = messages.Title + +// Mount the app mount({ app: Application, reducers diff --git a/src/types.js b/src/types.js index b300a08..4f4b384 100644 --- a/src/types.js +++ b/src/types.js @@ -128,6 +128,7 @@ export type InputEvent = Event & { export type MapEvent = { latlng?: Coordinate, target: { - _latlng: Coordinate + _latlng: Coordinate, + _zoom: number } } From cdd4cd5896d3893d15479d115173f074ad3068b3 Mon Sep 17 00:00:00 2001 From: Trevor Gerhardt Date: Fri, 10 Nov 2017 08:25:33 +0000 Subject: [PATCH 5/5] style(format): Format all js --- src/actions/browsochrones.js | 8 ++-- src/components/application.js | 15 +++--- src/components/form.js | 3 +- src/components/icon.js | 3 +- src/components/log-item/index.js | 3 +- src/components/log/index.js | 3 +- src/components/map.js | 33 ++++++------- src/components/route-card.js | 80 +++++++++++++++++--------------- src/utils/leaflet-icons/index.js | 3 +- 9 files changed, 81 insertions(+), 70 deletions(-) diff --git a/src/actions/browsochrones.js b/src/actions/browsochrones.js index 490c5b8..235c7cf 100644 --- a/src/actions/browsochrones.js +++ b/src/actions/browsochrones.js @@ -37,15 +37,17 @@ export default function initialize ({ setEndLabel(qs.end), // may not exist ...origins.map( (origin, index) => - qs.start + (qs.start ? setAccessibilityToLoadingFor({index, name: origin.name}) - : setAccessibilityToEmptyFor({index, name: origin.name}) + : setAccessibilityToEmptyFor({index, name: origin.name})) ), geocodeQs({geocoder, qs}).then(([start, end]) => { const actions = [] if (start) { actions.push(setStart(start)) - actions.push(updateMap({centerCoordinates: lonlat.toLeaflet(start.latlng)})) + actions.push( + updateMap({centerCoordinates: lonlat.toLeaflet(start.latlng)}) + ) } if (end) actions.push(setEnd(end)) if (qs.zoom) actions.push(updateMap({zoom: parseInt(qs.zoom, 10)})) diff --git a/src/components/application.js b/src/components/application.js index 9d79beb..1c42139 100644 --- a/src/components/application.js +++ b/src/components/application.js @@ -116,8 +116,9 @@ export default class Application extends Component { _setStart = ({label, latlng}: {label?: string, latlng: Coordinate}) => { const {browsochrones, map, mapMarkers, timeCutoff, updateStart} = this.props - const endLatlng = - mapMarkers.end && mapMarkers.end.latlng ? mapMarkers.end.latlng : null + const endLatlng = mapMarkers.end && mapMarkers.end.latlng + ? mapMarkers.end.latlng + : null updateStart({ browsochronesInstances: browsochrones.instances, @@ -185,8 +186,7 @@ export default class Application extends Component { } _setActiveBrowsochronesInstance = memoize(index => () => - this.props.setActiveBrowsochronesInstance(index) - ) + this.props.setActiveBrowsochronesInstance(index)) count = 0 render () { @@ -226,7 +226,8 @@ export default class Application extends Component {
{ui.fetches > 0 ? - : }{' '} + : } + {' '} {messages.Title}
{ selectedTimeCutoff={timeCutoff.selected} start={geocoder.start} /> - {destinations.map((accessibility, index) => + {destinations.map((accessibility, index) => ( { > {accessibility.name} - )} + ))} {ui.showLog && actionLog && actionLog.length > 0 && diff --git a/src/components/form.js b/src/components/form.js index 79ad469..58b0e81 100644 --- a/src/components/form.js +++ b/src/components/form.js @@ -48,7 +48,7 @@ export default ({ pointsOfInterest, selectedTimeCutoff, start -}: Props) => +}: Props) => (
{messages.Geocoding.StartTitle} @@ -108,3 +108,4 @@ export default ({
}
+) diff --git a/src/components/icon.js b/src/components/icon.js index e96caf3..fea9982 100644 --- a/src/components/icon.js +++ b/src/components/icon.js @@ -7,5 +7,6 @@ type Props = { props?: any } -export default ({className = '', type, ...props}: Props) => +export default ({className = '', type, ...props}: Props) => ( +) diff --git a/src/components/log-item/index.js b/src/components/log-item/index.js index b00a428..34c9673 100644 --- a/src/components/log-item/index.js +++ b/src/components/log-item/index.js @@ -6,7 +6,7 @@ import type {LogItem} from '../../types' const FORMAT = 'HH:mm:ss' -export default (props: LogItem) => +export default (props: LogItem) => (
{formatDate(props.createdAt, FORMAT)} @@ -15,3 +15,4 @@ export default (props: LogItem) => {props.text}
+) diff --git a/src/components/log/index.js b/src/components/log/index.js index 158c0f8..6b3b5d0 100644 --- a/src/components/log/index.js +++ b/src/components/log/index.js @@ -9,7 +9,8 @@ type Props = { items: LogItems } -export default (props: Props) => +export default (props: Props) => (
{props.items.map((item, index) => )}
+) diff --git a/src/components/map.js b/src/components/map.js index ced0b98..139bf86 100644 --- a/src/components/map.js +++ b/src/components/map.js @@ -19,10 +19,9 @@ import transitiveStyle from '../transitive-style' import type {Coordinate, Feature, MapEvent, PointsOfInterest} from '../types' -const TILE_LAYER_URL = - Browser.retina && process.env.LEAFLET_RETINA_URL - ? process.env.LEAFLET_RETINA_URL - : process.env.LEAFLET_TILE_URL +const TILE_LAYER_URL = Browser.retina && process.env.LEAFLET_RETINA_URL + ? process.env.LEAFLET_RETINA_URL + : process.env.LEAFLET_TILE_URL const startIcon = leafletIcon({ icon: 'play', @@ -161,7 +160,7 @@ export default class Map extends PureComponent { onClick={this._clickPoi} />} - {markers.map((m, index) => + {markers.map((m, index) => ( { } - )} + ))} {baseIsochrone && } @@ -216,16 +215,18 @@ export default class Map extends PureComponent { } function Isochrone ({isochrone, color}) { - return + return ( + + ) } class MapboxGeoJson extends GeoJson { diff --git a/src/components/route-card.js b/src/components/route-card.js index 34bf1c6..ad404ac 100644 --- a/src/components/route-card.js +++ b/src/components/route-card.js @@ -34,12 +34,12 @@ export default ({ showComparison, travelTime, waitTime -}: Props) => +}: Props) => (
- {bestJourney.map((segment, index) => + {bestJourney.map((segment, index) => ( - )} + ))}
{journeys.length > 1 && @@ -164,23 +166,23 @@ function Journeys ({journeys, oldTravelTime, travelTime, waitTime}) { {messages.Systems.AlternateTripsTitle}
- {alternateJourneys.map((segments, jindex) => + {alternateJourneys.map((segments, jindex) => (
{jindex + 1}. - {segments.map((segment, index) => + {segments.map((segment, index) => ( - )} + ))}
- )} + ))}
} ) } -const Segment = ({segment}) => +const Segment = ({segment}) => ( > {segment.name} +) function MetricIcon ({name}) { switch (name.toLowerCase()) { @@ -224,24 +227,25 @@ function ShowAccess ({ {messages.Systems.SelectStart} : base === ACCESSIBILITY_IS_LOADING - ? - {messages.Systems.CalculatingAccessibility} - - : keys.map((k, i) => -
- - {(base[k] | 0).toLocaleString()} {' '} - {toSpaceCase(k)} -
- )} + ? + {messages.Systems.CalculatingAccessibility} + + : keys.map((k, i) => ( +
+ + {(base[k] | 0).toLocaleString()} {' '} + {toSpaceCase(k)} +
+ ))} ) } function AccessDiffPercentage ({newAccess, originalAccess}) { const actualDiff = newAccess - originalAccess - const nume = - actualDiff > 0 ? newAccess - originalAccess : originalAccess - newAccess + const nume = actualDiff > 0 + ? newAccess - originalAccess + : originalAccess - newAccess const diff = parseInt((nume / originalAccess * 100).toFixed(1)) if (diff === 0 || isNaN(diff)) return else if (actualDiff > 0) { @@ -272,20 +276,20 @@ function ShowDiff ({keys, base, comparison}) { {messages.Systems.SelectStart} : base === ACCESSIBILITY_IS_LOADING - ? - {messages.Systems.CalculatingAccessibility} - - : keys.map((key, i) => -
- - {(base[key] | 0).toLocaleString()} {' '} - {toSpaceCase(key)} - -
- )} + ? + {messages.Systems.CalculatingAccessibility} + + : keys.map((key, i) => ( +
+ + {(base[key] | 0).toLocaleString()} {' '} + {toSpaceCase(key)} + +
+ ))} ) } diff --git a/src/utils/leaflet-icons/index.js b/src/utils/leaflet-icons/index.js index f46053d..c43cc91 100644 --- a/src/utils/leaflet-icons/index.js +++ b/src/utils/leaflet-icons/index.js @@ -61,8 +61,7 @@ const Icon = L.Icon.extend({ const options = this.options if ( - options.icon.slice(0, options.prefix.length + 1) === - options.prefix + '-' + options.icon.slice(0, options.prefix.length + 1) === options.prefix + '-' ) { iconClass = options.icon } else {