on f1ff0cf help sign in
bridge/src/Bridge.js
60 lines 1.7 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 ? [
26 { key: ROUTE_NAMES.LANDING },
27 { key: ROUTE_NAMES.LOGIN },
28 { key: ROUTE_NAMES.POINTS },
29 { key: ROUTE_NAMES.POINT },
30 { key: ROUTE_NAMES.INVITE },
31 ]
32 : [{ key: ROUTE_NAMES.LANDING }];
34const kInitialWallet = kIsStubbed
35 ? walletFromMnemonic(
36 process.env.REACT_APP_DEV_MNEMONIC,
37 process.env.REACT_APP_HD_PATH
38 )
39 : undefined;
40const kInitialMnemonic = kIsStubbed
41 ? Just(process.env.REACT_APP_DEV_MNEMONIC)
42 : Nothing();
43const kInitialPointCursor = kIsStubbed ? Just(65792) : Nothing();
45export default function Bridge() {
46 return (
47 <Provider
48 views={ROUTES}
49 names={ROUTE_NAMES}
50 initialRoutes={kInitialRoutes}
51 initialNetworkType={kInitialNetworkType}
52 initialWallet={kInitialWallet}
53 initialMnemonic={kInitialMnemonic}
54 initialPointCursor={kInitialPointCursor}>
55 <IndigoApp>
56 <Router />
57 </IndigoApp>
58 </Provider>
59 );