lbry-desktop/ui/page/channelsFollowing/view.jsx

56 lines
1.7 KiB
React
Raw Normal View History

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