diff --git a/react/src/components/dashboard/settings/settings.appSettings.js b/react/src/components/dashboard/settings/settings.appSettings.js new file mode 100644 index 0000000..d455557 --- /dev/null +++ b/react/src/components/dashboard/settings/settings.appSettings.js @@ -0,0 +1,322 @@ +import React from 'react'; +import { connect } from 'react-redux'; +import { translate } from '../../../translate/translate'; +import Config from '../../../config'; +import { + iguanaActiveHandle, + getAppConfig, + getAppInfo, + resetAppConfig, + saveAppConfig, + skipFullDashboardUpdate, + triggerToaster, +} from '../../../actions/actionCreators'; +import Store from '../../../store'; + +class AppSettingsPanel extends React.Component { + constructor() { + super(); + this.state = { + appSettings: {}, + appConfigSchema: {}, + }; + this._saveAppConfig = this._saveAppConfig.bind(this); + this._resetAppConfig = this._resetAppConfig.bind(this); + this._skipFullDashboardUpdate = this._skipFullDashboardUpdate.bind(this); + this.updateInput = this.updateInput.bind(this); + } + + componentWillMount() { + try { + const _appConfigSchema = window.require('electron').remote.getCurrentWindow().appConfigSchema; + const _appSettings = this.props.Settings.appSettings ? this.props.Settings.appSettings : Object.assign({}, window.require('electron').remote.getCurrentWindow().appConfig); + + this.setState(Object.assign({}, this.state, { + appConfigSchema: _appConfigSchema, + appSettings: _appSettings, + })); + } catch(e) {} + } + + componentDidMount(props) { + if (!this.props.disableWalletSpecificUI) { + Store.dispatch(iguanaActiveHandle()); + } + + Store.dispatch(getAppConfig()); + Store.dispatch(getAppInfo()); + } + + _skipFullDashboardUpdate() { + Store.dispatch(skipFullDashboardUpdate(!this.props.Dashboard.skipFullDashboardUpdate)); + } + + _resetAppConfig() { + Store.dispatch(resetAppConfig()); + } + + _saveAppConfig() { + const _appSettings = this.state.appSettings; + let _appSettingsPristine = Object.assign({}, this.props.Settings.appSettings); + let isError = false; + let saveAfterPathCheck = false; + + for (let key in _appSettings) { + if (key.indexOf('__') === -1) { + _appSettingsPristine[key] = this.state.appConfigSchema[key] && this.state.appConfigSchema[key].type === 'number' ? Number(_appSettings[key]) : _appSettings[key]; + + if (this.state.appConfigSchema[key] && this.state.appConfigSchema[key].type === 'folder' && + _appSettings[key] && + _appSettings[key].length) { + const _testLocation = window.require('electron').remote.getCurrentWindow().testLocation; + saveAfterPathCheck = true; + + _testLocation(_appSettings[key]) + .then((res) => { + if (res === -1) { + isError = true; + Store.dispatch( + triggerToaster( + translate('TOASTR.KOMODO_DATADIR_INVALID'), + translate('INDEX.SETTINGS'), + 'error' + ) + ); + } else if (res === false) { + isError = true; + Store.dispatch( + triggerToaster( + translate('TOASTR.KOMODO_DATADIR_NOT_DIR'), + translate('INDEX.SETTINGS'), + 'error' + ) + ); + } else { + Store.dispatch(saveAppConfig(_appSettingsPristine)); + } + }); + } + } else { + const _nestedKey = key.split('__'); + _appSettingsPristine[_nestedKey[0]][_nestedKey[1]] = this.state.appConfigSchema[_nestedKey[0]][_nestedKey[1]].type === 'number' ? Number(_appSettings[key]) : _appSettings[key]; + } + } + + if (!saveAfterPathCheck) { + Store.dispatch(saveAppConfig(_appSettingsPristine)); + } + } + + + renderConfigEditForm() { + let items = []; + const _appConfig = this.state.appSettings; + for (let key in _appConfig) { + if (this.state.appConfigSchema[key] && typeof _appConfig[key] === 'object') { + if (this.state.appConfigSchema[key].display) { + items.push( + + + { this.state.appConfigSchema[key].displayName ? this.state.appConfigSchema[key].displayName : key } + { this.state.appConfigSchema[key].info && + + } + + + + ); + + for (let _key in _appConfig[key]) { + items.push( + + + { this.state.appConfigSchema[key][_key].displayName ? this.state.appConfigSchema[key][_key].displayName : _key } + { this.state.appConfigSchema[key][_key].info && + + } + + + { this.state.appConfigSchema[key][_key].type === 'number' && + this.updateInputSettings(event, key, _key) } /> + } + { (this.state.appConfigSchema[key][_key].type === 'string' || this.state.appConfigSchema[key][_key].type === 'folder') && + this.updateInputSettings(event, key, _key) } /> + } + { this.state.appConfigSchema[key][_key].type === 'boolean' && + + + + } + + + ); + } + } + } else { + if (this.state.appConfigSchema[key] && this.state.appConfigSchema[key].display) { + items.push( + + + { this.state.appConfigSchema[key].displayName ? this.state.appConfigSchema[key].displayName : key } + { this.state.appConfigSchema[key].info && + + } + + + { this.state.appConfigSchema[key].type === 'number' && + this.updateInputSettings(event, key) } /> + } + { (this.state.appConfigSchema[key].type === 'string' || this.state.appConfigSchema[key].type === 'folder') && + this.updateInputSettings(event, key) } /> + } + { this.state.appConfigSchema[key].type === 'boolean' && + + + + } + + + ); + } + } + } + + items.push( + + + KMD main sync only + + + + + + + + + ); + + return items; + } + + updateInput(e) { + this.setState({ + [e.target.name]: e.target.value, + }); + } + + updateInputSettings(e, parentKey, childKey) { + let _appSettings = this.state.appSettings; + let _appSettingsPrev = Object.assign({}, _appSettings); + + if (!childKey && this.state.appConfigSchema[parentKey].type === 'boolean') { + _appSettings[parentKey] = typeof _appSettings[parentKey] !== undefined ? !_appSettings[parentKey] : !this.state.appSettings[parentKey]; + } else if (childKey && this.state.appConfigSchema[parentKey][childKey].type === 'boolean') { + _appSettings[parentKey][childKey] = typeof _appSettings[parentKey][childKey] !== undefined ? !_appSettings[parentKey][childKey] : !this.state.appSettings[parentKey][childKey]; + } else if ((!childKey && this.state.appConfigSchema[parentKey].type === 'number') || (childKey && this.state.appConfigSchema[parentKey][childKey].type === 'number')) { + if (e.target.value === '') { + _appSettings[e.target.name] = _appSettingsPrev[e.target.name]; + } else { + _appSettings[e.target.name] = e.target.value.replace(/[^0-9]+/g, ''); + } + } else { + _appSettings[e.target.name] = e.target.value; + } + + this.setState({ + appSettings: _appSettings, + }); + } + + render() { + return ( +
+

+ { translate('SETTINGS.CONFIG_RESTART_REQUIRED') } +

+
+ + + { this.renderConfigEditForm() } + +
+
+
+ + +
+
+); + }; +} + +const mapStateToProps = (state) => { + return { + Settings: state.Settings, + Dashboard: { + skipFullDashboardUpdate: state.Dashboard.skipFullDashboardUpdate, + } + }; +}; + +export default connect(mapStateToProps)(AppSettingsPanel); diff --git a/react/src/components/dashboard/settings/settings.cliPanel.js b/react/src/components/dashboard/settings/settings.cliPanel.js new file mode 100644 index 0000000..3e8d5e0 --- /dev/null +++ b/react/src/components/dashboard/settings/settings.cliPanel.js @@ -0,0 +1,206 @@ +import React from 'react'; +import { connect } from 'react-redux'; +import { translate } from '../../../translate/translate'; +import { + shepherdCli, +} from '../../../actions/actionCreators'; +import Store from '../../../store'; + +class CliPanel extends React.Component { + constructor() { + super(); + this.state = { + cliCmdString: '', + cliCoin: null, + cliResponse: null, + }; + } + + renderActiveCoinsList(mode) { + const modes = [ + 'native', + 'basilisk', + 'full' + ]; + + const allCoins = this.props.Main.coins; + let items = []; + + if (allCoins) { + if (mode === 'all') { + modes.map(function(mode) { + allCoins[mode].map(function(coin) { + items.push( + + ); + }); + }); + } else { + allCoins[mode].map(function(coin) { + items.push( + + ); + }); + } + + return items; + } else { + return null; + } + } + + // TODO: rerender only if prop is changed + renderCliResponse() { + const _cliResponse = this.props.Settings.cli; + let _items = []; + + if (_cliResponse) { + let _cliResponseParsed; + let responseType; + + try { + _cliResponseParsed = JSON.parse(_cliResponse.result); + } catch(e) { + _cliResponseParsed = _cliResponse.result; + } + + if (Object.prototype.toString.call(_cliResponseParsed) === '[object Array]') { + responseType = 'array'; + + for (let i = 0; i < _cliResponseParsed.length; i++) { + _items.push( +
{ JSON.stringify(_cliResponseParsed[i], null, '\t') }
+ ); + } + } + if (Object.prototype.toString.call(_cliResponseParsed) === '[object]' || + typeof _cliResponseParsed === 'object') { + responseType = 'object'; + + _items.push( +
{ JSON.stringify(_cliResponseParsed, null, '\t') }
+ ); + } + if (Object.prototype.toString.call(_cliResponseParsed) === 'number' || + typeof _cliResponseParsed === 'boolean' || + _cliResponseParsed === 'wrong cli string format') { + responseType = 'number'; + + _items.push( +
{ _cliResponseParsed.toString() }
+ ); + } + + if (responseType !== 'number' && + responseType !== 'array' && + responseType !== 'object' && + _cliResponseParsed.indexOf('\n') > -1) { + _cliResponseParsed = _cliResponseParsed.split('\n'); + + for (let i = 0; i < _cliResponseParsed.length; i++) { + _items.push( +
{ _cliResponseParsed[i] }
+ ); + } + } + + return ( +
+
+ { translate('SETTINGS.CLI_RESPONSE') }: +
+ { _items } +
+ ); + } else { + return null; + } + } + + execCliCmd() { + Store.dispatch( + shepherdCli( + 'passthru', + this.state.cliCoin, + this.state.cliCmdString + ) + ); + } + + updateInput = (e) => { + this.setState({ + [e.target.name]: e.target.value, + }); + } + + render() { + return ( +
+

{ translate('INDEX.CLI_SELECT_A_COIN') }

+
+
+
+ + +
+
+ + +
+
+ +
+
+
+ { this.renderCliResponse() } +
+
+
+
+); + }; +} + +const mapStateToProps = (state) => { + return { + Main: { + coins: state.Main.coins, + }, + Settings: state.Settings, + }; +}; + +export default connect(mapStateToProps)(CliPanel); diff --git a/react/src/components/dashboard/settings/settings.debugLogPanel.js b/react/src/components/dashboard/settings/settings.debugLogPanel.js new file mode 100644 index 0000000..a16e1bf --- /dev/null +++ b/react/src/components/dashboard/settings/settings.debugLogPanel.js @@ -0,0 +1,114 @@ +import React from 'react'; +import { connect } from 'react-redux'; +import { translate } from '../../../translate/translate'; +import Config from '../../../config'; +import { + getDebugLog, +} from '../../../actions/actionCreators'; +import Store from '../../../store'; + +class DebugLogPanel extends React.Component { + constructor() { + super(); + this.state = { + debugLinesCount: 10, + debugTarget: 'iguana', + nativeOnly: Config.iguanaLessMode, + }; + this.readDebugLog = this.readDebugLog.bind(this); + this.updateInput = this.updateInput.bind(this); + } + + readDebugLog() { + Store.dispatch( + getDebugLog( + this.state.debugTarget, + this.state.debugLinesCount + ) + ); + } + + renderDebugLogData() { + if (this.props.Settings.debugLog) { + const _debugLogDataRows = this.props.Settings.debugLog.split('\n'); + + if (_debugLogDataRows && + _debugLogDataRows.length) { + return _debugLogDataRows.map((_row) => +
{ _row }
+ ); + } else { + return ( + { translate('INDEX.EMPTY_DEBUG_LOG') } + ); + } + } else { + return null; + } + } + + updateInput(e) { + this.setState({ + [e.target.name]: e.target.value, + }); + } + + render() { + return ( +
+

{ translate('INDEX.DEBUG_LOG_DESC') }

+
+
+
+ + +
+
+ + +
+
+ +
+
+
{ this.renderDebugLogData() }
+
+
+
+); + }; +} + +const mapStateToProps = (state) => { + return { + Settings: state.Settings + }; +}; + +export default connect(mapStateToProps)(DebugLogPanel); diff --git a/react/src/components/dashboard/settings/settings.importKeys.js b/react/src/components/dashboard/settings/settings.importKeys.js index 4a3d31a..e4713ae 100644 --- a/react/src/components/dashboard/settings/settings.importKeys.js +++ b/react/src/components/dashboard/settings/settings.importKeys.js @@ -1,6 +1,5 @@ import React from 'react'; import { translate } from '../../../translate/translate'; -import { connect } from 'react-redux'; import { importPrivKey, } from '../../../actions/actionCreators'; diff --git a/react/src/components/dashboard/settings/settings.js b/react/src/components/dashboard/settings/settings.js index 29fa294..6101f12 100644 --- a/react/src/components/dashboard/settings/settings.js +++ b/react/src/components/dashboard/settings/settings.js @@ -4,18 +4,14 @@ import { translate } from '../../../translate/translate'; import Config from '../../../config'; import { iguanaActiveHandle, - getDebugLog, + getAppConfig, getPeersList, addPeerNode, - getAppConfig, - saveAppConfig, - resetAppConfig, getAppInfo, shepherdCli, checkForUpdateUIPromise, updateUIPromise, triggerToaster, - skipFullDashboardUpdate, } from '../../../actions/actionCreators'; import Store from '../../../store'; @@ -31,6 +27,10 @@ import WalletBackupTab from './settings.walletBackupTab'; import FiatCurrencyTab from './settings.fiatCurrency'; import ExportKeysTab from './settings.exportKeys'; import ImportKeysTab from './settings.importKeys'; +import DebugLogPanel from './settings.debugLogPanel'; +import AppSettingsPanel from './settings.appSettings'; +import CliPanel from './settings.cliPanel'; +import SupportPanel from './settings.supportPanel'; import { SocketProvider } from 'socket.io-react'; import io from 'socket.io-client'; @@ -52,15 +52,8 @@ class Settings extends React.Component { super(); this.state = { activeTab: 0, - debugLinesCount: 10, - debugTarget: 'iguana', activeTabHeight: '0', - appSettings: {}, - appConfigSchema: {}, tabElId: null, - cliCmdString: '', - cliCoin: null, - cliResponse: null, seedInputVisibility: false, nativeOnly: Config.iguanaLessMode, updatePatch: null, @@ -70,17 +63,9 @@ class Settings extends React.Component { disableWalletSpecificUI: false, }; this.updateInput = this.updateInput.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() { @@ -99,16 +84,6 @@ class Settings extends React.Component { componentWillMount() { socket.on('patch', msg => this.updateSocketsData(msg)); window.addEventListener('resize', this.updateTabDimensions); - - try { - const _appConfigSchema = window.require('electron').remote.getCurrentWindow().appConfigSchema; - const _appSettings = this.props.Settings.appSettings ? this.props.Settings.appSettings : Object.assign({}, window.require('electron').remote.getCurrentWindow().appConfig); - - this.setState(Object.assign({}, this.state, { - appConfigSchema: _appConfigSchema, - appSettings: _appSettings, - })); - } catch(e) {} } componentWillUnmount() { @@ -143,29 +118,6 @@ class Settings extends React.Component { } } - openExternalWindow(url) { - const remote = window.require('electron').remote; - const BrowserWindow = remote.BrowserWindow; - - const externalWindow = new BrowserWindow({ - width: 1280, - height: 800, - title: `${translate('INDEX.LOADING')}...`, - icon: remote.getCurrentWindow().iguanaIcon, - }); - - externalWindow.loadURL(url); - externalWindow.webContents.on('did-finish-load', function() { - setTimeout(function() { - externalWindow.show(); - }, 40); - }); - } - - _resetAppConfig() { - Store.dispatch(resetAppConfig()); - } - updateSocketsData(data) { if (data && data.msg && @@ -280,16 +232,6 @@ class Settings extends React.Component { } } - execCliCmd() { - Store.dispatch( - shepherdCli( - 'passthru', - this.state.cliCoin, - this.state.cliCmdString - ) - ); - } - openTab(elemId, tab) { setTimeout(() => { const _height = document.querySelector(`#${elemId} .panel-collapse .panel-body`).offsetHeight; @@ -313,15 +255,6 @@ class Settings extends React.Component { }, 100); } - readDebugLog() { - Store.dispatch( - getDebugLog( - this.state.debugTarget, - this.state.debugLinesCount - ) - ); - } - renderAppInfoTab() { const releaseInfo = this.props.Settings.appInfo && this.props.Settings.appInfo.releaseInfo; @@ -359,224 +292,20 @@ class Settings extends React.Component { return } - updateInputSettings(e, parentKey, childKey) { - let _appSettings = this.state.appSettings; - let _appSettingsPrev = Object.assign({}, _appSettings); - - if (!childKey && this.state.appConfigSchema[parentKey].type === 'boolean') { - _appSettings[parentKey] = typeof _appSettings[parentKey] !== undefined ? !_appSettings[parentKey] : !this.state.appSettings[parentKey]; - } else if (childKey && this.state.appConfigSchema[parentKey][childKey].type === 'boolean') { - _appSettings[parentKey][childKey] = typeof _appSettings[parentKey][childKey] !== undefined ? !_appSettings[parentKey][childKey] : !this.state.appSettings[parentKey][childKey]; - } else if ((!childKey && this.state.appConfigSchema[parentKey].type === 'number') || (childKey && this.state.appConfigSchema[parentKey][childKey].type === 'number')) { - if (e.target.value === '') { - _appSettings[e.target.name] = _appSettingsPrev[e.target.name]; - } else { - _appSettings[e.target.name] = e.target.value.replace(/[^0-9]+/g, ''); - } - } else { - _appSettings[e.target.name] = e.target.value; - } - - this.setState({ - appSettings: _appSettings, - }); + renderDebugLog() { + return } - _saveAppConfig() { - const _appSettings = this.state.appSettings; - let _appSettingsPristine = Object.assign({}, this.props.Settings.appSettings); - let isError = false; - let saveAfterPathCheck = false; - - for (let key in _appSettings) { - if (key.indexOf('__') === -1) { - _appSettingsPristine[key] = this.state.appConfigSchema[key].type === 'number' ? Number(_appSettings[key]) : _appSettings[key]; - - if (this.state.appConfigSchema[key].type === 'folder' && - _appSettings[key] && - _appSettings[key].length) { - const _testLocation = window.require('electron').remote.getCurrentWindow().testLocation; - saveAfterPathCheck = true; - - _testLocation(_appSettings[key]) - .then((res) => { - if (res === -1) { - isError = true; - Store.dispatch( - triggerToaster( - translate('TOASTR.KOMODO_DATADIR_INVALID'), - translate('INDEX.SETTINGS'), - 'error' - ) - ); - } else if (res === false) { - isError = true; - Store.dispatch( - triggerToaster( - translate('TOASTR.KOMODO_DATADIR_NOT_DIR'), - translate('INDEX.SETTINGS'), - 'error' - ) - ); - } else { - Store.dispatch(saveAppConfig(_appSettingsPristine)); - } - }); - } - } else { - const _nestedKey = key.split('__'); - _appSettingsPristine[_nestedKey[0]][_nestedKey[1]] = this.state.appConfigSchema[_nestedKey[0]][_nestedKey[1]].type === 'number' ? Number(_appSettings[key]) : _appSettings[key]; - } - } - - if (!saveAfterPathCheck) { - Store.dispatch(saveAppConfig(_appSettingsPristine)); - } + renderAppSettings() { + return + } + + renderCliPanel() { + return } - renderConfigEditForm() { - let items = []; - const _appConfig = this.state.appSettings; - for (let key in _appConfig) { - if (this.state.appConfigSchema[key] && typeof _appConfig[key] === 'object') { - if (this.state.appConfigSchema[key].display) { - items.push( - - - { this.state.appConfigSchema[key].displayName ? this.state.appConfigSchema[key].displayName : key } - { this.state.appConfigSchema[key].info && - - } - - - - ); - - for (let _key in _appConfig[key]) { - items.push( - - - { this.state.appConfigSchema[key][_key].displayName ? this.state.appConfigSchema[key][_key].displayName : _key } - { this.state.appConfigSchema[key][_key].info && - - } - - - { this.state.appConfigSchema[key][_key].type === 'number' && - this.updateInputSettings(event, key, _key) } /> - } - { (this.state.appConfigSchema[key][_key].type === 'string' || this.state.appConfigSchema[key][_key].type === 'folder') && - this.updateInputSettings(event, key, _key) } /> - } - { this.state.appConfigSchema[key][_key].type === 'boolean' && - - - - } - - - ); - } - } - } else { - if (this.state.appConfigSchema[key] && this.state.appConfigSchema[key].display) { - items.push( - - - { this.state.appConfigSchema[key].displayName ? this.state.appConfigSchema[key].displayName : key } - { this.state.appConfigSchema[key].info && - - } - - - { this.state.appConfigSchema[key].type === 'number' && - this.updateInputSettings(event, key) } /> - } - { (this.state.appConfigSchema[key].type === 'string' || this.state.appConfigSchema[key].type === 'folder') && - this.updateInputSettings(event, key) } /> - } - { this.state.appConfigSchema[key].type === 'boolean' && - - - - } - - - ); - } - } - } - - items.push( - - - KMD main sync only - - - - - - - - - ); - - return items; + renderSupportPanel() { + return } updateInput(e) { @@ -585,136 +314,6 @@ class Settings extends React.Component { }); } - renderDebugLogData() { - if (this.props.Settings.debugLog) { - const _debugLogDataRows = this.props.Settings.debugLog.split('\n'); - - if (_debugLogDataRows && - _debugLogDataRows.length) { - return _debugLogDataRows.map((_row) => -
{ _row }
- ); - } else { - return ( - { translate('INDEX.EMPTY_DEBUG_LOG') } - ); - } - } else { - return null; - } - } - - // TODO: rerender only if prop is changed - renderCliResponse() { - const _cliResponse = this.props.Settings.cli; - let _items = []; - - if (_cliResponse) { - let _cliResponseParsed; - let responseType; - - try { - _cliResponseParsed = JSON.parse(_cliResponse.result); - } catch(e) { - _cliResponseParsed = _cliResponse.result; - } - - if (Object.prototype.toString.call(_cliResponseParsed) === '[object Array]') { - responseType = 'array'; - - for (let i = 0; i < _cliResponseParsed.length; i++) { - _items.push( -
{ JSON.stringify(_cliResponseParsed[i], null, '\t') }
- ); - } - } - if (Object.prototype.toString.call(_cliResponseParsed) === '[object]' || - typeof _cliResponseParsed === 'object') { - responseType = 'object'; - - _items.push( -
{ JSON.stringify(_cliResponseParsed, null, '\t') }
- ); - } - if (Object.prototype.toString.call(_cliResponseParsed) === 'number' || - typeof _cliResponseParsed === 'boolean' || - _cliResponseParsed === 'wrong cli string format') { - responseType = 'number'; - - _items.push( -
{ _cliResponseParsed.toString() }
- ); - } - - if (responseType !== 'number' && - responseType !== 'array' && - responseType !== 'object' && - _cliResponseParsed.indexOf('\n') > -1) { - _cliResponseParsed = _cliResponseParsed.split('\n'); - - for (let i = 0; i < _cliResponseParsed.length; i++) { - _items.push( -
{ _cliResponseParsed[i] }
- ); - } - } - - return ( -
-
- { translate('SETTINGS.CLI_RESPONSE') }: -
- { _items } -
- ); - } else { - return null; - } - } - - renderActiveCoinsList(mode) { - const modes = [ - 'native', - 'basilisk', - 'full' - ]; - - const allCoins = this.props.Main.coins; - let items = []; - - if (allCoins) { - if (mode === 'all') { - modes.map(function(mode) { - allCoins[mode].map(function(coin) { - items.push( - - ); - }); - }); - } else { - allCoins[mode].map(function(coin) { - items.push( - - ); - }); - } - - return items; - } else { - return null; - } - } - render() { return SettingsRender.call(this); } diff --git a/react/src/components/dashboard/settings/settings.render.js b/react/src/components/dashboard/settings/settings.render.js index 2886646..ececb05 100644 --- a/react/src/components/dashboard/settings/settings.render.js +++ b/react/src/components/dashboard/settings/settings.render.js @@ -130,50 +130,7 @@ export const SettingsRender = function() {
-
-

{ translate('INDEX.DEBUG_LOG_DESC') }

-
-
-
- - -
-
- - -
-
- -
-
-
{ this.renderDebugLogData() }
-
-
-
+ { this.renderDebugLog() }
@@ -189,28 +146,7 @@ export const SettingsRender = function() {
-
-

- { translate('SETTINGS.CONFIG_RESTART_REQUIRED') } -

-
- - - { this.renderConfigEditForm() } - -
-
-
- - -
-
+ { this.renderAppSettings() }
@@ -243,53 +179,7 @@ export const SettingsRender = function() {
-
-

{ translate('INDEX.CLI_SELECT_A_COIN') }

-
-
-
- - -
-
- - -
-
- -
-
-
- { this.renderCliResponse() } -
-
-
-
+ { this.renderCliPanel() }
} @@ -306,7 +196,7 @@ export const SettingsRender = function() {
- { this.renderAppUpdateTab() } + { this.renderAppUpdateTab() }
@@ -322,54 +212,7 @@ export const SettingsRender = function() {
-
-
-
-
this.openExternalWindow('http://support.supernet.org') }> - Support tickets -
{ translate('SETTINGS.SUPPORT_TICKETS') }
-
support.supernet.org
-
-
-
-
this.openExternalWindow('https://sprnt.slack.com') }> - Slack -
Slack
-
sprnt.slack.com
-
-
-
-
this.openExternalWindow('http://slackinvite.supernet.org') }> - Slack invite -
{ translate('SETTINGS.GET_SLACK_INVITE') }
-
slackinvite.supernet.org
-
-
-
-
this.openExternalWindow('https://github.com/SuperNETorg/Agama') }> - Github -
Github
-
github.com/SuperNETorg/Agama
-
-
-
-
+ { this.renderSupportPanel() }
diff --git a/react/src/components/dashboard/settings/settings.supportPanel.js b/react/src/components/dashboard/settings/settings.supportPanel.js new file mode 100644 index 0000000..971ff4b --- /dev/null +++ b/react/src/components/dashboard/settings/settings.supportPanel.js @@ -0,0 +1,82 @@ +import React from 'react'; +import { translate } from '../../../translate/translate'; + +class SupportPanel extends React.Component { + constructor() { + super(); + } + + openExternalWindow(url) { + const remote = window.require('electron').remote; + const BrowserWindow = remote.BrowserWindow; + + const externalWindow = new BrowserWindow({ + width: 1280, + height: 800, + title: `${translate('INDEX.LOADING')}...`, + icon: remote.getCurrentWindow().iguanaIcon, + }); + + externalWindow.loadURL(url); + externalWindow.webContents.on('did-finish-load', function() { + setTimeout(function() { + externalWindow.show(); + }, 40); + }); + } + + render() { + return ( +
+
+
+
this.openExternalWindow('http://support.supernet.org') }> + Support tickets +
{ translate('SETTINGS.SUPPORT_TICKETS') }
+
support.supernet.org
+
+
+
+
this.openExternalWindow('https://sprnt.slack.com') }> + Slack +
Slack
+
sprnt.slack.com
+
+
+
+
this.openExternalWindow('http://slackinvite.supernet.org') }> + Slack invite +
{ translate('SETTINGS.GET_SLACK_INVITE') }
+
slackinvite.supernet.org
+
+
+
+
this.openExternalWindow('https://github.com/SuperNETorg/Agama') }> + Github +
Github
+
github.com/SuperNETorg/Agama
+
+
+
+
+); + }; +} + +export default SupportPanel; \ No newline at end of file