Check for missing download path

Fixes #646
This commit is contained in:
DC
2016-08-12 20:54:57 -07:00
parent 09d6fa550a
commit 1ec305162e
5 changed files with 59 additions and 13 deletions

View File

@@ -22,12 +22,12 @@ function renderGeneralSection (state) {
description: '',
icon: 'settings'
}, [
renderDownloadDirSelector(state),
renderDownloadPathSelector(state),
renderFileHandlers(state)
])
}
function renderDownloadDirSelector (state) {
function renderDownloadPathSelector (state) {
return renderFileSelector({
key: 'download-path',
label: 'Download Path',

View File

@@ -8,16 +8,36 @@ const {dispatcher} = require('../lib/dispatcher')
module.exports = class TorrentList extends React.Component {
render () {
var state = this.props.state
var torrentRows = state.saved.torrents.map(
(torrentSummary) => this.renderTorrent(torrentSummary)
)
return (
<div key='torrent-list' className='torrent-list'>
{torrentRows}
var contents
if (!state.downloadPathStatus) {
contents = ''
} else if (state.downloadPathStatus === 'missing') {
contents = (
<div>
<p>Download path missing: {state.saved.prefs.downloadPath}</p>
<p>Check that all drives are connected?</p>
<p>Alternatively, choose a new download path in
<a href='#' onClick={dispatcher('preferences')}>Preferences</a>
</p>
</div>
)
} else if (state.downloadPathStatus === 'ok') {
contents = state.saved.torrents.map(
(torrentSummary) => this.renderTorrent(torrentSummary)
)
contents.push(
<div key='torrent-placeholder' className='torrent-placeholder'>
<span className='ellipsis'>Drop a torrent file here or paste a magnet link</span>
</div>
)
} else {
throw new Error('Unhandled downloadPathStatus ' + state.downloadPathStatus)
}
return (
<div key='torrent-list' className='torrent-list'>
{contents}
</div>
)
}