1import React from 'react';
2import { Just, Nothing } from 'folktale/maybe';
4import Footer from './components/Footer';
5import Header from './components/Header';
6import { Container, Row, Col } from './components/Base';
8import nest from './lib/nest';
9import { router } from './lib/router';
10import { ROUTE_NAMES } from './lib/routeNames';
11import { NETWORK_TYPES } from './lib/network';
12import { walletFromMnemonic } from './lib/wallet';
13import { isDevelopment } from './lib/flags';
15import { HistoryProvider, useHistory } from './store/history';
16import { TxnConfirmationsProvider } from './store/txnConfirmations';
17import { OnlineProvider } from './store/online';
18import { NetworkProvider } from './store/network';
19import { WalletProvider } from './store/wallet';
20import { PointCursorProvider } from './store/pointCursor';
21import { PointCacheProvider } from './store/pointCache';
23const kInitialNetworkType = isDevelopment
25 : NETWORK_TYPES.MAINNET;
27// NB(shrugs): toggle these variables to change the default local state.
28// try not to commit changes to this line, but there shouldn't be a problem
29// if you do because we'll never stub on a production build.
30const shouldStubLocal = false;
31const kIsStubbed = isDevelopment && shouldStubLocal;
32const kInitialRoutes = kIsStubbed
34 { name: ROUTE_NAMES.LANDING },
35 { name: ROUTE_NAMES.NETWORK },
36 { name: ROUTE_NAMES.WALLET },
37 { name: ROUTE_NAMES.SHIPS },
39 : [{ name: ROUTE_NAMES.LANDING }];
41const kInitialWallet = kIsStubbed
43 process.env.REACT_APP_DEV_MNEMONIC,
44 process.env.REACT_APP_HD_PATH
47const kInitialMnemonic = kIsStubbed
48 ? process.env.REACT_APP_DEV_MNEMONIC
50const kInitialPointCursor = kIsStubbed ? Just(0) : Nothing();
52// the router itself is just a component that renders a specific view
53// depending on the history
54const Router = function(props) {
55 const history = useHistory();
56 const Route = router(history.peek());
58 return <Route {...props} />;
61// NB(shrugs): separate component because it needs useHistory
62// this will be must better structured as part of the UI overhaul
63const VariableWidthColumn = function({ children }) {
64 const history = useHistory();
65 // For the invite acceptance flow, widen the screen to use the full
66 // container, and hide the breadcrumbs
70 history.includes(ROUTE_NAMES.INVITE_TICKET)
72 : 'col-md-offset-1 col-md-10'
75 history.includes(ROUTE_NAMES.INVITE_TICKET) ? {} : { maxWidth: '620px' }
82// nest all of the providers within each other to avoid hella depth
83const AllProviders = nest([
85 TxnConfirmationsProvider,
93class Bridge extends React.Component {
98 networkSeedCache: null,
100 txnHashCursor: Nothing(),
101 txnConfirmations: {},
104 this.setTxnHashCursor = this.setTxnHashCursor.bind(this);
105 this.setNetworkSeedCache = this.setNetworkSeedCache.bind(this);
108 setNetworkSeedCache(networkSeed, revision) {
110 networkSeedCache: networkSeed,
111 networkRevisionCache: revision,
115 setTxnHashCursor(txnHashCursor) {
116 this.setState({ txnHashCursor });
122 networkRevisionCache,
128 initialRoutes={kInitialRoutes}
129 initialNetworkType={kInitialNetworkType}
130 initialWallet={kInitialWallet}
131 initialMnemonic={kInitialMnemonic}
132 initialPointCursor={kInitialPointCursor}>
135 <VariableWidthColumn>
138 <Row className={'row wrapper'}>
140 networkSeedCache={networkSeedCache}
141 networkRevisionCache={networkRevisionCache}
142 setNetworkSeedCache={this.setNetworkSeedCache}
143 onSent={this.setTxnHashCursor}
144 setTxnHashCursor={this.setTxnHashCursor}
145 txnHashCursor={txnHashCursor}
148 <div className={'push'} />
152 </VariableWidthColumn>
160export default Bridge;
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