+
+
+
{ translate('INDEX.IMPORT_KEYS_DESC_P1') }
+
{ translate('INDEX.IMPORT_KEYS_DESC_P2') }
+
{ translate('INDEX.IMPORT_KEYS_DESC_P3') }
+
+
+ { translate('INDEX.PLEASE_KEEP_KEYS_SAFE') }
+
+
-
-
+
+
);
}
diff --git a/react/src/components/dashboard/settings/settings.js b/react/src/components/dashboard/settings/settings.js
index 32c276daf..25a37e288 100644
--- a/react/src/components/dashboard/settings/settings.js
+++ b/react/src/components/dashboard/settings/settings.js
@@ -1,15 +1,10 @@
import React from 'react';
import { connect } from 'react-redux';
import { translate } from '../../../translate/translate';
-import Config from '../../../config';
import {
iguanaActiveHandle,
getAppConfig,
- getPeersList,
- addPeerNode,
getAppInfo,
- shepherdCli,
- triggerToaster,
} from '../../../actions/actionCreators';
import Store from '../../../store';
@@ -17,19 +12,6 @@ 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
@@ -38,105 +20,20 @@ import WalletBackupPanel from './settings.walletBackupPanel';
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);
+ constructor(props) {
+ super(props);
}
componentDidMount(props) {
if (!this.props.disableWalletSpecificUI) {
Store.dispatch(iguanaActiveHandle());
}
-
Store.dispatch(getAppConfig());
Store.dispatch(getAppInfo());
document.getElementById('section-iguana-wallet-settings').setAttribute('style', 'height:auto; min-height: 100%');
}
- componentWillReceiveProps(props) {
- if (this.state.tabElId) {
- this.setState(Object.assign({}, this.state, {
- activeTab: this.state.activeTab,
- tabElId: this.state.tabElId,
- disableWalletSpecificUI: this.props.disableWalletSpecificUI,
- }));
- }
- }
-
- 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
- }
-
- return null;
- }
-
- renderAppUpdateTab() {
- return
- }
-
- renderWalletInfo() {
- return
- }
- renderAddNode() {
- return
- }
-
- renderWalletBackup() {
- return
- }
-
- renderFiatCurrency() {
- return
- }
-
- renderExportKeys() {
- return
- }
-
- renderImportKeys() {
- return
- }
-
- renderDebugLog() {
- return
- }
-
- renderAppSettings() {
- return
- }
-
- renderCliPanel() {
- return
- }
-
- renderSupportPanel() {
- return
- }
-
render() {
return SettingsRender.call(this);
}
@@ -146,13 +43,7 @@ const mapStateToProps = (state) => {
return {
Main: {
coins: state.Main.coins,
- activeHandle: state.Main.activeHandle,
- },
- ActiveCoin: {
- coin: state.ActiveCoin.coin,
},
- Settings: state.Settings,
- Dashboard: state.Dashboard,
};
};
diff --git a/react/src/components/dashboard/settings/settings.panel.js b/react/src/components/dashboard/settings/settings.panel.js
new file mode 100644
index 000000000..44f83707e
--- /dev/null
+++ b/react/src/components/dashboard/settings/settings.panel.js
@@ -0,0 +1,86 @@
+import React from 'react';
+import className from 'classnames';
+import * as Utils from './settings.panelUtils';
+
+class Panel extends React.Component {
+
+ constructor(props) {
+ super(props);
+ this.toggleSection = this.toggleSection.bind(this);
+ this.state = {
+ singleOpen: this.props.singleOpen,
+ openByDefault: this.props.openByDefault,
+ activeSections: [],
+ };
+ }
+
+ componentWillMount() {
+ const {
+ singleOpen,
+ openByDefault,
+ uniqId,
+ children } = this.props;
+
+ const settings = {
+ singleOpen,
+ openByDefault,
+ uniqId,
+ kids: children
+ };
+
+ const initialStateSections = Utils.setupAccordion(settings).activeSections;
+ this.setState({ activeSections: initialStateSections });
+ }
+
+ getChildrenWithProps() {
+ const {
+ children,
+ } = this.props;
+
+
+ const kids = React.Children.map(children, (child, i) => {
+ if(child) {
+ const unqId = `panel-sec-${i}`;
+ return React.cloneElement(child, {
+ toggle: (acId) => this.toggleSection(acId),
+ key: unqId,
+ unq: unqId,
+ active: (this.state.activeSections && this.state.activeSections.lastIndexOf(unqId) !== -1)
+ });
+ }
+ });
+
+
+ return kids;
+ }
+
+ toggleSection(sectionId) {
+ const newActive = Utils.toggleSection(
+ sectionId,
+ this.state.activeSections,
+ this.state.singleOpen);
+
+ this.setState({
+ activeSections: newActive
+ });
+ }
+
+ render() {
+ const {
+ className: propClasses,
+ uniqId: propId
+ } = this.props;
+
+ const childrenWithProps = this.getChildrenWithProps();
+ const accordionClasses = className('panel-group', propClasses);
+ const uniqId = propId || '';
+
+ return(
+
+ {childrenWithProps}
+
+ );
+ }
+}
+
+export default Panel;
\ No newline at end of file
diff --git a/react/src/components/dashboard/settings/settings.panelBody.js b/react/src/components/dashboard/settings/settings.panelBody.js
new file mode 100644
index 000000000..84a52fee7
--- /dev/null
+++ b/react/src/components/dashboard/settings/settings.panelBody.js
@@ -0,0 +1,89 @@
+import React from 'react';
+import className from 'classnames';
+
+class PanelSection extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ sectionHeight: 0,
+ }
+ this.toggleSection = this.toggleSection.bind(this);
+ }
+
+ componentDidMount() {
+ const { active } = this.props;
+ if (active) this.setState({sectionHeight: this.accordionContent.scrollHeight});
+ }
+
+ componentWillReceiveProps(nextProps) {
+ if(this.props.active) {
+ this.setState({
+ sectionHeight: 'auto',
+ });
+ }
+ if (nextProps.active !== this.props.active) {
+ this.toggleOpen(nextProps.active);
+ }
+ }
+
+ getHeight() {
+ const { active } = this.props;
+ return (active) ? this.accordionContent.scrollHeight : 0;
+ }
+
+ toggleSection() {
+ const {
+ unq,
+ toggle
+ } = this.props;
+ toggle(unq);
+ }
+
+ toggleOpen(active) {
+ const height = (active) ? `${this.accordionContent.scrollHeight}px` : 0;
+ this.setState({
+ sectionHeight: height,
+ });
+ }
+
+ render() {
+ const {
+ title,
+ icon,
+ children,
+ active,
+ className: propClasses
+ } = this.props;
+
+ const contentStyles = {
+ height: this.state.sectionHeight,
+ overflow: 'hidden',
+ transition: 'height .25s ease',
+ };
+
+ const triggerClasses = className('panel', {
+ active
+ });
+
+ const contentClasses = className('panel-collapse', {
+ active
+ });
+
+ return(
+
this.toggleSection()}>
+
+
this.accordionContent = ref}>
+
+ {children}
+
+
+
+ );
+ }
+}
+
+export default PanelSection;
diff --git a/react/src/components/dashboard/settings/settings.panelUtils.js b/react/src/components/dashboard/settings/settings.panelUtils.js
new file mode 100644
index 000000000..e07614fda
--- /dev/null
+++ b/react/src/components/dashboard/settings/settings.panelUtils.js
@@ -0,0 +1,48 @@
+export function checkUndef(item) {
+ return (typeof item !== 'undefined');
+}
+
+export function toggleSection(sectionId, activeSections, singleOpen) {
+ let present = null;
+ let newActiveSections = activeSections;
+
+ newActiveSections.map((section) => {
+ if (section === sectionId) present = true;
+ return true;
+ });
+
+ if (!singleOpen) {
+ if (present) {
+ const pos = newActiveSections.indexOf(sectionId);
+ newActiveSections.splice(pos, 1);
+ } else {
+ newActiveSections.push(sectionId);
+ }
+ } else {
+ newActiveSections = [sectionId];
+ }
+
+ return newActiveSections;
+}
+
+export function setupAccordion(info) {
+ const singleOpen = (checkUndef(info.singleOpen)) ? info.singleOpen : false;
+ const activeSections = [];
+ const singleChild = typeof info.kids.length === 'undefined';
+
+ if (!singleChild) {
+ info.kids.forEach((child, i) => {
+ const { openByDefault } = child ? child.props : false;
+ if (singleOpen && activeSections.length === 0 && openByDefault) {
+ activeSections.push(`panel-sec-${i}`);
+ }
+ if (!singleOpen && openByDefault) {
+ activeSections.push(`panel-sec-${i}`);
+ }
+ });
+ }
+
+ return {
+ activeSections,
+ };
+}
\ No newline at end of file
diff --git a/react/src/components/dashboard/settings/settings.render.js b/react/src/components/dashboard/settings/settings.render.js
index 5a999d1cc..95fcf701b 100644
--- a/react/src/components/dashboard/settings/settings.render.js
+++ b/react/src/components/dashboard/settings/settings.render.js
@@ -1,227 +1,111 @@
import React from 'react';
import { translate } from '../../../translate/translate';
+import PanelSection from './settings.panelBody';
+import Panel from './settings.panel';
+
+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';
export const SettingsRender = function() {
return (
-
-
+
-
-
-
-
{ translate('INDEX.WALLET_SETTINGS') }
-
-
- { !this.props.disableWalletSpecificUI &&
-
this.openTab('WalletInfo', 0) }
- className={ 'panel' + (this.state.nativeOnly ? ' hide' : '') }>
-
-
- { this.renderWalletInfo() }
-
-
- }
- { !this.props.disableWalletSpecificUI &&
-
this.openTab('AddNodeforCoin', 1) }
- className={ 'panel' + (this.state.nativeOnly ? ' hide' : '') }>
-
-
- { this.renderAddNode() }
-
-
- }
- { !this.props.disableWalletSpecificUI &&
-
this.openTab('DumpWallet', 2) }
- className={ 'hide panel' + (this.state.nativeOnly ? ' hide' : '') }>
-
-
- { this.renderWalletBackup() }
-
-
- }
- { !this.props.disableWalletSpecificUI &&
-
this.openTab('FiatCurrencySettings', 3) }
- className={ 'hide panel' + (this.state.nativeOnly ? ' hide' : '') }>
-
-
- { this.renderFiatCurrency() }
-
-
- }
- { !this.props.disableWalletSpecificUI &&
-
this.openTab('ExportKeys', 4) }
- className={ 'panel' + (this.state.nativeOnly ? ' hide' : '') }>
-
-
- { this.renderExportKeys() }
-
-
- }
- { !this.props.disableWalletSpecificUI &&
-
this.openTab('ImportKeys', 5) }
- className={ 'panel' + (this.state.nativeOnly ? ' hide' : '') }>
-
-
- { this.renderImportKeys() }
-
-
- }
-
-
this.openTab('DebugLog', 6) }>
-
-
- { this.renderDebugLog() }
-
-
-
-
this.openTab('AppSettings', 7) }>
-
-
- { this.renderAppSettings() }
-
-
-
-
this.openTab('AppInfo', 8) }>
-
-
- { this.renderAppInfoTab() }
-
-
-
- { this.props.Main && this.props.Main.coins.native &&
-
this.openTab('Cli', 9) }
- className={ 'panel' + (!this.props.Main.coins.native.length ? ' hide' : '') }>
-
-
- { this.renderCliPanel() }
-
-
- }
-
-
this.openTab('AppUpdate', 10) }>
-
-
- { this.renderAppUpdateTab() }
-
-
-
-
this.openTab('Support', 11) }>
-
-
- { this.renderSupportPanel() }
-
-
-
-
-
+
+
{ translate('INDEX.WALLET_SETTINGS') }
+
+ { !this.props.disableWalletSpecificUI &&
+
+
+
+ }
+ { !this.props.disableWalletSpecificUI &&
+
+
+
+ }
+ { !this.props.disableWalletSpecificUI &&
+
+
+
+ }
+ { !this.props.disableWalletSpecificUI &&
+
+
+
+ }
+ { !this.props.disableWalletSpecificUI &&
+
+
+
+ }
+ { !this.props.disableWalletSpecificUI &&
+
+
+
+ }
+
+
+
+
+
+
+
+
+
+ { this.props.Main && this.props.Main.coins.native &&
+
+
+
+ }
+
+
+
+
+
+
+
-
);
};
\ No newline at end of file
diff --git a/react/src/components/dashboard/settings/settings.scss b/react/src/components/dashboard/settings/settings.scss
index bc1a47c62..e3a10c02b 100644
--- a/react/src/components/dashboard/settings/settings.scss
+++ b/react/src/components/dashboard/settings/settings.scss
@@ -93,10 +93,17 @@
#SettingsAccordion {
.panel {
.panel-collapse {
- transition: all .3s;
-
+
&.collapse {
- height: 0;
+ max-height: 0;
+ overflow: hidden;
+
+ }
+ &.in {
+ animation-name: max-height;
+ animation-duration: 1s;
+ animation-iteration-count: 1;
+ max-height: none;
}
}
}
@@ -110,7 +117,7 @@
cursor: hand;
&:before {
- content: '\F273';
+ content: '\F278';
}
&.collapsed {
&:before {
@@ -118,4 +125,21 @@
}
}
}
+ .panel.active {
+ .panel-title:before {
+ content: '\F273';
+ }
+ }
+}
+
+@keyframes max-height {
+ from {
+ max-height: 0;
+ }
+ 99% {
+ max-height: 2000px;
+ }
+ 100% {
+ max-height: none;
+ }
}
\ No newline at end of file
diff --git a/react/src/components/dashboard/settings/settings.supportPanel.js b/react/src/components/dashboard/settings/settings.supportPanel.js
index a13f89bbd..be016c58c 100644
--- a/react/src/components/dashboard/settings/settings.supportPanel.js
+++ b/react/src/components/dashboard/settings/settings.supportPanel.js
@@ -27,7 +27,7 @@ class SupportPanel extends React.Component {
render() {
return (
-
+
Wallet Backup section to be updated soon.
+
+
+
Wallet Backup section to be updated soon.
+
+
);
};
}
diff --git a/react/src/components/dashboard/settings/settings.walletInfoPanel.js b/react/src/components/dashboard/settings/settings.walletInfoPanel.js
index 29fda9d9e..ad255f921 100644
--- a/react/src/components/dashboard/settings/settings.walletInfoPanel.js
+++ b/react/src/components/dashboard/settings/settings.walletInfoPanel.js
@@ -9,8 +9,7 @@ class WalletInfoPanel extends React.Component {
render() {
return (
-
-
+
| { translate('INDEX.KEY') } |
@@ -44,7 +43,6 @@ class WalletInfoPanel extends React.Component {
-
);
};
}