move channel page to ClaimListDiscover
This commit is contained in:
parent
aad0f6fef6
commit
be3105db34
1 changed files with 11 additions and 43 deletions
|
@ -1,11 +1,10 @@
|
||||||
// @flow
|
// @flow
|
||||||
import React, { Fragment } from 'react';
|
import React, { Fragment } from 'react';
|
||||||
import ClaimList from 'component/claimList';
|
|
||||||
import HiddenNsfwClaims from 'component/hiddenNsfwClaims';
|
import HiddenNsfwClaims from 'component/hiddenNsfwClaims';
|
||||||
import { withRouter } from 'react-router-dom';
|
import { withRouter } from 'react-router-dom';
|
||||||
import Paginate from 'component/common/paginate';
|
|
||||||
import Spinner from 'component/spinner';
|
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
|
import ClaimListDiscover from 'component/claimListDiscover';
|
||||||
|
import { TYPE_NEW } from 'component/claimListDiscover/view';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
uri: string,
|
uri: string,
|
||||||
|
@ -21,37 +20,13 @@ type Props = {
|
||||||
};
|
};
|
||||||
|
|
||||||
function ChannelContent(props: Props) {
|
function ChannelContent(props: Props) {
|
||||||
const {
|
const { uri, fetching, channelIsMine, channelIsBlocked, channelIsBlackListed, claim } = props;
|
||||||
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;
|
const claimsInChannel = (claim && claim.meta.claims_in_channel) || 0;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
{fetching && !hasContent && (
|
{!fetching && Boolean(claimsInChannel) && !channelIsBlocked && !channelIsBlackListed && (
|
||||||
<section className="main--empty">
|
<HiddenNsfwClaims uri={uri} />
|
||||||
<Spinner delayed />
|
|
||||||
</section>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{!fetching && !claimsInChannel && !channelIsBlocked && !channelIsBlackListed && (
|
|
||||||
<div className="card--section">
|
|
||||||
<h2 className="section__subtitle">{__("This channel hasn't uploaded anything.")}</h2>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{!fetching && !hasContent && Boolean(claimsInChannel) && !channelIsBlocked && !channelIsBlackListed && (
|
|
||||||
<div className="card--section">
|
|
||||||
<HiddenNsfwClaims uri={uri} />
|
|
||||||
</div>
|
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{!fetching && channelIsBlackListed && (
|
{!fetching && channelIsBlackListed && (
|
||||||
|
@ -73,19 +48,12 @@ function ChannelContent(props: Props) {
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{!channelIsMine && hasContent && <HiddenNsfwClaims uri={uri} />}
|
{!channelIsMine && claimsInChannel > 0 && <HiddenNsfwClaims uri={uri} />}
|
||||||
|
|
||||||
{hasContent && !channelIsBlocked && !channelIsBlackListed && (
|
{claim && claimsInChannel > 0 ? (
|
||||||
<ClaimList header={false} uris={pageOfClaimsInChannel.map(claim => claim && claim.canonical_url)} />
|
<ClaimListDiscover channelIds={[claim.claim_id]} defaultTypeSort={TYPE_NEW} />
|
||||||
)}
|
) : (
|
||||||
|
<section className="main--empty">This channel hasn't published anything yet</section>
|
||||||
{!channelIsBlocked && !channelIsBlackListed && (
|
|
||||||
<Paginate
|
|
||||||
key={uri}
|
|
||||||
onPageChange={page => fetchClaims(uri, page)}
|
|
||||||
totalPages={totalPages}
|
|
||||||
loading={fetching && !hasContent}
|
|
||||||
/>
|
|
||||||
)}
|
)}
|
||||||
</Fragment>
|
</Fragment>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Reference in a new issue