// @flow import * as ICONS from 'constants/icons'; import * as MODALS from 'constants/modal_types'; import * as PAGES from 'constants/pages'; import { ENABLE_NO_SOURCE_CLAIMS } from 'config'; import React from 'react'; 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 } 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 classnames from 'classnames'; import Ads from 'web/component/ads'; import Meme from 'web/component/meme'; function resolveTitleOverride(title: string) { return title === 'Recent From Following' ? 'Following' : title; } type HomepageOrder = { active: ?Array, hidden: ?Array }; type Props = { authenticated: boolean, followedTags: Array, subscribedChannels: Array, showNsfw: boolean, homepageData: any, activeLivestreams: any, doFetchActiveLivestreams: () => void, fetchingActiveLivestreams: boolean, hideScheduledLivestreams: boolean, adBlockerFound: ?boolean, homepageOrder: HomepageOrder, doOpenModal: (id: string, ?{}) => void, }; function HomePage(props: Props) { const { followedTags, subscribedChannels, authenticated, showNsfw, homepageData, activeLivestreams, doFetchActiveLivestreams, fetchingActiveLivestreams, hideScheduledLivestreams, adBlockerFound, homepageOrder, doOpenModal, } = 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 channelIds = subscribedChannels.map((sub) => splitBySeparator(sub.uri)[1]); const rowData: Array = GetLinksData( homepageData, isLargeScreen, true, authenticated, showPersonalizedChannels, showPersonalizedTags, subscribedChannels, followedTags, showIndividualTags, showNsfw ); // TODO: probably need memo, or incorporate into GetLinksData. let sortedRowData: Array = []; if (homepageOrder.active && authenticated) { homepageOrder.active.forEach((key) => { const item = rowData.find((data) => data.id === key); if (item) { sortedRowData.push(item); } else if (key === 'FYP') { sortedRowData.push({ id: 'FYP', title: 'Recommended', icon: ICONS.GLOBE, link: `/$/${PAGES.FYP}`, }); } }); } else { sortedRowData = rowData; } type SectionHeaderProps = { title: string, navigate?: string, icon?: string, help?: string, }; const SectionHeader = ({ title, navigate = '/', icon = '', help }: SectionHeaderProps) => { return (

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