@@ -1,7 +1,7 @@
11import 'babel-polyfill' // required for @ledgerhq/hw-transport-u2f
22
33import React from 'react'
4−import _ from 'lodash'
4+import { get } from 'lodash'
55
66import Bridge from './bridge/Bridge'
77import Walletgen from './walletgen/Walletgen'
@@ -36,11 +36,11 @@ class Root extends React.Component {
3636 */
3737
3838 isWalletgenStyle(styleSheet) {
39− return _.get(styleSheet, 'cssRules[0].selectorText', null) === "walletgen"
39+ return get(styleSheet, 'cssRules[0].selectorText', null) === "walletgen"
4040 }
4141
4242 isBridgeStyle(styleSheet) {
43− return _.get(styleSheet, 'cssRules[0].selectorText', null) === "bridge"
43+ return get(styleSheet, 'cssRules[0].selectorText', null) === "bridge"
4444 }
4545
4646 disableStylesheets(appView) {
@@ -70,25 +70,20 @@ class Root extends React.Component {
7070 }
7171
7272 render() {
73− let appComponent = null;
74−
75− if (this.state.appView === "walletgen") {
76− appComponent = <Walletgen
77− appView={this.state.appView}
78− setView={this.setView} />
79− }
80−
81− if (this.state.appView === "bridge") {
82− appComponent = <Bridge
83− appView={this.state.appView}
84− setView={this.setView} />
73+ const { appView } = this.state;
74+
75+ switch (appView) {
76+ case "walletgen":
77+ return <Walletgen
78+ appView={appView}
79+ setView={this.setView} />
80+ case "bridge":
81+ return <Bridge
82+ appView={appView}
83+ setView={this.setView} />
84+ default:
85+ throw new Error(`Unknown appView ${appView}`)
8586 }
86−
87− return (
88− <React.Fragment>
89− {appComponent}
90− </React.Fragment>
91− )
9287 }
9388}
9489