overflow_app/src/ts/app/index.tsx

63 lines
1.6 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';
import createSagaMiddleware, { SagaMiddleware } from 'redux-saga';
2017-06-28 07:50:19 +00:00
import { fork } from 'redux-saga/effects';
2017-06-27 13:00:55 +00:00
import { createHashHistory } from 'history';
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-06-30 11:50:58 +00:00
import Platform from 'commons/platform';
2017-06-27 13:00:55 +00:00
import configureStore from 'config/configureStore';
2017-06-28 07:50:19 +00:00
import { sagas } from 'config/configureRedux';
2017-06-27 13:00:55 +00:00
import muiTheme from 'config/configureMuiTheme';
2017-06-28 07:50:19 +00:00
2017-06-27 13:00:55 +00:00
import App from 'app/views/container/component/App';
injectTapEventPlugin();
const sagaMiddleware: SagaMiddleware<any> = createSagaMiddleware();
const history = createHashHistory();
const store = configureStore(history, sagaMiddleware);
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}>
<ConnectedRouter history={history}>
<MuiThemeProvider muiTheme={muiTheme}>
<App/>
</MuiThemeProvider>
</ConnectedRouter>
</Provider>,
appContainer,
);
2017-06-21 11:24:44 +00:00
}
2017-06-27 13:00:55 +00:00
sagaMiddleware.run(app);