1
0
mirror of https://github.com/trezor/trezor-wallet synced 2025-03-10 05:36:04 +00:00
trezor-wallet/src/js/views/Device/components/LeftNavigation/Container.js

66 lines
2.6 KiB
JavaScript
Raw Normal View History

2018-02-20 09:30:36 +00:00
/* @flow */
import { toggleDeviceDropdown } from 'actions/WalletActions';
2018-02-20 09:30:36 +00:00
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { withRouter } from 'react-router-dom';
2018-08-14 12:56:47 +00:00
import * as TrezorConnectActions from 'actions/TrezorConnectActions';
2018-04-16 21:19:50 +00:00
import type { MapStateToProps, MapDispatchToProps } from 'react-redux';
2018-08-14 12:56:47 +00:00
import type { State, Dispatch } from 'flowtype';
2018-08-16 13:11:10 +00:00
import LeftNavigation from './index';
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'>,
wallet: $ElementType<State, 'wallet'>,
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,
}
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
export default withRouter(
connect(mapStateToProps, mapDispatchToProps)(LeftNavigation),
2018-02-20 09:30:36 +00:00
);