From bbab1f064a2a7944c9a787eb894c5a97ae1675f4 Mon Sep 17 00:00:00 2001 From: Alex Liebowitz Date: Mon, 17 Apr 2017 06:03:00 -0400 Subject: [PATCH] Show: don't display price if file is already downloaded --- ui/js/page/show.js | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/ui/js/page/show.js b/ui/js/page/show.js index d38e9dc75..ea41731af 100644 --- a/ui/js/page/show.js +++ b/ui/js/page/show.js @@ -55,6 +55,7 @@ let ShowPage = React.createClass({ cost: null, costIncludesData: null, uriLookupComplete: null, + isDownloaded: null, }; }, componentWillMount: function() { @@ -62,8 +63,16 @@ let ShowPage = React.createClass({ document.title = this._uri; lbry.resolve({uri: this._uri}).then(({ claim: {txid, nout, has_signature, signature_is_valid, value: {stream: {metadata, source: {contentType}}}}}) => { + const outpoint = txid + ':' + nout; + + lbry.file_list({outpoint}).then((fileInfo) => { + this.setState({ + isDownloaded: fileInfo.length > 0, + }); + }); + this.setState({ - outpoint: txid + ':' + nout, + outpoint: outpoint, metadata: metadata, hasSignature: has_signature, signatureIsValid: signature_is_valid, @@ -80,21 +89,21 @@ let ShowPage = React.createClass({ }); }, render: function() { - const - metadata = this.state.uriLookupComplete ? this.state.metadata : null, - title = this.state.uriLookupComplete ? metadata.title : this._uri; - + const metadata = this.state.metadata; + const title = metadata ? this.state.metadata.title : this._uri; return (
{ this.state.contentType && this.state.contentType.startsWith('video/') ? -
- + {this.state.isDownloaded === false + ? + : null}

{title}

{ this.state.uriLookupComplete ?