Don't show "file not available" message if user has the file
This commit is contained in:
parent
eba0ac6842
commit
042c093666
1 changed files with 24 additions and 12 deletions
|
@ -232,6 +232,7 @@ export let FileActions = React.createClass({
|
||||||
return {
|
return {
|
||||||
available: true,
|
available: true,
|
||||||
forceShowActions: false,
|
forceShowActions: false,
|
||||||
|
fileInfo: null,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onShowFileActionsRowClicked: function() {
|
onShowFileActionsRowClicked: function() {
|
||||||
|
@ -239,8 +240,14 @@ export let FileActions = React.createClass({
|
||||||
forceShowActions: true,
|
forceShowActions: true,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
onFileInfoUpdate: function(fileInfo) {
|
||||||
|
this.setState({
|
||||||
|
fileInfo: fileInfo,
|
||||||
|
});
|
||||||
|
},
|
||||||
componentDidMount: function() {
|
componentDidMount: function() {
|
||||||
this._isMounted = true;
|
this._isMounted = true;
|
||||||
|
this._fileInfoSubscribeId = lbry.fileInfoSubscribe(this.props.sdHash, this.onFileInfoUpdate);
|
||||||
lbry.getPeersForBlobHash(this.props.sdHash, (peers) => {
|
lbry.getPeersForBlobHash(this.props.sdHash, (peers) => {
|
||||||
if (!this._isMounted) {
|
if (!this._isMounted) {
|
||||||
return;
|
return;
|
||||||
|
@ -255,20 +262,25 @@ export let FileActions = React.createClass({
|
||||||
this._isMounted = false;
|
this._isMounted = false;
|
||||||
},
|
},
|
||||||
render: function() {
|
render: function() {
|
||||||
|
const fileInfo = this.state.fileInfo;
|
||||||
|
if (fileInfo === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return (<section className="file-actions">
|
return (<section className="file-actions">
|
||||||
{
|
{
|
||||||
this.state.available || this.state.forceShowActions ?
|
fileInfo || this.state.available || this.state.forceShowActions
|
||||||
<FileActionsRow sdHash={this.props.sdHash} metadata={this.props.metadata} streamName={this.props.streamName} /> :
|
? <FileActionsRow sdHash={this.props.sdHash} metadata={this.props.metadata} streamName={this.props.streamName} />
|
||||||
(<div>
|
: <div>
|
||||||
<div className="button-container empty">This file is not currently available.</div>
|
<div className="button-container empty">This file is not currently available.</div>
|
||||||
<div className="button-container">
|
<div className="button-container">
|
||||||
<ToolTip label="Why?"
|
<ToolTip label="Why?"
|
||||||
body="The content on LBRY is hosted by its users. It appears there are no users connected that have this file at the moment." />
|
body="The content on LBRY is hosted by its users. It appears there are no users connected that have this file at the moment." />
|
||||||
</div>
|
</div>
|
||||||
<div className="button-container">
|
<div className="button-container">
|
||||||
<Link label="Try Anyway" onClick={this.onShowFileActionsRowClicked} />
|
<Link label="Try Anyway" onClick={this.onShowFileActionsRowClicked} />
|
||||||
</div>
|
</div>
|
||||||
</div>)
|
</div>
|
||||||
}
|
}
|
||||||
</section>);
|
</section>);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue