Just always show homepage segment titles.. (#1116)
## Issue - "Following" was showing up in place of "Featured" - "Following" doesn't appear until livestreams are fetched, causing shifts. When "Upcoming Livestreams" was implemented, it was trying to retain the original behavior of not showing "Following" title if that was the first in the list. Not only is it a chicken-and-egg problem, but it causes extra renders due to the need to check if the other guys was rendered. With FYP, there are now more combinations to handle. ## Change Just show the title...
This commit is contained in:
parent
745e40a83e
commit
bffc27e8d0
2 changed files with 12 additions and 16 deletions
|
@ -72,7 +72,9 @@ export default function RecommendedPersonal(props: Props) {
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
// -- Update parent's callback request
|
// -- Update parent's callback request
|
||||||
onLoad(count > 0);
|
if (typeof onLoad === 'function') {
|
||||||
|
onLoad(count > 0);
|
||||||
|
}
|
||||||
}, [count, onLoad]);
|
}, [count, onLoad]);
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import * as ICONS from 'constants/icons';
|
import * as ICONS from 'constants/icons';
|
||||||
import * as PAGES from 'constants/pages';
|
import * as PAGES from 'constants/pages';
|
||||||
import { SITE_NAME, SIMPLE_SITE, ENABLE_NO_SOURCE_CLAIMS } from 'config';
|
import { SITE_NAME, SIMPLE_SITE, ENABLE_NO_SOURCE_CLAIMS } from 'config';
|
||||||
import React, { useState } from 'react';
|
import React from 'react';
|
||||||
import Page from 'component/page';
|
import Page from 'component/page';
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
import ClaimTilesDiscover from 'component/claimTilesDiscover';
|
import ClaimTilesDiscover from 'component/claimTilesDiscover';
|
||||||
|
@ -22,6 +22,10 @@ import Ads from 'web/component/ads';
|
||||||
import Meme from 'web/component/meme';
|
import Meme from 'web/component/meme';
|
||||||
// @endif
|
// @endif
|
||||||
|
|
||||||
|
function resolveTitleOverride(title: string) {
|
||||||
|
return title === 'Recent From Following' ? 'Following' : title;
|
||||||
|
}
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
authenticated: boolean,
|
authenticated: boolean,
|
||||||
followedTags: Array<Tag>,
|
followedTags: Array<Tag>,
|
||||||
|
@ -119,19 +123,18 @@ function HomePage(props: Props) {
|
||||||
'show-ribbon': index === 0,
|
'show-ribbon': index === 0,
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
{/* category header */}
|
{title && typeof title === 'string' && (
|
||||||
{index !== 0 && title && typeof title === 'string' && (
|
<SectionHeader title={__(resolveTitleOverride(title))} navigate={route || link} icon={icon} help={help} />
|
||||||
<SectionHeader title={__(title)} navigate={route || link} icon={icon} help={help} />
|
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{index === 0 && <>{claimTiles}</>}
|
{index === 0 && <>{claimTiles}</>}
|
||||||
|
|
||||||
{index !== 0 && (
|
{index !== 0 && (
|
||||||
<WaitUntilOnPage name={title} placeholder={tilePlaceholder} yOffset={800}>
|
<WaitUntilOnPage name={title} placeholder={tilePlaceholder} yOffset={800}>
|
||||||
{claimTiles}
|
{claimTiles}
|
||||||
</WaitUntilOnPage>
|
</WaitUntilOnPage>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* view more button */}
|
|
||||||
{(route || link) && (
|
{(route || link) && (
|
||||||
<Button
|
<Button
|
||||||
className="claim-grid__title--secondary"
|
className="claim-grid__title--secondary"
|
||||||
|
@ -149,10 +152,6 @@ function HomePage(props: Props) {
|
||||||
doFetchActiveLivestreams();
|
doFetchActiveLivestreams();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const [hasPersonalRecommendations, setHasPersonalRecommendations] = useState(false);
|
|
||||||
const [hasScheduledStreams, setHasScheduledStreams] = useState(false);
|
|
||||||
const scheduledStreamsLoaded = (total) => setHasScheduledStreams(total > 0);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Page className="homePage-wrapper" fullWidthPage>
|
<Page className="homePage-wrapper" fullWidthPage>
|
||||||
{!SIMPLE_SITE && (authenticated || !IS_WEB) && !subscribedChannels.length && (
|
{!SIMPLE_SITE && (authenticated || !IS_WEB) && !subscribedChannels.length && (
|
||||||
|
@ -174,7 +173,7 @@ function HomePage(props: Props) {
|
||||||
{SIMPLE_SITE && <Meme />}
|
{SIMPLE_SITE && <Meme />}
|
||||||
{/* @endif */}
|
{/* @endif */}
|
||||||
|
|
||||||
<RecommendedPersonal onLoad={(displayed) => setHasPersonalRecommendations(displayed)} />
|
<RecommendedPersonal />
|
||||||
|
|
||||||
{!fetchingActiveLivestreams && (
|
{!fetchingActiveLivestreams && (
|
||||||
<>
|
<>
|
||||||
|
@ -184,13 +183,8 @@ function HomePage(props: Props) {
|
||||||
tileLayout
|
tileLayout
|
||||||
liveUris={getLivestreamUris(activeLivestreams, channelIds)}
|
liveUris={getLivestreamUris(activeLivestreams, channelIds)}
|
||||||
limitClaimsPerChannel={2}
|
limitClaimsPerChannel={2}
|
||||||
onLoad={scheduledStreamsLoaded}
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{authenticated && ((hasScheduledStreams && !hideScheduledLivestreams) || hasPersonalRecommendations) && (
|
|
||||||
<SectionHeader title={__('Following')} navigate={`/$/${PAGES.CHANNELS_FOLLOWING}`} icon={ICONS.SUBSCRIBE} />
|
|
||||||
)}
|
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue