Browse Source

minor native send transparent improvements

all-modes
pbca26 8 years ago
parent
commit
558e210675
  1. 46
      react/src/components/dashboard/walletsNativeSend/walletsNativeSend.js
  2. 19
      react/src/components/dashboard/walletsNativeSend/walletsNativeSend.render.js
  3. 3
      react/src/components/dashboard/walletsProgress/walletsProgress.js

46
react/src/components/dashboard/walletsNativeSend/walletsNativeSend.js

@ -36,6 +36,7 @@ class WalletsNativeSend extends React.Component {
this.handleClickOutside = this.handleClickOutside.bind(this); this.handleClickOutside = this.handleClickOutside.bind(this);
this.checkZAddressCount = this.checkZAddressCount.bind(this); this.checkZAddressCount = this.checkZAddressCount.bind(this);
this.setRecieverFromScan = this.setRecieverFromScan.bind(this); this.setRecieverFromScan = this.setRecieverFromScan.bind(this);
this.renderOPIDListCheck = this.renderOPIDListCheck.bind(this);
} }
componentWillMount() { componentWillMount() {
@ -91,26 +92,46 @@ class WalletsNativeSend extends React.Component {
} }
renderAddressByType(type) { renderAddressByType(type) {
let _items = [];
if (this.props.ActiveCoin.addresses && if (this.props.ActiveCoin.addresses &&
this.props.ActiveCoin.addresses[type] && this.props.ActiveCoin.addresses[type] &&
this.props.ActiveCoin.addresses[type].length) { this.props.ActiveCoin.addresses[type].length) {
return this.props.ActiveCoin.addresses[type].map((address) => this.props.ActiveCoin.addresses[type].map((address) => {
<li key={ address.address } className={ address.amount <= 0 ? 'hide' : '' }> if (address.amount > 0) {
_items.push(
<li
className="selected"
key={ address.address }>
<a onClick={ () => this.updateAddressSelection(address.address, type, address.amount) }> <a onClick={ () => this.updateAddressSelection(address.address, type, address.amount) }>
<i className={ 'icon fa-eye' + (type === 'public' ? '' : '-slash') }></i>&nbsp;&nbsp; <i className={ 'icon fa-eye' + (type === 'public' ? '' : '-slash') }></i>&nbsp;&nbsp;
<span className="text"> <span className="text">
[ { address.amount } { this.props.ActiveCoin.coin } ]&nbsp;&nbsp; [ { address.amount } { this.props.ActiveCoin.coin } ]&nbsp;&nbsp;
{ type === 'public' ? address.address : address.address.substring(0, 34) + '...' } { type === 'public' ? address.address : address.address.substring(0, 34) + '...' }
</span> </span>
<span className="glyphicon glyphicon-ok check-mark"></span> <span
className="glyphicon glyphicon-ok check-mark pull-right"
style={{ display: this.state.sendFrom === address.address ? 'inline-block' : 'none' }}></span>
</a> </a>
</li> </li>
); );
}
});
return _items;
} else { } else {
return null; return null;
} }
} }
renderOPIDListCheck() {
if (this.state.renderAddressDropdown &&
this.props.ActiveCoin.opids &&
this.props.ActiveCoin.opids.length) {
return true;
}
}
renderSelectorCurrentLabel() { renderSelectorCurrentLabel() {
if (this.state.sendFrom) { if (this.state.sendFrom) {
return ( return (
@ -118,13 +139,13 @@ class WalletsNativeSend extends React.Component {
<i className={ 'icon fa-eye' + this.state.addressType === 'public' ? '' : '-slash' }></i> <i className={ 'icon fa-eye' + this.state.addressType === 'public' ? '' : '-slash' }></i>
<span className="text"> <span className="text">
[ { this.state.sendFromAmount } { this.props.ActiveCoin.coin } ] [ { this.state.sendFromAmount } { this.props.ActiveCoin.coin } ]
{ this.state.sendFrom } { this.state.addressType === 'public' ? this.state.sendFrom : this.state.sendFrom.substring(0, 34) + '...' }
</span> </span>
</span> </span>
); );
} else { } else {
return ( return (
<span>- { translate('SEND.SELECT_T_OR_Z_ADDR') } -</span> <span>Transparent funds</span>
); );
} }
} }
@ -247,6 +268,8 @@ class WalletsNativeSend extends React.Component {
this.state this.state
) )
); );
if (this.state.addressType === 'private') {
setTimeout(() => { setTimeout(() => {
Store.dispatch( Store.dispatch(
getKMDOPID( getKMDOPID(
@ -257,6 +280,19 @@ class WalletsNativeSend extends React.Component {
}, 1000); }, 1000);
} }
this.setState({
addressType: null,
sendFrom: null,
sendFromAmount: 0,
sendTo: '',
sendToOA: null,
amount: 0,
fee: 0,
addressSelectorOpen: false,
renderAddressDropdown: true,
});
}
getOAdress() { getOAdress() {
resolveOpenAliasAddress(this.state.sendToOA) resolveOpenAliasAddress(this.state.sendToOA)
.then((json) => { .then((json) => {

19
react/src/components/dashboard/walletsNativeSend/walletsNativeSend.render.js

@ -17,9 +17,15 @@ export const AddressListRender = function() {
</button> </button>
<div className="dropdown-menu open"> <div className="dropdown-menu open">
<ul className="dropdown-menu inner"> <ul className="dropdown-menu inner">
<li className="selected"> <li
<a><span className="text">Select private address</span> className="selected"
<span className="glyphicon glyphicon-ok check-mark"></span></a> onClick={ () => this.updateAddressSelection(null, 'public', null) }>
<a>
<span className="text">Transparent funds</span>
<span
className="glyphicon glyphicon-ok check-mark pull-right"
style={{ display: this.state.sendFrom === null ? 'inline-block' : 'none' }}></span>
</a>
</li> </li>
{ this.renderAddressByType('private') } { this.renderAddressByType('private') }
</ul> </ul>
@ -116,6 +122,7 @@ export const WalletsNativeSendRender = function() {
type="text" type="text"
className="form-control" className="form-control"
name="amount" name="amount"
value={ this.state.amount !== 0 ? this.state.amount : '' }
onChange={ this.updateInput } onChange={ this.updateInput }
id="kmdWalletAmount" id="kmdWalletAmount"
placeholder="0.000" placeholder="0.000"
@ -134,7 +141,7 @@ export const WalletsNativeSendRender = function() {
onChange={ this.updateInput } onChange={ this.updateInput }
id="kmdWalletFee" id="kmdWalletFee"
placeholder="0.000" placeholder="0.000"
value={ this.state.fee } value={ this.state.fee !== 0 ? this.state.fee : '' }
autoComplete="off" /> autoComplete="off" />
</div> </div>
<div className="col-lg-12 hide"> <div className="col-lg-12 hide">
@ -149,7 +156,7 @@ export const WalletsNativeSendRender = function() {
type="button" type="button"
className="btn btn-primary waves-effect waves-light pull-right" className="btn btn-primary waves-effect waves-light pull-right"
onClick={ this.handleSubmit } onClick={ this.handleSubmit }
disabled={ (!this.state.sendFrom && this.state.renderAddressDropdown) || !this.state.sendTo || !this.state.amount }> disabled={ !this.state.sendTo || !this.state.amount }>
{ translate('INDEX.SEND') } { this.state.amount } { this.props.ActiveCoin.coin } { translate('INDEX.SEND') } { this.state.amount } { this.props.ActiveCoin.coin }
</button> </button>
</div> </div>
@ -159,7 +166,7 @@ export const WalletsNativeSendRender = function() {
</div> </div>
</div> </div>
{ this.state.renderAddressDropdown && { this.renderOPIDListCheck() &&
<div className="col-xs-12"> <div className="col-xs-12">
<div className="row"> <div className="row">
<div className="panel nav-tabs-horizontal"> <div className="panel nav-tabs-horizontal">

3
react/src/components/dashboard/walletsProgress/walletsProgress.js

@ -112,8 +112,7 @@ class WalletsProgress extends React.Component {
if (this.props.Dashboard.progress && if (this.props.Dashboard.progress &&
this.props.Dashboard.progress.blocks) { this.props.Dashboard.progress.blocks) {
const syncPercentage = (parseFloat(parseInt(this.props.Dashboard.progress.blocks, 10) * 100 const syncPercentage = (parseFloat(parseInt(this.props.Dashboard.progress.blocks, 10) * 100 / parseInt(this.props.Dashboard.progress.longestchain, 10)).toFixed(2) + '%').replace('NaN', 0);
/ parseInt(this.props.Dashboard.progress.longestchain, 10)).toFixed(2) + '%').replace('NaN', 0);
return SyncPercentageRender.call(this, syncPercentage); return SyncPercentageRender.call(this, syncPercentage);
} }

Loading…
Cancel
Save