2018-02-20 09:30:36 +00:00
|
|
|
/* @flow */
|
2018-07-30 10:52:13 +00:00
|
|
|
|
2018-02-20 09:30:36 +00:00
|
|
|
|
|
|
|
import React, { Component, PropTypes } from 'react';
|
|
|
|
import { bindActionCreators } from 'redux';
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import { withRouter } from 'react-router-dom';
|
|
|
|
|
2018-05-18 16:38:02 +00:00
|
|
|
import * as TrezorConnectActions from '~/js/actions/TrezorConnectActions';
|
|
|
|
import { toggleDeviceDropdown } from '~/js/actions/WalletActions';
|
2018-04-11 10:06:46 +00:00
|
|
|
|
|
|
|
import Aside from './Aside';
|
|
|
|
|
2018-04-16 21:19:50 +00:00
|
|
|
import type { MapStateToProps, MapDispatchToProps } from 'react-redux';
|
2018-05-18 16:54:21 +00:00
|
|
|
import type { State, Dispatch } from '~/flowtype';
|
2018-04-16 21:19:50 +00:00
|
|
|
|
|
|
|
type OwnProps = {
|
2018-07-30 10:52:13 +00:00
|
|
|
|
2018-04-16 21:19:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type StateProps = {
|
|
|
|
connect: $ElementType<State, 'connect'>,
|
|
|
|
accounts: $ElementType<State, 'accounts'>,
|
|
|
|
router: $ElementType<State, 'router'>,
|
|
|
|
deviceDropdownOpened: boolean,
|
|
|
|
fiat: $ElementType<State, 'fiat'>,
|
|
|
|
localStorage: $ElementType<State, 'localStorage'>,
|
|
|
|
discovery: $ElementType<State, 'discovery'>,
|
2018-05-22 17:43:26 +00:00
|
|
|
wallet: $ElementType<State, 'wallet'>,
|
2018-05-23 08:57:36 +00:00
|
|
|
devices: $ElementType<State, 'devices'>,
|
2018-05-28 09:21:47 +00:00
|
|
|
pending: $ElementType<State, 'pending'>,
|
2018-04-16 21:19:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type DispatchProps = {
|
|
|
|
toggleDeviceDropdown: typeof toggleDeviceDropdown,
|
2018-05-16 16:30:46 +00:00
|
|
|
addAccount: typeof TrezorConnectActions.addAccount,
|
2018-04-16 21:19:50 +00:00
|
|
|
acquireDevice: typeof TrezorConnectActions.acquire,
|
|
|
|
forgetDevice: typeof TrezorConnectActions.forget,
|
|
|
|
duplicateDevice: typeof TrezorConnectActions.duplicateDevice,
|
|
|
|
gotoDeviceSettings: typeof TrezorConnectActions.gotoDeviceSettings,
|
|
|
|
onSelectDevice: typeof TrezorConnectActions.onSelectDevice,
|
|
|
|
}
|
|
|
|
|
|
|
|
export type Props = StateProps & DispatchProps;
|
|
|
|
|
2018-07-30 10:52:13 +00:00
|
|
|
const mapStateToProps: MapStateToProps<State, OwnProps, StateProps> = (state: State, own: OwnProps): StateProps => ({
|
|
|
|
connect: state.connect,
|
|
|
|
accounts: state.accounts,
|
|
|
|
router: state.router,
|
|
|
|
deviceDropdownOpened: state.wallet.dropdownOpened,
|
|
|
|
fiat: state.fiat,
|
|
|
|
localStorage: state.localStorage,
|
|
|
|
discovery: state.discovery,
|
|
|
|
wallet: state.wallet,
|
|
|
|
devices: state.devices,
|
|
|
|
pending: state.pending,
|
|
|
|
});
|
2018-02-20 09:30:36 +00:00
|
|
|
|
2018-07-30 10:52:13 +00:00
|
|
|
const mapDispatchToProps: MapDispatchToProps<Dispatch, OwnProps, DispatchProps> = (dispatch: Dispatch): DispatchProps => ({
|
|
|
|
//onAccountSelect: bindActionCreators(AccountActions.onAccountSelect, dispatch),
|
|
|
|
toggleDeviceDropdown: bindActionCreators(toggleDeviceDropdown, dispatch),
|
|
|
|
addAccount: bindActionCreators(TrezorConnectActions.addAccount, dispatch),
|
|
|
|
acquireDevice: bindActionCreators(TrezorConnectActions.acquire, dispatch),
|
|
|
|
forgetDevice: bindActionCreators(TrezorConnectActions.forget, dispatch),
|
|
|
|
duplicateDevice: bindActionCreators(TrezorConnectActions.duplicateDevice, dispatch),
|
|
|
|
gotoDeviceSettings: bindActionCreators(TrezorConnectActions.gotoDeviceSettings, dispatch),
|
|
|
|
onSelectDevice: bindActionCreators(TrezorConnectActions.onSelectDevice, dispatch),
|
|
|
|
});
|
2018-02-20 09:30:36 +00:00
|
|
|
|
2018-04-16 21:19:50 +00:00
|
|
|
// export default connect(mapStateToProps, mapDispatchToProps)(Aside);
|
2018-02-20 09:30:36 +00:00
|
|
|
export default withRouter(
|
2018-07-30 10:52:13 +00:00
|
|
|
connect(mapStateToProps, mapDispatchToProps)(Aside),
|
2018-02-20 09:30:36 +00:00
|
|
|
);
|