Browse Source

walletsData add/remove sockets

all-modes
pbca26 8 years ago
parent
commit
ced18c4b33
  1. 3
      react/src/actions/actionCreators.js
  2. 2
      react/src/actions/actions/addressBalance.js
  3. 8
      react/src/components/dashboard/qrModal/qrModal.js
  4. 11
      react/src/components/dashboard/receiveCoin/receiveCoin.render.js
  5. 2
      react/src/components/dashboard/settings/settings.render.js
  6. 19
      react/src/components/dashboard/walletsData/walletsData.js
  7. 8
      react/src/translate/translate.js

3
react/src/actions/actionCreators.js

@ -322,7 +322,6 @@ export function setBasiliskMainAddress(json, coin, mode) {
}
export function getNativeTxHistoryState(json) {
console.log('getNativeTxHistoryState', json.result.length);
if (json &&
json.error) {
json = null;
@ -332,8 +331,6 @@ export function getNativeTxHistoryState(json) {
json = 'no data';
}
console.log('getNativeTxHistoryState', json);
return {
type: DASHBOARD_ACTIVE_COIN_NATIVE_TXHISTORY,
txhistory: json,

2
react/src/actions/actions/addressBalance.js

@ -249,6 +249,7 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
for (let a = 0; a < result.length; a++) {
newAddressArray[a] = [];
if (result[a]) {
for (let b = 0; b < result[a].length; b++) {
let filteredArray;
@ -270,6 +271,7 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
};
}
}
}
// get zaddr balance
if (result[1] &&

8
react/src/components/dashboard/qrModal/qrModal.js

@ -19,14 +19,14 @@ class QRModal extends React.Component {
this.closeModal = this.closeModal.bind(this);
this.handleScan = this.handleScan.bind(this);
this.handleError = this.handleError.bind(this);
document.body.addEventListener('click', this.closeModal);
}
handleScan(data) {
if (data !== null) {
if (this.props.mode === 'scan') {
this.props.setRecieverFromScan(data)
this.props.setRecieverFromScan(data);
}
this.closeModal();
}
}
@ -60,10 +60,6 @@ class QRModal extends React.Component {
this.setState({
modalIsOpen: false,
});
if (this.props.mode === 'scan') {
ReactDOM.unmountComponentAtNode(document.getElementById('webcam'));
}
}
render() {

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

@ -26,9 +26,7 @@ export const AddressActionsBasiliskModeRender = function(address) {
onClick={ () => this._validateAddressBasilisk(address) }>
<i className="icon fa-info-circle"></i>
</span>
<QRModal
content={address}
/>
<QRModal content={ address } />
</td>
);
};
@ -45,9 +43,7 @@ export const AddressActionsNonBasiliskModeRender = function(address, type) {
onClick={ () => this._copyCoinAddress(address) }>
<i className="icon wb-copy"></i> { translate('INDEX.COPY') }
</button>
<QRModal
content={address}
/>
<QRModal content={ address } />
</td>
);
};
@ -76,7 +72,8 @@ export const ReceiveCoinRender = function() {
<header className="panel-heading">
{this.isNativeMode() &&
<div className="panel-actions">
<div className={ 'dropdown' + (this.state.openDropMenu ? ' open' : '') }
<div
className={ 'dropdown' + (this.state.openDropMenu ? ' open' : '') }
onClick={ this.openDropMenu }>
<a className="dropdown-toggle white btn btn-warning">
<i className="icon md-arrows margin-right-10"></i> { translate('INDEX.GET_NEW_ADDRESS') }

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

@ -593,7 +593,7 @@ export const SettingsRender = function() {
<textarea
type="text"
className="form-control"
name="cliCmd"
name="cliCmdString"
id="cliCmd"
value={ this.state.cliCmdString }
onChange={ this.updateInput }></textarea>

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

@ -64,7 +64,6 @@ class WalletsData extends React.Component {
this.basiliskRefreshActionOne = this.basiliskRefreshActionOne.bind(this);
this.handleClickOutside = this.handleClickOutside.bind(this);
this.refreshTxHistory = this.refreshTxHistory.bind(this);
socket.on('messages', msg => this.updateSocketsData(msg));
}
componentWillMount() {
@ -73,6 +72,14 @@ class WalletsData extends React.Component {
this.handleClickOutside,
false
);
setTimeout(() => {
if (this.props.ActiveCoin.mode === 'basilisk') {
socket.on('messages', msg => this.updateSocketsData(msg));
} else {
socket.removeAllListeners('messages');
}
}, 100);
}
componentWillUnmount() {
@ -81,6 +88,8 @@ class WalletsData extends React.Component {
this.handleClickOutside,
false
);
socket.removeAllListeners('messages');
}
handleClickOutside(e) {
@ -576,8 +585,14 @@ class WalletsData extends React.Component {
if (this.props &&
this.props.ActiveCoin &&
this.props.ActiveCoin.coin &&
(
this.props.ActiveCoin.mode !== 'native' &&
!this.props.ActiveCoin.send &&
!this.props.ActiveCoin.receive) {
!this.props.ActiveCoin.receive
) || (
this.props.ActiveCoin.mode === 'native' &&
this.props.ActiveCoin.nativeActiveSection === 'default'
)) {
return WalletsDataRender.call(this);
} else {
return null;

8
react/src/translate/translate.js

@ -13,13 +13,13 @@ export function translate(langID) {
_lang[defaultLang][langIDComponents[0]][langIDComponents[1]]) {
return _lang[defaultLang][langIDComponents[0]][langIDComponents[1]];
} else {
console.warn('Missing translation in js/' + defaultLang.toLowerCase() + '.js ' + langID);
return '--> ' + langID + ' <--';
console.warn(`Missing translation ${langID} in js/${defaultLang.toLowerCase()}.js`);
return `--> ${langID} <--`;
}
} else {
if (langID.length) {
console.warn('Missing translation in js/' + defaultLang.toLowerCase() + '.js ' + langID);
return '--> ' + langID + ' <--';
console.warn(`Missing translation ${langID} in js/${defaultLang.toLowerCase()}.js`);
return `--> ${langID} <--`;
}
}
}
Loading…
Cancel
Save