import React from 'react'; import lbry from 'lbry.js'; import lbryuri from 'lbryuri.js'; import Video from 'component/video' import { Thumbnail, } from 'component/common'; import FilePrice from 'component/filePrice' import FileActions from 'component/fileActions'; import Link from 'component/link'; import UriIndicator from 'component/uriIndicator'; const FormatItem = (props) => { const { contentType, metadata: { author, language, license, } } = props const mediaType = lbry.getMediaType(contentType); return (
Content-Type{mediaType}
Author{author}
Language{language}
License{license}
) } class FilePage extends React.Component{ componentDidMount() { this.fetchFileInfo(this.props) } componentWillReceiveProps(nextProps) { this.fetchFileInfo(nextProps) } fetchFileInfo(props) { if (props.fileInfo === undefined) { props.fetchFileInfo(props.uri) } } render() { const { claim, fileInfo, metadata, contentType, uri, } = this.props if (!claim || !metadata) { return Empty claim or metadata info. } const { txid, nout, channel_name: channelName, has_signature: hasSignature, signature_is_valid: signatureIsValid, value } = claim const outpoint = txid + ':' + nout const title = metadata.title const channelClaimId = claim.value && claim.value.publisherSignature ? claim.value.publisherSignature.certificateId : null; const channelUri = signatureIsValid && hasSignature && channelName ? lbryuri.build({channelName, claimId: channelClaimId}, false) : null const uriIndicator = return (
{ contentType && contentType.startsWith('video/') ?
{!fileInfo || fileInfo.written_bytes <= 0 ? : null}

{title}

{ channelUri ? this.props.navigate('/show', { uri: channelUri })}>{uriIndicator} : uriIndicator}
{metadata && metadata.description}
{ metadata ?
: '' }
) } } export default FilePage;