note infinite claim_search
This commit is contained in:
parent
8d0d207f08
commit
8a81f3d46b
1 changed files with 64 additions and 62 deletions
|
@ -29,79 +29,79 @@ type ChannelsFollowingItem = {
|
||||||
function ChannelsFollowingDiscover(props: Props) {
|
function ChannelsFollowingDiscover(props: Props) {
|
||||||
const { followedTags, subscribedChannels, blockedChannels, homepageData } = props;
|
const { followedTags, subscribedChannels, blockedChannels, homepageData } = props;
|
||||||
const { PRIMARY_CONTENT_CHANNEL_IDS } = homepageData;
|
const { PRIMARY_CONTENT_CHANNEL_IDS } = homepageData;
|
||||||
let rowData: Array<ChannelsFollowingItem> = [];
|
// let rowData: Array<ChannelsFollowingItem> = [];
|
||||||
const notChannels = subscribedChannels
|
const notChannels = subscribedChannels
|
||||||
.map(({ uri }) => uri)
|
.map(({ uri }) => uri)
|
||||||
.concat(blockedChannels)
|
.concat(blockedChannels)
|
||||||
.map(uri => uri.split('#')[1]);
|
.map(uri => uri.split('#')[1]);
|
||||||
|
|
||||||
rowData.push({
|
const getRowData = () => {
|
||||||
title: 'Top Channels Of All Time',
|
const rData = [];
|
||||||
link: `/$/${PAGES.DISCOVER}?claim_type=channel&${CS.ORDER_BY_KEY}=${CS.ORDER_BY_TOP}&${CS.FRESH_KEY}=${CS.FRESH_ALL}`,
|
rData.push({
|
||||||
options: {
|
title: 'Top Channels Of All Time',
|
||||||
pageSize: 12,
|
link: `/$/${PAGES.DISCOVER}?claim_type=channel&${CS.ORDER_BY_KEY}=${CS.ORDER_BY_TOP}&${CS.FRESH_KEY}=${CS.FRESH_ALL}`,
|
||||||
claimType: 'channel',
|
|
||||||
orderBy: ['effective_amount'],
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
rowData.push({
|
|
||||||
title: 'Latest From @lbrycast',
|
|
||||||
link: `/@lbrycast:4`,
|
|
||||||
options: {
|
|
||||||
orderBy: ['release_time'],
|
|
||||||
pageSize: 8,
|
|
||||||
channelIds: ['4c29f8b013adea4d5cca1861fb2161d5089613ea'],
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
rowData.push({
|
|
||||||
title: 'Trending Channels',
|
|
||||||
link: `/$/${PAGES.DISCOVER}?claim_type=channel`,
|
|
||||||
options: {
|
|
||||||
pageSize: 8,
|
|
||||||
claimType: 'channel',
|
|
||||||
orderBy: ['trending_group', 'trending_mixed'],
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
if (followedTags.length > 0 && followedTags.length < 5) {
|
|
||||||
const followedRows = followedTags.map((tag: Tag) => ({
|
|
||||||
title: `Trending Channels for #${toCapitalCase(tag.name)}`,
|
|
||||||
link: `/$/${PAGES.DISCOVER}?t=${tag.name}&claim_type=channel`,
|
|
||||||
options: {
|
options: {
|
||||||
|
pageSize: 12,
|
||||||
claimType: 'channel',
|
claimType: 'channel',
|
||||||
pageSize: 4,
|
orderBy: ['effective_amount'],
|
||||||
tags: [tag.name],
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
rowData.push(...followedRows);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (followedTags.length > 4) {
|
|
||||||
rowData.push({
|
|
||||||
title: 'Trending For Your Tags',
|
|
||||||
link: `/$/${PAGES.TAGS_FOLLOWING}?claim_type=channel`,
|
|
||||||
options: {
|
|
||||||
claimType: 'channel',
|
|
||||||
tags: followedTags.map(tag => tag.name),
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const rowDataWithGenericOptions = rowData.map(row => {
|
|
||||||
return {
|
|
||||||
...row,
|
|
||||||
options: {
|
|
||||||
...row.options,
|
|
||||||
notChannels,
|
notChannels,
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
});
|
|
||||||
|
rData.push({
|
||||||
|
title: 'Latest From @lbrycast',
|
||||||
|
link: `/@lbrycast:4`,
|
||||||
|
options: {
|
||||||
|
orderBy: ['release_time'],
|
||||||
|
pageSize: 8,
|
||||||
|
channelIds: ['4c29f8b013adea4d5cca1861fb2161d5089613ea'],
|
||||||
|
notChannels,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
rData.push({
|
||||||
|
title: 'Trending Channels',
|
||||||
|
link: `/$/${PAGES.DISCOVER}?claim_type=channel`,
|
||||||
|
options: {
|
||||||
|
pageSize: 8,
|
||||||
|
claimType: 'channel',
|
||||||
|
orderBy: ['trending_group', 'trending_mixed'],
|
||||||
|
notChannels,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (followedTags.length > 0 && followedTags.length < 5) {
|
||||||
|
const followedRows = followedTags.map((tag: Tag) => ({
|
||||||
|
title: `Trending Channels for #${toCapitalCase(tag.name)}`,
|
||||||
|
link: `/$/${PAGES.DISCOVER}?t=${tag.name}&claim_type=channel`,
|
||||||
|
options: {
|
||||||
|
claimType: 'channel',
|
||||||
|
pageSize: 4,
|
||||||
|
tags: [tag.name],
|
||||||
|
notChannels,
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
rData.push(...followedRows);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (followedTags.length > 4) {
|
||||||
|
rData.push({
|
||||||
|
title: 'Trending For Your Tags',
|
||||||
|
link: `/$/${PAGES.TAGS_FOLLOWING}?claim_type=channel`,
|
||||||
|
options: {
|
||||||
|
claimType: 'channel',
|
||||||
|
tags: followedTags.map(tag => tag.name),
|
||||||
|
notChannels,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return rData;
|
||||||
|
};
|
||||||
|
const [rowData] = React.useState(getRowData() || []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Page>
|
<Page>
|
||||||
{rowDataWithGenericOptions.map(({ title, link, help, options = {} }) => (
|
{rowData.map(({ title, link, help, options = {} }) => (
|
||||||
<div key={title} className="claim-grid__wrapper">
|
<div key={title} className="claim-grid__wrapper">
|
||||||
<h1 className="section__actions">
|
<h1 className="section__actions">
|
||||||
{link ? (
|
{link ? (
|
||||||
|
@ -117,7 +117,7 @@ function ChannelsFollowingDiscover(props: Props) {
|
||||||
)}
|
)}
|
||||||
{help}
|
{help}
|
||||||
</h1>
|
</h1>
|
||||||
|
{ /* This does infinite claim_search if apis are down */ }
|
||||||
<ClaimTilesDiscover {...options} />
|
<ClaimTilesDiscover {...options} />
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
@ -125,6 +125,7 @@ function ChannelsFollowingDiscover(props: Props) {
|
||||||
{__('More Channels')}
|
{__('More Channels')}
|
||||||
</h1>
|
</h1>
|
||||||
{/* odysee: claimIds = PRIMARY_CONTENT_CHANNEL_IDS if simplesite CLD */}
|
{/* odysee: claimIds = PRIMARY_CONTENT_CHANNEL_IDS if simplesite CLD */}
|
||||||
|
|
||||||
<ClaimListDiscover
|
<ClaimListDiscover
|
||||||
defaultOrderBy={CS.ORDER_BY_TRENDING}
|
defaultOrderBy={CS.ORDER_BY_TRENDING}
|
||||||
defaultFreshness={CS.FRESH_ALL}
|
defaultFreshness={CS.FRESH_ALL}
|
||||||
|
@ -132,6 +133,7 @@ function ChannelsFollowingDiscover(props: Props) {
|
||||||
claimIds={SIMPLE_SITE ? PRIMARY_CONTENT_CHANNEL_IDS : undefined}
|
claimIds={SIMPLE_SITE ? PRIMARY_CONTENT_CHANNEL_IDS : undefined}
|
||||||
scrollAnchor={MORE_CHANNELS_ANCHOR}
|
scrollAnchor={MORE_CHANNELS_ANCHOR}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</Page>
|
</Page>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue