Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Added React Hot Reload to dapps + TokenDeplpoy fix (#4846)
Browse files Browse the repository at this point in the history
  • Loading branch information
ngotchac authored and jacogr committed Mar 9, 2017
1 parent bd00256 commit 3478c16
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 14 deletions.
18 changes: 17 additions & 1 deletion js/src/dapps/githubhint.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -27,6 +28,21 @@ import '../../assets/fonts/RobotoMono/font.css';
import './style.css';

ReactDOM.render(
<Application />,
<AppContainer>
<Application />
</AppContainer>,
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')
);
});
}
18 changes: 17 additions & 1 deletion js/src/dapps/localtx.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -27,6 +28,21 @@ import '../../assets/fonts/RobotoMono/font.css';
import './style.css';

ReactDOM.render(
<Application />,
<AppContainer>
<Application />
</AppContainer>,
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')
);
});
}
18 changes: 17 additions & 1 deletion js/src/dapps/signaturereg.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -27,6 +28,21 @@ import '../../assets/fonts/RobotoMono/font.css';
import './style.css';

ReactDOM.render(
<Application />,
<AppContainer>
<Application />
</AppContainer>,
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')
);
});
}
41 changes: 33 additions & 8 deletions js/src/dapps/tokendeploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -31,13 +32,37 @@ import '../../assets/fonts/RobotoMono/font.css';
import './style.css';

ReactDOM.render(
<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>
<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')
);

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')
);
});
}
2 changes: 1 addition & 1 deletion js/src/dapps/tokendeploy/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
20 changes: 18 additions & 2 deletions js/src/dapps/tokenreg.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -29,10 +30,25 @@ import '../../assets/fonts/RobotoMono/font.css';
import './style.css';

ReactDOM.render(
(
<AppContainer>
<Provider store={ store }>
<Container />
</Provider>
),
</AppContainer>,
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')
);
});
}

0 comments on commit 3478c16

Please sign in to comment.