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

73 lines
2.8 KiB
JavaScript
Raw Normal View History

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';
import Aside from './Aside';
2018-04-16 21:19:50 +00:00
import type { MapStateToProps, MapDispatchToProps } from 'react-redux';
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'>,
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,
}
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
);