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

48 lines
1.3 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';
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';
2020-01-02 17:30:27 +01:00
import { TYPE_NEW } from 'component/claimListDiscover/view';
type Props = {
subscribedChannels: Array<Subscription>,
};
2020-02-17 20:12:28 +01:00
function ChannelsFollowingPage(props: Props) {
const { subscribedChannels } = props;
2020-01-02 17:30:27 +01:00
const hasSubsribedChannels = subscribedChannels.length > 0;
2020-02-17 20:12:28 +01:00
return !hasSubsribedChannels ? (
<ChannelsFollowingDiscoverPage />
) : (
2020-01-02 17:30:27 +01:00
<Page>
2020-02-17 20:12:28 +01:00
<ClaimListDiscover
headerLabel={
<span>
<Icon icon={ICONS.SUBSCRIBE} size={10} />
{__('Following')}
</span>
}
defaultTypeSort={TYPE_NEW}
channelIds={subscribedChannels.map(sub => sub.uri.split('#')[1])}
meta={
<Button
icon={ICONS.SEARCH}
button="link"
label={__('Discover New Channels')}
navigate={`/$/${PAGES.CHANNELS_FOLLOWING_DISCOVER}`}
/>
}
/>
2020-01-02 17:30:27 +01:00
</Page>
);
}
2020-02-17 20:12:28 +01:00
export default ChannelsFollowingPage;