From 111dc695ca84564666eb74bc4c08463274ff5b1f Mon Sep 17 00:00:00 2001 From: infinite-persistence Date: Thu, 23 Sep 2021 16:38:16 +0800 Subject: [PATCH] WildWest: limit livestream tiles + add ability to show more Most likely this behavior will change in the future, so we'll leave `ClaimListDiscover` untouched and handle the logic at the page level. This solution uses 2 `ClaimListDiscover` -- if the reduced livestream list is visible, it handles the header; else the normal list handles the header. --- ui/page/discover/view.jsx | 109 ++++++++++++++++++++--------- ui/scss/component/_livestream.scss | 6 ++ 2 files changed, 80 insertions(+), 35 deletions(-) diff --git a/ui/page/discover/view.jsx b/ui/page/discover/view.jsx index a88e34666..d8d59a280 100644 --- a/ui/page/discover/view.jsx +++ b/ui/page/discover/view.jsx @@ -18,6 +18,8 @@ import I18nMessage from 'component/i18nMessage'; import moment from 'moment'; import { getLivestreamUris } from 'util/livestream'; +const INITIAL_LIVESTREAM_TILE_LIMIT = 8; + type Props = { location: { search: string }, followedTags: Array, @@ -29,7 +31,7 @@ type Props = { dynamicRouteProps: RowDataItem, tileLayout: boolean, activeLivestreams: ?LivestreamInfo, - doFetchActiveLivestreams: () => void, + doFetchActiveLivestreams: (orderBy?: Array, pageSize?: number, forceFetch?: boolean) => void, }; function DiscoverPage(props: Props) { @@ -70,6 +72,40 @@ function DiscoverPage(props: Props) { label = __('Unfollow'); } + const [showViewMoreLivestreams, setShowViewMoreLivestreams] = React.useState(!dynamicRouteProps); + const livestreamUris = getLivestreamUris(activeLivestreams, channelIds); + const useDualList = showViewMoreLivestreams && livestreamUris.length > INITIAL_LIVESTREAM_TILE_LIMIT; + + function getElemMeta() { + return !dynamicRouteProps ? ( + + , + }} + > + Results boosted by %lbc% + + + ) : ( + tag && !isMobile && ( +