on fd7a195 help sign in
bridge/src/Bridge.js
62 lines 1.7 kB history raw
1import React from 'react';
2import { Just, Nothing } from 'folktale/maybe';
3import { IndigoApp } from 'indigo-react';
5import View from 'components/View';
6import Router from 'components/Router';
8import Provider from 'store/Provider';
10import Header from './components/old/Header';
12import { ROUTE_NAMES } from 'lib/routeNames';
13import { NETWORK_TYPES } from 'lib/network';
14import { walletFromMnemonic } from 'lib/wallet';
15import { isDevelopment } from 'lib/flags';
17import 'style/index.scss';
19const kInitialNetworkType = isDevelopment
20 ? NETWORK_TYPES.LOCAL
21 : NETWORK_TYPES.MAINNET;
23// NB(shrugs): modify these variables to change the default local state.
24const shouldStubLocal = process.env.REACT_APP_STUB_LOCAL === 'true';
25const kIsStubbed = isDevelopment && shouldStubLocal;
26const kInitialRoutes = kIsStubbed
27 ? [
28 { name: ROUTE_NAMES.LANDING },
29 { name: ROUTE_NAMES.NETWORK },
30 { name: ROUTE_NAMES.WALLET },
31 { name: ROUTE_NAMES.SHIPS },
32 ]
33 : [{ name: ROUTE_NAMES.LANDING }];
35const kInitialWallet = kIsStubbed
36 ? walletFromMnemonic(
37 process.env.REACT_APP_DEV_MNEMONIC,
38 process.env.REACT_APP_HD_PATH
39 )
40 : undefined;
41const kInitialMnemonic = kIsStubbed
42 ? Just(process.env.REACT_APP_DEV_MNEMONIC)
43 : Nothing();
44const kInitialPointCursor = kIsStubbed ? Just(0) : Nothing();
46export default function Bridge() {
47 return (
48 <Provider
49 initialRoutes={kInitialRoutes}
50 initialNetworkType={kInitialNetworkType}
51 initialWallet={kInitialWallet}
52 initialMnemonic={kInitialMnemonic}
53 initialPointCursor={kInitialPointCursor}>
54 <IndigoApp>
55 <View>
56 <Header />
57 <Router />
58 </View>
59 </IndigoApp>
60 </Provider>
61 );