Browse Source

SendCoin prop refactor

all-modes
Miika Turunen 8 years ago
parent
commit
a45a693590
  1. 2
      react/src/components/dashboard/main/dashboard.render.js
  2. 27
      react/src/components/dashboard/sendCoin/sendCoin.js

2
react/src/components/dashboard/main/dashboard.render.js

@ -30,7 +30,7 @@ const DashboardRender = function() {
<WalletsNav />
{ !this.isNativeMode() && <WalletsProgress /> }
{ !this.isNativeMode() && <WalletsBalance />}
<SendCoin {...this.props} />
<SendCoin />
{ !this.isNativeMode() && <ReceiveCoin {...this.props.ActiveCoin} /> }
{ !this.isNativeMode() && <WalletsData {...this.props} /> }
<WalletsTxInfo {...this.props} />

27
react/src/components/dashboard/sendCoin/sendCoin.js

@ -1,4 +1,5 @@
import React from 'react';
import { connect } from 'react-redux';
import Config from '../../../config';
import { translate } from '../../../translate/translate';
import { checkTimestamp } from '../../../util/time';
@ -41,7 +42,7 @@ class SendCoin extends React.Component {
super(props);
this.state = {
currentStep: 0,
sendFrom: this.props.Dashboard && this.props.Dashboard.activeHandle ? this.props.Dashboard.activeHandle[this.props.ActiveCoin.coin] : null,
sendFrom: this.props.Dashboard.activeHandle ? this.props.Dashboard.activeHandle[this.props.ActiveCoin.coin] : null,
sendFromAmount: 0,
sendTo: '',
sendToOA: null,
@ -768,4 +769,26 @@ class SendCoin extends React.Component {
}
}
export default SendCoin;
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,
cache: state.ActiveCoin.cache,
nativeActiveSection: state.ActiveCoin.nativeActiveSection,
activeAddress: state.ActiveCoin.activeAddress,
lastSendToResponse: state.ActiveCoin.lastSendToResponse,
addresses: state.ActiveCoin.addresses,
},
Dashboard: {
activeHandle: state.Dashboard.activeHandle,
}
};
};
export default connect(mapStateToProps)(SendCoin);
Loading…
Cancel
Save