Merge pull request #825 from feross/m/path-error-buttons

Don't render radial progress on path-missing error
This commit is contained in:
Feross Aboukhadijeh
2016-08-24 02:20:36 +02:00
committed by GitHub

View File

@@ -184,22 +184,20 @@ module.exports = class TorrentList extends React.Component {
downloadTooltip = 'Click to start torrenting.' downloadTooltip = 'Click to start torrenting.'
} }
// Do we have a saved position? Show it using a radial progress bar on top // Only show the play/dowload buttons for torrents that contain playable media
// of the play button, unless already showing a spinner there: var playButton, downloadButton, positionElem
var positionElem if (!torrentSummary.error) {
var willShowSpinner = torrentSummary.playStatus === 'requested' downloadButton = (
var defaultFile = torrentSummary.files && <i
torrentSummary.files[torrentSummary.defaultPlayFileIndex] key='download-button'
if (defaultFile && defaultFile.currentTime && !willShowSpinner) { className={'button-round icon download ' + torrentSummary.status}
var fraction = defaultFile.currentTime / defaultFile.duration title={downloadTooltip}
positionElem = this.renderRadialProgressBar(fraction, 'radial-progress-large') onClick={dispatcher('toggleTorrent', infoHash)}>
playClass = 'resume-position' {downloadIcon}
} </i>
)
// Only show the play button for torrents that contain playable media if (TorrentPlayer.isPlayableTorrentSummary(torrentSummary)) {
var playButton, downloadButton
var noErrors = !torrentSummary.error
if (noErrors && TorrentPlayer.isPlayableTorrentSummary(torrentSummary)) {
playButton = ( playButton = (
<i <i
key='play-button' key='play-button'
@@ -210,16 +208,17 @@ module.exports = class TorrentList extends React.Component {
</i> </i>
) )
} }
if (noErrors) {
downloadButton = ( // Do we have a saved position? Show it using a radial progress bar on top
<i // of the play button, unless already showing a spinner there:
key='download-button' var willShowSpinner = torrentSummary.playStatus === 'requested'
className={'button-round icon download ' + torrentSummary.status} var defaultFile = torrentSummary.files &&
title={downloadTooltip} torrentSummary.files[torrentSummary.defaultPlayFileIndex]
onClick={dispatcher('toggleTorrent', infoHash)}> if (defaultFile && defaultFile.currentTime && !willShowSpinner) {
{downloadIcon} var fraction = defaultFile.currentTime / defaultFile.duration
</i> positionElem = this.renderRadialProgressBar(fraction, 'radial-progress-large')
) playClass = 'resume-position'
}
} }
return ( return (