// @flow import React from 'react'; import classnames from 'classnames'; import { getSortedRowData } from './helper'; import { ENABLE_NO_SOURCE_CLAIMS } from 'config'; import * as ICONS from 'constants/icons'; import * as MODALS from 'constants/modal_types'; import * as PAGES from 'constants/pages'; import Page from 'component/page'; import Button from 'component/button'; import ClaimTilesDiscover from 'component/claimTilesDiscover'; import ClaimPreviewTile from 'component/claimPreviewTile'; import Icon from 'component/common/icon'; import WaitUntilOnPage from 'component/common/wait-until-on-page'; import RecommendedPersonal from 'component/recommendedPersonal'; import Yrbl from 'component/yrbl'; import { useIsLargeScreen, useIsMobile } from 'effects/use-screensize'; import { GetLinksData } from 'util/buildHomepage'; import { getLivestreamUris } from 'util/livestream'; import ScheduledStreams from 'component/scheduledStreams'; import { splitBySeparator } from 'util/lbryURI'; import Ads from 'web/component/ads'; import AdsBanner from 'web/component/adsBanner'; import Meme from 'web/component/meme'; const CATEGORY_LIVESTREAM_LIMIT = 3; type HomepageOrder = { active: ?Array, hidden: ?Array }; type Props = { authenticated: boolean, followedTags: Array, subscribedChannels: Array, showNsfw: boolean, homepageData: any, homepageMeme: ?{ text: string, url: string }, homepageFetched: boolean, activeLivestreams: any, doFetchActiveLivestreams: () => void, fetchingActiveLivestreams: boolean, hideScheduledLivestreams: boolean, homepageOrder: HomepageOrder, doOpenModal: (id: string, ?{}) => void, hasMembership: ?boolean, hasPremiumPlus: boolean, }; function HomePage(props: Props) { const { followedTags, subscribedChannels, authenticated, showNsfw, homepageData, homepageMeme, homepageFetched, activeLivestreams, doFetchActiveLivestreams, fetchingActiveLivestreams, hideScheduledLivestreams, homepageOrder, doOpenModal, hasMembership, hasPremiumPlus, } = props; const showPersonalizedChannels = (authenticated || !IS_WEB) && subscribedChannels && subscribedChannels.length > 0; const showPersonalizedTags = (authenticated || !IS_WEB) && followedTags && followedTags.length > 0; const showIndividualTags = showPersonalizedTags && followedTags.length < 5; const isLargeScreen = useIsLargeScreen(); const isMobileScreen = useIsMobile(); const subscriptionChannelIds = subscribedChannels.map((sub) => splitBySeparator(sub.uri)[1]); const rowData: Array = GetLinksData( homepageData, isLargeScreen, true, authenticated, showPersonalizedChannels, showPersonalizedTags, subscribedChannels, followedTags, showIndividualTags, showNsfw ); const sortedRowData: Array = getSortedRowData(authenticated, hasMembership, homepageOrder, rowData); type SectionHeaderProps = { title: string, navigate?: string, icon?: string, help?: string, }; const SectionHeader = ({ title, navigate = '/', icon = '', help }: SectionHeaderProps) => { return (

); }; const CustomizeHomepage = () => { return (