diff --git a/js/page/my_files.js b/js/page/my_files.js index 0387692dc..9deb17d83 100644 --- a/js/page/my_files.js +++ b/js/page/my_files.js @@ -11,6 +11,13 @@ progressBarStyle = { backgroundColor: '#444', border: '2px solid #eee', display: 'inline-block', +}, +myFilesRowImgStyle = { + maxHeight: '100px', + display: 'block', + marginLeft: 'auto', + marginRight: 'auto', + float: 'left' }; var MyFilesRow = React.createClass({ @@ -43,10 +50,24 @@ var MyFilesRow = React.createClass({ curProgressBarStyle.width = this.props.ratioLoaded * 230; curProgressBarStyle.borderRightWidth = 230 - (this.props.ratioLoaded * 230) + 2; } + + if (this.props.showWatchButton) { + // No support for lbry:// URLs in Windows or on Chrome yet + if (/windows|win32/i.test(navigator.userAgent) || (window.chrome && window.navigator.vendor == "Google Inc.")) { + var watchUri = "/?watch=" + this.props.lbryUri; + } else { + var watchUri = 'lbry://' + this.props.lbryUri; + } + + var watchLink = ; + } else { + var watchLink = null; + } + return (
- {'Photo + {'Photo

{this.props.title}

@@ -54,6 +75,7 @@ var MyFilesRow = React.createClass({ { ' ' } {this.props.completed ? 'Download complete' : (parseInt(this.props.ratioLoaded * 100) + '%')}
{ pauseLink }
+
{ watchLink }
{ this.onRemoveClicked() } } />
@@ -83,28 +105,33 @@ var MyFilesPage = React.createClass({ render: function() { if (this.state.filesInfo === null) { return null; - } else { - if (this.state.filesInfo.length == 0) { - var content = You haven't downloaded anything from LBRY yet. Go !; - } else { - var content = []; - for (let {completed, written_bytes, total_bytes, lbry_uri, stopped, metadata} of this.state.filesInfo) { - let {name, stream_name, thumbnail} = metadata; - var title = (name || stream_name || ('lbry://' + lbry_uri)); - var ratioLoaded = written_bytes / total_bytes; - content.push(); - } - } - return ( -
-

My files

- {content} -
- -
-
- ); } + + if (!this.state.filesInfo.length) { + var content = You haven't downloaded anything from LBRY yet. Go !; + } else { + var content = []; + for (let fileInfo of this.state.filesInfo) { + let {completed, written_bytes, total_bytes, lbry_uri, file_name, stopped, metadata} = fileInfo; + let {name, stream_name, thumbnail} = metadata; + + var title = (name || stream_name || ('lbry://' + lbry_uri)); + var ratioLoaded = written_bytes / total_bytes; + var showWatchButton = (lbry.getMediaType(file_name) == 'video'); + + content.push(); + } + } + return ( +
+

My files

+ {content} +
+ +
+
+ ); } }); \ No newline at end of file