diff --git a/.gitignore b/.gitignore index 0c609ba47..f3adf8f8a 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,6 @@ package-lock.json !/custom/robots.disallowall !/custom/robots.allowall .env +.env.ody +.env.desktop +.env.lbrytv diff --git a/ui/component/userChannelFollowIntro/view.jsx b/ui/component/userChannelFollowIntro/view.jsx index 8c1db7f68..970d41f69 100644 --- a/ui/component/userChannelFollowIntro/view.jsx +++ b/ui/component/userChannelFollowIntro/view.jsx @@ -6,7 +6,7 @@ import Nag from 'component/common/nag'; import { parseURI } from 'lbry-redux'; import Button from 'component/button'; import Card from 'component/common/card'; -import { AUTO_FOLLOW_CHANNELS, SIMPLE_SITE } from 'config'; +import { AUTO_FOLLOW_CHANNELS, CUSTOM_HOMEPAGE } from 'config'; type Props = { subscribedChannels: Array, @@ -23,7 +23,11 @@ const channelsToSubscribe = AUTO_FOLLOW_CHANNELS.trim() function UserChannelFollowIntro(props: Props) { const { subscribedChannels, channelSubscribe, onContinue, onBack, homepageData, prefsReady } = props; - const { PRIMARY_CONTENT_CHANNEL_IDS } = homepageData; + const { PRIMARY_CONTENT } = homepageData; + let channelIds; + if (PRIMARY_CONTENT && CUSTOM_HOMEPAGE) { + channelIds = PRIMARY_CONTENT.channelIds; + } const followingCount = (subscribedChannels && subscribedChannels.length) || 0; // subscribe to lbry @@ -62,7 +66,7 @@ function UserChannelFollowIntro(props: Props) { defaultOrderBy={CS.ORDER_BY_TOP} defaultFreshness={CS.FRESH_ALL} claimType="channel" - claimIds={SIMPLE_SITE ? undefined : PRIMARY_CONTENT_CHANNEL_IDS} + claimIds={CUSTOM_HOMEPAGE && channelIds ? channelIds : undefined} defaultTags={followingCount > 3 ? CS.TAGS_FOLLOWED : undefined} /> {followingCount > 0 && ( diff --git a/ui/component/viewers/videoViewer/view.jsx b/ui/component/viewers/videoViewer/view.jsx index 43727f8ea..3665aa249 100644 --- a/ui/component/viewers/videoViewer/view.jsx +++ b/ui/component/viewers/videoViewer/view.jsx @@ -20,6 +20,8 @@ import { useGetAds } from 'effects/use-get-ads'; import Button from 'component/button'; import I18nMessage from 'component/i18nMessage'; import { useHistory } from 'react-router'; +import { getAllIds } from 'util/buildHomepage'; +import type { HomepageCat } from 'util/buildHomepage'; const PLAY_TIMEOUT_ERROR = 'play_timeout_error'; const PLAY_TIMEOUT_LIMIT = 2000; @@ -48,15 +50,7 @@ type Props = { setVideoPlaybackRate: (number) => void, authenticated: boolean, userId: number, - homepageData: { - PRIMARY_CONTENT_CHANNEL_IDS?: Array, - ENLIGHTENMENT_CHANNEL_IDS?: Array, - GAMING_CHANNEL_IDS?: Array, - SCIENCE_CHANNEL_IDS?: Array, - TECHNOLOGY_CHANNEL_IDS?: Array, - COMMUNITY_CHANNEL_IDS?: Array, - FINCANCE_CHANNEL_IDS?: Array, - }, + homepageData?: { [string]: HomepageCat }, }; /* @@ -91,24 +85,8 @@ function VideoViewer(props: Props) { authenticated, userId, } = props; - const { - PRIMARY_CONTENT_CHANNEL_IDS = [], - ENLIGHTENMENT_CHANNEL_IDS = [], - GAMING_CHANNEL_IDS = [], - SCIENCE_CHANNEL_IDS = [], - TECHNOLOGY_CHANNEL_IDS = [], - COMMUNITY_CHANNEL_IDS = [], - FINCANCE_CHANNEL_IDS = [], - } = homepageData; - const adApprovedChannelIds = [ - ...PRIMARY_CONTENT_CHANNEL_IDS, - ...ENLIGHTENMENT_CHANNEL_IDS, - ...GAMING_CHANNEL_IDS, - ...SCIENCE_CHANNEL_IDS, - ...TECHNOLOGY_CHANNEL_IDS, - ...COMMUNITY_CHANNEL_IDS, - ...FINCANCE_CHANNEL_IDS, - ]; + + const adApprovedChannelIds = homepageData ? getAllIds(homepageData) : []; const claimId = claim && claim.claim_id; const channelClaimId = claim && claim.signing_channel && claim.signing_channel.claim_id; const isAudio = contentType.includes('audio'); diff --git a/ui/page/channelsFollowingDiscover/view.jsx b/ui/page/channelsFollowingDiscover/view.jsx index aa5875599..17865f54c 100644 --- a/ui/page/channelsFollowingDiscover/view.jsx +++ b/ui/page/channelsFollowingDiscover/view.jsx @@ -8,7 +8,7 @@ import ClaimTilesDiscover from 'component/claimTilesDiscover'; import ClaimListDiscover from 'component/claimListDiscover'; import * as CS from 'constants/claim_search'; import { toCapitalCase } from 'util/string'; -import { SIMPLE_SITE } from 'config'; +import { CUSTOM_HOMEPAGE } from 'config'; const MORE_CHANNELS_ANCHOR = 'MoreChannels'; @@ -28,12 +28,16 @@ type ChannelsFollowingItem = { function ChannelsFollowingDiscover(props: Props) { const { followedTags, subscribedChannels, blockedChannels, homepageData } = props; - const { PRIMARY_CONTENT_CHANNEL_IDS } = homepageData; + const { PRIMARY_CONTENT } = homepageData; + let channelIds; + if (PRIMARY_CONTENT && CUSTOM_HOMEPAGE) { + channelIds = PRIMARY_CONTENT.channelIds; + } let rowData: Array = []; const notChannels = subscribedChannels .map(({ uri }) => uri) .concat(blockedChannels) - .map(uri => uri.split('#')[1]); + .map((uri) => uri.split('#')[1]); rowData.push({ title: 'Top Channels Of All Time', @@ -84,12 +88,12 @@ function ChannelsFollowingDiscover(props: Props) { link: `/$/${PAGES.TAGS_FOLLOWING}?claim_type=channel`, options: { claimType: 'channel', - tags: followedTags.map(tag => tag.name), + tags: followedTags.map((tag) => tag.name), }, }); } - const rowDataWithGenericOptions = rowData.map(row => { + const rowDataWithGenericOptions = rowData.map((row) => { return { ...row, options: { @@ -124,12 +128,11 @@ function ChannelsFollowingDiscover(props: Props) {

{__('More Channels')}

- {/* odysee: claimIds = PRIMARY_CONTENT_CHANNEL_IDS if simplesite CLD */} diff --git a/ui/util/buildHomepage.js b/ui/util/buildHomepage.js index aa421a3e2..6f26bb4ed 100644 --- a/ui/util/buildHomepage.js +++ b/ui/util/buildHomepage.js @@ -38,6 +38,12 @@ export type HomepageCat = { mixIn?: Array, }; +// type HomepageData = { +// [string]: { +// [string]: HomepageCat, +// }, +// }; + function getLimitPerChannel(size, isChannel) { if (isChannel) { return 1; @@ -46,6 +52,17 @@ function getLimitPerChannel(size, isChannel) { } } +export function getAllIds(all: any) { + const idsSet: Set = new Set(); + (Object.values(all): any).forEach((cat) => { + if (cat.channelIds) { + cat.channelIds.forEach((id) => idsSet.add(id)); + } + }); + // $FlowFixMe + return Array.from(idsSet); +} + export const getHomepageRowForCat = (cat: HomepageCat) => { let orderValue; switch (cat.order) { @@ -106,7 +123,7 @@ export const getHomepageRowForCat = (cat: HomepageCat) => { }; export function GetLinksData( - all: any, + all: any, // HomepageData type? isHomepage?: boolean = false, authenticated?: boolean, showPersonalizedChannels?: boolean,