Design: address PR comments

This commit is contained in:
DC
2016-09-23 03:33:16 -07:00
parent 72db60bb12
commit 41b111c8a8

View File

@@ -83,35 +83,23 @@ module.exports = class TorrentList extends React.Component {
// If it's downloading/seeding then show progress info // If it's downloading/seeding then show progress info
const prog = torrentSummary.progress const prog = torrentSummary.progress
const progElems = [renderDownloadCheckbox(), renderTorrentStatus()]
if (torrentSummary.error) { if (torrentSummary.error) {
elements.push( progElems.push(getErrorMessage(torrentSummary))
<div key='progress-info' className='ellipsis'>
{renderDownloadCheckbox()}
{renderTorrentStatus()}
{getErrorMessage(torrentSummary)}
</div>
)
} else if (torrentSummary.status !== 'paused' && prog) { } else if (torrentSummary.status !== 'paused' && prog) {
elements.push( Array.prototype.push.call(progElems,
<div key='progress-info' className='ellipsis'> renderProgressBar(),
{renderDownloadCheckbox()} renderPercentProgress(),
{renderTorrentStatus()} renderTotalProgress(),
{renderProgressBar()} renderPeers(),
{renderPercentProgress()} renderSpeeds(),
{renderTotalProgress()} renderEta())
{renderPeers()}
{renderSpeeds()}
{renderEta()}
</div>
)
} else {
elements.push(
<div key='progress-info' className='ellipsis'>
{renderDownloadCheckbox()}
{renderTorrentStatus()}
</div>
)
} }
elements.push(
<div key='progress-info' className='ellipsis'>
{progElems}
</div>
)
return (<div key='metadata' className='metadata'>{elements}</div>) return (<div key='metadata' className='metadata'>{elements}</div>)
@@ -158,8 +146,8 @@ module.exports = class TorrentList extends React.Component {
function renderSpeeds () { function renderSpeeds () {
let str = '' let str = ''
if (prog.downloadSpeed > 0) str += prettySpeed(prog.downloadSpeed) + '' if (prog.downloadSpeed > 0) str += ' ↓ ' + prettyBytes(prog.downloadSpeed) + '/s'
if (prog.uploadSpeed > 0) str += prettySpeed(prog.uploadSpeed) + '' if (prog.uploadSpeed > 0) str += ' ↑ ' + prettyBytes(prog.uploadSpeed) + '/s'
if (str === '') return if (str === '') return
return (<span key='download'>{str}</span>) return (<span key='download'>{str}</span>)
} }
@@ -376,8 +364,3 @@ function getErrorMessage (torrentSummary) {
} }
return 'Error' return 'Error'
} }
// Returns '1.9m', '205k', etc
function prettySpeed (n) {
return prettyBytes(n).replace('B', '').toLowerCase()
}