From edd82826b27efd4b4cbe178b45f8907f7703f9ba Mon Sep 17 00:00:00 2001 From: Miika Turunen Date: Wed, 9 Aug 2017 18:47:59 +0300 Subject: [PATCH] Walletnav prop refactor --- .../dashboard/walletsNav/walletsNav.js | 25 ++++++++++++++----- .../dashboard/walletsNav/walletsNav.render.js | 8 +++--- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/react/src/components/dashboard/walletsNav/walletsNav.js b/react/src/components/dashboard/walletsNav/walletsNav.js index 4b17767..0c6ed43 100644 --- a/react/src/components/dashboard/walletsNav/walletsNav.js +++ b/react/src/components/dashboard/walletsNav/walletsNav.js @@ -1,4 +1,5 @@ import React from 'react'; +import { connect } from 'react-redux'; import { copyCoinAddress, iguanaEdexBalance, @@ -15,11 +16,8 @@ import { } from './walletsNav.render'; class WalletsNav extends React.Component { - constructor(props) { - super(props); - this.state = { - nativeOnly: Config.iguanaLessMode, - }; + constructor() { + super(); this.toggleSendReceiveCoinForms = this.toggleSendReceiveCoinForms.bind(this); this.toggleNativeWalletInfo = this.toggleNativeWalletInfo.bind(this); this.toggleNativeWalletTransactions = this.toggleNativeWalletTransactions.bind(this); @@ -124,4 +122,19 @@ class WalletsNav extends React.Component { } } -export default WalletsNav; +const mapStateToProps = (state) => { + return { + ActiveCoin: { + coin: state.ActiveCoin.coin, + mode: state.ActiveCoin.mode, + send: state.ActiveCoin.send, + receive: state.ActiveCoin.receive, + balance: state.ActiveCoin.balance, + }, + ActiveHandle: state.Dashboard.activeHandle, + nativeOnly: Config.iguanaLessMode, + }; + +}; + +export default connect(mapStateToProps)(WalletsNav); diff --git a/react/src/components/dashboard/walletsNav/walletsNav.render.js b/react/src/components/dashboard/walletsNav/walletsNav.render.js index 67d43a7..9b21f8b 100644 --- a/react/src/components/dashboard/walletsNav/walletsNav.render.js +++ b/react/src/components/dashboard/walletsNav/walletsNav.render.js @@ -24,15 +24,15 @@ export const WalletsNavWithWalletRender = function() { return (
-
    +
      { translate('INDEX.MY') } { this.props && this.props.ActiveCoin ? this.props.ActiveCoin.coin : '-' } { translate('INDEX.ADDRESS') }: - { this.props && this.props.Dashboard && this.props.Dashboard.activeHandle ? this.props.Dashboard.activeHandle[this.props.ActiveCoin.coin] : '-' } + { this.props.activeHandle ? this.props.activeHandle[this.props.ActiveCoin.coin] : '-' }