// @flow import React, { Fragment, PureComponent } from 'react'; import MarkdownPreview from 'component/common/markdown-preview'; import Button from 'component/button'; import Expandable from 'component/expandable'; import path from 'path'; type Props = { claim: StreamClaim, fileInfo: FileListItem, metadata: StreamMetadata, openFolder: string => void, contentType: string, user: ?any, }; class FileDetails extends PureComponent { render() { const { claim, contentType, fileInfo, metadata, openFolder } = this.props; if (!claim || !metadata) { return (
{__('Empty claim or metadata info.')}
); } const { description, languages, license } = metadata; const mediaType = contentType || 'unknown'; let downloadPath = fileInfo && fileInfo.download_path ? path.normalize(fileInfo.download_path) : null; let downloadNote; // If the path is blank, file is not avialable. Create path from name so the folder opens on click. if (fileInfo && fileInfo.download_path === null) { downloadPath = `${fileInfo.download_directory}/${fileInfo.file_name}`; downloadNote = 'This file may have been moved or deleted'; } return ( {description && (
)}
Info
{__('Content-Type')} {': '} {mediaType}
{__('Languages')} {': '} {languages ? languages.join(' ') : null}
{__('License')} {': '} {license}
{downloadPath && (
{__('Downloaded to')} {': '}
)}
); } } export default FileDetails;