overflow_app/src/ts/@overflow/app/index.tsx

54 lines
1.3 KiB
TypeScript
Raw Normal View History

2017-06-27 13:00:55 +00:00
import * as React from 'react';
import * as ReactDOM from 'react-dom';
2017-06-28 07:50:19 +00:00
import { fork } from 'redux-saga/effects';
2017-06-27 13:00:55 +00:00
import { Provider } from 'react-redux';
import { ConnectedRouter } from 'react-router-redux';
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
import * as injectTapEventPlugin from 'react-tap-event-plugin';
2017-07-03 10:47:54 +00:00
2017-07-03 10:21:42 +00:00
import Platform from '@overflow/commons/platform';
import { store, sagaMiddleware, history } from './redux/store';
2017-06-27 13:00:55 +00:00
2017-07-03 10:21:42 +00:00
import sagas from './redux/saga';
import muiTheme from './theme/mui';
2017-07-03 13:10:43 +00:00
import routes from './router';
2017-06-28 07:50:19 +00:00
2017-06-27 13:00:55 +00:00
injectTapEventPlugin();
function* app(): any {
2017-06-30 11:50:58 +00:00
const appContainer: HTMLElement = yield Platform.getAppContainer('react-placeholder');
2017-06-27 13:00:55 +00:00
2017-06-28 11:50:16 +00:00
2017-06-27 13:00:55 +00:00
ReactDOM.render(
<div style={{
width: '100vw',
height: '100vh',
backgroundColor: 'white',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
}}>
<h1>Loading...</h1>
</div>,
appContainer,
);
2017-06-28 07:50:19 +00:00
sagaMiddleware.run(sagas);
2017-06-27 13:00:55 +00:00
ReactDOM.render(
<Provider store={store}>
2017-07-03 13:10:43 +00:00
<MuiThemeProvider muiTheme={muiTheme}>
<ConnectedRouter history={history}>
{routes}
</ConnectedRouter>
</MuiThemeProvider>
2017-06-27 13:00:55 +00:00
</Provider>,
appContainer,
);
2017-06-21 11:24:44 +00:00
}
2017-06-27 13:00:55 +00:00
sagaMiddleware.run(app);