diff --git a/js/component/file-tile.js b/js/component/file-tile.js index 88ce9f55d..208de9f9b 100644 --- a/js/component/file-tile.js +++ b/js/component/file-tile.js @@ -17,6 +17,7 @@ let FileTile = React.createClass({ local: React.PropTypes.bool, cost: React.PropTypes.number, costIncludesData: React.PropTypes.bool, + hideOnRemove: React.PropTypes.bool, }, updateFileInfo: function(progress=null) { const updateFileInfoCallback = ((fileInfo) => { @@ -73,6 +74,7 @@ let FileTile = React.createClass({ getInitialState: function() { return { downloading: false, + removeConfirmed: false, isHovered: false, cost: null, costIncludesData: null, @@ -84,6 +86,7 @@ let FileTile = React.createClass({ getDefaultProps: function() { return { compact: false, + hideOnRemove: false, } }, handleMouseOver: function() { @@ -96,6 +99,11 @@ let FileTile = React.createClass({ isHovered: false, }); }, + handleRemoveConfirmed: function() { + this.setState({ + removeConfirmed: true, + }); + }, componentWillMount: function() { this.updateFileInfo(); @@ -120,8 +128,9 @@ let FileTile = React.createClass({ this._isMounted = false; }, render: function() { - if (this.state.isMine === null || this.state.local === null) { - // Can't render until we know whether we own the file and if we have a local copy + // Can't render until we know whether we own the file and if we have a local copy + if (this.state.isMine === null || this.state.local === null || + (this.props.hideOnRemove && this.state.removeConfirmed)) { return null; } @@ -163,7 +172,8 @@ let FileTile = React.createClass({
diff --git a/js/component/link.js b/js/component/link.js
index c667f9eee..3d4b54f6c 100644
--- a/js/component/link.js
+++ b/js/component/link.js
@@ -167,6 +167,7 @@ export let DownloadLink = React.createClass({
path: React.PropTypes.string,
hidden: React.PropTypes.bool,
deleteChecked: React.PropTypes.bool,
+ onRemoveConfirmed: React.PropTypes.func,
},
tryDownload: function() {
this.setState({
@@ -217,13 +218,18 @@ export let DownloadLink = React.createClass({
},
handleRemoveConfirmed: function() {
lbry.deleteFile(this.props.sdHash || this.props.streamName, this.state.deleteChecked);
+ if (this.props.onRemoveConfirmed) {
+ this.props.onRemoveConfirmed();
+ }
this.setState({
modal: null,
+ attemptingRemove: true,
});
},
getDefaultProps: function() {
return {
state: 'not-started',
+ hideOnDelete: false,
}
},
getInitialState: function() {
@@ -233,6 +239,7 @@ export let DownloadLink = React.createClass({
menuOpen: false,
deleteChecked: false,
attemptingDownload: false,
+ attemptingRemove: false,
}
},
closeModal: function() {
@@ -256,7 +263,9 @@ export let DownloadLink = React.createClass({
];
let linkBlock;
- if (this.state.attemptingDownload) {
+ if (this.state.attemptingRemove || this.props.state == 'not-started') {
+ linkBlock = ;
+ } else if (this.state.attemptingDownload) {
linkBlock =
} else if (this.props.state == 'downloading') {
@@ -273,10 +282,6 @@ export let DownloadLink = React.createClass({
);
- } else if (this.props.state == 'not-started') {
- linkBlock = (
-
- );
} else if (this.props.state == 'done') {
linkBlock = (