diff --git a/ui/effects/use-get-livestreams.js b/ui/effects/use-get-livestreams.js index 82962dafd..e151534e5 100644 --- a/ui/effects/use-get-livestreams.js +++ b/ui/effects/use-get-livestreams.js @@ -6,10 +6,11 @@ import { BITWAVE_LIVE_API } from 'constants/livestream'; * Gets latest livestream info list. Returns null (instead of a blank object) * when there are no active livestreams. * + * @param minViewers * @param refreshMs * @returns {{livestreamMap: null, loading: boolean}} */ -export default function useGetLivestreams(refreshMs: number) { +export default function useGetLivestreams(minViewers: number = 0, refreshMs: number = 0) { const [loading, setLoading] = React.useState(true); const [livestreamMap, setLivestreamMap] = React.useState(null); @@ -25,7 +26,9 @@ export default function useGetLivestreams(refreshMs: number) { } const livestreamMap = res.data.reduce((acc, curr) => { - acc[curr.claimId] = curr; + if (curr.viewCount >= minViewers) { + acc[curr.claimId] = curr; + } return acc; }, {}); diff --git a/ui/page/channelsFollowing/view.jsx b/ui/page/channelsFollowing/view.jsx index d941e51c8..1a9ddb899 100644 --- a/ui/page/channelsFollowing/view.jsx +++ b/ui/page/channelsFollowing/view.jsx @@ -19,7 +19,7 @@ type Props = { function ChannelsFollowingPage(props: Props) { const { subscribedChannels, tileLayout } = props; const hasSubsribedChannels = subscribedChannels.length > 0; - const { livestreamMap } = useGetLivestreams(0); + const { livestreamMap } = useGetLivestreams(); return !hasSubsribedChannels ? ( diff --git a/ui/page/discover/view.jsx b/ui/page/discover/view.jsx index a390ad9ba..5e404d95e 100644 --- a/ui/page/discover/view.jsx +++ b/ui/page/discover/view.jsx @@ -44,7 +44,7 @@ function DiscoverPage(props: Props) { const buttonRef = useRef(); const isHovering = useHover(buttonRef); const isMobile = useIsMobile(); - const { livestreamMap } = useGetLivestreams(0); + const { livestreamMap } = useGetLivestreams(); const urlParams = new URLSearchParams(search); const claimType = urlParams.get('claim_type'); diff --git a/ui/page/home/view.jsx b/ui/page/home/view.jsx index 08f2475e0..3f7bc1007 100644 --- a/ui/page/home/view.jsx +++ b/ui/page/home/view.jsx @@ -25,7 +25,7 @@ function HomePage(props: Props) { const showPersonalizedTags = (authenticated || !IS_WEB) && followedTags && followedTags.length > 0; const showIndividualTags = showPersonalizedTags && followedTags.length < 5; const { default: getHomepage } = homepageData; - const { livestreamMap } = useGetLivestreams(0); + const { livestreamMap } = useGetLivestreams(); const rowData: Array = getHomepage( authenticated,