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

63 lines
2 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';
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,
claim: ?Claim,
2019-05-07 04:35:04 +02:00
};
function ChannelContent(props: Props) {
2020-02-28 15:40:18 +01:00
const { uri, fetching, channelIsMine, channelIsBlocked, channelIsBlackListed, claim } = 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>
<div className="card__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 ? (
<ClaimListDiscover channelIds={[claim.claim_id]} defaultTypeSort={CS.ORDER_BY_NEW} />
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);