Fix screen stacking bug

You can no longer open a whole stack of Prefs windows, or Create Torrent windows

Simplifies and fixes behavior when dropping files onto the app or the dock icon. Before, you could use drag-drop to create stacks of Create Torrent windows. Now, you can only create torrents from the home screen.

Fixes #665
This commit is contained in:
DC
2016-08-10 00:53:27 -07:00
parent 563e1ca0ba
commit 4d48b9e7c1
12 changed files with 91 additions and 92 deletions

View File

@@ -16,7 +16,7 @@ module.exports = class CreateTorrentErrorPage extends React.Component {
</p>
</p>
<p className='float-right'>
<button className='button-flat light' onClick={dispatcher('back')}>
<button className='button-flat light' onClick={dispatcher('cancel')}>
Cancel
</button>
</p>

View File

@@ -89,7 +89,7 @@ module.exports = class CreateTorrentPage extends React.Component {
</div>
</div>
<div key='buttons' className='float-right'>
<button key='cancel' className='button-flat light' onClick={dispatcher('back')}>Cancel</button>
<button key='cancel' className='button-flat light' onClick={dispatcher('cancel')}>Cancel</button>
<button key='create' className='button-raised' onClick={handleOK}>Create Torrent</button>
</div>
</div>

View File

@@ -40,7 +40,7 @@ function renderDownloadDirSelector (state) {
},
state.unsaved.prefs.downloadPath,
function (filePath) {
setStateValue('downloadPath', filePath)
dispatch('updatePreferences', 'downloadPath', filePath)
})
}
@@ -98,12 +98,18 @@ function renderSection (definition, controls) {
// - callback takes a new file or folder path
function renderFileSelector (definition, value, callback) {
var controls = [(
<input type='text' className='file-picker-text'
<input
type='text'
className='file-picker-text'
key={definition.property}
id={definition.property}
disabled='disabled'
value={value} />
), (
<button className='btn' onClick={handleClick}>
<button
key={definition.property + '-btn'}
className='btn'
onClick={handleClick}>
<i className='icon'>folder_open</i>
</button>
)]
@@ -132,7 +138,3 @@ function renderControlGroup (definition, controls) {
</div>
)
}
function setStateValue (property, value) {
dispatch('updatePreferences', property, value)
}

View File

@@ -44,6 +44,7 @@ module.exports = class TorrentList extends React.Component {
if (torrentSummary.playStatus) classes.push(torrentSummary.playStatus)
if (isSelected) classes.push('selected')
if (!infoHash) classes.push('disabled')
if (torrentSummary.torrrentKey) console.error('Missing torrentKey', torrentSummary)
return (
<div
key={torrentSummary.torrentKey}

View File

@@ -11,18 +11,18 @@ module.exports = class UpdateAvailableModal extends React.Component {
<p><strong>A new version of WebTorrent is available: v{state.modal.version}</strong></p>
<p>We have an auto-updater for Windows and Mac. We don't have one for Linux yet, so you'll have to download the new version manually.</p>
<p className='float-right'>
<button className='button button-flat' onClick={handleCancel}>Skip This Release</button>
<button className='button button-raised' onClick={handleOK}>Show Download Page</button>
<button className='button button-flat' onClick={handleSkip}>Skip This Release</button>
<button className='button button-raised' onClick={handleShow}>Show Download Page</button>
</p>
</div>
)
function handleOK () {
function handleShow () {
electron.shell.openExternal('https://github.com/feross/webtorrent-desktop/releases')
dispatch('exitModal')
}
function handleCancel () {
function handleSkip () {
dispatch('skipVersion', state.modal.version)
dispatch('exitModal')
}