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

45 lines
1.1 KiB
React
Raw Normal View History

2017-06-06 23:19:12 +02:00
import React from "react";
import Router from "component/router";
import Header from "component/header";
2017-07-02 20:23:38 +02:00
import ModalError from "component/modalError";
import ModalDownloading from "component/modalDownloading";
2017-07-10 19:19:42 +02:00
import ModalUpgrade from "component/modalUpgrade";
import ModalWelcome from "component/modalWelcome";
2017-06-06 23:19:12 +02:00
import lbry from "lbry";
import { Line } from "rc-progress";
2017-04-07 07:15:22 +02:00
2017-06-08 06:42:19 +02:00
class App extends React.PureComponent {
2017-05-04 05:44:08 +02:00
componentWillMount() {
2017-06-06 23:19:12 +02:00
document.addEventListener("unhandledError", event => {
2017-04-07 07:15:22 +02:00
this.props.alertError(event.detail);
});
if (!this.props.upgradeSkipped) {
2017-06-06 23:19:12 +02:00
this.props.checkUpgradeAvailable();
2017-04-07 07:15:22 +02:00
}
2017-05-15 18:34:33 +02:00
2017-06-06 23:19:12 +02:00
lbry.balanceSubscribe(balance => {
this.props.updateBalance(balance);
});
2017-05-04 05:44:08 +02:00
}
render() {
2017-06-06 23:19:12 +02:00
const { modal } = this.props;
2017-04-07 07:15:22 +02:00
2017-06-06 23:19:12 +02:00
return (
<div id="window">
<Header />
<div id="main-content">
<Router />
</div>
2017-07-10 19:19:42 +02:00
{modal == "upgrade" && <ModalUpgrade />}
2017-07-02 20:23:38 +02:00
{modal == "downloading" && <ModalDownloading />}
{modal == "error" && <ModalError />}
2017-07-10 19:19:42 +02:00
{modal == "welcome" && <ModalWelcome />}
2017-04-21 04:31:50 +02:00
</div>
2017-06-06 23:19:12 +02:00
);
2017-04-07 07:15:22 +02:00
}
2017-05-04 05:44:08 +02:00
}
2017-04-07 07:15:22 +02:00
2017-06-06 06:21:55 +02:00
export default App;