2020-01-06 19:32:35 +01:00
|
|
|
// @flow
|
|
|
|
import * as React from 'react';
|
|
|
|
import { normalizeURI } from 'lbry-redux';
|
2020-02-01 02:47:13 +01:00
|
|
|
import classNames from 'classnames';
|
2020-03-14 17:07:36 +01:00
|
|
|
import FileSubtitle from 'component/fileSubtitle';
|
2020-01-06 19:32:35 +01:00
|
|
|
import FilePrice from 'component/filePrice';
|
|
|
|
import FileAuthor from 'component/fileAuthor';
|
|
|
|
import FileActions from 'component/fileActions';
|
2020-01-06 21:57:49 +01:00
|
|
|
import FileDetails from 'component/fileDetails';
|
2020-01-06 19:32:35 +01:00
|
|
|
import TextViewer from 'component/textViewer';
|
|
|
|
import RecommendedContent from 'component/recommendedContent';
|
|
|
|
import CommentsList from 'component/commentsList';
|
|
|
|
import CommentCreate from 'component/commentCreate';
|
|
|
|
import ClaimUri from 'component/claimUri';
|
|
|
|
import FileViewerInitiator from 'component/fileViewerInitiator';
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
uri: string,
|
|
|
|
title: string,
|
|
|
|
nsfw: boolean,
|
|
|
|
claim: StreamClaim,
|
|
|
|
thumbnail: ?string,
|
2020-01-29 18:31:31 +01:00
|
|
|
contentType: string,
|
|
|
|
fileType: string,
|
2020-01-06 19:32:35 +01:00
|
|
|
};
|
|
|
|
|
2020-01-06 21:57:49 +01:00
|
|
|
function LayoutWrapperText(props: Props) {
|
2020-01-29 18:31:31 +01:00
|
|
|
const { uri, claim, title, nsfw, contentType, fileType } = props;
|
|
|
|
|
|
|
|
const markdownType = ['md', 'markdown'];
|
2020-02-01 02:47:13 +01:00
|
|
|
const isMarkdown = markdownType.includes(fileType) || contentType === 'text/markdown' || contentType === 'text/md';
|
2020-01-06 19:32:35 +01:00
|
|
|
|
|
|
|
return (
|
2020-01-06 21:57:49 +01:00
|
|
|
<div>
|
2020-02-01 02:47:13 +01:00
|
|
|
<div className={classNames('main__document-wrapper', { 'main__document-wrapper--markdown': isMarkdown })}>
|
2020-01-06 19:32:35 +01:00
|
|
|
<ClaimUri uri={uri} />
|
|
|
|
|
|
|
|
<div className="media__title">
|
|
|
|
<span className="media__title-badge">
|
|
|
|
{nsfw && <span className="badge badge--tag-mature">{__('Mature')}</span>}
|
|
|
|
</span>
|
|
|
|
<span className="media__title-badge">
|
|
|
|
<FilePrice badge uri={normalizeURI(uri)} />
|
|
|
|
</span>
|
|
|
|
<h1 className="media__title-text">{title}</h1>
|
|
|
|
</div>
|
|
|
|
|
2020-03-14 17:07:36 +01:00
|
|
|
<FileSubtitle uri={uri} />
|
|
|
|
|
2020-01-06 21:57:49 +01:00
|
|
|
<div className="section">
|
|
|
|
<FileAuthor uri={uri} />
|
2020-01-06 19:32:35 +01:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div className="section__divider">
|
|
|
|
<hr />
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{/* Render the initiator to trigger the view of the file */}
|
|
|
|
<FileViewerInitiator uri={uri} />
|
|
|
|
<TextViewer uri={uri} />
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div className="columns">
|
|
|
|
<div>
|
2020-01-06 21:57:49 +01:00
|
|
|
<FileActions uri={uri} />
|
|
|
|
|
|
|
|
<div className="section__divider">
|
|
|
|
<hr />
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<FileAuthor uri={uri} />
|
|
|
|
|
|
|
|
<div className="section">
|
|
|
|
<FileDetails uri={uri} />
|
|
|
|
</div>
|
2020-01-06 19:32:35 +01:00
|
|
|
<div className="section__title--small">{__('Comments')}</div>
|
|
|
|
<section className="section">
|
|
|
|
<CommentCreate uri={uri} />
|
|
|
|
</section>
|
|
|
|
<section className="section">
|
|
|
|
<CommentsList uri={uri} />
|
|
|
|
</section>
|
|
|
|
</div>
|
|
|
|
<RecommendedContent uri={uri} claimId={claim.claim_id} />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-01-06 21:57:49 +01:00
|
|
|
export default LayoutWrapperText;
|