From 86bae6eaeeedb7e127808bc97c464e7e2800928f Mon Sep 17 00:00:00 2001 From: infiinte-persistence Date: Tue, 30 Jun 2020 02:26:08 +0800 Subject: [PATCH] AbandonedChannelPreview: Handle blocked channels as well. Issue 3800 --- ui/component/abandonedChannelPreview/index.js | 16 ++++--- ui/component/abandonedChannelPreview/view.jsx | 43 +++++++++++++------ 2 files changed, 39 insertions(+), 20 deletions(-) diff --git a/ui/component/abandonedChannelPreview/index.js b/ui/component/abandonedChannelPreview/index.js index a61910155..caec28e62 100644 --- a/ui/component/abandonedChannelPreview/index.js +++ b/ui/component/abandonedChannelPreview/index.js @@ -1,10 +1,14 @@ import { connect } from 'react-redux'; +import { selectBlockedChannels } from 'lbry-redux'; import { doChannelUnsubscribe } from 'redux/actions/subscriptions'; +import { doOpenModal } from 'redux/actions/app'; import AbandonedChannelPreview from './view'; -export default connect( - null, - { - doChannelUnsubscribe, - } -)(AbandonedChannelPreview); +const select = (state, props) => ({ + blockedChannelUris: selectBlockedChannels(state), +}); + +export default connect(select, { + doChannelUnsubscribe, + doOpenModal, +})(AbandonedChannelPreview); diff --git a/ui/component/abandonedChannelPreview/view.jsx b/ui/component/abandonedChannelPreview/view.jsx index bc2430392..11ee632b9 100644 --- a/ui/component/abandonedChannelPreview/view.jsx +++ b/ui/component/abandonedChannelPreview/view.jsx @@ -5,6 +5,7 @@ import ChannelThumbnail from 'component/channelThumbnail'; import Button from 'component/button'; import { parseURI } from 'lbry-redux'; import * as ICONS from '../../constants/icons'; +import * as MODALS from 'constants/modal_types'; type SubscriptionArgs = { channelName: string, @@ -15,11 +16,14 @@ type Props = { uri: string, doChannelUnsubscribe: SubscriptionArgs => void, type: string, + blockedChannelUris: Array, + doOpenModal: (string, {}) => void, }; function AbandonedChannelPreview(props: Props) { - const { uri, doChannelUnsubscribe, type } = props; + const { uri, doChannelUnsubscribe, type, blockedChannelUris, doOpenModal } = props; const { channelName } = parseURI(uri); + const isBlockedChannel = blockedChannelUris.includes(uri); return (
  • @@ -33,20 +37,31 @@ function AbandonedChannelPreview(props: Props) {
    {__(`This channel may have been unpublished.`)}
    + {isBlockedChannel && ( +