@@ -4,7 +4,7 @@ import * as lodash from 'lodash';
44import Header from './components/Header';
55import Footer from './components/Footer';
66
7−import { NETWORK_STATES, PROFILE_STATES, GEN_STATES } from './lib/constants';
7+import { PROFILE_STATES, GEN_STATES } from './lib/constants';
88
99import PrivacyPolicy from './views/PrivacyPolicy';
1010import Welcome from './views/Welcome';
@@ -18,9 +18,7 @@ import Download from './views/Download';
1818import Done from './views/Done';
1919
2020import './style/index.css';
21−
22−const checkNetwork = () =>
23− navigator.onLine ? NETWORK_STATES.ONLINE : NETWORK_STATES.OFFLINE;
21+import { OnlineProvider } from '../bridge/store/online';
2422
2523const ROUTES = [
2624 { path: '/Welcome', Component: Welcome },
@@ -41,7 +39,6 @@ class Walletgen extends React.Component {
4139 constructor(props) {
4240 super(props);
4341 this.state = {
44− network: checkNetwork(),
4542 'profile.state': PROFILE_STATES.NOSTART,
4643 'profile.value': null,
4744 'profile.shipCount': 0,
@@ -65,18 +62,9 @@ class Walletgen extends React.Component {
6562 };
6663 }
6764
68− componentDidMount = () => {
69− window.addEventListener('online', () =>
70− this.setState({ network: NETWORK_STATES.ONLINE })
71− );
72− window.addEventListener('offline', () =>
73− this.setState({ network: NETWORK_STATES.OFFLINE })
74− );
75− };
76−
7765 setGlobalState = state => this.setState(state);
7866
79− router = (network, path) => {
67+ router = path => {
8068 const route = key => {
8169 const { Component } = lodash.find(ROUTES, { path: key });
8270 const globals = {
@@ -87,39 +75,30 @@ class Walletgen extends React.Component {
8775 };
8876
8977 return route(path);
90−
91− // return network === NETWORK_STATES.ONLINE
92− // ? <NetworkWarning />
93− // : !(network === NETWORK_STATES.OFFLINE)
94− // ? <h1>Detecting your network state.</h1>
95− // : route(path)
9678 };
9779
9880 render() {
99− const { network, route, currentStep, lastRoute } = this.state;
81+ const { route, currentStep, lastRoute } = this.state;
10082
101− const routed = this.router(network, route); // hacky prod
102− // const routed = this.router(NETWORK_STATES.OFFLINE, true, route) // hacky dev
83+ const routed = this.router(route);
10384
10485 return (
105− <main className={'container'}>
106− <Header
107− network={network}
108− currentStep={currentStep}
109− totalSteps={TOTAL_STEPS}
110− />
111−
112− <div className={'row wrapper'}>
113− <div className={'col-'}>{routed}</div>
114− <div className={'push'} />
115− </div>
116−
117− <Footer
118− route={route}
119− lastRoute={lastRoute}
120− setGlobalState={this.setGlobalState}
121− />
122− </main>
86+ <OnlineProvider>
87+ <main className={'container'}>
88+ <Header currentStep={currentStep} totalSteps={TOTAL_STEPS} />
89+
90+ <div className={'row wrapper'}>
91+ <div className={'col-'}>{routed}</div>
92+ <div className={'push'} />
93+ </div>
94+
95+ <Footer
96+ route={route}
97+ lastRoute={lastRoute}
98+ setGlobalState={this.setGlobalState}
99+ />
100+ </main>
101+ </OnlineProvider>
123102 );
124103 }
125104}