2020-04-14 01:48:11 +02:00
|
|
|
// @flow
|
|
|
|
import React from 'react';
|
|
|
|
import Button from 'component/button';
|
|
|
|
import { formatLbryUrlForWeb } from 'util/url';
|
|
|
|
import { withRouter } from 'react-router';
|
2020-10-01 22:59:11 +02:00
|
|
|
import { URL, SITE_NAME } from 'config';
|
2020-04-14 01:48:11 +02:00
|
|
|
import * as ICONS from 'constants/icons';
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
uri: string,
|
|
|
|
isAuthenticated: boolean,
|
|
|
|
};
|
|
|
|
|
2020-04-29 20:35:55 +02:00
|
|
|
function FileViewerEmbeddedEnded(props: Props) {
|
2020-04-14 01:48:11 +02:00
|
|
|
const { uri, isAuthenticated } = props;
|
|
|
|
|
|
|
|
const prompts = isAuthenticated
|
|
|
|
? {
|
2020-10-01 22:59:11 +02:00
|
|
|
discuss_auth: `Continue the discussion on ${SITE_NAME}`,
|
2020-04-14 01:48:11 +02:00
|
|
|
tip_auth: 'Always tip your creators',
|
|
|
|
}
|
|
|
|
: {
|
|
|
|
bigtech_unauth: 'Together, we can take back control from big tech',
|
2020-10-01 22:59:11 +02:00
|
|
|
discuss_unauth: `Continue the discussion on ${SITE_NAME}`,
|
|
|
|
find_unauth: `Find more great content on ${SITE_NAME}`,
|
2020-04-14 01:48:11 +02:00
|
|
|
a_b_unauth: "We test a lot of messages here. Wouldn't it be funny if the one telling you that did the best?",
|
2020-10-01 22:59:11 +02:00
|
|
|
earn_unauth: `Join ${SITE_NAME} and earn to watch.`,
|
2020-04-14 01:48:11 +02:00
|
|
|
blockchain_unauth: "Now if anyone asks, you can say you've used a blockchain.",
|
|
|
|
};
|
|
|
|
|
|
|
|
const promptKeys = Object.keys(prompts);
|
|
|
|
const promptKey = promptKeys[Math.floor(Math.random() * promptKeys.length)];
|
2020-10-01 22:59:11 +02:00
|
|
|
// $FlowFixMe
|
2020-04-14 01:48:11 +02:00
|
|
|
const prompt = prompts[promptKey];
|
|
|
|
const lbrytvLink = `${URL}${formatLbryUrlForWeb(uri)}?src=${promptKey}`;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="file-viewer__overlay">
|
|
|
|
<div className="file-viewer__overlay-secondary">
|
2020-05-22 22:47:10 +02:00
|
|
|
<Button className="file-viewer__overlay-logo" label="LBRY" icon={ICONS.LBRY} href={URL} />
|
2020-04-14 01:48:11 +02:00
|
|
|
</div>
|
|
|
|
<div className="file-viewer__overlay-title">{prompt}</div>
|
|
|
|
<div className="file-viewer__overlay-actions">
|
|
|
|
<Button label={__('Rewatch or Discuss')} button="primary" href={lbrytvLink} />
|
2020-05-01 17:47:36 +02:00
|
|
|
{!isAuthenticated && (
|
|
|
|
<Button label={__('Join lbry.tv')} button="secondary" href={`${URL}/$/signup?src=embed_signup`} />
|
|
|
|
)}
|
2020-04-14 01:48:11 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-04-29 20:35:55 +02:00
|
|
|
export default withRouter(FileViewerEmbeddedEnded);
|