tag homepage campaign support

This commit is contained in:
Jeremy Kauffman 2020-04-17 12:21:00 -04:00 committed by Jeremy Kauffman
parent eb64079b9e
commit 3d6270b133
2 changed files with 22 additions and 40 deletions

View file

@ -4,6 +4,7 @@ import { createNormalizedClaimSearchKey, MATURE_TAGS } from 'lbry-redux';
import ClaimPreviewTile from 'component/claimPreviewTile';
type Props = {
prefixUris?: Array<string>,
uris: Array<string>,
doClaimSearch: ({}) => void,
showNsfw: boolean,
@ -39,6 +40,7 @@ function ClaimTilesDiscover(props: Props) {
pageSize = 8,
releaseTime,
claimType,
prefixUris,
timestamp,
} = props;
const [hasSearched, setHasSearched] = React.useState(false);
@ -92,7 +94,7 @@ function ClaimTilesDiscover(props: Props) {
}
const claimSearchCacheQuery = createNormalizedClaimSearchKey(options);
const uris = claimSearchByQuery[claimSearchCacheQuery] || [];
const uris = (prefixUris || []).concat(claimSearchByQuery[claimSearchCacheQuery] || []);
const shouldPerformSearch = !hasSearched || uris.length === 0;
// Don't use the query from createNormalizedClaimSearchKey for the effect since that doesn't include page & release_time
const optionsStringForEffect = JSON.stringify(options);

View file

@ -7,7 +7,6 @@ import moment from 'moment';
import Page from 'component/page';
import Button from 'component/button';
import ClaimTilesDiscover from 'component/claimTilesDiscover';
import Icon from 'component/common/icon';
import I18nMessage from 'component/i18nMessage';
import { parseURI } from 'lbry-redux';
import { toCapitalCase } from 'util/string';
@ -118,6 +117,17 @@ function HomePage(props: Props) {
},
});
rowData.push({
title: '#covidcuts',
link: `/$/${PAGES.DISCOVER}?t=covidcuts&${CS.ORDER_BY_KEY}=${CS.ORDER_BY_NEW}`,
options: {
tags: ['covidcuts'],
orderBy: ['release_time'],
pageSize: 3,
prefixUris: ['lbry://@lbry#3f/covidcuts'],
},
});
if (!showPersonalizedChannels) {
rowData.push({
title: 'Top Channels On LBRY',
@ -129,50 +139,20 @@ function HomePage(props: Props) {
});
}
rowData.push(
{
title: 'Trending Classics',
link: `/$/${PAGES.DISCOVER}?${CS.ORDER_BY_KEY}=${CS.ORDER_BY_TRENDING}&${CS.FRESH_KEY}=${CS.FRESH_WEEK}`,
options: {
pageSize: 4,
claimType: ['stream'],
releaseTime: `<${Math.floor(
moment()
.subtract(6, 'month')
.startOf('day')
.unix()
)}`,
},
}
/* the cagematch will return in some form! - Jeremy
{
title: '#HomePageCageMatch',
link: `/$/${PAGES.DISCOVER}?t=homepagecagematch&${CS.ORDER_BY_KEY}=${CS.ORDER_BY_TOP}&${CS.FRESH_KEY}=${
CS.FRESH_ALL
}`,
help: (
<div className="claim-grid__help">
<Icon
icon={ICONS.HELP}
tooltip
customTooltipText={__(
'This is an experiment, and may be removed in the future. Publish something with the #homepagecagematch tag to battle for the top spot on the home page!'
)}
/>
</div>
),
rowData.push({
title: 'Trending Classics',
link: `/$/${PAGES.DISCOVER}?${CS.ORDER_BY_KEY}=${CS.ORDER_BY_TRENDING}&${CS.FRESH_KEY}=${CS.FRESH_WEEK}`,
options: {
tags: ['homepagecagematch'],
orderBy: ['effective_amount'],
timestamp: `>${Math.floor(
pageSize: 4,
claimType: ['stream'],
releaseTime: `<${Math.floor(
moment()
.subtract(1, 'week')
.subtract(6, 'month')
.startOf('day')
.unix()
)}`,
},
} */
);
});
rowData.push({
title: 'Latest From @lbrycast',