You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

160 lines
3.5 KiB

import React from 'react';
import { connect } from 'react-redux';
import { translate } from '../../../translate/translate';
import Config from '../../../config';
import {
iguanaActiveHandle,
getAppConfig,
getPeersList,
8 years ago
addPeerNode,
8 years ago
getAppInfo,
shepherdCli,
triggerToaster,
} from '../../../actions/actionCreators';
import Store from '../../../store';
import {
SettingsRender,
} from './settings.render';
import AppUpdatePanel from './settings.appUpdatePanel';
import AppInfoPanel from './settings.appInfoPanel';
import AddNodePanel from './settings.addNodePanel';
import AppSettingsPanel from './settings.appSettingsPanel';
import CliPanel from './settings.cliPanel';
import DebugLogPanel from './settings.debugLogPanel';
import FiatCurrencyPanel from './settings.fiatCurrencyPanel';
import ExportKeysPanel from './settings.exportKeysPanel';
import ImportKeysPanel from './settings.importKeysPanel';
import SupportPanel from './settings.supportPanel';
import WalletInfoPanel from './settings.walletInfoPanel';
import WalletBackupPanel from './settings.walletBackupPanel';
/*
TODO:
1) pre-select active coin in add node tab
2) add fiat section
3) kickstart section
4) batch export/import wallet addresses
*/
class Settings extends React.Component {
constructor() {
super();
this.state = {
activeTab: 0,
tabElId: null,
seedInputVisibility: false,
nativeOnly: Config.iguanaLessMode,
disableWalletSpecificUI: false,
};
this.updateInput = this.updateInput.bind(this);
}
componentDidMount(props) {
if (!this.props.disableWalletSpecificUI) {
Store.dispatch(iguanaActiveHandle());
}
8 years ago
Store.dispatch(getAppConfig());
8 years ago
Store.dispatch(getAppInfo());
document.getElementById('section-iguana-wallet-settings').setAttribute('style', 'height:auto; min-height: 100%');
8 years ago
}
componentWillReceiveProps(props) {
if (this.state.tabElId) {
this.setState(Object.assign({}, this.state, {
activeTab: this.state.activeTab,
tabElId: this.state.tabElId,
disableWalletSpecificUI: this.props.disableWalletSpecificUI,
}));
}
8 years ago
}
openTab(elemId, tab) {
this.setState(Object.assign({}, this.state, {
activeTab: tab,
tabElId: elemId,
}));
}
updateInput(e) {
this.setState({
[e.target.name]: e.target.value,
});
}
renderAppInfoTab() {
const releaseInfo = this.props.Settings.appInfo && this.props.Settings.appInfo.releaseInfo;
if (releaseInfo) {
return <AppInfoPanel />
}
return null;
}
renderAppUpdateTab() {
return <AppUpdatePanel />
}
renderWalletInfo() {
return <WalletInfoPanel />
}
renderAddNode() {
return <AddNodePanel />
}
renderWalletBackup() {
return <WalletBackupPanel />
}
renderFiatCurrency() {
return <FiatCurrencyPanel />
}
renderExportKeys() {
return <ExportKeysPanel />
}
renderImportKeys() {
return <ImportKeysPanel />
}
renderDebugLog() {
return <DebugLogPanel />
}
renderAppSettings() {
return <AppSettingsPanel />
}
renderCliPanel() {
return <CliPanel />
}
renderSupportPanel() {
return <SupportPanel />
8 years ago
}
render() {
return SettingsRender.call(this);
}
}
const mapStateToProps = (state) => {
return {
Main: {
coins: state.Main.coins,
activeHandle: state.Main.activeHandle,
},
ActiveCoin: {
coin: state.ActiveCoin.coin,
},
Settings: state.Settings,
Dashboard: state.Dashboard,
};
};
export default connect(mapStateToProps)(Settings);