From a32889291f8b2d9cee738d0a6110d775b2eaa978 Mon Sep 17 00:00:00 2001 From: DC Date: Sun, 25 Sep 2016 17:33:22 -0700 Subject: [PATCH] Design: don't show 'Paused' on new torrents --- src/renderer/pages/torrent-list-page.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/renderer/pages/torrent-list-page.js b/src/renderer/pages/torrent-list-page.js index dfb3abd0..31bea29c 100644 --- a/src/renderer/pages/torrent-list-page.js +++ b/src/renderer/pages/torrent-list-page.js @@ -189,7 +189,19 @@ module.exports = class TorrentList extends React.Component { } function renderTorrentStatus () { - return ({capitalize(torrentSummary.status)}) + let status + if (torrentSummary.status === 'paused') { + if (!torrentSummary.progress) status = '' + else if (torrentSummary.progress.progress === 1) status = 'Not seeding' + else status = 'Paused' + } else if (torrentSummary.status === 'downloading') { + status = 'Downloading' + } else if (torrentSummary.status === 'seeding') { + status = 'Seeding' + } else { // torrentSummary.status is 'new' or something unexpected + status = '' + } + return ({status}) } } @@ -362,11 +374,6 @@ function stopPropagation (e) { e.stopPropagation() } -// Takes "foo bar", returns "Foo bar" -function capitalize (str) { - return str.slice(0, 1).toUpperCase() + str.slice(1) -} - function getErrorMessage (torrentSummary) { const err = torrentSummary.error if (err === 'path-missing') {