diff --git a/README.md b/README.md index 618d30d099..26b0110733 100644 --- a/README.md +++ b/README.md @@ -20,12 +20,7 @@ npm run dev Open http://localhost:8080 -For ease of development, you can `setItem` in `localStorage` to see network options in login page: -``` -localStorage.setItem('showNetwork', true) -``` - -You can also pass the same key-value pair as query string: +For ease of development, you can set the following query string to see network options in login page: ``` http://localhost:8080/#/?showNetwork=true ``` diff --git a/i18n/locales/en/common.json b/i18n/locales/en/common.json index b7dd6d69be..dde1ae8daf 100644 --- a/i18n/locales/en/common.json +++ b/i18n/locales/en/common.json @@ -261,6 +261,7 @@ "Submit": "Submit", "Success": "Success", "Success!": "Success!", + "Switch networks (Main-/Testnet, Custom)": "Switch networks (Main-/Testnet, Custom)", "Take a tour to see how it works. It should not take longer than 5 minutes": "Take a tour to see how it works. It should not take longer than 5 minutes", "Testnet": "Testnet", "Thank you": "Thank you", diff --git a/src/components/login/index.js b/src/components/login/index.js index 2fb52b4f7e..ba9335c8a3 100644 --- a/src/components/login/index.js +++ b/src/components/login/index.js @@ -22,6 +22,7 @@ const mapStateToProps = state => ({ account: state.account, peers: state.peers, savedAccounts: state.savedAccounts, + settings: state.settings, }); const mapDispatchToProps = dispatch => ({ diff --git a/src/components/login/login.js b/src/components/login/login.js index c18321ad49..29d9fcc63f 100644 --- a/src/components/login/login.js +++ b/src/components/login/login.js @@ -57,7 +57,9 @@ class Login extends React.Component { componentDidUpdate(prevProps) { const params = parseSearchParams(prevProps.history.location.search); - const showNetworkParam = params.showNetwork || params.shownetwork; + const showNetworkParam = params.showNetwork + || params.shownetwork + || (this.props.settings && this.props.settings.showNetwork); if (this.props.account && this.props.account.address && (showNetworkParam !== 'true' || this.secondIteration) && @@ -136,7 +138,7 @@ class Login extends React.Component { // eslint-disable-next-line class-methods-use-this showNetworkOptions() { - const showNetwork = localStorage.getItem('showNetwork') || localStorage.getItem('shownetwork'); + const showNetwork = this.props.settings && this.props.settings.showNetwork; const params = parseSearchParams(this.props.history.location.search); const showNetworkParam = params.showNetwork || params.shownetwork; diff --git a/src/components/login/login.test.js b/src/components/login/login.test.js index c9f34c5939..6b772fc703 100644 --- a/src/components/login/login.test.js +++ b/src/components/login/login.test.js @@ -38,6 +38,7 @@ describe('Login', () => { store = configureMockStore([])({ peers, account, + settings: {}, }); history = { location: { diff --git a/src/components/mainMenu/mainMenu.js b/src/components/mainMenu/mainMenu.js index 8f8d8909bd..dd3d49a857 100644 --- a/src/components/mainMenu/mainMenu.js +++ b/src/components/mainMenu/mainMenu.js @@ -110,7 +110,7 @@ class MainMenu extends React.Component { } const itemShouldBeDisabled = index => - (isCurrent(history, index, tabs) || !account.address) && index !== 2; + (isCurrent(history, index, tabs) || !account.address) && index !== 2 && index !== 4; return ( diff --git a/src/components/onboarding/index.js b/src/components/onboarding/index.js index d915fce39b..7df1f5ee7b 100644 --- a/src/components/onboarding/index.js +++ b/src/components/onboarding/index.js @@ -122,7 +122,7 @@ const mapDispatchToProps = dispatch => ({ const mapStateToProps = state => ({ isAuthenticated: !!state.account.publicKey, showDelegates: state.settings.advancedMode, - start: state.settings.onBoarding, + start: Object.prototype.hasOwnProperty.call(state.settings, 'onBoarding') && state.settings.onBoarding, }); export { Onboarding }; diff --git a/src/components/setting/setting.css b/src/components/setting/setting.css index 8f6471d6ae..4904012838 100644 --- a/src/components/setting/setting.css +++ b/src/components/setting/setting.css @@ -10,6 +10,11 @@ --check-box-font-size: 23px; } +.disable { + pointer-events: none !important; + opacity: 0.5; +} + .wrapper { position: relative; display: flex; diff --git a/src/components/setting/setting.js b/src/components/setting/setting.js index dc68a02db0..99e52d42c0 100644 --- a/src/components/setting/setting.js +++ b/src/components/setting/setting.js @@ -48,10 +48,6 @@ class Setting extends React.Component { settingsUpdated({ autoLog: !settings.autoLog }); } - showOnboardingSetting() { - return this.props.isAuthenticated && window.innerWidth > breakpoints.m; - } - render() { this.language = (i18n.language === 'de'); const { @@ -59,6 +55,8 @@ class Setting extends React.Component { hasSecondPassphrase, } = this.props; + const allowAuthClass = !this.props.isAuthenticated ? styles.disable : ''; + const showOnboardingSetting = window.innerWidth > breakpoints.m; const activeCurrency = settings.currency || settingsConst.currencies[0]; return ( @@ -67,7 +65,7 @@ class Setting extends React.Component {

{t('Settings')}

{t('Set up Lisk Hub and your account.')}

- {this.showOnboardingSetting() + {showOnboardingSetting ?