fixes defaults for channel follow intro

This commit is contained in:
jessop 2020-03-01 17:51:21 -05:00
parent 5693fde3e6
commit 60e74ad4a7
3 changed files with 51 additions and 39 deletions

View file

@ -100,6 +100,8 @@ function ClaimListDiscover(props: Props) {
streamType || (CS.FILE_TYPES.includes(contentTypeParam) && contentTypeParam) || defaultStreamType || null; streamType || (CS.FILE_TYPES.includes(contentTypeParam) && contentTypeParam) || defaultStreamType || null;
const durationParam = urlParams.get(CS.DURATION_KEY) || null; const durationParam = urlParams.get(CS.DURATION_KEY) || null;
const showDuration = !(claimType && claimType === CS.CLAIM_CHANNEL);
const showContentType = !(claimType || streamType);
const isFiltered = () => const isFiltered = () =>
Boolean(urlParams.get(CS.FRESH_KEY) || urlParams.get(CS.CONTENT_KEY) || urlParams.get(CS.DURATION_KEY)); Boolean(urlParams.get(CS.FRESH_KEY) || urlParams.get(CS.CONTENT_KEY) || urlParams.get(CS.DURATION_KEY));
@ -155,14 +157,20 @@ function ClaimListDiscover(props: Props) {
// For more than 20, drop it down to 6 months // For more than 20, drop it down to 6 months
// This helps with timeout issues for users that are following a ton of stuff // This helps with timeout issues for users that are following a ton of stuff
// https://github.com/lbryio/lbry-sdk/issues/2420 // https://github.com/lbryio/lbry-sdk/issues/2420
if (options.channel_ids.length > 20 || options.any_tags.length > 20) { if (
(options.channel_ids && options.channel_ids.length > 20) ||
(options.any_tags && options.any_tags.length > 20)
) {
options.release_time = `>${Math.floor( options.release_time = `>${Math.floor(
moment() moment()
.subtract(3, CS.FRESH_MONTH) .subtract(3, CS.FRESH_MONTH)
.startOf('week') .startOf('week')
.unix() .unix()
)}`; )}`;
} else if (options.channel_ids.length > 10 || options.any_tags.length > 10) { } else if (
(options.channel_ids && options.channel_ids.length > 10) ||
(options.any_tags && options.any_tags.length > 10)
) {
options.release_time = `>${Math.floor( options.release_time = `>${Math.floor(
moment() moment()
.subtract(1, CS.FRESH_YEAR) .subtract(1, CS.FRESH_YEAR)
@ -373,9 +381,11 @@ function ClaimListDiscover(props: Props) {
{/* i18fixme */} {/* i18fixme */}
{time === CS.FRESH_DAY && __('Today')} {time === CS.FRESH_DAY && __('Today')}
{time !== CS.FRESH_ALL && {time !== CS.FRESH_ALL &&
time !== CS.FRESH_DEFAULT &&
time !== CS.FRESH_DAY && time !== CS.FRESH_DAY &&
__('This ' + toCapitalCase(time)) /* yes, concat before i18n, since it is read from const */} __('This ' + toCapitalCase(time)) /* yes, concat before i18n, since it is read from const */}
{time === CS.FRESH_ALL && __('All time')} {time === CS.FRESH_ALL && __('All time')}
{time === CS.FRESH_DEFAULT && __('Default')}
</option> </option>
))} ))}
</FormField> </FormField>
@ -424,6 +434,7 @@ function ClaimListDiscover(props: Props) {
</FormField> </FormField>
</div> </div>
{/* DURATIONS FIELD */} {/* DURATIONS FIELD */}
{showDuration && (
<div className={'claim-search__input-container'}> <div className={'claim-search__input-container'}>
<FormField <FormField
className={classnames('claim-search__dropdown', { className={classnames('claim-search__dropdown', {
@ -457,6 +468,7 @@ function ClaimListDiscover(props: Props) {
))} ))}
</FormField> </FormField>
</div> </div>
)}
</div> </div>
</> </>
)} )}

View file

@ -23,8 +23,8 @@ function UserChannelFollowIntro(props: Props) {
</p> </p>
<div className="section__body"> <div className="section__body">
<ClaimListDiscover <ClaimListDiscover
defaultTypeSort={CS.ORDER_BY_TOP} defaultOrderBy={CS.ORDER_BY_TOP}
defaultTimeSort={CS.FRESH_ALL} defaultFreshness={CS.FRESH_ALL}
claimType="channel" claimType="channel"
hideBlock hideBlock
hideFilter hideFilter

View file

@ -116,8 +116,8 @@ function ChannelsFollowingDiscover(props: Props) {
))} ))}
<h1 className="claim-grid__title">{__('More Channels')}</h1> <h1 className="claim-grid__title">{__('More Channels')}</h1>
<ClaimListDiscover <ClaimListDiscover
defaultTypeSort={CS.ORDER_BY_TOP} defaultOrderBy={CS.ORDER_BY_TOP}
defaultTimeSort={CS.FRESH_ALL} defaultFreshness={CS.FRESH_ALL}
claimType="channel" claimType="channel"
hideFilter hideFilter
/> />