From b9fc9b631912e061fe5742f48cf48b1b2a661bc5 Mon Sep 17 00:00:00 2001 From: zeppi Date: Wed, 28 Apr 2021 23:44:29 -0400 Subject: [PATCH] allow unsubscribe from deleted channels by navigating from sidebar --- static/app-strings.json | 4 +- ui/component/abandonedChannelPreview/view.jsx | 2 + ui/component/subscribeButton/view.jsx | 35 +++++++++++++-- ui/redux/reducers/subscriptions.js | 14 +++--- ui/redux/selectors/subscriptions.js | 44 ++++++++++--------- 5 files changed, 68 insertions(+), 31 deletions(-) diff --git a/static/app-strings.json b/static/app-strings.json index 5dbf7fe17..c9f9eaa9c 100644 --- a/static/app-strings.json +++ b/static/app-strings.json @@ -1886,7 +1886,6 @@ "No replays found.": "No replays found.", "Replay video available": "Replay video available", "Check for Replays:": "Check for Replays", - "A thumbnail is required. Please upload or provide an image URL above.": "A thumbnail is required. Please upload or provide an image URL above.", "You can upload your own recording or select a replay when your stream is over": "You can upload your own recording or select a replay when your stream is over", "This channel isn't staking enough LBRY Credits for inline image previews.": "This channel isn't staking enough LBRY Credits for inline image previews.", "Fromage": "Fromage", @@ -1894,6 +1893,7 @@ "Tá Rolando": "Tá Rolando", "Watch content and earn more Credits for each level unlocked! 10 views required for level 1 (Current Score: 0). Only up to 10 views per day count.": "Watch content and earn more Credits for each level unlocked! 10 views required for level 1 (Current Score: 0). Only up to 10 views per day count.", "Follow your favorite creators and earn more Credits for each level unlocked! Follow 1 creators for level 1 (Current Score: 0).": "Follow your favorite creators and earn more Credits for each level unlocked! Follow 1 creators for level 1 (Current Score: 0).", - "Video/Audio": "Video/Audio", + "Channel Not Found": "Channel Not Found", + "Probably because you didn't make it.": "Probably because you didn't make it.", "--end--": "--end--" } diff --git a/ui/component/abandonedChannelPreview/view.jsx b/ui/component/abandonedChannelPreview/view.jsx index 755e015ee..1fc67c6bd 100644 --- a/ui/component/abandonedChannelPreview/view.jsx +++ b/ui/component/abandonedChannelPreview/view.jsx @@ -5,6 +5,7 @@ import ChannelThumbnail from 'component/channelThumbnail'; import { parseURI } from 'lbry-redux'; import ChannelBlockButton from 'component/channelBlockButton'; import ChannelMuteButton from 'component/channelMuteButton'; +import SubscribeButton from 'component/subscribeButton'; type Props = { uri: string, @@ -30,6 +31,7 @@ function AbandonedChannelPreview(props: Props) {
+
diff --git a/ui/component/subscribeButton/view.jsx b/ui/component/subscribeButton/view.jsx index 0bc24a580..3352cba67 100644 --- a/ui/component/subscribeButton/view.jsx +++ b/ui/component/subscribeButton/view.jsx @@ -15,13 +15,14 @@ type SubscriptionArgs = { type Props = { permanentUrl: ?string, isSubscribed: boolean, - doChannelSubscribe: SubscriptionArgs => void, - doChannelUnsubscribe: SubscriptionArgs => void, + doChannelSubscribe: (SubscriptionArgs) => void, + doChannelUnsubscribe: (SubscriptionArgs) => void, showSnackBarOnSubscribe: boolean, doToast: ({ message: string }) => void, shrinkOnMobile: boolean, notificationsDisabled: boolean, user: ?User, + uri: string, }; export default function SubscribeButton(props: Props) { @@ -35,6 +36,7 @@ export default function SubscribeButton(props: Props) { shrinkOnMobile = false, notificationsDisabled, user, + uri, } = props; const buttonRef = useRef(); @@ -43,6 +45,7 @@ export default function SubscribeButton(props: Props) { isHovering = isMobile ? true : isHovering; const uiNotificationsEnabled = user && user.experimental_ui; + const { channelName: rawChannelName } = parseURI(uri); const { channelName } = parseURI(permanentUrl); const claimName = '@' + channelName; @@ -55,6 +58,32 @@ export default function SubscribeButton(props: Props) { const label = isMobile && shrinkOnMobile ? '' : unfollowOverride || subscriptionLabel; const titlePrefix = isSubscribed ? __('Unfollow this channel') : __('Follow this channel'); + if (isSubscribed && !permanentUrl && rawChannelName) { + return ( +
+
+ ); + } + return permanentUrl ? (