Skip to content

Commit

Permalink
Download Item Removal Confirmation
Browse files Browse the repository at this point in the history
  • Loading branch information
michalbe committed Feb 4, 2017
1 parent 50443ad commit 4d5f6b2
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 5 deletions.
17 changes: 16 additions & 1 deletion app/renderer/components/downloadItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@ class DownloadItem extends ImmutableComponent {
this.onResumeDownload = this.onDownloadActionPerformed.bind(this, RESUME)
this.onCancelDownload = this.onDownloadActionPerformed.bind(this, CANCEL)
this.onClearDownload = this.onClearDownload.bind(this)
this.onShowDeleteConfirmation = this.onShowDeleteConfirmation.bind(this)
this.onDeleteDownload = this.onDeleteDownload.bind(this)
this.onRedownload = this.onRedownload.bind(this)
this.onCopyLinkToClipboard = this.onCopyLinkToClipboard.bind(this)
this.state = {
deleteConfirmationVisible: false
}
}
onRevealDownload () {
appActions.downloadRevealed(this.props.downloadId)
Expand All @@ -34,6 +38,12 @@ class DownloadItem extends ImmutableComponent {
onClearDownload () {
appActions.downloadCleared(this.props.downloadId)
}
onShowDeleteConfirmation () {
console.log('no hej', this.state)
this.setState({
deleteConfirmationVisible: true
})
}
onDeleteDownload () {
appActions.downloadDeleted(this.props.downloadId)
}
Expand Down Expand Up @@ -78,6 +88,11 @@ class DownloadItem extends ImmutableComponent {
downloadItem: true,
[this.props.download.get('state')]: true
})}>
{
this.state.deleteConfirmationVisible
? <div className='deleteConfirmation'>Delete?<Button l10nId='ok' className='primaryButton confirmButton' onClick={this.onDeleteDownload} /></div>
: null
}
<div className='downloadActions'>
{
downloadUtil.shouldAllowPause(this.props.download)
Expand Down Expand Up @@ -111,7 +126,7 @@ class DownloadItem extends ImmutableComponent {
}
{
downloadUtil.shouldAllowDelete(this.props.download)
? <Button className='deleteButton' l10nId='downloadDelete' iconClass='fa-trash-o' onClick={this.onDeleteDownload} />
? <Button className='deleteButton' l10nId='downloadDelete' iconClass='fa-trash-o' onClick={this.onShowDeleteConfirmation} />
: null
}
{
Expand Down
26 changes: 22 additions & 4 deletions less/downloadBar.less
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
min-width: var(--download-item-width);

&:hover {
height: 62px;
top: -24px;
height: 105px;
top: -67px;

.downloadInfo .downloadArrow {
display: none;
Expand All @@ -60,6 +60,10 @@
.downloadActions {
display: none;
}

.deleteConfirmation {
display: none;
}
}

&.paused {
Expand Down Expand Up @@ -125,6 +129,22 @@
}
}
}

.deleteConfirmation {
line-height: 2;
border-bottom: 1px solid #CCC;
padding: 5px 0;
margin-bottom: auto 0 10px 0;
font-size: 12px;

.confirmButton {
font-weight: normal;
padding: 1px;
min-width: 50px;
float: right;
margin-right: -5px;
}
}
}
}

Expand All @@ -150,5 +170,3 @@
}
}
}


0 comments on commit 4d5f6b2

Please sign in to comment.