1import React from 'react';
2import { useEffect } from 'react';
3import { Just, Nothing } from 'folktale/maybe';
4import { IndigoApp } from 'indigo-react';
6import Router from 'components/Router';
8import Provider from 'store/Provider';
10import { ROUTE_NAMES } from 'lib/routeNames';
11import { ROUTES } from 'lib/router';
12import { NETWORK_TYPES } from 'lib/network';
13import { walletFromMnemonic } from 'lib/wallet';
14import { isDevelopment, isMainnet, isRopsten } from 'lib/flags';
15import useImpliedTicket from 'lib/useImpliedTicket';
16import useHasDisclaimed from 'lib/useHasDisclaimed';
18import 'style/index.scss';
19import WithErrorBoundary from 'components/WithErrorBoundary';
20import GlobalErrorBoundary from 'components/GlobalErrorBoundary';
22const INITIAL_NETWORK_TYPE = isRopsten
23 ? NETWORK_TYPES.ROPSTEN
24 : isDevelopment && !isMainnet
26 : NETWORK_TYPES.MAINNET;
28// NB(shrugs): modify these variables to change the default local state.
29const SHOULD_STUB_LOCAL = process.env.REACT_APP_STUB_LOCAL === 'true';
30const IS_STUBBED = isDevelopment && SHOULD_STUB_LOCAL;
32const INITIAL_WALLET = IS_STUBBED
34 process.env.REACT_APP_DEV_MNEMONIC,
35 process.env.REACT_APP_HD_PATH
38const INITIAL_MNEMONIC = IS_STUBBED
39 ? Just(process.env.REACT_APP_DEV_MNEMONIC)
41const INITIAL_POINT_CURSOR = IS_STUBBED ? Just(65792) : Nothing();
43function useInitialRoutes() {
44 const [hasDisclaimed] = useHasDisclaimed();
45 const { impliedTicket } = useImpliedTicket();
47 const isActivateUrl = window.location.pathname === '/activate';
51 { key: ROUTE_NAMES.LOGIN },
52 // { key: ROUTE_NAMES.POINTS },
53 // { key: ROUTE_NAMES.POINT },
57 if (impliedTicket || isActivateUrl) {
58 return [{ key: ROUTE_NAMES.ACTIVATE }];
62 return [{ key: ROUTE_NAMES.DISCLAIMER, data: { next: ROUTE_NAMES.LOGIN } }];
65 return [{ key: ROUTE_NAMES.LOGIN }];
69 const initialRoutes = useInitialRoutes();
71 // full reload if the user changes their selected network in Metamask
74 if (window.ethereum) {
75 window.ethereum.on('chainChanged', () => {
76 document.location.reload();
82 <WithErrorBoundary render={error => <GlobalErrorBoundary error={error} />}>
86 initialRoutes={initialRoutes}
87 initialNetworkType={INITIAL_NETWORK_TYPE}
88 initialWallet={INITIAL_WALLET}
89 initialMnemonic={INITIAL_MNEMONIC}
90 initialPointCursor={INITIAL_POINT_CURSOR}>
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