diff --git a/assets/mainWindow/css/loading.css b/assets/mainWindow/css/loading.css index ce2afc51d..3e5808228 100644 --- a/assets/mainWindow/css/loading.css +++ b/assets/mainWindow/css/loading.css @@ -175,6 +175,7 @@ body.agama-app-settings-window { top: 0; right: 0; cursor: pointer; + z-index: 100; } .btn-close img { @@ -466,4 +467,47 @@ small { .padding-top-40 { padding-top: 40px; +} + +.agama-modes-help { + background: rgba(255, 255, 255, 0.85); + width: 420px; + height: auto; + position: absolute; + color: #000; + border-radius: 4px; + font-weight: normal; + font-size: 14px; + text-align: left; + padding: 10px; + top: 60px; + left: 40px; + z-index: 1000; +} + +.agama-modes-help .close-btn { + float: right; + width: 10px; + height: 10px; + cursor: pointer; +} + +.pointer { + cursor: pointer; +} + +.mode-desc { + top: 173px; + position: absolute; +} +.mode-desc.native { + left: 88px; +} +.mode-desc.spv { + left: 293px; +} + +.intro { + position: relative; + top: -15px; } \ No newline at end of file diff --git a/assets/mainWindow/js/loading.js b/assets/mainWindow/js/loading.js index 83063a583..10fce4375 100644 --- a/assets/mainWindow/js/loading.js +++ b/assets/mainWindow/js/loading.js @@ -1,6 +1,16 @@ // TODO: merge into react app let _configCopy; +function toggleMainWindowHelp() { + const _help = $('.agama-modes-help'); + + if (_help.is(':visible')) { + _help.hide(); + } else { + _help.show(); + } +} + function toggleDropdown(type) { const _dropdown = $('.dropdown-menu.' + (type === 'lite' ? 'lite' : 'native')); @@ -10,7 +20,7 @@ function toggleDropdown(type) { _dropdown.addClass('hide'); } - $('.dropdown-menu.' + (type === 'lite' ? 'native' : 'lite')).addClass('hide');; + $('.dropdown-menu.' + (type === 'lite' ? 'native' : 'lite')).addClass('hide'); } function initSettingsForm() { diff --git a/react/src/actions/actionCreators.js b/react/src/actions/actionCreators.js index ff46bf5a5..8df7dbf9f 100644 --- a/react/src/actions/actionCreators.js +++ b/react/src/actions/actionCreators.js @@ -29,6 +29,7 @@ import { DISPLAY_IMPORT_KEY_MODAL, ELECTRUM_SERVER_CHANGED, DISPLAY_ZCASH_PARAMS_FETCH, + DASHBOARD_REMOVE_COIN, } from './storeType'; export * from './actions/nativeSyncInfo'; @@ -288,4 +289,11 @@ export function toggleZcparamsFetchModal(display) { type: DISPLAY_ZCASH_PARAMS_FETCH, displayZcparamsModal: display, } +} + +export function dashboardRemoveCoin(coin) { + return { + type: DASHBOARD_REMOVE_COIN, + coin, + } } \ No newline at end of file diff --git a/react/src/actions/actions/coinList.js b/react/src/actions/actions/coinList.js index 7a69e197e..034ba0c16 100644 --- a/react/src/actions/actions/coinList.js +++ b/react/src/actions/actions/coinList.js @@ -147,4 +147,27 @@ export function shepherdPostCoinList(data) { .then(response => response.json()) .then(json => resolve(json)) }); +} + +export function shepherdClearCoindFolder(coin, keepWalletDat) { + return new Promise((resolve, reject) => { + fetch(keepWalletDat ? `http://127.0.0.1:${Config.agamaPort}/shepherd/kick?coin=${coin}&keepwallet=true` : `http://127.0.0.1:${Config.agamaPort}/shepherd/kick?coin=${coin}`, { + method: 'GET', + headers: { + 'Content-Type': 'application/json', + }, + }) + .catch((error) => { + console.log(error); + dispatch( + triggerToaster( + 'shepherdClearCoindFolder', + 'Error', + 'error' + ) + ); + }) + .then(response => response.json()) + .then(json => resolve(json)) + }); } \ No newline at end of file diff --git a/react/src/actions/actions/interest.js b/react/src/actions/actions/interest.js index 49742c148..b994d0d70 100644 --- a/react/src/actions/actions/interest.js +++ b/react/src/actions/actions/interest.js @@ -35,6 +35,20 @@ export function getListUnspent(coin) { }) .then(response => response.json()) .then(json => { + if (json && + json.result && + json.result.length) { + let _spendable = []; + + for (let i = 0; i < json.result.length; i++) { + if (json.result[i].spendable) { + _spendable.push(json.result[i]); + } + } + + json.result = _spendable; + } + resolve(json.result ? json.result : json); }) }); diff --git a/react/src/actions/actions/nativeDashboardUpdate.js b/react/src/actions/actions/nativeDashboardUpdate.js index af3cd75a1..b9f269a91 100644 --- a/react/src/actions/actions/nativeDashboardUpdate.js +++ b/react/src/actions/actions/nativeDashboardUpdate.js @@ -45,10 +45,10 @@ export function getDashboardUpdate(coin, activeCoinProps) { export function getDashboardUpdateState(json, coin, fakeResponse) { // rescan or similar resource heavy process if (fakeResponse || - ((json.result['getinfo'].error && json.result['getinfo'].error === 'daemon is busy') && - (json.result['z_getoperationstatus'].error && json.result['z_getoperationstatus'].error === 'daemon is busy') && - (json.result['listtransactions'].error && json.result['listtransactions'].error === 'daemon is busy') && - (json.result['listtransactions'].error && json.result['listtransactions'].error === 'daemon is busy'))) { + ((json.result.getinfo.error && json.result.getinfo.error === 'daemon is busy') && + (json.result.z_getoperationstatus.error && json.result.z_getoperationstatus.error === 'daemon is busy') && + (json.result.listtransactions.error && json.result.listtransactions.error === 'daemon is busy') && + (json.result.listtransactions.error && json.result.listtransactions.error === 'daemon is busy'))) { return { type: DASHBOARD_UPDATE, progress: null, @@ -60,7 +60,7 @@ export function getDashboardUpdateState(json, coin, fakeResponse) { rescanInProgress: true, }; } else { - let _listtransactions = json.result['listtransactions']; + let _listtransactions = json.result.listtransactions; if (_listtransactions && _listtransactions.error) { @@ -74,22 +74,40 @@ export function getDashboardUpdateState(json, coin, fakeResponse) { if (coin === 'CHIPS') { return { type: DASHBOARD_UPDATE, - progress: json.result['getinfo'].result, + progress: json.result.getinfo.result, opids: null, txhistory: _listtransactions, - balance: { transparent: json.result['getbalance'].result, total: json.result['getbalance'].result }, - addresses: json.result['addresses'], + balance: { + transparent: json.result.getbalance.result, + total: json.result.getbalance.result + }, + addresses: json.result.addresses, coin: coin, rescanInProgress: false, }; } else { + // calc transparent balance properly + let _tbalance = 0; + + if (json.result.addresses && + json.result.addresses.public && + json.result.addresses.public.length) { + for (let i = 0; i < json.result.addresses.public.length; i++) { + _tbalance += json.result.addresses.public[i].spendable; + } + } + + json.result.z_gettotalbalance.result.transparent = _tbalance.toFixed(8); + json.result.z_gettotalbalance.result.total = Number(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.total.toFixed(8); + return { type: DASHBOARD_UPDATE, - progress: json.result['getinfo'].result, - opids: json.result['z_getoperationstatus'].result, + progress: json.result.getinfo.result, + opids: json.result.z_getoperationstatus.result, txhistory: _listtransactions, - balance: json.result['z_gettotalbalance'].result, - addresses: json.result['addresses'], + balance: json.result.z_gettotalbalance.result, + addresses: json.result.addresses, coin: coin, rescanInProgress: false, }; diff --git a/react/src/actions/storeType.js b/react/src/actions/storeType.js index f3860b385..02c3c1054 100644 --- a/react/src/actions/storeType.js +++ b/react/src/actions/storeType.js @@ -46,4 +46,5 @@ export const DASHBOARD_ELECTRUM_BALANCE = 'DASHBOARD_ELECTRUM_BALANCE'; export const DASHBOARD_ELECTRUM_TRANSACTIONS = 'DASHBOARD_ELECTRUM_TRANSACTIONS'; export const DASHBOARD_ELECTRUM_COINS = 'DASHBOARD_ELECTRUM_COINS'; export const ELECTRUM_SERVER_CHANGED = 'ELECTRUM_SERVER_CHANGED'; -export const DISPLAY_ZCASH_PARAMS_FETCH = 'DISPLAY_ZCASH_PARAMS_FETCH'; \ No newline at end of file +export const DISPLAY_ZCASH_PARAMS_FETCH = 'DISPLAY_ZCASH_PARAMS_FETCH'; +export const DASHBOARD_REMOVE_COIN = 'DASHBOARD_REMOVE_COIN'; \ No newline at end of file diff --git a/react/src/components/dashboard/claimInterestModal/claimInterestModal.js b/react/src/components/dashboard/claimInterestModal/claimInterestModal.js index 8fe21d3ea..002358704 100755 --- a/react/src/components/dashboard/claimInterestModal/claimInterestModal.js +++ b/react/src/components/dashboard/claimInterestModal/claimInterestModal.js @@ -8,7 +8,7 @@ import { getRawTransaction, copyString, sendToAddressPromise, - triggerToaster + triggerToaster, } from '../../../actions/actionCreators'; import { translate } from '../../../translate/translate'; import { diff --git a/react/src/components/dashboard/coinTile/coinTileItem.js b/react/src/components/dashboard/coinTile/coinTileItem.js index 12b824143..c4adf7aa4 100644 --- a/react/src/components/dashboard/coinTile/coinTileItem.js +++ b/react/src/components/dashboard/coinTile/coinTileItem.js @@ -25,6 +25,7 @@ import { triggerToaster, shepherdRemoveCoin, toggleCoindDownModal, + dashboardRemoveCoin, } from '../../../actions/actionCreators'; import Store from '../../../store'; import Config from '../../../config'; @@ -94,9 +95,9 @@ class CoinTileItem extends React.Component { ]; const allCoins = this.props.Main.coins; let _coinSelected = false; + let _coinMode = {}; let _mode; let _coin; - let _coinMode = {}; if (allCoins) { modes.map((mode) => { @@ -151,6 +152,8 @@ class CoinTileItem extends React.Component { 'success' ) ); + + Store.dispatch(dashboardRemoveCoin(coin)); Store.dispatch(getDexCoins()); Store.dispatch(activeHandle()); setTimeout(() => { @@ -179,6 +182,7 @@ class CoinTileItem extends React.Component { ) ); + Store.dispatch(dashboardRemoveCoin(coin)); Store.dispatch(getDexCoins()); Store.dispatch(activeHandle()); setTimeout(() => { diff --git a/react/src/components/dashboard/coindDownModal/coindDownModal.scss b/react/src/components/dashboard/coindDownModal/coindDownModal.scss index 179ecd4f7..c7abbf38d 100644 --- a/react/src/components/dashboard/coindDownModal/coindDownModal.scss +++ b/react/src/components/dashboard/coindDownModal/coindDownModal.scss @@ -9,6 +9,7 @@ &.form-material { &.floating { height: 80%; + max-height: calc(100% - 100px); } } } diff --git a/react/src/components/dashboard/receiveCoin/receiveCoin.js b/react/src/components/dashboard/receiveCoin/receiveCoin.js index ab8440e8b..a9ce8401d 100644 --- a/react/src/components/dashboard/receiveCoin/receiveCoin.js +++ b/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(); + } } } diff --git a/react/src/components/dashboard/receiveCoin/receiveCoin.render.js b/react/src/components/dashboard/receiveCoin/receiveCoin.render.js index c8915b95e..e4c4b7ce4 100644 --- a/react/src/components/dashboard/receiveCoin/receiveCoin.render.js +++ b/react/src/components/dashboard/receiveCoin/receiveCoin.render.js @@ -24,7 +24,7 @@ export const AddressActionsNonBasiliskModeRender = function(address, type) {