04f88f7f10
fix replay select styling make meme a link Fix audio references get newest livestream claim in livestreamLink pin crackermilk fix livestream banner placement fix live page fix rebase fix rebase fix error nag fix darkmode blockquote style break word on livestream comment text fix dark mode snack fix live badge fix lint small fixes - word wrap, live badge wip Fix invisible snack in Odysee Light Theme Revert "wip" This reverts commitd17e477fe0
. Revert "small fixes - word wrap, live badge" This reverts commit0e431d4038
. fix blank pinned destiny fix badges and homepage again only get livestreams live for less than a day pinned hammy and olivia multi pin pin destiny updated pinned videos update tagline Update view.jsx pins updated destiny's video updated pinned videos removed destiny, added lie likes music pinned destiny and mason's woodshop removed hammy and olivia unpinned mason's woodshop removed pins added hammy and olivia pinned sam seder unpinned destiny and hammy and olivia Fix merge on ChannelThumbnails - sam seder, + hammy & olivia and passion for food update tagline (#6086) removed everyone, added kona and suba Theme color fixes (odysee) (#6089) * Cherry-pick master's 'base-theme.scss' * Non-functional cleanup (remove dups, re-order, etc.) * Dark: update positive Toast to --color-primary as well. This follows the intention of the refactoring, which I guess was (1) reduce the number of color names (2) reduce the number of customizations needed. The only issue I have with this is that the current Odysee primary color is pink, which can be intepreted as an error. The original (pre-refactoring color was green). For now, I follow the refactoring path. We can tweak this later. * Fix text color inside '--color-card-background-highlighted' Light: use base-theme (it was the same value anyway). Dark: use bright text. * Dark: add some contrast between the components The color for the background, header, card, placeholder, etc. is almost identical -- it looks like there are all in the same component. The almost-invisible border doesn't help. One would have to crank up the monitor's contrast setting to see separation of components. Brighten up the components a bit, somewhat following the same scale as lbry.tv's dark theme. Overall, I still think it's too dark. The Card's background color can still be brightened up further for better contrast, but I try not to make too drastic of a change for now. The original lbry.tv's gray theme is the most pleasant theme I've seen so far, but this is all subjective. changed pins removed kona and suba added destiny changed pins removed destiny pinned sgtducky changed pins removed sgtducky added hammy and olivia added chrissie mayr added the bite shot changed pins removed the bite shot added heads of tech changed pins removed hammy and olivia removed chrissie mayr changed pins removed heads of tech added crackermilk changed pins removed crackermilk added some ordinary gamer added passion for food changed pins removed some ordinary gamers removed passion for food added emmy hucker changed pins added game knights Update view.jsx Force rebuild changed pins removed emmy hucker changed pins removed game knights added crackermilk changed pins removed crackermilk added some ordinary gamer changed pins removed some ordinary gamers added passion for food added green renaissance changed pins removed passion for food removed green renaissance added expand love changed pins removed expand love added dr nora change tagline (#6122) there's so much room for activities comment out music changed pins removed dr nora added kona and suba changed pins removed kona and suba added destiny changed pins removed destiny added crackermilk changed pins removed crackermilk added someordinarygamers change tagline Drake, where's the door hole? changed pins unpinned someordinarygamers pinned kona and suba Add message for mature content changed pin changed pins removed creative model changed pins added bcpov added krish mohan added cigarvixen changed pins removed krish mohan added adrian logan bump fix footer change tagline just like the simulations changed pins removed: bcpov cigarvixen adrian logan added: someordinarygamers quick fix for reposts oops fix channel tabs changed pin removed someordinarygamers added kona and suba changed pins removed kona and suba added dirtyworkz added crackermilk
342 lines
11 KiB
JavaScript
342 lines
11 KiB
JavaScript
// @flow
|
|
import * as ICONS from 'constants/icons';
|
|
import * as PAGES from 'constants/pages';
|
|
import React from 'react';
|
|
import { parseURI } from 'lbry-redux';
|
|
import { YOUTUBE_STATUSES } from 'lbryinc';
|
|
import Page from 'component/page';
|
|
import SubscribeButton from 'component/subscribeButton';
|
|
import ShareButton from 'component/shareButton';
|
|
import { Tabs, TabList, Tab, TabPanels, TabPanel } from 'component/common/tabs';
|
|
import { useHistory } from 'react-router';
|
|
import Button from 'component/button';
|
|
import { formatLbryUrlForWeb } from 'util/url';
|
|
import ChannelContent from 'component/channelContent';
|
|
import ChannelAbout from 'component/channelAbout';
|
|
import ChannelDiscussion from 'component/channelDiscussion';
|
|
import ChannelThumbnail from 'component/channelThumbnail';
|
|
import ChannelEdit from 'component/channelEdit';
|
|
import classnames from 'classnames';
|
|
import HelpLink from 'component/common/help-link';
|
|
import ClaimSupportButton from 'component/claimSupportButton';
|
|
import ChannelStakedIndicator from 'component/channelStakedIndicator';
|
|
import ClaimMenuList from 'component/claimMenuList';
|
|
import Yrbl from 'component/yrbl';
|
|
import I18nMessage from '../../component/i18nMessage';
|
|
|
|
export const PAGE_VIEW_QUERY = `view`;
|
|
const CONTENT_PAGE = 'content';
|
|
const LISTS_PAGE = 'lists';
|
|
const REPOSTS_PAGE = 'reposts';
|
|
const ABOUT_PAGE = `about`;
|
|
export const DISCUSSION_PAGE = `discussion`;
|
|
const EDIT_PAGE = 'edit';
|
|
|
|
type Props = {
|
|
uri: string,
|
|
claim: ChannelClaim,
|
|
title: ?string,
|
|
cover: ?string,
|
|
thumbnail: ?string,
|
|
page: number,
|
|
match: { params: { attribute: ?string } },
|
|
channelIsMine: boolean,
|
|
isSubscribed: boolean,
|
|
channelIsBlocked: boolean,
|
|
blackListedOutpoints: Array<{
|
|
txid: string,
|
|
nout: number,
|
|
}>,
|
|
fetchSubCount: (string) => void,
|
|
subCount: number,
|
|
pending: boolean,
|
|
youtubeChannels: ?Array<{ channel_claim_id: string, sync_status: string, transfer_state: string }>,
|
|
blockedChannels: Array<string>,
|
|
mutedChannels: Array<string>,
|
|
unpublishedCollections: CollectionGroup,
|
|
};
|
|
|
|
function ChannelPage(props: Props) {
|
|
const {
|
|
uri,
|
|
claim,
|
|
title,
|
|
cover,
|
|
// page, ?page= may come back some day?
|
|
channelIsMine,
|
|
isSubscribed,
|
|
blackListedOutpoints,
|
|
fetchSubCount,
|
|
subCount,
|
|
pending,
|
|
youtubeChannels,
|
|
blockedChannels,
|
|
mutedChannels,
|
|
unpublishedCollections,
|
|
} = props;
|
|
const {
|
|
push,
|
|
goBack,
|
|
location: { search },
|
|
} = useHistory();
|
|
const [viewBlockedChannel, setViewBlockedChannel] = React.useState(false);
|
|
const urlParams = new URLSearchParams(search);
|
|
const currentView = urlParams.get(PAGE_VIEW_QUERY) || undefined;
|
|
const [discussionWasMounted, setDiscussionWasMounted] = React.useState(false);
|
|
const editing = urlParams.get(PAGE_VIEW_QUERY) === EDIT_PAGE;
|
|
const { channelName } = parseURI(uri);
|
|
const { permanent_url: permanentUrl } = claim;
|
|
const claimId = claim.claim_id;
|
|
const formattedSubCount = Number(subCount).toLocaleString();
|
|
const isBlocked = claim && blockedChannels.includes(claim.permanent_url);
|
|
const isMuted = claim && mutedChannels.includes(claim.permanent_url);
|
|
const isMyYouTubeChannel =
|
|
claim &&
|
|
youtubeChannels &&
|
|
youtubeChannels.some(({ channel_claim_id, sync_status, transfer_state }) => {
|
|
if (
|
|
channel_claim_id === claim.claim_id &&
|
|
sync_status !== YOUTUBE_STATUSES.YOUTUBE_SYNC_ABANDONDED &&
|
|
transfer_state !== YOUTUBE_STATUSES.YOUTUBE_SYNC_COMPLETED_TRANSFER
|
|
) {
|
|
return true;
|
|
}
|
|
});
|
|
|
|
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;
|
|
|
|
if (claim && blackListedOutpoints) {
|
|
channelIsBlackListed = blackListedOutpoints.some(
|
|
(outpoint) => outpoint.txid === claim.txid && outpoint.nout === claim.nout
|
|
);
|
|
}
|
|
|
|
// If a user changes tabs, update the url so it stays on the same page if they refresh.
|
|
// We don't want to use links here because we can't animate the tab change and using links
|
|
// would alter the Tab label's role attribute, which should stay role="tab" to work with keyboards/screen readers.
|
|
let tabIndex;
|
|
switch (currentView) {
|
|
case CONTENT_PAGE:
|
|
tabIndex = 0;
|
|
break;
|
|
case LISTS_PAGE:
|
|
tabIndex = 1;
|
|
break;
|
|
case REPOSTS_PAGE:
|
|
tabIndex = 2;
|
|
break;
|
|
case ABOUT_PAGE:
|
|
tabIndex = 3;
|
|
break;
|
|
case DISCUSSION_PAGE:
|
|
tabIndex = 4;
|
|
break;
|
|
default:
|
|
tabIndex = 0;
|
|
break;
|
|
}
|
|
|
|
function onTabChange(newTabIndex) {
|
|
let url = formatLbryUrlForWeb(uri);
|
|
let search = '?';
|
|
|
|
if (newTabIndex === 0) {
|
|
search += `${PAGE_VIEW_QUERY}=${CONTENT_PAGE}`;
|
|
} else if (newTabIndex === 1) {
|
|
search += `${PAGE_VIEW_QUERY}=${LISTS_PAGE}`;
|
|
} else if (newTabIndex === 2) {
|
|
search += `${PAGE_VIEW_QUERY}=${REPOSTS_PAGE}`;
|
|
} else if (newTabIndex === 3) {
|
|
search += `${PAGE_VIEW_QUERY}=${ABOUT_PAGE}`;
|
|
} else {
|
|
search += `${PAGE_VIEW_QUERY}=${DISCUSSION_PAGE}`;
|
|
}
|
|
|
|
push(`${url}${search}`);
|
|
}
|
|
|
|
React.useEffect(() => {
|
|
if (currentView === DISCUSSION_PAGE) {
|
|
setDiscussionWasMounted(true);
|
|
}
|
|
}, [currentView]);
|
|
|
|
React.useEffect(() => {
|
|
fetchSubCount(claimId);
|
|
}, [uri, fetchSubCount, claimId]);
|
|
|
|
if (editing) {
|
|
return (
|
|
<Page
|
|
noFooter
|
|
noSideNavigation={editing}
|
|
backout={{
|
|
title: __('Editing @%channel%', { channel: channelName }),
|
|
simpleTitle: __('Editing'),
|
|
}}
|
|
>
|
|
<ChannelEdit uri={uri} onDone={() => goBack()} />
|
|
</Page>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<Page noFooter>
|
|
<header className="channel-cover">
|
|
<div className="channel__quick-actions">
|
|
{isMyYouTubeChannel && (
|
|
<Button
|
|
button="alt"
|
|
label={__('Claim Your Channel')}
|
|
icon={ICONS.YOUTUBE}
|
|
navigate={`/$/${PAGES.CHANNELS}`}
|
|
/>
|
|
)}
|
|
{!channelIsBlackListed && <ShareButton uri={uri} />}
|
|
{!(isBlocked || isMuted) && <ClaimSupportButton uri={uri} />}
|
|
{!(isBlocked || isMuted) && (!channelIsBlackListed || isSubscribed) && <SubscribeButton uri={permanentUrl} />}
|
|
{/* TODO: add channel collections <ClaimCollectionAddButton uri={uri} fileAction /> */}
|
|
<ClaimMenuList uri={claim.permanent_url} channelUri={claim.permanent_url} inline isChannelPage />
|
|
</div>
|
|
{cover && <img className={classnames('channel-cover__custom')} src={cover} />}
|
|
<div className="channel__primary-info">
|
|
<ChannelThumbnail
|
|
className="channel__thumbnail--channel-page"
|
|
uri={uri}
|
|
allowGifs
|
|
hideStakedIndicator
|
|
noOptimization
|
|
/>
|
|
<h1 className="channel__title">
|
|
{title || '@' + channelName}
|
|
<ChannelStakedIndicator uri={uri} large />
|
|
</h1>
|
|
<div className="channel__meta">
|
|
<span>
|
|
{formattedSubCount} {subCount !== 1 ? __('Followers') : __('Follower')}
|
|
<HelpLink href="https://lbry.com/faq/views" />
|
|
</span>
|
|
{channelIsMine && (
|
|
<>
|
|
{pending ? (
|
|
<span>{__('Your changes will be live in a few minutes')}</span>
|
|
) : (
|
|
<Button
|
|
button="alt"
|
|
title={__('Edit')}
|
|
onClick={() => push(`?${PAGE_VIEW_QUERY}=${EDIT_PAGE}`)}
|
|
icon={ICONS.EDIT}
|
|
iconSize={18}
|
|
disabled={pending}
|
|
/>
|
|
)}
|
|
</>
|
|
)}
|
|
</div>
|
|
</div>
|
|
<div className="channel-cover__gradient" />
|
|
</header>
|
|
|
|
{(isBlocked || isMuted) && !viewBlockedChannel ? (
|
|
<div className="main--empty">
|
|
<Yrbl
|
|
title={isBlocked ? __('This channel is blocked') : __('This channel is muted')}
|
|
subtitle={
|
|
isBlocked
|
|
? __('Are you sure you want to view this content? Viewing will not unblock @%channel%', {
|
|
channel: channelName,
|
|
})
|
|
: __('Are you sure you want to view this content? Viewing will not unmute @%channel%', {
|
|
channel: channelName,
|
|
})
|
|
}
|
|
actions={
|
|
<div className="section__actions">
|
|
<Button button="primary" label={__('View Content')} onClick={() => setViewBlockedChannel(true)} />
|
|
</div>
|
|
}
|
|
/>
|
|
</div>
|
|
) : (
|
|
<Tabs onChange={onTabChange} index={tabIndex}>
|
|
<TabList className="tabs__list--channel-page">
|
|
<Tab disabled={editing}>{__('Publishes')}</Tab>
|
|
<Tab disabled={editing}>{__('Playlists')}</Tab>
|
|
<Tab disabled={editing}>{__('Reposts')}</Tab>
|
|
<Tab>{editing ? __('Editing Your Channel') : __('About --[tab title in Channel Page]--')}</Tab>
|
|
<Tab disabled={editing}>{__('Community')}</Tab>
|
|
</TabList>
|
|
<TabPanels>
|
|
<TabPanel>
|
|
<ChannelContent
|
|
claimType={'stream'}
|
|
uri={uri}
|
|
channelIsBlackListed={channelIsBlackListed}
|
|
viewHiddenChannels
|
|
empty={<section className="main--empty">{__('No Content Found')}</section>}
|
|
/>
|
|
</TabPanel>
|
|
<TabPanel>
|
|
<ChannelContent
|
|
claimType={'collection'}
|
|
uri={uri}
|
|
channelIsBlackListed={channelIsBlackListed}
|
|
viewHiddenChannels
|
|
empty={collectionEmpty}
|
|
/>
|
|
</TabPanel>
|
|
<TabPanel>
|
|
<ChannelContent
|
|
claimType={'repost'}
|
|
uri={uri}
|
|
channelIsBlackListed={channelIsBlackListed}
|
|
viewHiddenChannels
|
|
empty={<section className="main--empty">{__('No Reposts Found')}</section>}
|
|
/>
|
|
</TabPanel>
|
|
<TabPanel>
|
|
<ChannelContent
|
|
claimType={'repost'}
|
|
uri={uri}
|
|
channelIsBlackListed={channelIsBlackListed}
|
|
viewHiddenChannels
|
|
/>
|
|
</TabPanel>
|
|
<TabPanel>
|
|
<ChannelAbout uri={uri} />
|
|
</TabPanel>
|
|
<TabPanel>
|
|
{(discussionWasMounted || currentView === DISCUSSION_PAGE) && <ChannelDiscussion uri={uri} />}
|
|
</TabPanel>
|
|
</TabPanels>
|
|
</Tabs>
|
|
)}
|
|
</Page>
|
|
);
|
|
}
|
|
|
|
export default ChannelPage;
|