fixes defaults for channel follow intro
This commit is contained in:
parent
5693fde3e6
commit
60e74ad4a7
3 changed files with 51 additions and 39 deletions
|
@ -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,39 +434,41 @@ function ClaimListDiscover(props: Props) {
|
||||||
</FormField>
|
</FormField>
|
||||||
</div>
|
</div>
|
||||||
{/* DURATIONS FIELD */}
|
{/* DURATIONS FIELD */}
|
||||||
<div className={'claim-search__input-container'}>
|
{showDuration && (
|
||||||
<FormField
|
<div className={'claim-search__input-container'}>
|
||||||
className={classnames('claim-search__dropdown', {
|
<FormField
|
||||||
'claim-search__dropdown--selected': durationParam,
|
className={classnames('claim-search__dropdown', {
|
||||||
})}
|
'claim-search__dropdown--selected': durationParam,
|
||||||
label={__('Duration')}
|
})}
|
||||||
type="select"
|
label={__('Duration')}
|
||||||
name="duration"
|
type="select"
|
||||||
disabled={
|
name="duration"
|
||||||
!(
|
disabled={
|
||||||
contentTypeParam === null ||
|
!(
|
||||||
streamTypeParam === CS.FILE_AUDIO ||
|
contentTypeParam === null ||
|
||||||
streamTypeParam === CS.FILE_VIDEO
|
streamTypeParam === CS.FILE_AUDIO ||
|
||||||
)
|
streamTypeParam === CS.FILE_VIDEO
|
||||||
}
|
)
|
||||||
value={durationParam || CS.DURATION_ALL}
|
}
|
||||||
onChange={e =>
|
value={durationParam || CS.DURATION_ALL}
|
||||||
handleChange({
|
onChange={e =>
|
||||||
key: CS.DURATION_KEY,
|
handleChange({
|
||||||
value: e.target.value,
|
key: CS.DURATION_KEY,
|
||||||
})
|
value: e.target.value,
|
||||||
}
|
})
|
||||||
>
|
}
|
||||||
{CS.DURATION_TYPES.map(dur => (
|
>
|
||||||
<option key={dur} value={dur}>
|
{CS.DURATION_TYPES.map(dur => (
|
||||||
{/* i18fixme */}
|
<option key={dur} value={dur}>
|
||||||
{dur === CS.DURATION_SHORT && __('Short')}
|
{/* i18fixme */}
|
||||||
{dur === CS.DURATION_LONG && __('Long')}
|
{dur === CS.DURATION_SHORT && __('Short')}
|
||||||
{dur === CS.DURATION_ALL && __('Any')}
|
{dur === CS.DURATION_LONG && __('Long')}
|
||||||
</option>
|
{dur === CS.DURATION_ALL && __('Any')}
|
||||||
))}
|
</option>
|
||||||
</FormField>
|
))}
|
||||||
</div>
|
</FormField>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in a new issue