import React from 'react'; import lbry from '../lbry.js'; import lighthouse from '../lighthouse.js'; import uri from '../uri.js'; import {CreditAmount, Thumbnail} from '../component/common.js'; import {FileActions} from '../component/file-actions.js'; import {Link} from '../component/link.js'; var formatItemImgStyle = { maxWidth: '100%', maxHeight: '100%', display: 'block', marginLeft: 'auto', marginRight: 'auto', marginTop: '5px', }; var FormatItem = React.createClass({ propTypes: { metadata: React.PropTypes.object, contentType: React.PropTypes.string, cost: React.PropTypes.number, uri: React.PropTypes.string, outpoint: React.PropTypes.string, costIncludesData: React.PropTypes.bool, }, render: function() { const {thumbnail, author, title, description, language, license} = this.props.metadata; const mediaType = lbry.getMediaType(this.props.contentType); var costIncludesData = this.props.costIncludesData; var cost = this.props.cost || 0.0; return (

{description}

Content-Type{this.props.contentType}
Cost
Author{author}
Language{language}
License{license}
); } }); var FormatsSection = React.createClass({ propTypes: { uri: React.PropTypes.string, outpoint: React.PropTypes.string, metadata: React.PropTypes.object, contentType: React.PropTypes.string, cost: React.PropTypes.number, costIncludesData: React.PropTypes.bool, }, render: function() { if(this.props.metadata == null) { return (

Sorry, no results found for "{name}".

); } return (
{ this.props.metadata.thumbnail ?
: '' }

{this.props.metadata.title}

{this.props.uri}
{/* In future, anticipate multiple formats, just a guess at what it could look like // var formats = this.props.metadata.formats // return ({formats.map(function(format,i){ */} {/* })}); */}
); } }); var ShowPage = React.createClass({ _uri: null, propTypes: { uri: React.PropTypes.string, }, getInitialState: function() { return { metadata: null, contentType: null, cost: null, costIncludesData: null, uriLookupComplete: null, }; }, componentWillMount: function() { this._uri = uri.normalizeLbryUri(this.props.uri); document.title = this._uri; lbry.resolve({uri: this._uri}).then(({txid, nout, claim: {value: {stream: {metadata, source: {contentType}}}}}) => { this.setState({ outpoint: txid + ':' + nout, metadata: metadata, contentType: contentType, uriLookupComplete: true, }); }); lbry.getCostInfo(this._uri, ({cost, includesData}) => { this.setState({ cost: cost, costIncludesData: includesData, }); }); }, render: function() { if (this.state.metadata == null) { return null; } return (
{this.state.uriLookupComplete ? ( ) : (

No content

There is no content available at {this._uri}. If you reached this page from a link within the LBRY interface, please . Thanks!
)}
); } }); export default ShowPage;