import { AnyAction } from 'redux' ; import { ThunkDispatch } from 'redux-thunk' ; import { connect } from 'react-redux' ; import { ToolsControl } from './tools_control' ; import { setDrawMode , updateDrawState } from '../../../actions' ; import { MapStoreState } from '../../../reducers/store' ; import { DrawState } from '../../../../common/descriptor_types' ; import { DRAW_MODE } from '../../../../common/constants' ; import { getDrawMode } from '../../../selectors/ui_selectors' ; function mapStateToProps ( state ) { const drawMode = getDrawMode ( state ) ; return { filterModeActive : drawMode === DRAW_MODE . DRAW_FILTERS , } ; } function mapDispatchToProps ( dispatch ) { return { cancelDraw : ( ) => { dispatch ( updateDrawState ( null ) ) ; dispatch ( setDrawMode ( DRAW_MODE . NONE ) ) ; } , initiateDraw : ( drawState ) => { dispatch ( setDrawMode ( DRAW_MODE . DRAW_FILTERS ) ) ; dispatch ( updateDrawState ( drawState ) ) ; } , } ; } const connectedToolsControl = connect ( mapStateToProps , mapDispatchToProps ) ( ToolsControl ) ; export { connectedToolsControl as ToolsControl } ;