lbry-desktop/ui/component/channelContent/view.jsx

83 lines
2.5 KiB
React
Raw Normal View History

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';
import Button from 'component/button';
2020-02-28 15:40:18 +01:00
import ClaimListDiscover from 'component/claimListDiscover';
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 },
pageOfClaimsInChannel: Array<StreamClaim>,
channelIsBlocked: boolean,
2019-05-07 04:35:04 +02:00
channelIsMine: boolean,
fetchClaims: (string, number) => void,
channelIsBlackListed: boolean,
defaultPageSize?: number,
defaultInfiniteScroll?: Boolean,
claim: ?Claim,
2020-03-26 22:47:07 +01:00
isAuthenticated: boolean,
2019-05-07 04:35:04 +02:00
};
function ChannelContent(props: Props) {
const {
uri,
fetching,
channelIsMine,
channelIsBlocked,
channelIsBlackListed,
claim,
isAuthenticated,
defaultPageSize = CS.PAGE_SIZE,
defaultInfiniteScroll = true,
} = props;
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} />
)}
{!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>
2020-05-01 19:55:42 +02:00
<div className="section__actions">
<Button button="link" href="https://lbry.com/faq/dmca" label={__('Read More')} />
</div>
</section>
)}
{!fetching && channelIsBlocked && (
<div className="card--section">
2019-08-02 17:11:31 +02:00
<h2 className="help">{__('You have blocked this channel content.')}</h2>
</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}
pageSize={defaultPageSize}
infiniteScroll={defaultInfiniteScroll}
2020-03-26 22:47:07 +01:00
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-05-07 04:35:04 +02:00
</Fragment>
);
}
export default withRouter(ChannelContent);