@@ -4,7 +4,7 @@ import * as lodash from 'lodash';
4import Header from './components/Header';
4import Header from './components/Header';
5import Footer from './components/Footer';
5import Footer from './components/Footer';
7−import { NETWORK_STATES, PROFILE_STATES, GEN_STATES } from './lib/constants';
7+import { PROFILE_STATES, GEN_STATES } from './lib/constants';
9import PrivacyPolicy from './views/PrivacyPolicy';
9import PrivacyPolicy from './views/PrivacyPolicy';
10import Welcome from './views/Welcome';
10import Welcome from './views/Welcome';
@@ -18,9 +18,7 @@ import Download from './views/Download';
18import Done from './views/Done';
18import Done from './views/Done';
20import './style/index.css';
20import './style/index.css';
21−
21+import { OnlineProvider } from '../bridge/store/online';
22−const checkNetwork = () =>
23− navigator.onLine ? NETWORK_STATES.ONLINE : NETWORK_STATES.OFFLINE;
25const ROUTES = [
23const ROUTES = [
26 { path: '/Welcome', Component: Welcome },
24 { path: '/Welcome', Component: Welcome },
@@ -41,7 +39,6 @@ class Walletgen extends React.Component {
41 constructor(props) {
39 constructor(props) {
42 super(props);
40 super(props);
43 this.state = {
41 this.state = {
44− network: checkNetwork(),
45 'profile.state': PROFILE_STATES.NOSTART,
42 'profile.state': PROFILE_STATES.NOSTART,
46 'profile.value': null,
43 'profile.value': null,
47 'profile.shipCount': 0,
44 'profile.shipCount': 0,
@@ -65,18 +62,9 @@ class Walletgen extends React.Component {
68− componentDidMount = () => {
69− window.addEventListener('online', () =>
70− this.setState({ network: NETWORK_STATES.ONLINE })
72− window.addEventListener('offline', () =>
73− this.setState({ network: NETWORK_STATES.OFFLINE })
77 setGlobalState = state => this.setState(state);
65 setGlobalState = state => this.setState(state);
79− router = (network, path) => {
67+ router = path => {
80 const route = key => {
68 const route = key => {
81 const { Component } = lodash.find(ROUTES, { path: key });
69 const { Component } = lodash.find(ROUTES, { path: key });
82 const globals = {
70 const globals = {
@@ -87,39 +75,30 @@ class Walletgen extends React.Component {
89 return route(path);
77 return route(path);
91− // return network === NETWORK_STATES.ONLINE
92− // ? <NetworkWarning />
93− // : !(network === NETWORK_STATES.OFFLINE)
94− // ? <h1>Detecting your network state.</h1>
98 render() {
80 render() {
99− const { network, route, currentStep, lastRoute } = this.state;
81+ const { route, currentStep, lastRoute } = this.state;
101− const routed = this.router(network, route); // hacky prod
83+ const routed = this.router(route);
102− // const routed = this.router(NETWORK_STATES.OFFLINE, true, route) // hacky dev
105− <main className={'container'}>
87+ <main className={'container'}>
108− currentStep={currentStep}
88+ <Header currentStep={currentStep} totalSteps={TOTAL_STEPS} />
109− totalSteps={TOTAL_STEPS}
89+
112− <div className={'row wrapper'}>
90+ <div className={'row wrapper'}>
113− <div className={'col-'}>{routed}</div>
91+ <div className={'col-'}>{routed}</div>
114− <div className={'push'} />
92+ <div className={'push'} />
118− route={route}
96+ route={route}
119− lastRoute={lastRoute}
97+ lastRoute={lastRoute}
120− setGlobalState={this.setGlobalState}
98+ setGlobalState={this.setGlobalState}