diff --git a/flow-typed/homepage.js b/flow-typed/homepage.js index 0ea62495e..bf00bed7c 100644 --- a/flow-typed/homepage.js +++ b/flow-typed/homepage.js @@ -17,6 +17,7 @@ declare type RowDataItem = { help?: any, icon?: string, extra?: any, + pinUrls?: Array, options?: { channelIds?: Array, limitClaimsPerChannel?: number, diff --git a/ui/component/channelContent/view.jsx b/ui/component/channelContent/view.jsx index 4425e0e24..ac1d1f233 100644 --- a/ui/component/channelContent/view.jsx +++ b/ui/component/channelContent/view.jsx @@ -1,5 +1,5 @@ // @flow -import { SHOW_ADS, ENABLE_NO_SOURCE_CLAIMS } from 'config'; +import { SHOW_ADS, ENABLE_NO_SOURCE_CLAIMS, SIMPLE_SITE } from 'config'; import * as CS from 'constants/claim_search'; import * as ICONS from 'constants/icons'; import React, { Fragment } from 'react'; @@ -144,7 +144,8 @@ function ChannelContent(props: Props) { hideAdvancedFilter={!showFilters} tileLayout={tileLayout} uris={searchResults} - channelIds={[claim.claim_id]} + streamType={SIMPLE_SITE ? CS.CONTENT_ALL : undefined} + channelIds={[claimId]} claimType={claimType} feeAmount={CS.FEE_AMOUNT_ANY} defaultOrderBy={CS.ORDER_BY_NEW} diff --git a/ui/component/claimListDiscover/view.jsx b/ui/component/claimListDiscover/view.jsx index 0491ce967..ec546cec6 100644 --- a/ui/component/claimListDiscover/view.jsx +++ b/ui/component/claimListDiscover/view.jsx @@ -1,5 +1,5 @@ // @flow -import { ENABLE_NO_SOURCE_CLAIMS } from 'config'; +import { ENABLE_NO_SOURCE_CLAIMS, SIMPLE_SITE } from 'config'; import type { Node } from 'react'; import * as CS from 'constants/claim_search'; import React from 'react'; @@ -72,6 +72,8 @@ type Props = { liveLivestreamsFirst?: boolean, livestreamMap?: { [string]: any }, hasSource?: boolean, + limitClaimsPerChannel?: number, + releaseTime?: string, showNoSourceClaims?: boolean, isChannel?: boolean, empty?: string, @@ -104,8 +106,8 @@ function ClaimListDiscover(props: Props) { claimType, pageSize, defaultClaimType, - streamType, - defaultStreamType, + streamType = SIMPLE_SITE ? CS.FILE_VIDEO : undefined, + defaultStreamType = SIMPLE_SITE ? CS.FILE_VIDEO : undefined, // add param for DEFAULT_STREAM_TYPE freshness, defaultFreshness = CS.FRESH_WEEK, renderProperties, @@ -124,6 +126,8 @@ function ClaimListDiscover(props: Props) { forceShowReposts = false, languageSetting, searchInLanguage, + limitClaimsPerChannel, + releaseTime, scrollAnchor, showHiddenByUser = false, liveLivestreamsFirst, @@ -172,12 +176,12 @@ function ClaimListDiscover(props: Props) { const durationParam = urlParams.get(CS.DURATION_KEY) || null; const channelIdsInUrl = urlParams.get(CS.CHANNEL_IDS_KEY); const channelIdsParam = channelIdsInUrl ? channelIdsInUrl.split(',') : channelIds; - const feeAmountParam = urlParams.get('fee_amount') || feeAmount; + const feeAmountParam = urlParams.get('fee_amount') || feeAmount || SIMPLE_SITE ? CS.FEE_AMOUNT_ONLY_FREE : undefined; const originalPageSize = pageSize || CS.PAGE_SIZE; const dynamicPageSize = isLargeScreen ? Math.ceil(originalPageSize * (3 / 2)) : originalPageSize; const historyAction = history.action; - let orderParam = orderBy || urlParams.get(CS.ORDER_BY_KEY) || defaultOrderBy; + let orderParam = orderBy || urlParams.get(CS.ORDER_BY_KEY) || defaultOrderBy || orderParamEntry; if (!orderParam) { if (historyAction === 'POP') { @@ -221,6 +225,7 @@ function ClaimListDiscover(props: Props) { fee_amount?: string, has_source?: boolean, has_no_source?: boolean, + limit_claims_per_channel?: number, } = { page_size: dynamicPageSize, page, @@ -243,6 +248,10 @@ function ClaimListDiscover(props: Props) { options.has_source = true; } + if (limitClaimsPerChannel) { + options.limit_claims_per_channel = limitClaimsPerChannel; + } + if (feeAmountParam && claimType !== CS.CLAIM_CHANNEL) { options.fee_amount = feeAmountParam; } @@ -271,8 +280,10 @@ function ClaimListDiscover(props: Props) { // SDK chokes on reposted_claim_id of null or false, needs to not be present if no value options.reposted_claim_id = repostedClaimId; } - - if (claimType !== CS.CLAIM_CHANNEL) { + // IF release time, set it, else set fallback release times using the hack below. + if (releaseTime) { + options.release_time = releaseTime; + } else if (claimType !== CS.CLAIM_CHANNEL) { if (orderParam === CS.ORDER_BY_TOP && freshnessParam !== CS.FRESH_ALL) { options.release_time = `>${Math.floor(moment().subtract(1, freshnessParam).startOf('hour').unix())}`; } else if (orderParam === CS.ORDER_BY_NEW || orderParam === CS.ORDER_BY_TRENDING) { @@ -476,7 +487,7 @@ function ClaimListDiscover(props: Props) { claimType={claimType} streamType={streamType} defaultStreamType={defaultStreamType} - feeAmount={feeAmount} + feeAmount={SIMPLE_SITE ? undefined : feeAmount} // ENABLE_PAID_CONTENT_DISCOVER or something orderBy={orderBy} defaultOrderBy={defaultOrderBy} hideAdvancedFilter={hideAdvancedFilter} diff --git a/ui/component/claimMenuList/view.jsx b/ui/component/claimMenuList/view.jsx index 9d08f1e71..bc38196f1 100644 --- a/ui/component/claimMenuList/view.jsx +++ b/ui/component/claimMenuList/view.jsx @@ -109,7 +109,7 @@ function ClaimMenuList(props: Props) { const lbryUrl: string = generateLbryContentUrl(claim.canonical_url, claim.permanent_url); const shareUrl: string = generateShareUrl(SHARE_DOMAIN, lbryUrl); - const rssUrl: string = isChannel ? generateRssUrl(URL, claim) : ''; + const rssUrl: string = isChannel ? generateRssUrl(SHARE_DOMAIN, claim) : ''; const isCollectionClaim = claim && claim.value_type === 'collection'; // $FlowFixMe const isPlayable = diff --git a/ui/component/claimPreviewTile/view.jsx b/ui/component/claimPreviewTile/view.jsx index 62e95d155..67a7e5d00 100644 --- a/ui/component/claimPreviewTile/view.jsx +++ b/ui/component/claimPreviewTile/view.jsx @@ -233,7 +233,6 @@ function ClaimPreviewTile(props: Props) { )} - {/* CHECK CLAIM MENU LIST PARAMS (IS REPOST?) */} diff --git a/ui/component/claimTilesDiscover/view.jsx b/ui/component/claimTilesDiscover/view.jsx index f580c2028..128cdc664 100644 --- a/ui/component/claimTilesDiscover/view.jsx +++ b/ui/component/claimTilesDiscover/view.jsx @@ -115,6 +115,7 @@ type Props = { liveLivestreamsFirst?: boolean, livestreamMap?: { [string]: any }, pin?: boolean, + pinUrls?: Array, showNoSourceClaims?: boolean, }; @@ -146,7 +147,8 @@ function ClaimTilesDiscover(props: Props) { mutedUris, liveLivestreamsFirst, livestreamMap, - // pin, // let's pin from /web folder + pin, // let's pin from /web folder + pinUrls, prefixUris, showNoSourceClaims, } = props; @@ -288,10 +290,24 @@ function ClaimTilesDiscover(props: Props) { return undefined; }; + const modifiedUris = uris ? uris.slice() : []; + const fixUris = pinUrls || ['lbry://@AlisonMorrow#6/LBRY#8']; + + if (pin && modifiedUris && modifiedUris.length > 2 && window.location.pathname === '/') { + fixUris.forEach((fixUri) => { + if (modifiedUris.indexOf(fixUri) !== -1) { + modifiedUris.splice(modifiedUris.indexOf(fixUri), 1); + } else { + modifiedUris.pop(); + } + }); + modifiedUris.splice(2, 0, ...fixUris); + } + return (
    - {uris && uris.length - ? uris.map((uri, index) => ( + {modifiedUris && modifiedUris.length + ? modifiedUris.map((uri, index) => ( )) : new Array(pageSize) diff --git a/ui/page/home/view.jsx b/ui/page/home/view.jsx index 580d60b49..b6e7e1356 100644 --- a/ui/page/home/view.jsx +++ b/ui/page/home/view.jsx @@ -45,7 +45,7 @@ function HomePage(props: Props) { showNsfw ); - function getRowElements(title, route, link, icon, help, options, index) { + function getRowElements(title, route, link, icon, help, options, index, pinUrls) { const tilePlaceholder = (
      {new Array(options.pageSize || 8).fill(1).map((x, i) => ( @@ -60,6 +60,7 @@ function HomePage(props: Props) { livestreamMap={livestreamMap} showNoSourceClaims={ENABLE_NO_SOURCE_CLAIMS} hasSource + pinUrls={pinUrls} pin={route === `/$/${PAGES.GENERAL}`} // use pinUrls here /> ); @@ -140,9 +141,9 @@ function HomePage(props: Props) {

      )} - {rowData.map(({ title, route, link, icon, help, options = {} }, index) => { + {rowData.map(({ title, route, link, icon, help, pinUrls, options = {} }, index) => { // add pins here - return getRowElements(title, route, link, icon, help, options, index); + return getRowElements(title, route, link, icon, help, options, index, pinUrls); })} {/* @if TARGET='web' */}