2020-04-29 22:50:06 +02:00
|
|
|
// @flow
|
|
|
|
import React from 'react';
|
|
|
|
import Button from 'component/button';
|
2020-05-22 22:47:10 +02:00
|
|
|
import FilePrice from 'component/filePrice';
|
2020-04-29 22:50:06 +02:00
|
|
|
import { formatLbryUrlForWeb } from 'util/url';
|
|
|
|
import { withRouter } from 'react-router';
|
|
|
|
import { URL } from 'config';
|
|
|
|
import * as ICONS from 'constants/icons';
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
uri: string,
|
|
|
|
title: ?string,
|
|
|
|
isInApp: boolean,
|
|
|
|
};
|
|
|
|
|
|
|
|
function FileViewerEmbeddedTitle(props: Props) {
|
|
|
|
const { uri, title, isInApp } = props;
|
|
|
|
|
|
|
|
let contentLink = `${formatLbryUrlForWeb(uri)}`;
|
|
|
|
|
|
|
|
if (!isInApp) {
|
|
|
|
contentLink = `${contentLink}?src=embed`;
|
|
|
|
}
|
|
|
|
|
2020-05-18 19:07:42 +02:00
|
|
|
const contentLinkProps = isInApp ? { navigate: contentLink } : { href: contentLink };
|
2020-04-29 22:50:06 +02:00
|
|
|
const lbryLinkProps = isInApp ? { navigate: '/' } : { href: URL };
|
|
|
|
|
|
|
|
return (
|
2020-05-22 22:47:10 +02:00
|
|
|
<div className="file-viewer__embedded-header">
|
|
|
|
<Button label={title} button="link" className="file-viewer__embedded-title" {...contentLinkProps} />
|
|
|
|
<div className="file-viewer__embedded-info">
|
|
|
|
<Button className="file-viewer__overlay-logo" icon={ICONS.LBRY} {...lbryLinkProps} />
|
|
|
|
<FilePrice uri={uri} />
|
|
|
|
</div>
|
2020-04-29 22:50:06 +02:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default withRouter(FileViewerEmbeddedTitle);
|