import { AnyAction } from 'redux' ; import { ThunkDispatch } from 'redux-thunk' ; import { connect } from 'react-redux' ; import { TooltipState } from '../../../../common/descriptor_types' ; import { TooltipControl } from './tooltip_control' ; import { closeOnClickTooltip , openOnClickTooltip , closeOnHoverTooltip , openOnHoverTooltip , } from '../../../actions' ; import { getLayerList , getOpenTooltips , getHasLockedTooltips , getGeoFieldNames , } from '../../../selectors/map_selectors' ; import { getDrawMode } from '../../../selectors/ui_selectors' ; import { DRAW_MODE } from '../../../../common/constants' ; import { MapStoreState } from '../../../reducers/store' ; function mapStateToProps ( state ) { return { layerList : getLayerList ( state ) , hasLockedTooltips : getHasLockedTooltips ( state ) , filterModeActive : getDrawMode ( state ) === DRAW_MODE . DRAW_FILTERS , drawModeActive : getDrawMode ( state ) === DRAW_MODE . DRAW_SHAPES || getDrawMode ( state ) === DRAW_MODE . DRAW_POINTS , openTooltips : getOpenTooltips ( state ) , geoFieldNames : getGeoFieldNames ( state ) , } ; } function mapDispatchToProps ( dispatch ) { return { closeOnClickTooltip ( tooltipId ) { dispatch ( closeOnClickTooltip ( tooltipId ) ) ; } , openOnClickTooltip ( tooltipState ) { dispatch ( openOnClickTooltip ( tooltipState ) ) ; } , closeOnHoverTooltip ( ) { dispatch ( closeOnHoverTooltip ( ) ) ; } , openOnHoverTooltip ( tooltipState ) { dispatch ( openOnHoverTooltip ( tooltipState ) ) ; } , } ; } const connectedTooltipControl = connect ( mapStateToProps , mapDispatchToProps ) ( TooltipControl ) ; export { connectedTooltipControl as TooltipControl } ;