2019-05-07 04:35:04 +02:00
|
|
|
// @flow
|
|
|
|
import React, { Fragment } from 'react';
|
|
|
|
import HiddenNsfwClaims from 'component/hiddenNsfwClaims';
|
|
|
|
import { withRouter } from 'react-router-dom';
|
2019-08-29 03:39:21 +02:00
|
|
|
import Button from 'component/button';
|
2020-02-28 15:40:18 +01:00
|
|
|
import ClaimListDiscover from 'component/claimListDiscover';
|
2020-02-10 20:43:24 +01:00
|
|
|
import * as CS from 'constants/claim_search';
|
2020-03-26 22:47:07 +01:00
|
|
|
import Ads from 'lbrytv/component/ads';
|
2019-05-07 04:35:04 +02:00
|
|
|
|
|
|
|
type Props = {
|
|
|
|
uri: string,
|
|
|
|
totalPages: number,
|
|
|
|
fetching: boolean,
|
|
|
|
params: { page: number },
|
2019-11-22 02:37:25 +01:00
|
|
|
pageOfClaimsInChannel: Array<StreamClaim>,
|
2019-07-08 22:54:58 +02:00
|
|
|
channelIsBlocked: boolean,
|
2019-05-07 04:35:04 +02:00
|
|
|
channelIsMine: boolean,
|
|
|
|
fetchClaims: (string, number) => void,
|
2019-08-29 03:39:21 +02:00
|
|
|
channelIsBlackListed: boolean,
|
2019-12-13 23:32:20 +01:00
|
|
|
claim: ?Claim,
|
2020-03-26 22:47:07 +01:00
|
|
|
isAuthenticated: boolean,
|
2019-05-07 04:35:04 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
function ChannelContent(props: Props) {
|
2020-03-26 22:47:07 +01:00
|
|
|
const { uri, fetching, channelIsMine, channelIsBlocked, channelIsBlackListed, claim, isAuthenticated } = props;
|
2019-12-13 23:32:20 +01:00
|
|
|
const claimsInChannel = (claim && claim.meta.claims_in_channel) || 0;
|
2020-02-28 15:40:18 +01:00
|
|
|
|
2019-05-07 04:35:04 +02:00
|
|
|
return (
|
|
|
|
<Fragment>
|
2020-02-28 15:40:18 +01:00
|
|
|
{!fetching && Boolean(claimsInChannel) && !channelIsBlocked && !channelIsBlackListed && (
|
|
|
|
<HiddenNsfwClaims uri={uri} />
|
2019-12-13 23:32:20 +01:00
|
|
|
)}
|
|
|
|
|
2019-08-29 03:39:21 +02:00
|
|
|
{!fetching && channelIsBlackListed && (
|
|
|
|
<section className="card card--section">
|
|
|
|
<p>
|
|
|
|
{__(
|
|
|
|
'In response to a complaint we received under the US Digital Millennium Copyright Act, we have blocked access to this channel from our applications.'
|
|
|
|
)}
|
|
|
|
</p>
|
|
|
|
<div className="card__actions">
|
|
|
|
<Button button="link" href="https://lbry.com/faq/dmca" label={__('Read More')} />
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
)}
|
|
|
|
|
2019-07-08 22:54:58 +02:00
|
|
|
{!fetching && channelIsBlocked && (
|
|
|
|
<div className="card--section">
|
2019-08-02 17:11:31 +02:00
|
|
|
<h2 className="help">{__('You have blocked this channel content.')}</h2>
|
2019-07-08 22:54:58 +02:00
|
|
|
</div>
|
|
|
|
)}
|
2019-05-07 04:35:04 +02:00
|
|
|
|
2020-02-28 15:40:18 +01:00
|
|
|
{!channelIsMine && claimsInChannel > 0 && <HiddenNsfwClaims uri={uri} />}
|
2019-10-27 15:41:43 +01:00
|
|
|
|
2020-02-28 15:40:18 +01:00
|
|
|
{claim && claimsInChannel > 0 ? (
|
2020-03-26 22:47:07 +01:00
|
|
|
<ClaimListDiscover
|
|
|
|
channelIds={[claim.claim_id]}
|
|
|
|
defaultOrderBy={CS.ORDER_BY_NEW}
|
|
|
|
injectedItem={!isAuthenticated && IS_WEB && <Ads type="video" />}
|
|
|
|
/>
|
2020-02-28 15:40:18 +01:00
|
|
|
) : (
|
|
|
|
<section className="main--empty">This channel hasn't published anything yet</section>
|
2019-07-08 22:54:58 +02:00
|
|
|
)}
|
2019-05-07 04:35:04 +02:00
|
|
|
</Fragment>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default withRouter(ChannelContent);
|