lbry-desktop/js/app.js
Alex Liebowitz f8c0382db0 If user has old version, redirect them to lbry.io/[os] to upgrade
The OS checking is ugly, but once we have an "upgrade" page on lbry.io we'll change it to point there
2016-04-12 06:35:14 -04:00

40 lines
1.1 KiB
JavaScript

var appStyles = {
width: '800px',
marginLeft: 'auto',
marginRight: 'auto',
};
var App = React.createClass({
getInitialState: function() {
return {
viewingPage: window.location.search === '?settings' ? 'settings' : 'home'
}
},
componentWillMount: function() {
lbry.checkNewVersionAvailable(function(isAvailable) {
if (isAvailable) {
alert("The version of LBRY you're using is not up to date.\n\n" +
"You'll now be taken to lbry.io, where you can download the latest version.");
window.location = "http://www.lbry.io/" + (navigator.userAgent.indexOf('Mac OS X') != -1 ? 'osx' : 'linux');
}
});
},
componentDidMount: function() {
lbry.getStartNotice(function(notice) {
if (notice) {
alert(notice);
}
});
},
render: function() {
if (this.state.viewingPage == 'home') {
var content = <HomePage />;
} else if (this.state.viewingPage == 'settings') {
var content = <SettingsPage />;
}
return (
<div style={appStyles}>
{content}
</div>
);
}
});