Browse Source

Walletnav prop refactor

all-modes
Miika Turunen 8 years ago
parent
commit
edd82826b2
  1. 25
      react/src/components/dashboard/walletsNav/walletsNav.js
  2. 8
      react/src/components/dashboard/walletsNav/walletsNav.render.js

25
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);

8
react/src/components/dashboard/walletsNav/walletsNav.render.js

@ -24,15 +24,15 @@ export const WalletsNavWithWalletRender = function() {
return (
<div>
<div
className={ 'page-header page-header-bordered header-easydex padding-bottom-' + (this.state.nativeOnly ? '40' : '20') }
className={ 'page-header page-header-bordered header-easydex padding-bottom-' + (this.props.nativeOnly ? '40' : '20') }
id="header-dashboard"
style={{ marginBottom: this.props.ActiveCoin.mode === 'basilisk' ? '30px' : '0' }}>
<ol className={ this.state.nativeOnly ? 'hide' : 'breadcrumb' }>
<ol className={ this.props.nativeOnly ? 'hide' : 'breadcrumb' }>
<strong>{ translate('INDEX.MY') } { this.props && this.props.ActiveCoin ? this.props.ActiveCoin.coin : '-' } { translate('INDEX.ADDRESS') }: </strong>
{ 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] : '-' }
<button
className="btn btn-default btn-xs clipboard-edexaddr"
onClick={ () => this.copyMyAddress(this.props.Dashboard.activeHandle[this.props.ActiveCoin.coin]) }>
onClick={ () => this.copyMyAddress(this.props.activeHandle[this.props.ActiveCoin.coin]) }>
<i className="icon wb-copy"></i> { translate('INDEX.COPY') }
</button>
</ol>

Loading…
Cancel
Save