5bec6accc2
refactor modals and settings, clean-up CHANGELOG
52 lines
1.1 KiB
JavaScript
52 lines
1.1 KiB
JavaScript
import React from "react";
|
|
import Router from "component/router/index";
|
|
import Header from "component/header";
|
|
import ModalRouter from "modal/modalRouter";
|
|
import lbry from "lbry";
|
|
|
|
class App extends React.PureComponent {
|
|
componentWillMount() {
|
|
const {
|
|
alertError,
|
|
checkUpgradeAvailable,
|
|
updateBalance,
|
|
fetchRewardedContent,
|
|
} = this.props;
|
|
|
|
document.addEventListener("unhandledError", event => {
|
|
alertError(event.detail);
|
|
});
|
|
|
|
if (!this.props.upgradeSkipped) {
|
|
checkUpgradeAvailable();
|
|
}
|
|
|
|
lbry.balanceSubscribe(balance => {
|
|
updateBalance(balance);
|
|
});
|
|
|
|
fetchRewardedContent();
|
|
|
|
this.scrollListener = () => this.props.recordScroll(window.scrollY);
|
|
|
|
window.addEventListener("scroll", this.scrollListener);
|
|
}
|
|
|
|
componentWillUnmount() {
|
|
window.removeEventListener("scroll", this.scrollListener);
|
|
}
|
|
|
|
render() {
|
|
return (
|
|
<div id="window">
|
|
<Header />
|
|
<div id="main-content">
|
|
<Router />
|
|
</div>
|
|
<ModalRouter />
|
|
</div>
|
|
);
|
|
}
|
|
}
|
|
|
|
export default App;
|