fix livestream display

This commit is contained in:
zeppi 2021-07-08 12:21:42 -04:00 committed by jessopb
parent 36fe736669
commit 0bb9c520ff
5 changed files with 24 additions and 6 deletions

View file

@ -115,6 +115,7 @@ type Props = {
liveLivestreamsFirst?: boolean,
livestreamMap?: { [string]: any },
pin?: boolean,
showNoSourceClaims?: boolean,
};
function ClaimTilesDiscover(props: Props) {
@ -147,6 +148,7 @@ function ClaimTilesDiscover(props: Props) {
livestreamMap,
// pin, // let's pin from /web folder
prefixUris,
showNoSourceClaims,
} = props;
const { location } = useHistory();
@ -290,7 +292,11 @@ function ClaimTilesDiscover(props: Props) {
? uris.map((uri, index) => (
<ClaimPreviewTile key={uri} uri={uri} properties={renderProperties} live={resolveLive(index)} />
))
: new Array(pageSize).fill(1).map((x, i) => <ClaimPreviewTile key={i} placeholder />)}
: new Array(pageSize)
.fill(1)
.map((x, i) => (
<ClaimPreviewTile showNoSourceClaims={hasNoSource || showNoSourceClaims} key={i} placeholder />
))}
</ul>
);
}

View file

@ -56,6 +56,7 @@ export default function LivestreamList() {
{livestreamMap && Object.keys(livestreamMap).length > 0 && (
<ClaimTilesDiscover
showNoSourceClaims
hasNoSource
streamTypes={null}
channelIds={Object.keys(livestreamMap)}

View file

@ -2,7 +2,7 @@
import * as PAGES from 'constants/pages';
import * as ICONS from 'constants/icons';
import * as CS from 'constants/claim_search';
import { SIMPLE_SITE } from 'config';
import { SIMPLE_SITE, ENABLE_NO_SOURCE_CLAIMS } from 'config';
import React from 'react';
import ChannelsFollowingDiscoverPage from 'page/channelsFollowingDiscover';
import ClaimListDiscover from 'component/claimListDiscover';
@ -47,6 +47,7 @@ function ChannelsFollowingPage(props: Props) {
}
liveLivestreamsFirst
livestreamMap={livestreamMap}
showNoSourceClaims={ENABLE_NO_SOURCE_CLAIMS}
hasSource
/>
</Page>

View file

@ -1,5 +1,5 @@
// @flow
import { SHOW_ADS, DOMAIN, SIMPLE_SITE } from 'config';
import { SHOW_ADS, DOMAIN, SIMPLE_SITE, ENABLE_NO_SOURCE_CLAIMS } from 'config';
import * as ICONS from 'constants/icons';
import * as PAGES from 'constants/pages';
import React, { useRef } from 'react';
@ -153,6 +153,7 @@ function DiscoverPage(props: Props) {
liveLivestreamsFirst
livestreamMap={livestreamMap}
hasSource
showNoSourceClaims={ENABLE_NO_SOURCE_CLAIMS}
/>
</Page>
);

View file

@ -1,7 +1,7 @@
// @flow
import * as ICONS from 'constants/icons';
import * as PAGES from 'constants/pages';
import { SITE_NAME, SIMPLE_SITE, DOMAIN } from 'config';
import { SITE_NAME, SIMPLE_SITE, DOMAIN, ENABLE_NO_SOURCE_CLAIMS } from 'config';
import React from 'react';
import Page from 'component/page';
import Button from 'component/button';
@ -43,11 +43,20 @@ function HomePage(props: Props) {
const tilePlaceholder = (
<ul className="claim-grid">
{new Array(options.pageSize || 8).fill(1).map((x, i) => (
<ClaimPreviewTile key={i} placeholder />
<ClaimPreviewTile showNoSourceClaims={ENABLE_NO_SOURCE_CLAIMS} key={i} placeholder />
))}
</ul>
);
const claimTiles = <ClaimTilesDiscover {...options} liveLivestreamsFirst livestreamMap={livestreamMap} hasSource />;
const claimTiles = (
<ClaimTilesDiscover
{...options}
liveLivestreamsFirst
livestreamMap={livestreamMap}
showNoSourceClaims={ENABLE_NO_SOURCE_CLAIMS}
hasSource
pin={route === `/$/${PAGES.GENERAL}`}
/>
);
return (
<div key={title} className="claim-grid__wrapper">