import React from 'react'; import lbry from 'lbry.js'; import lbryuri from 'lbryuri.js'; import Link from 'component/link'; import {Thumbnail, TruncatedText,} from 'component/common'; import FilePrice from 'component/filePrice' import UriIndicator from 'component/uriIndicator'; class FileCard extends React.Component { componentDidMount() { const { isResolvingUri, resolveUri, claim, uri, } = this.props if(!isResolvingUri && !claim && uri) { resolveUri(uri) } } handleMouseOver() { this.setState({ hovered: true, }); } handleMouseOut() { this.setState({ hovered: false, }); } render() { const { metadata, isResolvingUri, navigate, } = this.props const uri = lbryuri.normalize(this.props.uri); const title = !isResolvingUri && metadata && metadata.title ? metadata.title : uri; const obscureNsfw = this.props.obscureNsfw && metadata && metadata.nsfw; let description = "" if (isResolvingUri) { description = "Loading..." } else if (metadata && metadata.description) { description = metadata.description } return (
navigate('/show', { uri })} className="card__link">
{title}
{metadata && metadata.thumbnail &&
}
{description}
{obscureNsfw && this.state.hovered ?

This content is Not Safe For Work. To view adult content, please change your navigate('settings')} label="Settings" />.

: null}
); } } export default FileCard