2021-03-11 18:08:11 +01:00
|
|
|
// @flow
|
|
|
|
import * as React from 'react';
|
|
|
|
import { normalizeURI } from 'lbry-redux';
|
|
|
|
import FilePrice from 'component/filePrice';
|
|
|
|
import ClaimInsufficientCredits from 'component/claimInsufficientCredits';
|
|
|
|
import FileSubtitle from 'component/fileSubtitle';
|
|
|
|
import FileAuthor from 'component/fileAuthor';
|
|
|
|
import Card from 'component/common/card';
|
|
|
|
import * as ICONS from 'constants/icons';
|
|
|
|
import Icon from 'component/common/icon';
|
|
|
|
import I18nMessage from 'component/i18nMessage';
|
|
|
|
import Button from 'component/button';
|
|
|
|
import * as PAGES from 'constants/pages';
|
|
|
|
import FileDescription from 'component/fileDescription';
|
2021-03-30 18:00:30 +02:00
|
|
|
import usePersistedState from 'effects/use-persisted-state';
|
2021-03-11 18:08:11 +01:00
|
|
|
|
|
|
|
type Props = {
|
|
|
|
uri: string,
|
|
|
|
title: string,
|
|
|
|
nsfw: boolean,
|
|
|
|
isNsfwBlocked: boolean,
|
2021-03-18 18:21:49 +01:00
|
|
|
livestream?: boolean,
|
2021-04-14 17:40:36 +02:00
|
|
|
isLive?: boolean,
|
2021-03-19 21:14:31 +01:00
|
|
|
activeViewers?: number,
|
2021-03-11 18:08:11 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
function FileTitleSection(props: Props) {
|
2021-04-14 17:40:36 +02:00
|
|
|
const { title, uri, nsfw, isNsfwBlocked, livestream = false, isLive = false, activeViewers } = props;
|
2021-03-30 18:00:30 +02:00
|
|
|
const [hasAcknowledgedSec, setHasAcknowledgedSec] = usePersistedState('sec-nag', false);
|
2021-03-11 18:08:11 +01:00
|
|
|
|
|
|
|
return (
|
2021-03-30 18:00:30 +02:00
|
|
|
<>
|
|
|
|
{!hasAcknowledgedSec && (
|
|
|
|
<div className="notice-message">
|
|
|
|
<Button button="close" icon={ICONS.REMOVE} onClick={() => setHasAcknowledgedSec(true)} />
|
|
|
|
<h1 className="section__title">{__('Help LBRY Save Crypto')}</h1>
|
|
|
|
<p className="section__subtitle">
|
2021-04-14 17:40:36 +02:00
|
|
|
{__('The US government is attempting to destroy the cryptocurrency industry. Can you help?')}{' '}
|
2021-04-02 20:39:32 +02:00
|
|
|
<Button label={__('Learn more and sign petition')} button="link" href="https://helplbrysavecrypto.com" />
|
2021-03-30 18:00:30 +02:00
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
<Card
|
|
|
|
isPageTitle
|
|
|
|
noTitleWrap
|
|
|
|
title={
|
|
|
|
<React.Fragment>
|
|
|
|
{title}
|
|
|
|
{nsfw && (
|
|
|
|
<span className="media__title-badge">
|
|
|
|
<span className="badge badge--tag-mature">{__('Mature')}</span>
|
|
|
|
</span>
|
|
|
|
)}
|
|
|
|
</React.Fragment>
|
|
|
|
}
|
|
|
|
titleActions={<FilePrice uri={normalizeURI(uri)} type="filepage" />}
|
|
|
|
body={
|
|
|
|
<React.Fragment>
|
|
|
|
<ClaimInsufficientCredits uri={uri} />
|
2021-04-14 17:40:36 +02:00
|
|
|
<FileSubtitle uri={uri} isLive={isLive} livestream={livestream} activeViewers={activeViewers} />
|
2021-03-30 18:00:30 +02:00
|
|
|
</React.Fragment>
|
|
|
|
}
|
|
|
|
actions={
|
|
|
|
isNsfwBlocked ? (
|
|
|
|
<div className="main--empty">
|
|
|
|
<h2>
|
|
|
|
<Icon className="icon--hidden" icon={ICONS.EYE_OFF} />
|
|
|
|
{__('Mature content blocked.')}
|
|
|
|
</h2>
|
|
|
|
<div>
|
|
|
|
<I18nMessage
|
|
|
|
tokens={{
|
|
|
|
content_settings: (
|
|
|
|
<Button button="link" label={__('content settings')} navigate={`/$/${PAGES.SETTINGS}`} />
|
|
|
|
),
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
Change this in your %content_settings%.
|
|
|
|
</I18nMessage>
|
|
|
|
</div>
|
2021-03-11 18:08:11 +01:00
|
|
|
</div>
|
2021-03-30 18:00:30 +02:00
|
|
|
) : (
|
|
|
|
<div className="section">
|
|
|
|
<FileAuthor uri={uri} />
|
|
|
|
<FileDescription uri={uri} />
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
</>
|
2021-03-11 18:08:11 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default FileTitleSection;
|