2020-03-25 04:15:05 +01:00
|
|
|
// @flow
|
2020-08-10 22:47:39 +02:00
|
|
|
import React, { PureComponent } from 'react';
|
2020-03-25 04:15:05 +01:00
|
|
|
import MarkdownPreview from 'component/common/markdown-preview';
|
|
|
|
import ClaimTags from 'component/claimTags';
|
|
|
|
import Card from 'component/common/card';
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
uri: string,
|
|
|
|
claim: StreamClaim,
|
|
|
|
metadata: StreamMetadata,
|
|
|
|
user: ?any,
|
|
|
|
tags: any,
|
|
|
|
};
|
|
|
|
|
|
|
|
class FileDescription extends PureComponent<Props> {
|
|
|
|
render() {
|
|
|
|
const { uri, claim, metadata, tags } = this.props;
|
|
|
|
|
|
|
|
if (!claim || !metadata) {
|
|
|
|
return <span className="empty">{__('Empty claim or metadata info.')}</span>;
|
|
|
|
}
|
|
|
|
|
|
|
|
const { description } = metadata;
|
|
|
|
|
|
|
|
if (!description && !(tags && tags.length)) return null;
|
2020-08-10 22:47:39 +02:00
|
|
|
|
2020-03-25 04:15:05 +01:00
|
|
|
return (
|
2020-08-10 22:47:39 +02:00
|
|
|
<Card
|
|
|
|
title={__('Description')}
|
|
|
|
defaultExpand
|
|
|
|
actions={
|
|
|
|
<>
|
|
|
|
{description && (
|
|
|
|
<div className="media__info-text">
|
|
|
|
<MarkdownPreview content={description} />
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
<ClaimTags uri={uri} type="large" />
|
|
|
|
</>
|
|
|
|
}
|
|
|
|
/>
|
2020-03-25 04:15:05 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default FileDescription;
|