Homepage: limit livestreams in categories to 3 ...

... but leave Following as "no limit"

The primary reason for this case is due to News and Wild West having lots of livestreams. But instead of just applying the limit to these 2 and polluting the loop, just limit it for all Categories.
This commit is contained in:
infinite-persistence 2022-05-25 21:39:16 +08:00 committed by Thomas Zarebczan
parent cc0ed44bf6
commit f0bf6fa9a0

View file

@ -23,6 +23,8 @@ import { splitBySeparator } from 'util/lbryURI';
import Ads from 'web/component/ads'; import Ads from 'web/component/ads';
import Meme from 'web/component/meme'; import Meme from 'web/component/meme';
const CATEGORY_LIVESTREAM_LIMIT = 3;
type HomepageOrder = { active: ?Array<string>, hidden: ?Array<string> }; type HomepageOrder = { active: ?Array<string>, hidden: ?Array<string> };
type Props = { type Props = {
@ -66,7 +68,7 @@ function HomePage(props: Props) {
const showPersonalizedTags = (authenticated || !IS_WEB) && followedTags && followedTags.length > 0; const showPersonalizedTags = (authenticated || !IS_WEB) && followedTags && followedTags.length > 0;
const showIndividualTags = showPersonalizedTags && followedTags.length < 5; const showIndividualTags = showPersonalizedTags && followedTags.length < 5;
const isLargeScreen = useIsLargeScreen(); const isLargeScreen = useIsLargeScreen();
const channelIds = subscribedChannels.map((sub) => splitBySeparator(sub.uri)[1]); const subscriptionChannelIds = subscribedChannels.map((sub) => splitBySeparator(sub.uri)[1]);
const rowData: Array<RowDataItem> = GetLinksData( const rowData: Array<RowDataItem> = GetLinksData(
homepageData, homepageData,
@ -128,7 +130,7 @@ function HomePage(props: Props) {
{...options} {...options}
showNoSourceClaims={ENABLE_NO_SOURCE_CLAIMS} showNoSourceClaims={ENABLE_NO_SOURCE_CLAIMS}
hasSource hasSource
prefixUris={getLivestreamUris(activeLivestreams, options.channelIds)} prefixUris={getLivestreamUris(activeLivestreams, options.channelIds).slice(0, CATEGORY_LIVESTREAM_LIMIT)}
pins={{ urls: pinUrls, claimIds: pinnedClaimIds }} pins={{ urls: pinUrls, claimIds: pinnedClaimIds }}
injectedItem={index === 0 && !hasPremiumPlus && { node: <Ads small type="video" tileLayout /> }} injectedItem={index === 0 && !hasPremiumPlus && { node: <Ads small type="video" tileLayout /> }}
forceShowReposts={id !== 'FOLLOWING'} forceShowReposts={id !== 'FOLLOWING'}
@ -196,11 +198,11 @@ function HomePage(props: Props) {
{!fetchingActiveLivestreams && ( {!fetchingActiveLivestreams && (
<> <>
{authenticated && channelIds.length > 0 && !hideScheduledLivestreams && ( {authenticated && subscriptionChannelIds.length > 0 && !hideScheduledLivestreams && (
<ScheduledStreams <ScheduledStreams
channelIds={channelIds} channelIds={subscriptionChannelIds}
tileLayout tileLayout
liveUris={getLivestreamUris(activeLivestreams, channelIds)} liveUris={getLivestreamUris(activeLivestreams, subscriptionChannelIds)}
limitClaimsPerChannel={2} limitClaimsPerChannel={2}
/> />
)} )}