diff --git a/renderer/views/torrent-list.js b/renderer/views/torrent-list.js index 718438d4..35cc5943 100644 --- a/renderer/views/torrent-list.js +++ b/renderer/views/torrent-list.js @@ -49,17 +49,28 @@ function renderTorrent (state, dispatch, torrent) { // Renders the torrent name and download progress function renderTorrentMetadata (torrent) { + var progressPercent = 0 + var progressBytes = 0 + + if (torrent.progress) { + progressPercent = Math.floor(100 * torrent.progress) + } + + if (torrent.length && torrent.progress) { + progressBytes = torrent.length * torrent.progress + } + return hx`
${torrent.name || 'Loading torrent...'}
- ${Math.floor(100 * torrent.progress)}% - ${prettyBytes(torrent.length * torrent.progress)} / ${prettyBytes(torrent.length)} + ${progressPercent}% + ${prettyBytes(progressBytes)} / ${prettyBytes(torrent.length || 0)}
${getFilesLength()} ${getPeers()} - ↓ ${prettyBytes(torrent.downloadSpeed)}/s - ↑ ${prettyBytes(torrent.uploadSpeed)}/s + ↓ ${prettyBytes(torrent.downloadSpeed || 0)}/s + ↑ ${prettyBytes(torrent.uploadSpeed || 0)}/s
`