import React from 'react'; import { Link } from 'react-router-dom'; class AssetInfo extends React.Component { constructor (props) { super(props); this.state = { showDetails: false, }; this.toggleDetails = this.toggleDetails.bind(this); this.copyToClipboard = this.copyToClipboard.bind(this); } toggleDetails () { if (this.state.showDetails) { return this.setState({showDetails: false}); } this.setState({showDetails: true}); } copyToClipboard (event) { var elementToCopy = event.target.dataset.elementtocopy; var element = document.getElementById(elementToCopy); element.select(); try { document.execCommand('copy'); } catch (err) { this.setState({error: 'Oops, unable to copy'}); } } render () { const { asset: { shortId, claimData : { channelName, certificateId, description, name, claimId, fileExt, contentType, thumbnail, host } } } = this.props; return (
{channelName &&
Channel:
{channelName}
} {description &&
{description}
}
Embed:
{(contentType === 'video/mp4') ? ( `}/> ) : ( `} /> )}
Share:
twitter facebook tumblr reddit
{ this.state.showDetails &&
Claim Name:
{name}
Claim Id:
{claimId}
File Type:
{contentType ? `${contentType}` : 'unknown'}
Report
}
); } }; export default AssetInfo;