import React from 'react'; import lbry from '../lbry.js'; import lighthouse from '../lighthouse.js'; import {CreditAmount, Thumbnail} from '../component/common.js'; import {Link, DownloadLink, WatchLink} from '../component/link.js'; var formatItemImgStyle = { maxWidth: '100%', maxHeight: '100%', display: 'block', marginLeft: 'auto', marginRight: 'auto', marginTop: '5px', }; var FormatItem = React.createClass({ propTypes: { claimInfo: React.PropTypes.object, cost: React.PropTypes.number, name: React.PropTypes.string, costIncludesData: React.PropTypes.bool, }, render: function() { var claimInfo = this.props.claimInfo; var thumbnail = claimInfo.thumbnail; var title = claimInfo.title; var description = claimInfo.description; var author = claimInfo.author; var language = claimInfo.language; var license = claimInfo.license; var fileContentType = (claimInfo.content_type || claimInfo['content-type']); var mediaType = lbry.getMediaType(fileContentType); var costIncludesData = this.props.costIncludesData; var cost = this.props.cost || 0.0; return (

{description}

Content-Type{fileContentType}
Cost
Author{author}
Language{language}
License{license}
{mediaType == 'video' ? : null}
); } }); var FormatsSection = React.createClass({ propTypes: { claimInfo: React.PropTypes.object, cost: React.PropTypes.number, name: React.PropTypes.string, costIncludesData: React.PropTypes.bool, }, render: function() { var name = this.props.name; var format = this.props.claimInfo; var title = format.title; if(format == null) { return (

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

); } return (
lbry://{name}

{title}

{/* In future, anticipate multiple formats, just a guess at what it could look like // var formats = this.props.claimInfo.formats // return ({formats.map(function(format,i){ */} {/* })}); */}
); } }); var DetailPage = React.createClass({ propTypes: { name: React.PropTypes.string, }, getInitialState: function() { return { metadata: null, cost: null, costIncludesData: null, nameLookupComplete: null, }; }, componentWillMount: function() { document.title = 'lbry://' + this.props.name; lbry.resolveName(this.props.name, (metadata) => { this.setState({ metadata: metadata, nameLookupComplete: true, }); }); lbry.getCostInfoForName(this.props.name, ({cost, includesData}) => { this.setState({ cost: cost, costIncludesData: includesData, }); }); }, render: function() { if (this.state.metadata == null) { return null; } const name = this.props.name; const costIncludesData = this.state.costIncludesData; const metadata = this.state.metadata; const cost = this.state.cost; return (
{this.state.nameLookupComplete ? ( ) : (

No content

There is no content available at the name lbry://{this.props.name}. If you reached this page from a link within the LBRY interface, please . Thanks!
)}
); } }); export default DetailPage;