Added React Hot Reload to dapps + TokenDeplpoy fix (#4846)

This commit is contained in:
Nicolas Gotchac 2017-03-09 19:55:48 +01:00 committed by Jaco Greeff
parent bd00256e0c
commit 3478c16e10
6 changed files with 103 additions and 14 deletions

View File

@ -16,6 +16,7 @@
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import React from 'react'; import React from 'react';
import { AppContainer } from 'react-hot-loader';
import injectTapEventPlugin from 'react-tap-event-plugin'; import injectTapEventPlugin from 'react-tap-event-plugin';
injectTapEventPlugin(); injectTapEventPlugin();
@ -27,6 +28,21 @@ import '../../assets/fonts/RobotoMono/font.css';
import './style.css'; import './style.css';
ReactDOM.render( ReactDOM.render(
<Application />, <AppContainer>
<Application />
</AppContainer>,
document.querySelector('#container') document.querySelector('#container')
); );
if (module.hot) {
module.hot.accept('./githubhint/Application/index.js', () => {
require('./githubhint/Application/index.js');
ReactDOM.render(
<AppContainer>
<Application />
</AppContainer>,
document.querySelector('#container')
);
});
}

View File

@ -16,6 +16,7 @@
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import React from 'react'; import React from 'react';
import { AppContainer } from 'react-hot-loader';
import injectTapEventPlugin from 'react-tap-event-plugin'; import injectTapEventPlugin from 'react-tap-event-plugin';
injectTapEventPlugin(); injectTapEventPlugin();
@ -27,6 +28,21 @@ import '../../assets/fonts/RobotoMono/font.css';
import './style.css'; import './style.css';
ReactDOM.render( ReactDOM.render(
<Application />, <AppContainer>
<Application />
</AppContainer>,
document.querySelector('#container') document.querySelector('#container')
); );
if (module.hot) {
module.hot.accept('./localtx/Application/index.js', () => {
require('./localtx/Application/index.js');
ReactDOM.render(
<AppContainer>
<Application />
</AppContainer>,
document.querySelector('#container')
);
});
}

View File

@ -16,6 +16,7 @@
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import React from 'react'; import React from 'react';
import { AppContainer } from 'react-hot-loader';
import injectTapEventPlugin from 'react-tap-event-plugin'; import injectTapEventPlugin from 'react-tap-event-plugin';
injectTapEventPlugin(); injectTapEventPlugin();
@ -27,6 +28,21 @@ import '../../assets/fonts/RobotoMono/font.css';
import './style.css'; import './style.css';
ReactDOM.render( ReactDOM.render(
<Application />, <AppContainer>
<Application />
</AppContainer>,
document.querySelector('#container') document.querySelector('#container')
); );
if (module.hot) {
module.hot.accept('./signaturereg/Application/index.js', () => {
require('./signaturereg/Application/index.js');
ReactDOM.render(
<AppContainer>
<Application />
</AppContainer>,
document.querySelector('#container')
);
});
}

View File

@ -17,6 +17,7 @@
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import React from 'react'; import React from 'react';
import { Redirect, Router, Route, hashHistory } from 'react-router'; import { Redirect, Router, Route, hashHistory } from 'react-router';
import { AppContainer } from 'react-hot-loader';
import injectTapEventPlugin from 'react-tap-event-plugin'; import injectTapEventPlugin from 'react-tap-event-plugin';
injectTapEventPlugin(); injectTapEventPlugin();
@ -31,6 +32,7 @@ import '../../assets/fonts/RobotoMono/font.css';
import './style.css'; import './style.css';
ReactDOM.render( ReactDOM.render(
<AppContainer>
<Router history={ hashHistory }> <Router history={ hashHistory }>
<Redirect from='/' to='/overview' /> <Redirect from='/' to='/overview' />
<Route path='/' component={ Application }> <Route path='/' component={ Application }>
@ -38,6 +40,29 @@ ReactDOM.render(
<Route path='overview' component={ Overview } /> <Route path='overview' component={ Overview } />
<Route path='transfer' component={ Transfer } /> <Route path='transfer' component={ Transfer } />
</Route> </Route>
</Router>, </Router>
</AppContainer>,
document.querySelector('#container') document.querySelector('#container')
); );
if (module.hot) {
module.hot.accept('./tokendeploy/Application/index.js', () => {
require('./tokendeploy/Application/index.js');
require('./tokendeploy/Overview/index.js');
require('./tokendeploy/Transfer/index.js');
ReactDOM.render(
<AppContainer>
<Router history={ hashHistory }>
<Redirect from='/' to='/overview' />
<Route path='/' component={ Application }>
<Route path='deploy' component={ Deploy } />
<Route path='overview' component={ Overview } />
<Route path='transfer' component={ Transfer } />
</Route>
</Router>
</AppContainer>,
document.querySelector('#container')
);
});
}

View File

@ -119,7 +119,7 @@ export function attachInstances () {
.all([ .all([
api.parity.registryAddress(), api.parity.registryAddress(),
api.parity.netChain(), api.parity.netChain(),
api.partiy.netVersion() api.net.version()
]) ])
.then(([registryAddress, netChain, _netVersion]) => { .then(([registryAddress, netChain, _netVersion]) => {
const registry = api.newContract(abis.registry, registryAddress).instance; const registry = api.newContract(abis.registry, registryAddress).instance;

View File

@ -17,6 +17,7 @@
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import React from 'react'; import React from 'react';
import { Provider } from 'react-redux'; import { Provider } from 'react-redux';
import { AppContainer } from 'react-hot-loader';
import injectTapEventPlugin from 'react-tap-event-plugin'; import injectTapEventPlugin from 'react-tap-event-plugin';
injectTapEventPlugin(); injectTapEventPlugin();
@ -29,10 +30,25 @@ import '../../assets/fonts/RobotoMono/font.css';
import './style.css'; import './style.css';
ReactDOM.render( ReactDOM.render(
( <AppContainer>
<Provider store={ store }> <Provider store={ store }>
<Container /> <Container />
</Provider> </Provider>
), </AppContainer>,
document.querySelector('#container') document.querySelector('#container')
); );
if (module.hot) {
module.hot.accept('./tokenreg/Container.js', () => {
require('./tokenreg/Container.js');
ReactDOM.render(
<AppContainer>
<Provider store={ store }>
<Container />
</Provider>
</AppContainer>,
document.querySelector('#container')
);
});
}