Help: slight refactor of version section

This commit is contained in:
Alex Liebowitz 2016-11-23 19:55:36 -05:00
parent e0d0c3f915
commit a0fb58415e

View file

@ -17,21 +17,24 @@ var HelpPage = React.createClass({
document.title = "Help";
},
render: function() {
var ver = this.state.versionInfo;
let ver, osName, platform, newVerLink;
if (this.state.versionInfo) {
ver = this.state.versionInfo;
if (ver) {
if (ver.os_system == 'Darwin') {
var osName = (parseInt(ver.os_release.match(/^\d+/)) < 16 ? 'Mac OS X' : 'Mac OS');
osName = (parseInt(ver.os_release.match(/^\d+/)) < 16 ? 'Mac OS X' : 'Mac OS');
var platform = osName + ' ' + ver.os_release;
var newVerLink = 'https://lbry.io/get/lbry.dmg';
platform = `${osName} ${ver.os_release}`
newVerLink = 'https://lbry.io/get/lbry.dmg';
} else if (ver.os_system == 'Linux') {
var platform = 'Linux (' + ver.platform + ')';
var newVerLink = 'https://lbry.io/get/lbry.deb';
platform = `Linux (${ver.platform})`;
newVerLink = 'https://lbry.io/get/lbry.deb';
} else {
var platform = 'Windows (' + ver.platform + ')';
var newVerLink = 'https://lbry.io/get/lbry.msi';
platform = `Windows (${ver.platform})`;
newVerLink = 'https://lbry.io/get/lbry.msi';
}
} else {
ver = null;
}
return (
@ -60,7 +63,7 @@ var HelpPage = React.createClass({
<section className="card">
<h3>About</h3>
{ver.lbrynet_update_available || ver.lbryum_update_available ?
<p>A newer version of LBRY is available. <Link href={newVerLink} label={"Download LBRY " + ver.remote_lbrynet + " now!"} /></p>
<p>A newer version of LBRY is available. <Link href={newVerLink} label={`Download LBRY ${ver.remote_lbrynet} now!`} /></p>
: <p>Your copy of LBRY is up to date.</p>
}
<table className="table-standard">