Upgrade react to v16

[MAILPOET-1634]
This commit is contained in:
Pavel Dohnal
2018-11-14 15:03:28 +01:00
parent 061c8c2d28
commit ed8325c6f9
46 changed files with 1789 additions and 1735 deletions

View File

@@ -1,39 +1,24 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { Router, Route, IndexRedirect, useRouterHistory } from 'react-router';
import { createHashHistory } from 'history';
import PropTypes from 'prop-types';
import { HashRouter, Route, Redirect, Switch } from 'react-router-dom';
import KnowledgeBase from 'help/knowledge_base.jsx';
import SystemInfo from 'help/system_info.jsx';
import SystemStatus from 'help/system_status.jsx';
import YourPrivacy from 'help/your_privacy.jsx';
const history = useRouterHistory(createHashHistory)({ queryKey: false });
class App extends React.Component {
render() {
return this.props.children;
}
}
App.propTypes = {
children: PropTypes.element.isRequired,
};
const container = document.getElementById('help_container');
if (container) {
ReactDOM.render((
<Router history={history}>
<Route path="/" component={App}>
<IndexRedirect to="knowledgeBase" />
{/* Pages */}
<Route path="knowledgeBase(/)**" params={{ tab: 'knowledgeBase' }} component={KnowledgeBase} />
<Route path="systemStatus(/)**" params={{ tab: 'systemStatus' }} component={SystemStatus} />
<Route path="systemInfo(/)**" params={{ tab: 'systemInfo' }} component={SystemInfo} />
<Route path="yourPrivacy(/)**" params={{ tab: 'yourPrivacy' }} component={YourPrivacy} />
</Route>
</Router>
<HashRouter>
<Switch>
<Route exact path="/" render={() => <Redirect to="/knowledgeBase" />} />
<Route path="/knowledgeBase" component={KnowledgeBase} />
<Route path="/systemStatus" component={SystemStatus} />
<Route path="/systemInfo" component={SystemInfo} />
<Route path="/yourPrivacy" component={YourPrivacy} />
</Switch>
</HashRouter>
), container);
}