/* @flow */ 'use strict'; import React, { Component, PropTypes } from 'react'; import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; import { withRouter } from 'react-router-dom'; import * as TrezorConnectActions from '../../../actions/TrezorConnectActions'; import { toggleDeviceDropdown } from '../../../actions/WalletActions'; import Aside from './Aside'; import type { MapStateToProps, MapDispatchToProps } from 'react-redux'; import type { State, Dispatch } from '../../../flowtype'; type OwnProps = { } type StateProps = { connect: $ElementType, accounts: $ElementType, router: $ElementType, deviceDropdownOpened: boolean, fiat: $ElementType, localStorage: $ElementType, discovery: $ElementType, } type DispatchProps = { toggleDeviceDropdown: typeof toggleDeviceDropdown, addAddress: typeof TrezorConnectActions.addAddress, 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; const mapStateToProps: MapStateToProps = (state: State, own: OwnProps): StateProps => { return { connect: state.connect, accounts: state.accounts, router: state.router, deviceDropdownOpened: state.wallet.dropdownOpened, fiat: state.fiat, localStorage: state.localStorage, discovery: state.discovery }; } const mapDispatchToProps: MapDispatchToProps = (dispatch: Dispatch): DispatchProps => { return { //onAccountSelect: bindActionCreators(AccountActions.onAccountSelect, dispatch), toggleDeviceDropdown: bindActionCreators(toggleDeviceDropdown, dispatch), addAddress: bindActionCreators(TrezorConnectActions.addAddress, 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), }; } // export default connect(mapStateToProps, mapDispatchToProps)(Aside); export default withRouter( connect(mapStateToProps, mapDispatchToProps)(Aside) );