import { AnyAction } from 'redux' ; import { connect } from 'react-redux' ; import { ThunkDispatch } from 'redux-thunk' ; import { FLYOUT_STATE } from '../../reducers/ui' ; import { MapStoreState } from '../../reducers/store' ; import { MapSettingsPanel } from './map_settings_panel' ; import { rollbackMapSettings , updateMapSetting , updateFlyout } from '../../actions' ; import { getMapCenter , getMapSettings , getMapZoom , hasMapSettingsChanges , } from '../../selectors/map_selectors' ; function mapStateToProps ( state ) { return { center : getMapCenter ( state ) , hasMapSettingsChanges : hasMapSettingsChanges ( state ) , settings : getMapSettings ( state ) , zoom : getMapZoom ( state ) , } ; } function mapDispatchToProps ( dispatch ) { return { cancelChanges : ( ) => { dispatch ( rollbackMapSettings ( ) ) ; dispatch ( updateFlyout ( FLYOUT_STATE . NONE ) ) ; } , keepChanges : ( ) => { dispatch ( updateFlyout ( FLYOUT_STATE . NONE ) ) ; } , updateMapSetting : ( settingKey , settingValue ) => { dispatch ( updateMapSetting ( settingKey , settingValue ) ) ; } , } ; } const connectedMapSettingsPanel = connect ( mapStateToProps , mapDispatchToProps ) ( MapSettingsPanel ) ; export { connectedMapSettingsPanel as MapSettingsPanel } ;