2017-06-06 17:19:12 -04:00
|
|
|
import React from "react";
|
|
|
|
import Router from "component/router";
|
|
|
|
import Header from "component/header";
|
|
|
|
import ErrorModal from "component/errorModal";
|
|
|
|
import DownloadingModal from "component/downloadingModal";
|
|
|
|
import UpgradeModal from "component/upgradeModal";
|
2017-06-07 20:56:52 -04:00
|
|
|
import WelcomeModal from "component/welcomeModal";
|
2017-06-06 17:19:12 -04:00
|
|
|
import lbry from "lbry";
|
|
|
|
import { Line } from "rc-progress";
|
2017-04-07 12:15:22 +07:00
|
|
|
|
2017-06-07 21:42:19 -07:00
|
|
|
class App extends React.PureComponent {
|
2017-05-03 23:44:08 -04:00
|
|
|
componentWillMount() {
|
2017-06-06 17:19:12 -04:00
|
|
|
document.addEventListener("unhandledError", event => {
|
2017-04-07 12:15:22 +07:00
|
|
|
this.props.alertError(event.detail);
|
|
|
|
});
|
|
|
|
|
|
|
|
if (!this.props.upgradeSkipped) {
|
2017-06-06 17:19:12 -04:00
|
|
|
this.props.checkUpgradeAvailable();
|
2017-04-07 12:15:22 +07:00
|
|
|
}
|
2017-05-15 12:34:33 -04:00
|
|
|
|
2017-06-06 17:19:12 -04:00
|
|
|
lbry.balanceSubscribe(balance => {
|
|
|
|
this.props.updateBalance(balance);
|
|
|
|
});
|
2017-05-03 23:44:08 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
2017-06-06 17:19:12 -04:00
|
|
|
const { modal } = this.props;
|
2017-04-07 12:15:22 +07:00
|
|
|
|
2017-06-06 17:19:12 -04:00
|
|
|
return (
|
|
|
|
<div id="window">
|
|
|
|
<Header />
|
|
|
|
<div id="main-content">
|
|
|
|
<Router />
|
|
|
|
</div>
|
|
|
|
{modal == "upgrade" && <UpgradeModal />}
|
|
|
|
{modal == "downloading" && <DownloadingModal />}
|
|
|
|
{modal == "error" && <ErrorModal />}
|
2017-06-07 20:56:52 -04:00
|
|
|
{modal == "welcome" && <WelcomeModal />}
|
2017-04-20 22:31:50 -04:00
|
|
|
</div>
|
2017-06-06 17:19:12 -04:00
|
|
|
);
|
2017-04-07 12:15:22 +07:00
|
|
|
}
|
2017-05-03 23:44:08 -04:00
|
|
|
}
|
2017-04-07 12:15:22 +07:00
|
|
|
|
2017-06-05 21:21:55 -07:00
|
|
|
export default App;
|