Skip to content

Commit

Permalink
fix(leaflet): leaflet 1.0 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
landonreed committed Mar 6, 2017
1 parent 3dfffa4 commit 4e61963
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 25 deletions.
1 change: 1 addition & 0 deletions lib/editor/components/FeedInfoPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export default class FeedInfoPanel extends Component {
position: 'absolute',
right: this.state.right,
bottom: 20,
zIndex: 500,
borderRadius: '5px',
// height: panelHeight,
width: `${panelWidth}px`
Expand Down
13 changes: 12 additions & 1 deletion lib/editor/components/GtfsEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import ActiveTimetableEditor from '../containers/ActiveTimetableEditor'
import ActiveFeedInfoPanel from '../containers/ActiveFeedInfoPanel'

import { getConfigProperty } from '../../common/util/config'
import { getEntityName } from '../util/gtfs'
import { gtfsIcons } from '../util/ui'

export default class GtfsEditor extends Component {
static propTypes = {
Expand Down Expand Up @@ -100,6 +102,15 @@ export default class GtfsEditor extends Component {
showConfirmModal (props) {
this.refs.confirmModal.open(props)
}
getEditorTitle () {
let title = `${getConfigProperty('application.title')} - GTFS Editor`
if (this.props.activeEntity) {
title += ` - ${getEntityName(this.props.activeComponent, this.props.activeEntity)}`
} else if (this.props.activeComponent) {
title += ` - ${gtfsIcons.find(i => i.id === this.props.activeComponent).label}`
}
return title
}
getMapOffset (activeComponent, dWidth, activeEntityId, lWidth) {
return activeComponent === 'feedinfo'
? dWidth
Expand Down Expand Up @@ -161,7 +172,7 @@ export default class GtfsEditor extends Component {
: null
return (
<div>
<Title>{`${getConfigProperty('application.title')} - GTFS Editor`}</Title>
<Title>{this.getEditorTitle()}</Title>
<EditorSidebar
activeComponent={activeComponent}
expanded={sidebarExpanded}
Expand Down
4 changes: 2 additions & 2 deletions lib/editor/components/map/EditorMap.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Component } from 'react'
import { Map, ZoomControl, GeoJson, FeatureGroup } from 'react-leaflet'
import { Map, ZoomControl, GeoJSON, FeatureGroup } from 'react-leaflet'
import { shallowEqual } from 'react-pure-render'

import EditorMapLayersControl from './EditorMapLayersControl'
Expand Down Expand Up @@ -278,7 +278,7 @@ export default class EditorMap extends Component {
stops={tableData.stop} />
{!hidden && this.getMapComponents(activeComponent, activeEntity, subEntityId, activePattern, tableData.stop, editSettings, mapState)}
{mapState.routesGeojson &&
<GeoJson
<GeoJSON
key={mapState.routesGeojson.key}
data={mapState.routesGeojson} />
}
Expand Down
8 changes: 4 additions & 4 deletions lib/editor/components/map/RouteLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ a layer for drawing route alignments, adapted from StopLayer

const MIN_ZOOM = 1 // don't draw stops below this zoom

import { BaseTileLayer } from 'react-leaflet'
import { TileLayer } from 'leaflet'
import { GridLayer } from 'react-leaflet'
import { Canvas } from 'leaflet'

export default class StopLayer extends BaseTileLayer {
export default class RouteLayer extends GridLayer {
static defaultProps = {
minZoom: MIN_ZOOM
}

componentWillMount () {
super.componentWillMount()
this.leafletElement = new TileLayer.Canvas({
this.leafletElement = new Canvas({
// retina: '@2x',
detectRetina: true
})
Expand Down
4 changes: 2 additions & 2 deletions lib/gtfs/components/GtfsMap.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { Component, PropTypes } from 'react'
import { shallowEqual } from 'react-pure-render'
import { Browser } from 'leaflet'
import { Map, Marker, TileLayer, GeoJson, FeatureGroup, Rectangle } from 'react-leaflet'
import { Map, Marker, TileLayer, GeoJSON, FeatureGroup, Rectangle } from 'react-leaflet'

import { getFeedId } from '../../common/util/modules'
import PatternGeoJson from './PatternGeoJson'
Expand Down Expand Up @@ -116,7 +116,7 @@ export default class GtfsMap extends Component {
comps = this.props.version.isochrones.features.map((iso, index) => {
if (iso.properties.time !== bandTime) return null
return (
<GeoJson
<GeoJSON
key={Math.random()}
data={{type: 'MultiPolygon', coordinates: iso.geometry.coordinates}}
color={'blue'}
Expand Down
8 changes: 4 additions & 4 deletions lib/gtfs/components/PatternGeoJson.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import Icon from '@conveyal/woonerf/components/icon'
import React, {PropTypes} from 'react'
import { GeoJson, Popup } from 'react-leaflet'
import { GeoJSON, Popup } from 'react-leaflet'
import { Button } from 'react-bootstrap'

import { getRouteName } from '../../editor/util/gtfs'
import { getFeed } from '../../common/util/modules'

const COLORS = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99', '#e31a1c', '#fdbf6f', '#ff7f00', '#cab2d6', '#6a3d9a']

export default class PatternGeoJson extends GeoJson {
export default class PatternGeoJson extends GeoJSON {
static propTypes = {
pattern: PropTypes.object,
index: PropTypes.number,
Expand Down Expand Up @@ -54,7 +54,7 @@ export default class PatternGeoJson extends GeoJson {
</Popup>
)
return (
<GeoJson
<GeoJSON
color={COLORS[index % (COLORS.length - 1)]}
key={pattern.pattern_id}
data={pattern.geometry}
Expand All @@ -64,7 +64,7 @@ export default class PatternGeoJson extends GeoJson {
}}
>
{popup}
</GeoJson>
</GeoJSON>
)
}
}
18 changes: 10 additions & 8 deletions lib/gtfs/components/gtfsmapsearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,16 @@ export default class GtfsMapSearch extends Component {
}
return (
<div>
<GtfsSearch
ref='mapSearch'
feeds={this.props.feeds}
limit={100}
placeholder={this.props.placeholder}
onChange={(input) => this.handleSelection(input)}
entities={this.state.searching}
/>
<div className='gtfs-map-select'>
<GtfsSearch
ref='mapSearch'
feeds={this.props.feeds}
limit={100}
placeholder={this.props.placeholder}
onChange={(input) => this.handleSelection(input)}
entities={this.state.searching}
/>
</div>
<ul style={{marginBottom: 0}} className='list-inline'>
<li style={{width: '50%'}} className='text-left'>
<Button
Expand Down
4 changes: 1 addition & 3 deletions lib/index.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

@import url(node_modules/font-awesome/css/font-awesome.css);
@import url(node_modules/leaflet/dist/leaflet.css);
@import url(node_modules/leaflet-draw/dist/leaflet.draw.css);

@import url(node_modules/bootstrap/dist/css/bootstrap.min.css);
@import url(node_modules/react-bootstrap-table/dist/react-bootstrap-table.min.css);
Expand All @@ -14,5 +13,4 @@
@import url(node_modules/rc-slider/assets/index.css);
@import url(node_modules/react-toggle/style.css);

@import url(lib/common/style.css);
@import url(lib/alerts/style.css);
@import url(lib/style.css);
7 changes: 6 additions & 1 deletion lib/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
font-weight: bold;
text-align: center;
line-height: 120%;
background-image: url(../assets/application_icon.png);
background-image: url(assets/application_icon.png);
background-size: contain;
}

Expand All @@ -123,3 +123,8 @@
.react-bs-table-tool-bar {
margin: 0px;
}


.gtfs-map-select > .Select > .Select-menu-outer {
z-index: 2000;
}

0 comments on commit 4e61963

Please sign in to comment.