diff --git a/ui/js/component/file-actions.js b/ui/js/component/file-actions.js index c8331e261..92d787a21 100644 --- a/ui/js/component/file-actions.js +++ b/ui/js/component/file-actions.js @@ -70,6 +70,7 @@ let FileActionsRow = React.createClass({ streamName: React.PropTypes.string, outpoint: React.PropTypes.string.isRequired, metadata: React.PropTypes.oneOfType([React.PropTypes.object, React.PropTypes.string]), + contentType: React.PropTypes.string, }, getInitialState: function() { return { @@ -197,7 +198,7 @@ let FileActionsRow = React.createClass({ return (
- {this.props.metadata.content_type && this.props.metadata.content_type.startsWith('video/') + {this.props.contentType && this.props.contentType.startsWith('video/') ? : null} {this.state.fileInfo !== null || this.state.fileInfo.isMine @@ -236,6 +237,7 @@ export let FileActions = React.createClass({ streamName: React.PropTypes.string, outpoint: React.PropTypes.string.isRequired, metadata: React.PropTypes.oneOfType([React.PropTypes.object, React.PropTypes.string]), + contentType: React.PropTypes.string, }, getInitialState: function() { return { @@ -289,7 +291,8 @@ export let FileActions = React.createClass({ return (
{ fileInfo || this.state.available || this.state.forceShowActions - ? + ? :
This file is not currently available.
{ + lbry.getCostInfoForName(this.props.uri, ({cost, includesData}) => { if (this._isMounted) { this.setState({ cost: cost, @@ -55,9 +56,11 @@ let FilePrice = React.createClass({ export let FileTileStream = React.createClass({ _fileInfoSubscribeId: null, _isMounted: null, + _metadata: null, propTypes: { - metadata: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.object]), + uri: React.PropTypes.string, + claimInfo: React.PropTypes.object, outpoint: React.PropTypes.string, hideOnRemove: React.PropTypes.bool, hidePrice: React.PropTypes.bool, @@ -76,6 +79,11 @@ export let FileTileStream = React.createClass({ hidePrice: false } }, + componentWillMount: function() { + const {value: {stream: {metadata, source: {contentType}}}} = this.props.claimInfo; + this._metadata = metadata; + this._contentType = contentType; + }, componentDidMount: function() { this._isMounted = true; if (this.props.hideOnRemove) { @@ -95,7 +103,7 @@ export let FileTileStream = React.createClass({ } }, handleMouseOver: function() { - if (this.props.obscureNsfw && this.props.metadata && this.props.metadata.nsfw) { + if (this.props.obscureNsfw && this.props.metadata && this._metadata.nsfw) { this.setState({ showNsfwHelp: true, }); @@ -113,29 +121,30 @@ export let FileTileStream = React.createClass({ return null; } - const metadata = this.props.metadata; + const metadata = this._metadata; const isConfirmed = typeof metadata == 'object'; - const title = isConfirmed ? metadata.title : ('lbry://' + this.props.name); + const title = isConfirmed ? metadata.title : ('lbry://' + this.props.uri); const obscureNsfw = this.props.obscureNsfw && isConfirmed && metadata.nsfw; return (
- +
{ !this.props.hidePrice - ? + ? : null} - +

- + {title}

- + +

{isConfirmed @@ -162,26 +171,27 @@ export let FileTile = React.createClass({ _isMounted: false, propTypes: { - name: React.PropTypes.string.isRequired, + uri: React.PropTypes.string.isRequired, available: React.PropTypes.bool, }, getInitialState: function() { return { outpoint: null, - metadata: null + claimInfo: null } }, componentDidMount: function() { this._isMounted = true; - lbry.claim_show({name: this.props.name}).then(({value, txid, nout}) => { - if (this._isMounted && value) { + lbry.resolve({uri: this.props.uri}).then(({claim: claimInfo}) => { + const {value: {stream: {metadata}}, txid, nout} = claimInfo; + if (this._isMounted && claimInfo.value.stream.metadata) { // In case of a failed lookup, metadata will be null, in which case the component will never display this.setState({ outpoint: txid + ':' + nout, - metadata: value, + claimInfo: claimInfo, }); } }); @@ -190,10 +200,11 @@ export let FileTile = React.createClass({ this._isMounted = false; }, render: function() { - if (!this.state.metadata || !this.state.outpoint) { + if (!this.state.claimInfo || !this.state.outpoint) { return null; } - return ; + return ; } }); diff --git a/ui/js/page/discover.js b/ui/js/page/discover.js index c01cbe75b..762c55d3c 100644 --- a/ui/js/page/discover.js +++ b/ui/js/page/discover.js @@ -48,7 +48,7 @@ var SearchResults = React.createClass({ if (!seenNames[name]) { seenNames[name] = name; rows.push( - + ); } }); @@ -84,18 +84,18 @@ var FeaturedContent = React.createClass({

Featured Content

- { this.state.featuredNames.map((name) => { return }) } + { this.state.featuredNames.map((name) => { return }) }

Community Content

- - - - - + + + + +
);