2020-01-02 11:30:27 -05:00
|
|
|
// @flow
|
|
|
|
import * as PAGES from 'constants/pages';
|
2020-01-02 15:36:03 -05:00
|
|
|
import * as ICONS from 'constants/icons';
|
2021-04-27 21:16:28 -04:00
|
|
|
import * as CS from 'constants/claim_search';
|
2021-07-08 12:21:42 -04:00
|
|
|
import { SIMPLE_SITE, ENABLE_NO_SOURCE_CLAIMS } from 'config';
|
2020-01-02 11:30:27 -05:00
|
|
|
import React from 'react';
|
2020-02-17 14:12:28 -05:00
|
|
|
import ChannelsFollowingDiscoverPage from 'page/channelsFollowingDiscover';
|
2020-01-02 11:30:27 -05:00
|
|
|
import ClaimListDiscover from 'component/claimListDiscover';
|
|
|
|
import Page from 'component/page';
|
|
|
|
import Button from 'component/button';
|
2020-01-02 15:36:03 -05:00
|
|
|
import Icon from 'component/common/icon';
|
2021-04-29 15:22:56 +08:00
|
|
|
import useGetLivestreams from 'effects/use-get-livestreams';
|
2021-07-15 16:22:44 -04:00
|
|
|
import { splitBySeparator } from 'lbry-redux';
|
2020-01-02 11:30:27 -05:00
|
|
|
|
|
|
|
type Props = {
|
|
|
|
subscribedChannels: Array<Subscription>,
|
2020-08-21 11:49:13 -04:00
|
|
|
tileLayout: boolean,
|
2020-01-02 11:30:27 -05:00
|
|
|
};
|
|
|
|
|
2020-02-17 14:12:28 -05:00
|
|
|
function ChannelsFollowingPage(props: Props) {
|
2020-08-21 11:49:13 -04:00
|
|
|
const { subscribedChannels, tileLayout } = props;
|
2020-01-02 11:30:27 -05:00
|
|
|
const hasSubsribedChannels = subscribedChannels.length > 0;
|
2021-04-29 16:25:06 +08:00
|
|
|
const { livestreamMap } = useGetLivestreams();
|
2020-01-02 11:30:27 -05:00
|
|
|
|
2020-02-17 14:12:28 -05:00
|
|
|
return !hasSubsribedChannels ? (
|
|
|
|
<ChannelsFollowingDiscoverPage />
|
|
|
|
) : (
|
2020-08-21 11:49:13 -04:00
|
|
|
<Page noFooter fullWidthPage={tileLayout}>
|
2020-02-17 14:12:28 -05:00
|
|
|
<ClaimListDiscover
|
2021-04-27 21:16:28 -04:00
|
|
|
hideAdvancedFilter={SIMPLE_SITE}
|
|
|
|
streamType={SIMPLE_SITE ? CS.CONTENT_ALL : undefined}
|
2020-08-21 11:49:13 -04:00
|
|
|
tileLayout={tileLayout}
|
2020-02-17 14:12:28 -05:00
|
|
|
headerLabel={
|
|
|
|
<span>
|
|
|
|
<Icon icon={ICONS.SUBSCRIBE} size={10} />
|
|
|
|
{__('Following')}
|
|
|
|
</span>
|
|
|
|
}
|
2021-04-27 21:16:28 -04:00
|
|
|
defaultOrderBy={CS.ORDER_BY_NEW}
|
2021-07-15 16:22:44 -04:00
|
|
|
channelIds={subscribedChannels.map((sub) => splitBySeparator(sub.uri)[1])}
|
2020-02-17 14:12:28 -05:00
|
|
|
meta={
|
|
|
|
<Button
|
|
|
|
icon={ICONS.SEARCH}
|
2020-05-21 11:38:28 -04:00
|
|
|
button="secondary"
|
2020-05-11 11:54:39 -04:00
|
|
|
label={__('Discover Channels')}
|
2020-02-17 14:12:28 -05:00
|
|
|
navigate={`/$/${PAGES.CHANNELS_FOLLOWING_DISCOVER}`}
|
|
|
|
/>
|
|
|
|
}
|
2021-04-29 15:22:56 +08:00
|
|
|
liveLivestreamsFirst
|
|
|
|
livestreamMap={livestreamMap}
|
2021-07-08 12:21:42 -04:00
|
|
|
showNoSourceClaims={ENABLE_NO_SOURCE_CLAIMS}
|
2021-04-29 17:33:24 +08:00
|
|
|
hasSource
|
2020-02-17 14:12:28 -05:00
|
|
|
/>
|
2020-01-02 11:30:27 -05:00
|
|
|
</Page>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-02-17 14:12:28 -05:00
|
|
|
export default ChannelsFollowingPage;
|