From 7515ed27048b48c3321333cf72f091e811188824 Mon Sep 17 00:00:00 2001 From: infinite-persistence Date: Fri, 17 Sep 2021 17:21:10 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20Re-enable=20active=20livestream=20t?= =?UTF-8?q?iles=20using=20the=20new=20method?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/page/channelsFollowing/index.js | 9 +++++++-- ui/page/channelsFollowing/view.jsx | 14 ++++++++++++-- ui/page/discover/index.js | 4 ++++ ui/page/discover/view.jsx | 16 +++++++++++++--- ui/page/home/index.js | 7 ++++++- ui/page/home/view.jsx | 26 ++++++++++++++++++++++++-- 6 files changed, 66 insertions(+), 10 deletions(-) diff --git a/ui/page/channelsFollowing/index.js b/ui/page/channelsFollowing/index.js index 599cbf841..c08a2107f 100644 --- a/ui/page/channelsFollowing/index.js +++ b/ui/page/channelsFollowing/index.js @@ -1,13 +1,18 @@ import { connect } from 'react-redux'; import { SETTINGS } from 'lbry-redux'; +import { doFetchActiveLivestreams } from 'redux/actions/livestream'; +import { selectActiveLivestreams } from 'redux/selectors/livestream'; import { selectSubscriptions } from 'redux/selectors/subscriptions'; import { makeSelectClientSetting } from 'redux/selectors/settings'; import ChannelsFollowingPage from './view'; -const select = state => ({ +const select = (state) => ({ subscribedChannels: selectSubscriptions(state), tileLayout: makeSelectClientSetting(SETTINGS.TILE_LAYOUT)(state), + activeLivestreams: selectActiveLivestreams(state), }); -export default connect(select)(ChannelsFollowingPage); +export default connect(select, { + doFetchActiveLivestreams, +})(ChannelsFollowingPage); diff --git a/ui/page/channelsFollowing/view.jsx b/ui/page/channelsFollowing/view.jsx index 87bb5423f..c7f9d7222 100644 --- a/ui/page/channelsFollowing/view.jsx +++ b/ui/page/channelsFollowing/view.jsx @@ -10,21 +10,31 @@ import Page from 'component/page'; import Button from 'component/button'; import Icon from 'component/common/icon'; import { splitBySeparator } from 'lbry-redux'; +import { getLivestreamUris } from 'util/livestream'; type Props = { subscribedChannels: Array, tileLayout: boolean, + activeLivestreams: ?LivestreamInfo, + doFetchActiveLivestreams: () => void, }; function ChannelsFollowingPage(props: Props) { - const { subscribedChannels, tileLayout } = props; + const { subscribedChannels, tileLayout, activeLivestreams, doFetchActiveLivestreams } = props; + const hasSubsribedChannels = subscribedChannels.length > 0; + const channelIds = subscribedChannels.map((sub) => splitBySeparator(sub.uri)[1]); + + React.useEffect(() => { + doFetchActiveLivestreams(); + }, []); return !hasSubsribedChannels ? ( ) : ( } defaultOrderBy={CS.ORDER_BY_NEW} - channelIds={subscribedChannels.map((sub) => splitBySeparator(sub.uri)[1])} + channelIds={channelIds} meta={