restore playlists tab

This commit is contained in:
zeppi 2021-07-03 23:19:13 -04:00 committed by jessopb
parent 0bb9c520ff
commit 814acc5b11
2 changed files with 47 additions and 2 deletions

View file

@ -7,6 +7,7 @@ import {
selectCurrentChannelPage, selectCurrentChannelPage,
makeSelectClaimForUri, makeSelectClaimForUri,
makeSelectClaimIsPending, makeSelectClaimIsPending,
selectMyUnpublishedCollections,
} from 'lbry-redux'; } from 'lbry-redux';
import { selectBlackListedOutpoints, doFetchSubCount, makeSelectSubCountForUri } from 'lbryinc'; import { selectBlackListedOutpoints, doFetchSubCount, makeSelectSubCountForUri } from 'lbryinc';
import { selectYoutubeChannels } from 'redux/selectors/user'; import { selectYoutubeChannels } from 'redux/selectors/user';
@ -30,6 +31,7 @@ const select = (state, props) => ({
youtubeChannels: selectYoutubeChannels(state), youtubeChannels: selectYoutubeChannels(state),
blockedChannels: selectModerationBlockList(state), blockedChannels: selectModerationBlockList(state),
mutedChannels: selectMutedChannels(state), mutedChannels: selectMutedChannels(state),
unpublishedCollections: selectMyUnpublishedCollections(state),
}); });
const perform = (dispatch) => ({ const perform = (dispatch) => ({

View file

@ -25,6 +25,7 @@ import Yrbl from 'component/yrbl';
export const PAGE_VIEW_QUERY = `view`; export const PAGE_VIEW_QUERY = `view`;
const CONTENT_PAGE = 'content'; const CONTENT_PAGE = 'content';
const LISTS_PAGE = 'lists';
const ABOUT_PAGE = `about`; const ABOUT_PAGE = `about`;
export const DISCUSSION_PAGE = `discussion`; export const DISCUSSION_PAGE = `discussion`;
const EDIT_PAGE = 'edit'; const EDIT_PAGE = 'edit';
@ -50,6 +51,7 @@ type Props = {
youtubeChannels: ?Array<{ channel_claim_id: string, sync_status: string, transfer_state: string }>, youtubeChannels: ?Array<{ channel_claim_id: string, sync_status: string, transfer_state: string }>,
blockedChannels: Array<string>, blockedChannels: Array<string>,
mutedChannels: Array<string>, mutedChannels: Array<string>,
unpublishedCollections: CollectionGroup,
}; };
function ChannelPage(props: Props) { function ChannelPage(props: Props) {
@ -68,6 +70,7 @@ function ChannelPage(props: Props) {
youtubeChannels, youtubeChannels,
blockedChannels, blockedChannels,
mutedChannels, mutedChannels,
unpublishedCollections,
} = props; } = props;
const { const {
push, push,
@ -98,6 +101,31 @@ function ChannelPage(props: Props) {
} }
}); });
const hasUnpublishedCollections = unpublishedCollections && Object.keys(unpublishedCollections).length;
let collectionEmpty;
if (channelIsMine) {
collectionEmpty = hasUnpublishedCollections ? (
<section className="main--empty">
{
<p>
<I18nMessage
tokens={{
pick: <Button button="link" navigate={`/$/${PAGES.LISTS}`} label={__('Pick')} />,
}}
>
You have unpublished lists! %pick% one and publish it!
</I18nMessage>
</p>
}
</section>
) : (
<section className="main--empty">{__('You have no lists! Create one from any playable content.')}</section>
);
} else {
collectionEmpty = <section className="main--empty">{__('No Lists Found')}</section>;
}
let channelIsBlackListed = false; let channelIsBlackListed = false;
if (claim && blackListedOutpoints) { if (claim && blackListedOutpoints) {
@ -114,12 +142,15 @@ function ChannelPage(props: Props) {
case CONTENT_PAGE: case CONTENT_PAGE:
tabIndex = 0; tabIndex = 0;
break; break;
case ABOUT_PAGE: case LISTS_PAGE:
tabIndex = 1; tabIndex = 1;
break; break;
case DISCUSSION_PAGE: case ABOUT_PAGE:
tabIndex = 2; tabIndex = 2;
break; break;
case DISCUSSION_PAGE:
tabIndex = 3;
break;
default: default:
tabIndex = 0; tabIndex = 0;
break; break;
@ -132,6 +163,8 @@ function ChannelPage(props: Props) {
if (newTabIndex === 0) { if (newTabIndex === 0) {
search += `${PAGE_VIEW_QUERY}=${CONTENT_PAGE}`; search += `${PAGE_VIEW_QUERY}=${CONTENT_PAGE}`;
} else if (newTabIndex === 1) { } else if (newTabIndex === 1) {
search += `${PAGE_VIEW_QUERY}=${LISTS_PAGE}`;
} else if (newTabIndex === 2) {
search += `${PAGE_VIEW_QUERY}=${ABOUT_PAGE}`; search += `${PAGE_VIEW_QUERY}=${ABOUT_PAGE}`;
} else { } else {
search += `${PAGE_VIEW_QUERY}=${DISCUSSION_PAGE}`; search += `${PAGE_VIEW_QUERY}=${DISCUSSION_PAGE}`;
@ -240,6 +273,7 @@ function ChannelPage(props: Props) {
<Tabs onChange={onTabChange} index={tabIndex}> <Tabs onChange={onTabChange} index={tabIndex}>
<TabList className="tabs__list--channel-page"> <TabList className="tabs__list--channel-page">
<Tab disabled={editing}>{__('Content')}</Tab> <Tab disabled={editing}>{__('Content')}</Tab>
<Tab disabled={editing}>{__('Playlists')}</Tab>
<Tab>{editing ? __('Editing Your Channel') : __('About --[tab title in Channel Page]--')}</Tab> <Tab>{editing ? __('Editing Your Channel') : __('About --[tab title in Channel Page]--')}</Tab>
<Tab disabled={editing}>{__('Community')}</Tab> <Tab disabled={editing}>{__('Community')}</Tab>
</TabList> </TabList>
@ -252,6 +286,15 @@ function ChannelPage(props: Props) {
empty={<section className="main--empty">{__('No Content Found')}</section>} empty={<section className="main--empty">{__('No Content Found')}</section>}
/> />
</TabPanel> </TabPanel>
<TabPanel>
<ChannelContent
claimType={'collection'}
uri={uri}
channelIsBlackListed={channelIsBlackListed}
viewHiddenChannels
empty={collectionEmpty}
/>
</TabPanel>
<TabPanel> <TabPanel>
<ChannelAbout uri={uri} /> <ChannelAbout uri={uri} />
</TabPanel> </TabPanel>