import React from 'react'; import lbry from '../lbry.js'; import {Link, DownloadLink, WatchLink} from '../component/link.js'; import {Thumbnail, TruncatedText, CreditAmount} from '../component/common.js'; let FileTile = React.createClass({ propTypes: { name: React.PropTypes.string.isRequired, mediaType: React.PropTypes.string.isRequired, title: React.PropTypes.string.isRequired, description: React.PropTypes.string, compact: React.PropTypes.boolean, cost: React.PropTypes.number, costIncludesData: React.PropTypes.boolean, }, getInitialState: function() { return { downloading: false, isHovered: false, cost: null, costIncludesData: null, } }, getDefaultProps: function() { return { compact: false, } }, handleMouseOver: function() { this.setState({ isHovered: true, }); }, handleMouseOut: function() { this.setState({ isHovered: false, }); }, componentWillMount: function() { if ('cost' in this.props) { this.setState({ cost: this.props.cost, costIncludesData: this.props.costIncludesData, }); } else { lbry.getCostInfoForName(this.props.name, ({cost, includesData}) => { this.setState({ cost: cost, costIncludesData: includesData, }); }); } }, render: function() { let obscureNsfw = !lbry.getClientSetting('showNsfw') && this.props.nsfw; return (
{this.state.cost !== null ? : null}
lbry://{this.props.name}

{this.props.title}

{this.props.mediaType == 'video' ? : null} {!this.props.isMine ? : null}

{this.props.description}

{obscureNsfw && this.state.isHovered ?

This content is Not Safe For Work. To view adult content, please change your .

: null}
); } }); export default FileTile;