aboutsummaryrefslogtreecommitdiffstats
path: root/app/javascript/routes/containers/VisibleStopPoints.js
blob: 67d77af50faad87f484a164ba167abf645df1f9d (plain)
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
53
54
55
56
57
58
import actions from '../actions'
import  { connect } from 'react-redux'
import StopPointList from '../components/StopPointList'

const mapStateToProps = (state) => {
  return {
    stopPoints: state.stopPoints
  }
}

const mapDispatchToProps = (dispatch) => {
  return {
    onDeleteClick: (index) =>{
      dispatch(actions.deleteStop(index))
      dispatch(actions.closeMaps())
    },
    onMoveUpClick: (index) =>{
      dispatch(actions.moveStopUp(index))
      dispatch(actions.closeMaps())
    },
    onMoveDownClick: (index) =>{
      dispatch(actions.moveStopDown(index))
      dispatch(actions.closeMaps())
    },
    onChange: (index, text) =>{
      dispatch(actions.updateInputValue(index, text))
      dispatch(actions.closeMaps())
      dispatch(actions.toggleEdit(index))
    },
    onSelectChange: (e, index) =>{
      dispatch(actions.updateSelectValue(e, index))
      dispatch(actions.closeMaps())
    },
    onToggleMap: (index) =>{
      dispatch(actions.toggleMap(index))
    },
    onToggleEdit: (index) =>{
      dispatch(actions.toggleEdit(index))
    },
    onSelectMarker: (index, data) =>{
      dispatch(actions.selectMarker(index, data))
    },
    onUnselectMarker: (index) =>{
      dispatch(actions.unselectMarker(index))
    },
    onUpdateViaOlMap: (index, data) =>{
      dispatch(actions.updateInputValue(index, data))
      dispatch(actions.toggleMap(index))
    }
  }
}

const VisibleStopPoints = connect(
  mapStateToProps,
  mapDispatchToProps
)(StopPointList)

export default VisibleStopPoints