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.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,
hideZeroAdresses: false,
toggledAddressMenu: null,
toggleIsMine: false,
};
this.openDropMenu = this.openDropMenu.bind(this);
this.handleClickOutside = this.handleClickOutside.bind(this);
@ -30,6 +31,7 @@ class ReceiveCoin extends React.Component {
this.checkTotalBalance = this.checkTotalBalance.bind(this);
this.ReceiveCoinTableRender = _ReceiveCoinTableRender.bind(this);
this.toggleAddressMenu = this.toggleAddressMenu.bind(this);
this.toggleIsMine = this.toggleIsMine.bind(this);
}
toggleAddressMenu(address) {
@ -119,6 +121,12 @@ class ReceiveCoin extends React.Component {
}));
}
toggleIsMine() {
this.setState(Object.assign({}, this.state, {
toggleIsMine: !this.state.toggleIsMine,
}));
}
checkTotalBalance() {
let _balance = '0';
@ -147,10 +155,20 @@ class ReceiveCoin extends React.Component {
AddressItemRender.call(this, address, type)
);
}
if (!this.state.toggleIsMine &&
!address.canspend) {
items.pop();
}
} else {
items.push(
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) }
<td>
{ type === 'public' ? address.address : `${address.address.substring(0, 34)}...` }
{ address.spendable === 0 &&
{ !address.canspend &&
<i
title="You don't own priv keys for this address"
className="fa fa-ban margin-left-10"></i>
@ -53,8 +53,7 @@ export const AddressItemRender = function(address, type) {
</td>
<td>
<span>{ address.amount }</span>
{ address.spendable === 0 &&
address.amount > 0 &&
{ !address.canspend &&
<span title="Available amount to spend: 0"> (0)</span>
}
</td>
@ -66,7 +65,7 @@ export const _ReceiveCoinTableRender = function() {
return (
<span>
{ 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' &&
<div>
<label className="switch">
@ -87,6 +86,28 @@ export const _ReceiveCoinTableRender = function() {
}
</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">
<thead>
<tr>

7
react/src/components/overrides.scss

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