Browse Source

Merge branch 'redux' into feature/settings-refactor

# Conflicts:
#	react/src/components/dashboard/settings/settings.js
all-modes
Miika Turunen 7 years ago
parent
commit
6e7f42a046
  1. 6
      assets/mainWindow/css/loading.css
  2. 21
      assets/mainWindow/js/loading.js
  3. 10
      react/src/actions/actionCreators.js
  4. 74
      react/src/actions/actions/nativeSyncInfo.js
  5. 1
      react/src/actions/storeType.js
  6. 42
      react/src/components/dashboard/claimInterestModal/claimInterestModal.render.js
  7. 9
      react/src/components/dashboard/coinTile/coinTileItem.js
  8. 3
      react/src/components/dashboard/jumblr/jumblr.scss
  9. 14
      react/src/components/dashboard/receiveCoin/receiveCoin.js
  10. 33
      react/src/components/dashboard/settings/settings.js
  11. 1
      react/src/components/dashboard/walletsData/walletsData.js
  12. 13
      react/src/components/dashboard/walletsNativeSend/walletsNativeSend.js
  13. 2
      react/src/components/dashboard/walletsNativeSend/walletsNativeSend.render.js
  14. 9
      react/src/reducers/dashboard.js

6
assets/mainWindow/css/loading.css

