From 3478c16e10f24bca3cc1321e387a732c12d41dbc Mon Sep 17 00:00:00 2001 From: Nicolas Gotchac Date: Thu, 9 Mar 2017 19:55:48 +0100 Subject: [PATCH] Added React Hot Reload to dapps + TokenDeplpoy fix (#4846) --- js/src/dapps/githubhint.js | 18 +++++++++++- js/src/dapps/localtx.js | 18 +++++++++++- js/src/dapps/signaturereg.js | 18 +++++++++++- js/src/dapps/tokendeploy.js | 41 ++++++++++++++++++++++------ js/src/dapps/tokendeploy/services.js | 2 +- js/src/dapps/tokenreg.js | 20 ++++++++++++-- 6 files changed, 103 insertions(+), 14 deletions(-) diff --git a/js/src/dapps/githubhint.js b/js/src/dapps/githubhint.js index 14db7c7b3..1e55b91f5 100644 --- a/js/src/dapps/githubhint.js +++ b/js/src/dapps/githubhint.js @@ -16,6 +16,7 @@ import ReactDOM from 'react-dom'; import React from 'react'; +import { AppContainer } from 'react-hot-loader'; import injectTapEventPlugin from 'react-tap-event-plugin'; injectTapEventPlugin(); @@ -27,6 +28,21 @@ import '../../assets/fonts/RobotoMono/font.css'; import './style.css'; ReactDOM.render( - , + + + , document.querySelector('#container') ); + +if (module.hot) { + module.hot.accept('./githubhint/Application/index.js', () => { + require('./githubhint/Application/index.js'); + + ReactDOM.render( + + + , + document.querySelector('#container') + ); + }); +} diff --git a/js/src/dapps/localtx.js b/js/src/dapps/localtx.js index 8d8db8caf..4625ded20 100644 --- a/js/src/dapps/localtx.js +++ b/js/src/dapps/localtx.js @@ -16,6 +16,7 @@ import ReactDOM from 'react-dom'; import React from 'react'; +import { AppContainer } from 'react-hot-loader'; import injectTapEventPlugin from 'react-tap-event-plugin'; injectTapEventPlugin(); @@ -27,6 +28,21 @@ import '../../assets/fonts/RobotoMono/font.css'; import './style.css'; ReactDOM.render( - , + + + , document.querySelector('#container') ); + +if (module.hot) { + module.hot.accept('./localtx/Application/index.js', () => { + require('./localtx/Application/index.js'); + + ReactDOM.render( + + + , + document.querySelector('#container') + ); + }); +} diff --git a/js/src/dapps/signaturereg.js b/js/src/dapps/signaturereg.js index c20e45170..61b67aab0 100644 --- a/js/src/dapps/signaturereg.js +++ b/js/src/dapps/signaturereg.js @@ -16,6 +16,7 @@ import ReactDOM from 'react-dom'; import React from 'react'; +import { AppContainer } from 'react-hot-loader'; import injectTapEventPlugin from 'react-tap-event-plugin'; injectTapEventPlugin(); @@ -27,6 +28,21 @@ import '../../assets/fonts/RobotoMono/font.css'; import './style.css'; ReactDOM.render( - , + + + , document.querySelector('#container') ); + +if (module.hot) { + module.hot.accept('./signaturereg/Application/index.js', () => { + require('./signaturereg/Application/index.js'); + + ReactDOM.render( + + + , + document.querySelector('#container') + ); + }); +} diff --git a/js/src/dapps/tokendeploy.js b/js/src/dapps/tokendeploy.js index a1808199e..b6de05d05 100644 --- a/js/src/dapps/tokendeploy.js +++ b/js/src/dapps/tokendeploy.js @@ -17,6 +17,7 @@ import ReactDOM from 'react-dom'; import React from 'react'; import { Redirect, Router, Route, hashHistory } from 'react-router'; +import { AppContainer } from 'react-hot-loader'; import injectTapEventPlugin from 'react-tap-event-plugin'; injectTapEventPlugin(); @@ -31,13 +32,37 @@ import '../../assets/fonts/RobotoMono/font.css'; import './style.css'; ReactDOM.render( - - - - - - - - , + + + + + + + + + + , 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( + + + + + + + + + + , + document.querySelector('#container') + ); + }); +} diff --git a/js/src/dapps/tokendeploy/services.js b/js/src/dapps/tokendeploy/services.js index 9ca4c4f56..6cfeff05f 100644 --- a/js/src/dapps/tokendeploy/services.js +++ b/js/src/dapps/tokendeploy/services.js @@ -119,7 +119,7 @@ export function attachInstances () { .all([ api.parity.registryAddress(), api.parity.netChain(), - api.partiy.netVersion() + api.net.version() ]) .then(([registryAddress, netChain, _netVersion]) => { const registry = api.newContract(abis.registry, registryAddress).instance; diff --git a/js/src/dapps/tokenreg.js b/js/src/dapps/tokenreg.js index 5c6bb4bd1..3e8dc9b19 100644 --- a/js/src/dapps/tokenreg.js +++ b/js/src/dapps/tokenreg.js @@ -17,6 +17,7 @@ import ReactDOM from 'react-dom'; import React from 'react'; import { Provider } from 'react-redux'; +import { AppContainer } from 'react-hot-loader'; import injectTapEventPlugin from 'react-tap-event-plugin'; injectTapEventPlugin(); @@ -29,10 +30,25 @@ import '../../assets/fonts/RobotoMono/font.css'; import './style.css'; ReactDOM.render( - ( + - ), + , document.querySelector('#container') ); + +if (module.hot) { + module.hot.accept('./tokenreg/Container.js', () => { + require('./tokenreg/Container.js'); + + ReactDOM.render( + + + + + , + document.querySelector('#container') + ); + }); +}