From 60e74ad4a7e11da28a132f8653fb345461637142 Mon Sep 17 00:00:00 2001
From: jessop
Date: Sun, 1 Mar 2020 17:51:21 -0500
Subject: [PATCH] fixes defaults for channel follow intro
---
ui/component/claimListDiscover/view.jsx | 82 +++++++++++---------
ui/component/userChannelFollowIntro/view.jsx | 4 +-
ui/page/channelsFollowingDiscover/view.jsx | 4 +-
3 files changed, 51 insertions(+), 39 deletions(-)
diff --git a/ui/component/claimListDiscover/view.jsx b/ui/component/claimListDiscover/view.jsx
index f58335bcc..210efa40a 100644
--- a/ui/component/claimListDiscover/view.jsx
+++ b/ui/component/claimListDiscover/view.jsx
@@ -100,6 +100,8 @@ function ClaimListDiscover(props: Props) {
streamType || (CS.FILE_TYPES.includes(contentTypeParam) && contentTypeParam) || defaultStreamType || null;
const durationParam = urlParams.get(CS.DURATION_KEY) || null;
+ const showDuration = !(claimType && claimType === CS.CLAIM_CHANNEL);
+ const showContentType = !(claimType || streamType);
const isFiltered = () =>
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
// This helps with timeout issues for users that are following a ton of stuff
// 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(
moment()
.subtract(3, CS.FRESH_MONTH)
.startOf('week')
.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(
moment()
.subtract(1, CS.FRESH_YEAR)
@@ -373,9 +381,11 @@ function ClaimListDiscover(props: Props) {
{/* i18fixme */}
{time === CS.FRESH_DAY && __('Today')}
{time !== CS.FRESH_ALL &&
+ time !== CS.FRESH_DEFAULT &&
time !== CS.FRESH_DAY &&
__('This ' + toCapitalCase(time)) /* yes, concat before i18n, since it is read from const */}
{time === CS.FRESH_ALL && __('All time')}
+ {time === CS.FRESH_DEFAULT && __('Default')}
))}
@@ -424,39 +434,41 @@ function ClaimListDiscover(props: Props) {
{/* DURATIONS FIELD */}
-
-
- handleChange({
- key: CS.DURATION_KEY,
- value: e.target.value,
- })
- }
- >
- {CS.DURATION_TYPES.map(dur => (
-
- ))}
-
-
+ {showDuration && (
+
+
+ handleChange({
+ key: CS.DURATION_KEY,
+ value: e.target.value,
+ })
+ }
+ >
+ {CS.DURATION_TYPES.map(dur => (
+
+ ))}
+
+
+ )}
>
)}
diff --git a/ui/component/userChannelFollowIntro/view.jsx b/ui/component/userChannelFollowIntro/view.jsx
index 7ba098d9a..11979c395 100644
--- a/ui/component/userChannelFollowIntro/view.jsx
+++ b/ui/component/userChannelFollowIntro/view.jsx
@@ -23,8 +23,8 @@ function UserChannelFollowIntro(props: Props) {
{__('More Channels')}