Skip to content

Commit 4e61963

Browse files
committed
fix(leaflet): leaflet 1.0 fixes
1 parent 3dfffa4 commit 4e61963

File tree

9 files changed

+42
-25
lines changed

9 files changed

+42
-25
lines changed

lib/editor/components/FeedInfoPanel.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export default class FeedInfoPanel extends Component {
4949
position: 'absolute',
5050
right: this.state.right,
5151
bottom: 20,
52+
zIndex: 500,
5253
borderRadius: '5px',
5354
// height: panelHeight,
5455
width: `${panelWidth}px`

lib/editor/components/GtfsEditor.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import ActiveTimetableEditor from '../containers/ActiveTimetableEditor'
1414
import ActiveFeedInfoPanel from '../containers/ActiveFeedInfoPanel'
1515

1616
import { getConfigProperty } from '../../common/util/config'
17+
import { getEntityName } from '../util/gtfs'
18+
import { gtfsIcons } from '../util/ui'
1719

1820
export default class GtfsEditor extends Component {
1921
static propTypes = {
@@ -100,6 +102,15 @@ export default class GtfsEditor extends Component {
100102
showConfirmModal (props) {
101103
this.refs.confirmModal.open(props)
102104
}
105+
getEditorTitle () {
106+
let title = `${getConfigProperty('application.title')} - GTFS Editor`
107+
if (this.props.activeEntity) {
108+
title += ` - ${getEntityName(this.props.activeComponent, this.props.activeEntity)}`
109+
} else if (this.props.activeComponent) {
110+
title += ` - ${gtfsIcons.find(i => i.id === this.props.activeComponent).label}`
111+
}
112+
return title
113+
}
103114
getMapOffset (activeComponent, dWidth, activeEntityId, lWidth) {
104115
return activeComponent === 'feedinfo'
105116
? dWidth
@@ -161,7 +172,7 @@ export default class GtfsEditor extends Component {
161172
: null
162173
return (
163174
<div>
164-
<Title>{`${getConfigProperty('application.title')} - GTFS Editor`}</Title>
175+
<Title>{this.getEditorTitle()}</Title>
165176
<EditorSidebar
166177
activeComponent={activeComponent}
167178
expanded={sidebarExpanded}

lib/editor/components/map/EditorMap.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { Component } from 'react'
2-
import { Map, ZoomControl, GeoJson, FeatureGroup } from 'react-leaflet'
2+
import { Map, ZoomControl, GeoJSON, FeatureGroup } from 'react-leaflet'
33
import { shallowEqual } from 'react-pure-render'
44

55
import EditorMapLayersControl from './EditorMapLayersControl'
@@ -278,7 +278,7 @@ export default class EditorMap extends Component {
278278
stops={tableData.stop} />
279279
{!hidden && this.getMapComponents(activeComponent, activeEntity, subEntityId, activePattern, tableData.stop, editSettings, mapState)}
280280
{mapState.routesGeojson &&
281-
<GeoJson
281+
<GeoJSON
282282
key={mapState.routesGeojson.key}
283283
data={mapState.routesGeojson} />
284284
}

lib/editor/components/map/RouteLayer.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ a layer for drawing route alignments, adapted from StopLayer
44

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

7-
import { BaseTileLayer } from 'react-leaflet'
8-
import { TileLayer } from 'leaflet'
7+
import { GridLayer } from 'react-leaflet'
8+
import { Canvas } from 'leaflet'
99

10-
export default class StopLayer extends BaseTileLayer {
10+
export default class RouteLayer extends GridLayer {
1111
static defaultProps = {
1212
minZoom: MIN_ZOOM
1313
}
1414

1515
componentWillMount () {
1616
super.componentWillMount()
17-
this.leafletElement = new TileLayer.Canvas({
17+
this.leafletElement = new Canvas({
1818
// retina: '@2x',
1919
detectRetina: true
2020
})

lib/gtfs/components/GtfsMap.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { Component, PropTypes } from 'react'
22
import { shallowEqual } from 'react-pure-render'
33
import { Browser } from 'leaflet'
4-
import { Map, Marker, TileLayer, GeoJson, FeatureGroup, Rectangle } from 'react-leaflet'
4+
import { Map, Marker, TileLayer, GeoJSON, FeatureGroup, Rectangle } from 'react-leaflet'
55

66
import { getFeedId } from '../../common/util/modules'
77
import PatternGeoJson from './PatternGeoJson'
@@ -116,7 +116,7 @@ export default class GtfsMap extends Component {
116116
comps = this.props.version.isochrones.features.map((iso, index) => {
117117
if (iso.properties.time !== bandTime) return null
118118
return (
119-
<GeoJson
119+
<GeoJSON
120120
key={Math.random()}
121121
data={{type: 'MultiPolygon', coordinates: iso.geometry.coordinates}}
122122
color={'blue'}

lib/gtfs/components/PatternGeoJson.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import Icon from '@conveyal/woonerf/components/icon'
22
import React, {PropTypes} from 'react'
3-
import { GeoJson, Popup } from 'react-leaflet'
3+
import { GeoJSON, Popup } from 'react-leaflet'
44
import { Button } from 'react-bootstrap'
55

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

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

11-
export default class PatternGeoJson extends GeoJson {
11+
export default class PatternGeoJson extends GeoJSON {
1212
static propTypes = {
1313
pattern: PropTypes.object,
1414
index: PropTypes.number,
@@ -54,7 +54,7 @@ export default class PatternGeoJson extends GeoJson {
5454
</Popup>
5555
)
5656
return (
57-
<GeoJson
57+
<GeoJSON
5858
color={COLORS[index % (COLORS.length - 1)]}
5959
key={pattern.pattern_id}
6060
data={pattern.geometry}
@@ -64,7 +64,7 @@ export default class PatternGeoJson extends GeoJson {
6464
}}
6565
>
6666
{popup}
67-
</GeoJson>
67+
</GeoJSON>
6868
)
6969
}
7070
}

lib/gtfs/components/gtfsmapsearch.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,16 @@ export default class GtfsMapSearch extends Component {
6161
}
6262
return (
6363
<div>
64-
<GtfsSearch
65-
ref='mapSearch'
66-
feeds={this.props.feeds}
67-
limit={100}
68-
placeholder={this.props.placeholder}
69-
onChange={(input) => this.handleSelection(input)}
70-
entities={this.state.searching}
71-
/>
64+
<div className='gtfs-map-select'>
65+
<GtfsSearch
66+
ref='mapSearch'
67+
feeds={this.props.feeds}
68+
limit={100}
69+
placeholder={this.props.placeholder}
70+
onChange={(input) => this.handleSelection(input)}
71+
entities={this.state.searching}
72+
/>
73+
</div>
7274
<ul style={{marginBottom: 0}} className='list-inline'>
7375
<li style={{width: '50%'}} className='text-left'>
7476
<Button

lib/index.css

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11

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

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

17-
@import url(lib/common/style.css);
18-
@import url(lib/alerts/style.css);
16+
@import url(lib/style.css);

lib/style.css

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
font-weight: bold;
105105
text-align: center;
106106
line-height: 120%;
107-
background-image: url(../assets/application_icon.png);
107+
background-image: url(assets/application_icon.png);
108108
background-size: contain;
109109
}
110110

@@ -123,3 +123,8 @@
123123
.react-bs-table-tool-bar {
124124
margin: 0px;
125125
}
126+
127+
128+
.gtfs-map-select > .Select > .Select-menu-outer {
129+
z-index: 2000;
130+
}

0 commit comments

Comments
 (0)