@ -33,7 +33,11 @@ body.agamaMode {
background-color: rgba(33, 33, 33, 0.85);
padding-top: 40px;
color: #fff;
height: 335px;
height: 300px;
}
body.loading-window {
height: 355px;
}
body.agama-default-window-height {

21
assets/mainWindow/js/loading.js

@ -182,6 +182,21 @@ function openSettingsWindow() {
window.createAppSettingsWindow();
}
function startKMDPassive() {
const remote = require('electron').remote;
const window = remote.getCurrentWindow();
$('.dropdown-menu').addClass('hide');
disableModeButtons();
window.startKMDNative('KMD', true);
setTimeout(function() {
window.createWindow('open');
window.hide();
}, 1000);
}
function closeMainWindow(isKmdOnly, isCustom) {
const remote = require('electron').remote;
const window = remote.getCurrentWindow();
@ -193,8 +208,10 @@ function closeMainWindow(isKmdOnly, isCustom) {
window.startKMDNative(isKmdOnly ? 'KMD' : null);
}
window.createWindow('open');
window.hide();
setTimeout(function() {
window.createWindow('open');
window.hide();
}, 3000);
}
function quitApp() {

10
react/src/actions/actionCreators.js

@ -28,7 +28,8 @@ import {
DISPLAY_COIND_DOWN_MODAL,
DISPLAY_CLAIM_INTEREST_MODAL,
START_INTERVAL,
STOP_INTERVAL
STOP_INTERVAL,
DASHBOARD_SYNC_ONLY_UPDATE,
} from './storeType';
export * from './actions/nativeSyncInfo';
@ -342,3 +343,10 @@ export function toggleClaimInterestModal(display) {
displayClaimInterestModal: display,
}
}
export function skipFullDashboardUpdate(skip) {
return {
type: DASHBOARD_SYNC_ONLY_UPDATE,
skipFullDashboardUpdate: skip,
}
}

74
react/src/actions/actions/nativeSyncInfo.js

@ -8,44 +8,54 @@ import {
import Config from '../../config';
// TODO: use debug.log instead
export function getSyncInfoNativeKMD(skipDebug, json) {
const coin = 'KMD';
// https://www.kmd.host/
return dispatch => {
return fetch(
Config.iguanaLessMode ? 'https://kmd.explorer.supernet.org/api/status?q=getInfo' : `http://127.0.0.1:${Config.iguanaCorePort}/api/dex/getinfo?userpass=tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}&symbol=${coin}`, {
method: 'GET',
})
.catch(function(error) {
console.log(error);
/*dispatch(
triggerToaster(
'getSyncInfoNativeKMD',
'Error',
'error'
)
);*/
console.warn('remote kmd node fetch failed', true);
dispatch(getSyncInfoNativeState({ remoteKMDNode: null }));
})
.then(response => response.json())
.then(json => {
dispatch(getSyncInfoNativeState({ remoteKMDNode: Config.iguanaLessMode ? json.info : json }));
})
.then(function() {
export function getSyncInfoNativeKMD(skipDebug, json, skipRemote) {
if (skipRemote) {
return dispatch => {
dispatch(getSyncInfoNativeState(Config.iguanaLessMode ? json.info : json ));
if (!skipDebug) {
dispatch(getDebugLog('komodo', 1));
}
})
}
} else {
const coin = 'KMD';
// https://www.kmd.host/
return dispatch => {
return fetch(
Config.iguanaLessMode ? 'https://kmd.explorer.supernet.org/api/status?q=getInfo' : `http://127.0.0.1:${Config.iguanaCorePort}/api/dex/getinfo?userpass=tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}&symbol=${coin}`, {
method: 'GET',
})
.catch(function(error) {
console.log(error);
/*dispatch(
triggerToaster(
'getSyncInfoNativeKMD',
'Error',
'error'
)
);*/
console.warn('remote kmd node fetch failed', true);
dispatch(getSyncInfoNativeState({ remoteKMDNode: null }));
})
.then(response => response.json())
.then(json => {
dispatch(getSyncInfoNativeState({ remoteKMDNode: Config.iguanaLessMode ? json.info : json }));
})
.then(function() {
if (!skipDebug) {
dispatch(getDebugLog('komodo', 1));
}
})
}
}
}
function getSyncInfoNativeState(json, coin, skipDebug) {
function getSyncInfoNativeState(json, coin, skipDebug, skipRemote) {
if (coin === 'KMD' &&
json &&
json.error &&
json.error.message.indexOf('Activating best') === -1) {
return getSyncInfoNativeKMD(skipDebug, json);
return getSyncInfoNativeKMD(skipDebug, json, skipRemote);
} else {
if (json &&
json.error &&
@ -63,7 +73,7 @@ function getSyncInfoNativeState(json, coin, skipDebug) {
}
}
export function getSyncInfoNative(coin, skipDebug) {
export function getSyncInfoNative(coin, skipDebug, skipRemote) {
let payload = {
userpass: `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
agent: getPassthruAgent(coin),
@ -125,7 +135,8 @@ export function getSyncInfoNative(coin, skipDebug) {
id: null
},
coin,
skipDebug
skipDebug,
skipRemote
)
);
} else {
@ -163,7 +174,8 @@ export function getSyncInfoNative(coin, skipDebug) {
getSyncInfoNativeState(
json,
coin,
skipDebug
skipDebug,
skipRemote
)
);
}

1
react/src/actions/storeType.js

@ -31,6 +31,7 @@ export const DASHBOARD_ACTIVE_COIN_SENDTO = 'DASHBOARD_ACTIVE_COIN_SENDTO';
export const DASHBOARD_ACTIVE_COIN_GET_CACHE = 'DASHBOARD_ACTIVE_COIN_GET_CACHE';
export const DASHBOARD_ACTIVE_COIN_MAIN_BASILISK_ADDR = 'DASHBOARD_ACTIVE_COIN_MAIN_BASILISK_ADDR';
export const DASHBOARD_UPDATE = 'DASHBOARD_UPDATE';
export const DASHBOARD_SYNC_ONLY_UPDATE = 'DASHBOARD_SYNC_ONLY_UPDATE';
export const VIEW_CACHE_DATA = 'VIEW_CACHE_DATA';
export const SYNC_ONLY_MODAL_TOGGLE = 'SYNC_ONLY_MODAL_TOGGLE';
export const SYNC_ONLY_DATA = 'SYNC_ONLY_DATA';

42
react/src/components/dashboard/claimInterestModal/claimInterestModal.render.js

@ -46,27 +46,29 @@ export const _ClaimInterestTableRender = function() {
<strong>{ translate('CLAIM_INTEREST.TIP') }:</strong> { translate('CLAIM_INTEREST.TIP_DESC') }
</p>
</div>
<div className="text-left padding-top-10 padding-bottom-10">
<label className="switch">
<input
type="checkbox"
checked={ this.state.showZeroInterest } />
{ this.state.totalInterest > 0 &&
<div className="text-left padding-top-10 padding-bottom-10">
<label className="switch">
<input
type="checkbox"
checked={ this.state.showZeroInterest } />
<div
className="slider"
onClick={ this.toggleZeroInterest }></div>
</label>
<div
className="slider"
onClick={ this.toggleZeroInterest }></div>
</label>
<div
className="toggle-label margin-right-15 pointer"
onClick={ this.toggleZeroInterest }>
Show zero interest
className="toggle-label margin-right-15 pointer"
onClick={ this.toggleZeroInterest }>
Show zero interest
</div>
<button
type="button"
className="btn btn-success waves-effect waves-light claim-btn"
onClick={ () => this.claimInterest() }>
<i className="icon fa-dollar"></i> { translate('CLAIM_INTEREST.CLAIM_INTEREST', `${this.state.totalInterest} KMD `) }
</button>
</div>
<button
type="button"
className="btn btn-success waves-effect waves-light claim-btn"
onClick={ () => this.claimInterest() }>
<i className="icon fa-dollar"></i> { translate('CLAIM_INTEREST.CLAIM_INTEREST', `${this.state.totalInterest} KMD `) }
</button>
</div>
}
<div className="table-scroll">
<table className="table table-hover dataTable table-striped">
<thead>
@ -109,7 +111,7 @@ export const ClaimInterestModalRender = function() {
onClick={ this.closeModal }>
<span>×</span>
</button>
<h4 className="modal-title white text-left">{ translate('CLAIM_INTEREST.CLAIM_INTEREST') }</h4>
<h4 className="modal-title white text-left">{ translate('CLAIM_INTEREST.CLAIM_INTEREST', ' ') }</h4>
</div>
<div className="modal-body">
<i

9
react/src/components/dashboard/coinTile/coinTileItem.js

@ -85,10 +85,13 @@ class CoinTileItem extends React.Component {
_propsDashboard.progress.longestchain &&
syncPercentage &&
(Config.iguanaLessMode || syncPercentage >= NATIVE_MIN_SYNC_PERCENTAGE_THRESHOLD)) {
Store.dispatch(getSyncInfoNative(coin, true));
Store.dispatch(getDashboardUpdate(coin, _propsDashboard));
Store.dispatch(getSyncInfoNative(coin, true, this.props.Dashboard.skipFullDashboardUpdate));
if (!this.props.Dashboard.skipFullDashboardUpdate) {
Store.dispatch(getDashboardUpdate(coin, _propsDashboard));
}
} else {
Store.dispatch(getSyncInfoNative(coin));
Store.dispatch(getSyncInfoNative(coin, null, this.props.Dashboard.skipFullDashboardUpdate));
}
}
if (mode === 'full') {

3
react/src/components/dashboard/jumblr/jumblr.scss

@ -1,4 +1,7 @@
.jumblr {
.alert-info {
width: 100%;
}
p {
width: calc(100% - 100px);
}

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

@ -217,8 +217,9 @@ class ReceiveCoin extends React.Component {
return null;
}
}
const mapStateToProps = (state) => {
return {
const mapStateToProps = (state, props) => {
let _mappedProps = {
coin: state.ActiveCoin.coin,
mode: state.ActiveCoin.mode,
receive: state.ActiveCoin.receive,
@ -228,6 +229,15 @@ const mapStateToProps = (state) => {
activeAddress: state.ActiveCoin.activeAddress,
addresses: state.ActiveCoin.addresses,
};
if (props &&
props.activeSection &&
props.renderTableOnly) {
_mappedProps.ActiveCoin.activeSection = props.activeSection;
_mappedProps.renderTableOnly = props.renderTableOnly;
}
return _mappedProps;
};
export default connect(mapStateToProps)(ReceiveCoin);

33
react/src/components/dashboard/settings/settings.js

@ -15,6 +15,7 @@ import {
checkForUpdateUIPromise,
updateUIPromise,
triggerToaster,
skipFullDashboardUpdate,
} from '../../../actions/actionCreators';
import Store from '../../../store';
@ -69,13 +70,17 @@ class Settings extends React.Component {
disableWalletSpecificUI: false,
};
this.updateInput = this.updateInput.bind(this);
// this.updateInputSettings = this.updateInputSettings.bind(this);
this.readDebugLog = this.readDebugLog.bind(this);
this._saveAppConfig = this._saveAppConfig.bind(this);
this._resetAppConfig = this._resetAppConfig.bind(this);
this._checkForUpdateUIPromise = this._checkForUpdateUIPromise.bind(this);
this._updateUIPromise = this._updateUIPromise.bind(this);
this.updateTabDimensions = this.updateTabDimensions.bind(this);
this._skipFullDashboardUpdate = this._skipFullDashboardUpdate.bind(this);
}
_skipFullDashboardUpdate() {
Store.dispatch(skipFullDashboardUpdate(!this.props.Dashboard.skipFullDashboardUpdate));
}
updateTabDimensions() {
@ -546,6 +551,31 @@ class Settings extends React.Component {
}
}
items.push(
<tr key={ `kmd-main-sync-only` }>
<td className="padding-15">
KMD main sync only
<i
className="icon fa-question-circle settings-help"
title="Fetch block synchronization data only. Skip any other requests that can deteriorate sync speed."></i>
</td>
<td className="padding-15">
<span className="pointer toggle">
<label className="switch">
<input
type="checkbox"
name={ `kmd-main-sync-only` }
value={ this.props.Dashboard.skipFullDashboardUpdate }
checked={ this.props.Dashboard.skipFullDashboardUpdate } />
<div
className="slider"
onClick={ this._skipFullDashboardUpdate }></div>
</label>
</span>
</td>
</tr>
);
return items;
}
@ -700,6 +730,7 @@ const mapStateToProps = (state) => {
coin: state.ActiveCoin.coin,
},
Settings: state.Settings,
Dashboard: state.Dashboard,
};
};

1
react/src/components/dashboard/walletsData/walletsData.js

@ -335,6 +335,7 @@ class WalletsData extends React.Component {
}
// TODO: clean
// TODO: figure out why changing ActiveCoin props doesn't trigger comp update
if (this.props.ActiveCoin.txhistory &&
this.props.ActiveCoin.txhistory !== 'loading' &&
this.props.ActiveCoin.txhistory !== 'no data' &&

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

@ -453,8 +453,8 @@ class WalletsNativeSend extends React.Component {
}
}
const mapStateToProps = (state) => {
return {
const mapStateToProps = (state, props) => {
let _mappedProps = {
ActiveCoin: {
addresses: state.ActiveCoin.addresses,
coin: state.ActiveCoin.coin,
@ -464,6 +464,15 @@ const mapStateToProps = (state) => {
activeSection: state.ActiveCoin.activeSection,
},
};
if (props &&
props.activeSection &&
props.renderFormOnly) {
_mappedProps.ActiveCoin.activeSection = props.activeSection;
_mappedProps.renderFormOnly = props.renderFormOnly;
}
return _mappedProps;
};
export default connect(mapStateToProps)(WalletsNativeSend);

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

@ -35,8 +35,6 @@ export const AddressListRender = function() {
);
};
// { this.renderAddressByType('public') }
export const OASendUIRender = function() {
return (
<div className="row">

9
react/src/reducers/dashboard.js

@ -4,7 +4,8 @@ import {
VIEW_CACHE_DATA,
TOGGLE_NOTIFICATIONS_MODAL,
DISPLAY_COIND_DOWN_MODAL,
DISPLAY_CLAIM_INTEREST_MODAL
DISPLAY_CLAIM_INTEREST_MODAL,
DASHBOARD_SYNC_ONLY_UPDATE
} from '../actions/storeType';
export function Dashboard(state = {
@ -14,6 +15,7 @@ export function Dashboard(state = {
guiLog: {},
displayCoindDownModal: false,
displayClaimInterestModal: false,
skipFullDashboardUpdate: false,
}, action) {
switch (action.type) {
case DASHBOARD_SECTION_CHANGE:
@ -43,6 +45,11 @@ export function Dashboard(state = {
displayClaimInterestModal: action.displayClaimInterestModal,
};
break;
case DASHBOARD_SYNC_ONLY_UPDATE:
return {
...state,
skipFullDashboardUpdate: action.skipFullDashboardUpdate,
};
default:
return state;
}

Loading…
Cancel
Save