lbry-desktop/js/app.js

40 lines
1.1 KiB
JavaScript
Raw Normal View History

2016-04-10 02:00:56 +02:00
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');
}
});
},
2016-04-10 02:00:56 +02:00
componentDidMount: function() {
lbry.getStartNotice(function(notice) {
if (notice) {
alert(notice);
}
});
},
render: function() {
if (this.state.viewingPage == 'home') {
2016-04-10 02:03:23 +02:00
var content = <HomePage />;
2016-04-10 02:00:56 +02:00
} else if (this.state.viewingPage == 'settings') {
2016-04-10 02:03:23 +02:00
var content = <SettingsPage />;
2016-04-10 02:00:56 +02:00
}
return (
<div style={appStyles}>
{content}
</div>
);
}
});