From 5db518b08f0b64d6c364716cd3b6ce9f024ee125 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Renaudeau?= Date: Sat, 30 Jun 2018 14:52:50 +0200 Subject: [PATCH] Fix going back on Portfolio after a reset also don't mount app during onboarding for better performance --- src/components/App.js | 18 +++++++++--------- src/components/Onboarding/index.js | 2 ++ src/components/OnboardingOrElse.js | 28 ++++++++++++++++++++++++++++ src/helpers/hardReset.js | 1 + src/reducers/settings.js | 2 ++ 5 files changed, 42 insertions(+), 9 deletions(-) create mode 100644 src/components/OnboardingOrElse.js diff --git a/src/components/App.js b/src/components/App.js index 39c94983..d3dbd19a 100644 --- a/src/components/App.js +++ b/src/components/App.js @@ -12,8 +12,7 @@ import theme from 'styles/theme' import i18n from 'renderer/i18n/electron' -import Onboarding from 'components/Onboarding' - +import OnboardingOrElse from 'components/OnboardingOrElse' import ThrowBlock from 'components/ThrowBlock' import Default from 'components/layout/Default' import Print from 'components/layout/Print' @@ -35,13 +34,14 @@ const App = ({ - - - - - - - + + + + + + + + diff --git a/src/components/Onboarding/index.js b/src/components/Onboarding/index.js index 291e5496..f212c8b0 100644 --- a/src/components/Onboarding/index.js +++ b/src/components/Onboarding/index.js @@ -24,6 +24,7 @@ import { getCurrentDevice } from 'reducers/devices' import { unlock } from 'reducers/application' import Box from 'components/base/Box' +import TriggerAppReady from '../TriggerAppReady' import Start from './steps/Start' import InitStep from './steps/Init' @@ -147,6 +148,7 @@ class Onboarding extends PureComponent { return ( + {step.options.showBreadcrumb && } diff --git a/src/components/OnboardingOrElse.js b/src/components/OnboardingOrElse.js new file mode 100644 index 00000000..f82a9418 --- /dev/null +++ b/src/components/OnboardingOrElse.js @@ -0,0 +1,28 @@ +// @flow + +import React, { PureComponent } from 'react' +import { connect } from 'react-redux' +import { createStructuredSelector } from 'reselect' +import { hasCompletedOnboardingSelector } from 'reducers/settings' +import Onboarding from './Onboarding' + +type Props = { + hasCompletedOnboarding: boolean, + children: *, +} + +class OnboardingOrElse extends PureComponent { + render() { + const { hasCompletedOnboarding, children } = this.props + if (hasCompletedOnboarding) { + return children + } + return + } +} + +export default connect( + createStructuredSelector({ + hasCompletedOnboarding: hasCompletedOnboardingSelector, + }), +)(OnboardingOrElse) diff --git a/src/helpers/hardReset.js b/src/helpers/hardReset.js index aacbdd87..2d4e64ee 100644 --- a/src/helpers/hardReset.js +++ b/src/helpers/hardReset.js @@ -9,4 +9,5 @@ export default async function hardReset() { disableDBMiddleware() db.resetAll() await delay(500) + window.location.href = '' } diff --git a/src/reducers/settings.js b/src/reducers/settings.js index 6a5d20e1..ee8d1163 100644 --- a/src/reducers/settings.js +++ b/src/reducers/settings.js @@ -223,5 +223,7 @@ export const marketIndicatorSelector = (state: State) => state.settings.marketIn export const sentryLogsBooleanSelector = (state: State) => state.settings.sentryLogs export const shareAnalyticsSelector = (state: State) => state.settings.shareAnalytics export const selectedTimeRangeSelector = (state: State) => state.settings.selectedTimeRange +export const hasCompletedOnboardingSelector = (state: State) => + state.settings.hasCompletedOnboarding export default handleActions(handlers, INITIAL_STATE)