// @flow import React, { Fragment } from 'react'; import ClaimList from 'component/claimList'; import HiddenNsfwClaims from 'component/hiddenNsfwClaims'; import { withRouter } from 'react-router-dom'; import Paginate from 'component/common/paginate'; import Spinner from 'component/spinner'; import Button from 'component/button'; type Props = { uri: string, totalPages: number, fetching: boolean, params: { page: number }, pageOfClaimsInChannel: Array, channelIsBlocked: boolean, channelIsMine: boolean, fetchClaims: (string, number) => void, channelIsBlackListed: boolean, claim: ?Claim, }; function ChannelContent(props: Props) { const { uri, fetching, pageOfClaimsInChannel, totalPages, channelIsMine, channelIsBlocked, fetchClaims, channelIsBlackListed, claim, } = props; const hasContent = Boolean(pageOfClaimsInChannel && pageOfClaimsInChannel.length); const claimsInChannel = (claim && claim.meta.claims_in_channel) || 0; return ( {fetching && !hasContent && (
)} {!fetching && !claimsInChannel && !channelIsBlocked && !channelIsBlackListed && (

{__("This channel hasn't uploaded anything.")}

)} {!fetching && !hasContent && Boolean(claimsInChannel) && !channelIsBlocked && !channelIsBlackListed && (
)} {!fetching && channelIsBlackListed && (

{__( 'In response to a complaint we received under the US Digital Millennium Copyright Act, we have blocked access to this channel from our applications.' )}

)} {!fetching && channelIsBlocked && (

{__('You have blocked this channel content.')}

)} {!channelIsMine && hasContent && } {hasContent && !channelIsBlocked && !channelIsBlackListed && ( claim && claim.canonical_url)} /> )} {!channelIsBlocked && !channelIsBlackListed && ( fetchClaims(uri, page)} totalPages={totalPages} loading={fetching && !hasContent} /> )}
); } export default withRouter(ChannelContent);