lbry-desktop/ui/js/component/app/view.jsx

43 lines
1.2 KiB
React
Raw Normal View History

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