-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathremove-stops.js
52 lines (46 loc) · 1.41 KB
/
remove-stops.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/** Remove stops from a route */
import React, {Component, PropTypes} from 'react'
import SelectFeedRouteAndPatterns from './select-feed-route-and-patterns'
import SelectStops from './select-stops'
export default class RemoveStops extends Component {
static propTypes = {
feeds: PropTypes.array.isRequired,
feedsById: PropTypes.object.isRequired,
modification: PropTypes.object.isRequired,
replaceModification: PropTypes.func.isRequired,
setMapState: PropTypes.func.isRequired
}
onPatternSelectorChange = ({feed, routes, trips}) => {
const {modification, replaceModification} = this.props
replaceModification({
...modification,
feed,
routes,
trips,
stops: []
})
}
render () {
const {feeds, feedsById, modification, replaceModification, setMapState} = this.props
const selectedFeed = feedsById[modification.feed]
return (
<form>
<SelectFeedRouteAndPatterns
feeds={feeds}
onChange={this.onPatternSelectorChange}
routes={modification.routes}
selectedFeed={selectedFeed}
trips={modification.trips}
/>
{modification.routes && selectedFeed &&
<SelectStops
feed={selectedFeed}
modification={modification}
replaceModification={replaceModification}
setMapState={setMapState}
/>
}
</form>
)
}
}