pull/492/head
Vladimir Volek 5 years ago
parent 33cce4bcae
commit 98413b68e6

@ -4,39 +4,34 @@ import { connect } from 'react-redux';
import { injectIntl } from 'react-intl'; import { injectIntl } from 'react-intl';
import { showAddress } from 'actions/ReceiveActions'; import { showAddress } from 'actions/ReceiveActions';
import type { MapStateToProps, MapDispatchToProps } from 'react-redux';
import type { State, Dispatch } from 'flowtype'; import type { State, Dispatch } from 'flowtype';
import Receive from './index'; import Receive from './index';
type OwnProps = { type OwnProps = {|
intl: any, intl: any,
}; |};
type StateProps = { type StateProps = {|
selectedAccount: $ElementType<State, 'selectedAccount'>, selectedAccount: $ElementType<State, 'selectedAccount'>,
receive: $ElementType<State, 'receive'>, receive: $ElementType<State, 'receive'>,
modal: $ElementType<State, 'modal'>, modal: $ElementType<State, 'modal'>,
wallet: $ElementType<State, 'wallet'>, wallet: $ElementType<State, 'wallet'>,
}; |};
type DispatchProps = { type DispatchProps = {|
showAddress: typeof showAddress, showAddress: typeof showAddress,
}; |};
export type Props = OwnProps & StateProps & DispatchProps; export type Props = {| ...OwnProps, ...StateProps, ...DispatchProps |};
const mapStateToProps: MapStateToProps<State, OwnProps, StateProps> = ( const mapStateToProps = (state: State): StateProps => ({
state: State
): StateProps => ({
selectedAccount: state.selectedAccount, selectedAccount: state.selectedAccount,
receive: state.receive, receive: state.receive,
modal: state.modal, modal: state.modal,
wallet: state.wallet, wallet: state.wallet,
}); });
const mapDispatchToProps: MapDispatchToProps<Dispatch, OwnProps, DispatchProps> = ( const mapDispatchToProps = (dispatch: Dispatch): DispatchProps => ({
dispatch: Dispatch
): DispatchProps => ({
showAddress: bindActionCreators(showAddress, dispatch), showAddress: bindActionCreators(showAddress, dispatch),
}); });

