Consider more live streams (#6974)

and order by release time always

f
This commit is contained in:
Thomas Zarebczan 2021-08-27 10:57:54 -04:00 committed by GitHub
parent bcbfc54188
commit c6ad44d1e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 5 deletions

View file

@ -72,6 +72,7 @@ type Props = {
liveLivestreamsFirst?: boolean, liveLivestreamsFirst?: boolean,
livestreamMap?: { [string]: any }, livestreamMap?: { [string]: any },
hasSource?: boolean, hasSource?: boolean,
hasNoSource?: boolean,
limitClaimsPerChannel?: number, limitClaimsPerChannel?: number,
releaseTime?: string, releaseTime?: string,
showNoSourceClaims?: boolean, showNoSourceClaims?: boolean,
@ -133,6 +134,7 @@ function ClaimListDiscover(props: Props) {
liveLivestreamsFirst, liveLivestreamsFirst,
livestreamMap, livestreamMap,
hasSource, hasSource,
hasNoSource,
isChannel = false, isChannel = false,
showNoSourceClaims, showNoSourceClaims,
empty, empty,
@ -230,7 +232,7 @@ function ClaimListDiscover(props: Props) {
page_size: dynamicPageSize, page_size: dynamicPageSize,
page, page,
name, name,
claim_type: claimType || undefined, claim_type: claimType || ['stream', 'repost', 'channel'],
// no_totals makes it so the sdk doesn't have to calculate total number pages for pagination // no_totals makes it so the sdk doesn't have to calculate total number pages for pagination
// it's faster, but we will need to remove it if we start using total_pages // it's faster, but we will need to remove it if we start using total_pages
no_totals: true, no_totals: true,
@ -244,7 +246,9 @@ function ClaimListDiscover(props: Props) {
: CS.ORDER_BY_TOP_VALUE, // Sort by top : CS.ORDER_BY_TOP_VALUE, // Sort by top
}; };
if (hasSource || (!ENABLE_NO_SOURCE_CLAIMS && (!claimType || claimType === CS.CLAIM_STREAM))) { if (ENABLE_NO_SOURCE_CLAIMS && hasNoSource) {
options.has_no_source = true;
} else if (hasSource || (!ENABLE_NO_SOURCE_CLAIMS && (!claimType || claimType === 'stream'))) {
options.has_source = true; options.has_source = true;
} }
@ -628,13 +632,20 @@ function ClaimListDiscover(props: Props) {
liveLivestreamsFirst={liveLivestreamsFirst} liveLivestreamsFirst={liveLivestreamsFirst}
livestreamMap={livestreamMap} livestreamMap={livestreamMap}
searchOptions={options} searchOptions={options}
showNoSourceClaims={showNoSourceClaims} showNoSourceClaims={hasNoSource || showNoSourceClaims}
empty={empty} empty={empty}
/> />
{loading && {loading &&
new Array(dynamicPageSize) new Array(dynamicPageSize)
.fill(1) .fill(1)
.map((x, i) => <ClaimPreview key={i} placeholder="loading" type={type} />)} .map((x, i) => (
<ClaimPreview
showNoSourceClaims={hasNoSource || showNoSourceClaims}
key={i}
placeholder="loading"
type={type}
/>
))}
</div> </div>
)} )}
</React.Fragment> </React.Fragment>

View file

@ -188,7 +188,7 @@ function ClaimTilesDiscover(props: Props) {
has_no_source?: boolean, has_no_source?: boolean,
} = { } = {
page_size: pageSize, page_size: pageSize,
claim_type: claimType || undefined, claim_type: claimType || ['stream', 'repost', 'channel'],
// no_totals makes it so the sdk doesn't have to calculate total number pages for pagination // no_totals makes it so the sdk doesn't have to calculate total number pages for pagination
// it's faster, but we will need to remove it if we start using total_pages // it's faster, but we will need to remove it if we start using total_pages
no_totals: true, no_totals: true,

View file

@ -34,6 +34,9 @@ export function getLivestreamOnlyOptions(options: any) {
delete newOptions.has_source; delete newOptions.has_source;
delete newOptions.stream_types; delete newOptions.stream_types;
newOptions.has_no_source = true; newOptions.has_no_source = true;
newOptions.claim_type = ['stream'];
newOptions.page_size = 50;
newOptions.order_by = ['release_time'];
return newOptions; return newOptions;
} }