File size: 942 Bytes
597ee18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import {connect} from 'react-redux'
import Map from './Map'
import {newGeometry, removeGeometry} from '../../actions/SearchParamActions'
import {
  clearCollections,
  triggerSearch,
} from '../../actions/SearchRequestActions'
import {showCollections} from '../../actions/FlowActions'

import {withRouter} from 'react-router'

const mapStateToProps = state => {
  const {geoJSON} = state.behavior.search
  return {
    geoJsonSelection: geoJSON,
    showMap: state.ui.layout.showMap,
  }
}

const mapDispatchToProps = (dispatch, ownProps) => {
  return {
    handleNewGeometry: geoJSON => dispatch(newGeometry(geoJSON)),
    removeGeometry: () => dispatch(removeGeometry()),
    submit: () => {
      dispatch(clearCollections())
      dispatch(triggerSearch())
      dispatch(showCollections(ownProps.history))
    },
  }
}

const MapContainer = withRouter(
  connect(mapStateToProps, mapDispatchToProps)(Map)
)

export default MapContainer