Browse Source

receive ismine flag toggle

v0.25
pbca26 7 years ago
parent
commit
dd5587dea9
  1. 2
      react/src/actions/actions/nativeDashboardUpdate.js
  2. 18
      react/src/components/dashboard/receiveCoin/receiveCoin.js
  3. 29
      react/src/components/dashboard/receiveCoin/receiveCoin.render.js
  4. 7
      react/src/components/overrides.scss

2
react/src/actions/actions/nativeDashboardUpdate.js

@ -97,8 +97,6 @@ export function getDashboardUpdateState(json, coin, fakeResponse) {
} }
} }
console.warn(_tbalance);
json.result.z_gettotalbalance.result.transparent = _tbalance.toFixed(8); json.result.z_gettotalbalance.result.transparent = _tbalance.toFixed(8);
json.result.z_gettotalbalance.result.total = json.result.z_gettotalbalance.result.transparent + Number(json.result.z_gettotalbalance.result.interest) + Number(json.result.z_gettotalbalance.result.private); json.result.z_gettotalbalance.result.total = json.result.z_gettotalbalance.result.transparent + Number(json.result.z_gettotalbalance.result.interest) + Number(json.result.z_gettotalbalance.result.private);

18
react/src/components/dashboard/receiveCoin/receiveCoin.js

@ -23,6 +23,7 @@ class ReceiveCoin extends React.Component {
openDropMenu: false, openDropMenu: false,
hideZeroAdresses: false, hideZeroAdresses: false,
toggledAddressMenu: null, toggledAddressMenu: null,
toggleIsMine: false,
}; };
this.openDropMenu = this.openDropMenu.bind(this); this.openDropMenu = this.openDropMenu.bind(this);
this.handleClickOutside = this.handleClickOutside.bind(this); this.handleClickOutside = this.handleClickOutside.bind(this);
@ -30,6 +31,7 @@ class ReceiveCoin extends React.Component {
this.checkTotalBalance = this.checkTotalBalance.bind(this); this.checkTotalBalance = this.checkTotalBalance.bind(this);
this.ReceiveCoinTableRender = _ReceiveCoinTableRender.bind(this); this.ReceiveCoinTableRender = _ReceiveCoinTableRender.bind(this);
this.toggleAddressMenu = this.toggleAddressMenu.bind(this); this.toggleAddressMenu = this.toggleAddressMenu.bind(this);
this.toggleIsMine = this.toggleIsMine.bind(this);
} }
toggleAddressMenu(address) { toggleAddressMenu(address) {
@ -119,6 +121,12 @@ class ReceiveCoin extends React.Component {
})); }));
} }
toggleIsMine() {
this.setState(Object.assign({}, this.state, {
toggleIsMine: !this.state.toggleIsMine,
}));
}
checkTotalBalance() { checkTotalBalance() {
let _balance = '0'; let _balance = '0';
@ -147,10 +155,20 @@ class ReceiveCoin extends React.Component {
AddressItemRender.call(this, address, type) AddressItemRender.call(this, address, type)
); );
} }
if (!this.state.toggleIsMine &&
!address.canspend) {
items.pop();
}
} else { } else {
items.push( items.push(
AddressItemRender.call(this, address, type) AddressItemRender.call(this, address, type)
); );
if (!this.state.toggleIsMine &&
!address.canspend) {
items.pop();
}
} }
} }

29
react/src/components/dashboard/receiveCoin/receiveCoin.render.js

@ -45,7 +45,7 @@ export const AddressItemRender = function(address, type) {
{ this.renderAddressActions(address.address, type) } { this.renderAddressActions(address.address, type) }
<td> <td>
{ type === 'public' ? address.address : `${address.address.substring(0, 34)}...` } { type === 'public' ? address.address : `${address.address.substring(0, 34)}...` }
{ address.spendable === 0 && { !address.canspend &&
<i <i
title="You don't own priv keys for this address" title="You don't own priv keys for this address"
className="fa fa-ban margin-left-10"></i> className="fa fa-ban margin-left-10"></i>
@ -53,8 +53,7 @@ export const AddressItemRender = function(address, type) {
</td> </td>
<td> <td>
<span>{ address.amount }</span> <span>{ address.amount }</span>
{ address.spendable === 0 && { !address.canspend &&
address.amount > 0 &&
<span title="Available amount to spend: 0"> (0)</span> <span title="Available amount to spend: 0"> (0)</span>
} }
</td> </td>
@ -66,7 +65,7 @@ export const _ReceiveCoinTableRender = function() {
return ( return (
<span> <span>
{ this.checkTotalBalance() !== 0 && { this.checkTotalBalance() !== 0 &&
<div className="text-left padding-top-10 padding-bottom-10"> <div className="text-left padding-top-20 padding-bottom-15 push-left">
{ this.props.mode !== 'spv' && { this.props.mode !== 'spv' &&
<div> <div>
<label className="switch"> <label className="switch">
@ -87,6 +86,28 @@ export const _ReceiveCoinTableRender = function() {
} }
</div> </div>
} }
{ this.checkTotalBalance() !== 0 &&
<div className="text-left padding-top-20 padding-bottom-15 push-right">
{ this.props.mode !== 'spv' &&
<div title="Display all addresses including not mine (ismine:false)">
<label className="switch">
<input
type="checkbox"
value="on"
checked={ this.state.toggleIsMine } />
<div
className="slider"
onClick={ this.toggleIsMine }></div>
</label>
<div
className="toggle-label margin-right-15 pointer"
onClick={ this.toggleIsMine }>
Show all addresses
</div>
</div>
}
</div>
}
<table className="table table-hover dataTable table-striped"> <table className="table table-hover dataTable table-striped">
<thead> <thead>
<tr> <tr>

7
react/src/components/overrides.scss

@ -591,4 +591,11 @@ select{
cursor: default; cursor: default;
} }
} }
}
.push-right {
float: right;
}
.push-left {
float: left;
} }
Loading…
Cancel
Save