1import React from 'react';
2import { get } from 'lodash';
4import Bridge from './bridge/Bridge';
5import Walletgen from './walletgen/Walletgen';
6// import { AppNavigation } from './common/components/AppNavigation'
8import './common/style/index.css';
9import './bridge/style/index.css';
11class Root extends React.Component {
19 this.setView = this.setView.bind(this);
25 To switch between walletgen and bridge styles without them clobbering each
26 other, we need a way to identify which app the stylesheet belongs to.
28 So we include a "walletgen" or "bridge" style as the first rule of any
29 stylesheet. If this directive is included, we can disable the appropriate
30 sheet when the user switches applications
32 A bit hacky, but does the job for now. These styles should probably be
33 fully merged at some point.
36 isWalletgenStyle(styleSheet) {
37 return get(styleSheet, 'cssRules[0].selectorText', null) === 'walletgen';
40 isBridgeStyle(styleSheet) {
41 return get(styleSheet, 'cssRules[0].selectorText', null) === 'bridge';
44 disableStylesheets(appView) {
45 for (var i = 0; i < document.styleSheets.length; i++) {
46 let styleSheet = document.styleSheets[i];
48 if (appView === 'bridge') {
49 if (this.isWalletgenStyle(styleSheet)) styleSheet.disabled = true;
50 if (this.isBridgeStyle(styleSheet)) styleSheet.disabled = false;
51 } else if (appView === 'walletgen') {
52 if (this.isWalletgenStyle(styleSheet)) styleSheet.disabled = false;
53 if (this.isBridgeStyle(styleSheet)) styleSheet.disabled = true;
59 this.disableStylesheets(this.state.appView);
63 this.disableStylesheets(appView);
71 const { appView } = this.state;
75 return <Walletgen appView={appView} setView={this.setView} />;
77 return <Bridge appView={appView} setView={this.setView} />;
79 throw new Error(`Unknown appView ${appView}`);
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list