2018-10-11 11:06:16 +00:00
|
|
|
/* @flow */
|
|
|
|
import { bindActionCreators } from 'redux';
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import { withRouter } from 'react-router-dom';
|
|
|
|
|
|
|
|
import ModalActions from 'actions/ModalActions';
|
|
|
|
import ReceiveActions from 'actions/ReceiveActions';
|
|
|
|
|
|
|
|
import type { MapStateToProps, MapDispatchToProps } from 'react-redux';
|
|
|
|
import type { State, Dispatch } from 'flowtype';
|
|
|
|
|
|
|
|
import Modal from './index';
|
|
|
|
|
2018-12-05 14:10:38 +00:00
|
|
|
type OwnProps = {};
|
2018-10-11 11:06:16 +00:00
|
|
|
|
|
|
|
type StateProps = {
|
|
|
|
modal: $ElementType<State, 'modal'>,
|
|
|
|
accounts: $ElementType<State, 'accounts'>,
|
|
|
|
devices: $ElementType<State, 'devices'>,
|
|
|
|
connect: $ElementType<State, 'connect'>,
|
|
|
|
selectedAccount: $ElementType<State, 'selectedAccount'>,
|
2018-12-05 13:40:28 +00:00
|
|
|
sendFormEthereum: $ElementType<State, 'sendFormEthereum'>,
|
|
|
|
sendFormRipple: $ElementType<State, 'sendFormRipple'>,
|
2018-10-11 11:06:16 +00:00
|
|
|
receive: $ElementType<State, 'receive'>,
|
|
|
|
localStorage: $ElementType<State, 'localStorage'>,
|
|
|
|
wallet: $ElementType<State, 'wallet'>,
|
2018-12-05 14:10:38 +00:00
|
|
|
};
|
2018-10-11 11:06:16 +00:00
|
|
|
|
|
|
|
type DispatchProps = {
|
|
|
|
modalActions: typeof ModalActions,
|
|
|
|
receiveActions: typeof ReceiveActions,
|
2018-12-05 14:10:38 +00:00
|
|
|
};
|
2018-10-11 11:06:16 +00:00
|
|
|
|
|
|
|
export type Props = StateProps & DispatchProps;
|
|
|
|
|
2019-03-04 12:33:02 +00:00
|
|
|
const mapStateToProps: MapStateToProps<State, OwnProps, StateProps> = (
|
|
|
|
state: State
|
|
|
|
): StateProps => ({
|
2018-10-11 11:06:16 +00:00
|
|
|
modal: state.modal,
|
|
|
|
accounts: state.accounts,
|
|
|
|
devices: state.devices,
|
|
|
|
connect: state.connect,
|
|
|
|
selectedAccount: state.selectedAccount,
|
2018-12-05 13:40:28 +00:00
|
|
|
sendFormEthereum: state.sendFormEthereum,
|
|
|
|
sendFormRipple: state.sendFormRipple,
|
2018-10-11 11:06:16 +00:00
|
|
|
receive: state.receive,
|
|
|
|
localStorage: state.localStorage,
|
|
|
|
wallet: state.wallet,
|
|
|
|
});
|
|
|
|
|
2019-03-04 12:33:02 +00:00
|
|
|
const mapDispatchToProps: MapDispatchToProps<Dispatch, OwnProps, DispatchProps> = (
|
|
|
|
dispatch: Dispatch
|
|
|
|
): DispatchProps => ({
|
2018-10-11 11:06:16 +00:00
|
|
|
modalActions: bindActionCreators(ModalActions, dispatch),
|
|
|
|
receiveActions: bindActionCreators(ReceiveActions, dispatch),
|
|
|
|
});
|
|
|
|
|
|
|
|
// export default connect(mapStateToProps, mapDispatchToProps)(Modal);
|
|
|
|
export default withRouter(
|
2019-03-04 12:33:02 +00:00
|
|
|
connect(
|
|
|
|
mapStateToProps,
|
|
|
|
mapDispatchToProps
|
|
|
|
)(Modal)
|
|
|
|
);
|