on fb6d07a help sign in
bridge/src/Bridge.js
54 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 { ROUTES } from 'lib/router';
11import { NETWORK_TYPES } from 'lib/network';
12import { walletFromMnemonic } from 'lib/wallet';
13import { isDevelopment } from 'lib/flags';
15import 'style/index.scss';
17const kInitialNetworkType = isDevelopment
18 ? NETWORK_TYPES.LOCAL
19 : NETWORK_TYPES.MAINNET;
21// NB(shrugs): modify these variables to change the default local state.
22const shouldStubLocal = process.env.REACT_APP_STUB_LOCAL === 'true';
23const kIsStubbed = isDevelopment && shouldStubLocal;
24const kInitialRoutes = kIsStubbed
25 ? [{ key: ROUTE_NAMES.LANDING }, { key: ROUTE_NAMES.ACTIVATE }]
26 : [{ key: ROUTE_NAMES.LANDING }];
28const kInitialWallet = kIsStubbed
29 ? walletFromMnemonic(
30 process.env.REACT_APP_DEV_MNEMONIC,
31 process.env.REACT_APP_HD_PATH
32 )
33 : undefined;
34const kInitialMnemonic = kIsStubbed
35 ? Just(process.env.REACT_APP_DEV_MNEMONIC)
36 : Nothing();
37const kInitialPointCursor = kIsStubbed ? Just(65792) : Nothing();
39export default function Bridge() {
40 return (
41 <Provider
42 views={ROUTES}
43 names={ROUTE_NAMES}
44 initialRoutes={kInitialRoutes}
45 initialNetworkType={kInitialNetworkType}
46 initialWallet={kInitialWallet}
47 initialMnemonic={kInitialMnemonic}
48 initialPointCursor={kInitialPointCursor}>
49 <IndigoApp>
50 <Router />
51 </IndigoApp>
52 </Provider>
53 );