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,
livestreamMap?: { [string]: any },
hasSource?: boolean,
hasNoSource?: boolean,
limitClaimsPerChannel?: number,
releaseTime?: string,
showNoSourceClaims?: boolean,
@ -133,6 +134,7 @@ function ClaimListDiscover(props: Props) {
liveLivestreamsFirst,
livestreamMap,
hasSource,
hasNoSource,
isChannel = false,
showNoSourceClaims,
empty,
@ -230,7 +232,7 @@ function ClaimListDiscover(props: Props) {
page_size: dynamicPageSize,
page,
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
// it's faster, but we will need to remove it if we start using total_pages
no_totals: true,
@ -244,7 +246,9 @@ function ClaimListDiscover(props: Props) {
: 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;
}
@ -628,13 +632,20 @@ function ClaimListDiscover(props: Props) {
liveLivestreamsFirst={liveLivestreamsFirst}
livestreamMap={livestreamMap}
searchOptions={options}
showNoSourceClaims={showNoSourceClaims}
showNoSourceClaims={hasNoSource || showNoSourceClaims}
empty={empty}
/>
{loading &&
new Array(dynamicPageSize)
.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>
)}
</React.Fragment>

View file

@ -188,7 +188,7 @@ function ClaimTilesDiscover(props: Props) {
has_no_source?: boolean,
} = {
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
// it's faster, but we will need to remove it if we start using total_pages
no_totals: true,

View file

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