@ -6,32 +6,29 @@ import { injectIntl } from 'react-intl';
import SendFormActions from 'actions/ripple/SendFormActions'; import SendFormActions from 'actions/ripple/SendFormActions';
import { openQrModal } from 'actions/ModalActions'; import { openQrModal } from 'actions/ModalActions';
import type { MapStateToProps, MapDispatchToProps } from 'react-redux';
import type { State, Dispatch } from 'flowtype'; import type { State, Dispatch } from 'flowtype';
import AccountSend from './index'; import AccountSend from './index';
type OwnProps = { type OwnProps = {|
intl: any, intl: any,
}; |};
export type StateProps = { export type StateProps = {|
selectedAccount: $ElementType<State, 'selectedAccount'>, selectedAccount: $ElementType<State, 'selectedAccount'>,
sendForm: $ElementType<State, 'sendFormRipple'>, sendForm: $ElementType<State, 'sendFormRipple'>,
wallet: $ElementType<State, 'wallet'>, wallet: $ElementType<State, 'wallet'>,
fiat: $ElementType<State, 'fiat'>, fiat: $ElementType<State, 'fiat'>,
localStorage: $ElementType<State, 'localStorage'>, localStorage: $ElementType<State, 'localStorage'>,
}; |};
export type DispatchProps = { export type DispatchProps = {|
sendFormActions: typeof SendFormActions, sendFormActions: typeof SendFormActions,
openQrModal: typeof openQrModal, openQrModal: typeof openQrModal,
}; |};
export type Props = OwnProps & StateProps & DispatchProps; export type Props = OwnProps & StateProps & DispatchProps;
const mapStateToProps: MapStateToProps<State, OwnProps, StateProps> = ( const mapStateToProps = (state: State): StateProps => ({
state: State
): StateProps => ({
selectedAccount: state.selectedAccount, selectedAccount: state.selectedAccount,
sendForm: state.sendFormRipple, sendForm: state.sendFormRipple,
wallet: state.wallet, wallet: state.wallet,
@ -39,10 +36,9 @@ const mapStateToProps: MapStateToProps<State, OwnProps, StateProps> = (
localStorage: state.localStorage, localStorage: state.localStorage,
}); });
const mapDispatchToProps: MapDispatchToProps<Dispatch, OwnProps, DispatchProps> = ( const mapDispatchToProps = (dispatch: Dispatch): DispatchProps => ({
dispatch: Dispatch
): DispatchProps => ({
sendFormActions: bindActionCreators(SendFormActions, dispatch), sendFormActions: bindActionCreators(SendFormActions, dispatch),
openQrModal: bindActionCreators(openQrModal, dispatch),
}); });
export default injectIntl( export default injectIntl(

@ -2,37 +2,32 @@
import { bindActionCreators } from 'redux'; import { bindActionCreators } from 'redux';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { injectIntl } from 'react-intl'; import { injectIntl } from 'react-intl';
import type { MapStateToProps, MapDispatchToProps } from 'react-redux';
import * as TokenActions from 'actions/TokenActions'; import * as TokenActions from 'actions/TokenActions';
import type { State, Dispatch } from 'flowtype'; import type { State, Dispatch } from 'flowtype';
import Summary from './index'; import Summary from './index';
type OwnProps = { type OwnProps = {|
intl: any, intl: any,
}; |};
type StateProps = { type StateProps = {|
selectedAccount: $ElementType<State, 'selectedAccount'>, selectedAccount: $ElementType<State, 'selectedAccount'>,
summary: $ElementType<State, 'summary'>, summary: $ElementType<State, 'summary'>,
wallet: $ElementType<State, 'wallet'>, wallet: $ElementType<State, 'wallet'>,
tokens: $ElementType<State, 'tokens'>, tokens: $ElementType<State, 'tokens'>,
fiat: $ElementType<State, 'fiat'>, fiat: $ElementType<State, 'fiat'>,
localStorage: $ElementType<State, 'localStorage'>, localStorage: $ElementType<State, 'localStorage'>,
}; |};
type DispatchProps = { type DispatchProps = {|
addToken: typeof TokenActions.add, addToken: typeof TokenActions.add,
loadTokens: typeof TokenActions.load, loadTokens: typeof TokenActions.load,
removeToken: typeof TokenActions.remove, removeToken: typeof TokenActions.remove,
}; |};
export type Props = OwnProps & StateProps & DispatchProps; export type Props = OwnProps & StateProps & DispatchProps;
const mapStateToProps: MapStateToProps<State, OwnProps, StateProps> = ( const mapStateToProps = (state: State): StateProps => ({
state: State
): StateProps => ({
selectedAccount: state.selectedAccount, selectedAccount: state.selectedAccount,
summary: state.summary, summary: state.summary,
wallet: state.wallet, wallet: state.wallet,
@ -41,9 +36,7 @@ const mapStateToProps: MapStateToProps<State, OwnProps, StateProps> = (
localStorage: state.localStorage, localStorage: state.localStorage,
}); });
const mapDispatchToProps: MapDispatchToProps<Dispatch, OwnProps, DispatchProps> = ( const mapDispatchToProps = (dispatch: Dispatch): DispatchProps => ({
dispatch: Dispatch
): DispatchProps => ({
addToken: bindActionCreators(TokenActions.add, dispatch), addToken: bindActionCreators(TokenActions.add, dispatch),
loadTokens: bindActionCreators(TokenActions.load, dispatch), loadTokens: bindActionCreators(TokenActions.load, dispatch),
removeToken: bindActionCreators(TokenActions.remove, dispatch), removeToken: bindActionCreators(TokenActions.remove, dispatch),

Loading…
Cancel
Save