From 042c0936666e8e87082935b120169fd56302100d Mon Sep 17 00:00:00 2001 From: Alex Liebowitz Date: Mon, 30 Jan 2017 03:21:43 -0500 Subject: [PATCH] Don't show "file not available" message if user has the file --- js/component/file-actions.js | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/js/component/file-actions.js b/js/component/file-actions.js index 7dba036e0..cc1dba546 100644 --- a/js/component/file-actions.js +++ b/js/component/file-actions.js @@ -232,6 +232,7 @@ export let FileActions = React.createClass({ return { available: true, forceShowActions: false, + fileInfo: null, } }, onShowFileActionsRowClicked: function() { @@ -239,8 +240,14 @@ export let FileActions = React.createClass({ forceShowActions: true, }); }, + onFileInfoUpdate: function(fileInfo) { + this.setState({ + fileInfo: fileInfo, + }); + }, componentDidMount: function() { this._isMounted = true; + this._fileInfoSubscribeId = lbry.fileInfoSubscribe(this.props.sdHash, this.onFileInfoUpdate); lbry.getPeersForBlobHash(this.props.sdHash, (peers) => { if (!this._isMounted) { return; @@ -255,20 +262,25 @@ export let FileActions = React.createClass({ this._isMounted = false; }, render: function() { + const fileInfo = this.state.fileInfo; + if (fileInfo === null) { + return null; + } + return (
{ - this.state.available || this.state.forceShowActions ? - : - (
-
This file is not currently available.
-
- -
-
- -
-
) + fileInfo || this.state.available || this.state.forceShowActions + ? + :
+
This file is not currently available.
+
+ +
+
+ +
+
}
); }