2017-04-07 07:15:22 +02:00
|
|
|
import React from 'react'
|
|
|
|
import Router from 'component/router'
|
2017-04-22 15:17:01 +02:00
|
|
|
import Header from 'component/header';
|
2017-04-07 07:15:22 +02:00
|
|
|
import ErrorModal from 'component/errorModal'
|
|
|
|
import DownloadingModal from 'component/downloadingModal'
|
|
|
|
import UpgradeModal from 'component/upgradeModal'
|
|
|
|
import {Line} from 'rc-progress';
|
|
|
|
|
2017-05-04 05:44:08 +02:00
|
|
|
class App extends React.Component {
|
|
|
|
componentWillMount() {
|
2017-04-07 07:15:22 +02:00
|
|
|
document.addEventListener('unhandledError', (event) => {
|
|
|
|
this.props.alertError(event.detail);
|
|
|
|
});
|
|
|
|
|
|
|
|
if (!this.props.upgradeSkipped) {
|
|
|
|
this.props.checkUpgradeAvailable()
|
|
|
|
}
|
2017-05-04 05:44:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
2017-04-07 07:15:22 +02:00
|
|
|
const {
|
|
|
|
currentPage,
|
|
|
|
modal,
|
|
|
|
headerLinks,
|
|
|
|
searchTerm,
|
|
|
|
} = this.props
|
|
|
|
const searchQuery = (currentPage == 'discover' && searchTerm ? searchTerm : '')
|
|
|
|
|
2017-05-04 05:44:08 +02:00
|
|
|
return <div id="window">
|
|
|
|
<Header initialQuery={searchQuery} onSearch={() => { alert('header search'); }}
|
|
|
|
onSubmit={() => { alert('header submit'); }} links={headerLinks} />
|
2017-05-03 01:49:02 +02:00
|
|
|
<div id="main-content">
|
2017-04-21 04:31:50 +02:00
|
|
|
<Router />
|
|
|
|
</div>
|
|
|
|
{modal == 'upgrade' && <UpgradeModal />}
|
|
|
|
{modal == 'downloading' && <DownloadingModal />}
|
|
|
|
{modal == 'error' && <ErrorModal />}
|
|
|
|
</div>
|
2017-04-07 07:15:22 +02:00
|
|
|
}
|
2017-05-04 05:44:08 +02:00
|
|
|
}
|
2017-04-07 07:15:22 +02:00
|
|
|
|
|
|
|
export default App
|