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