add claim_type support to tags page

This commit is contained in:
Sean Yesmunt 2020-02-21 11:33:14 -05:00
parent 2bb2648afd
commit dc38c8f809
3 changed files with 11 additions and 2 deletions

View file

@ -50,6 +50,7 @@ type Props = {
header?: Node, header?: Node,
headerLabel?: string | Node, headerLabel?: string | Node,
name?: string, name?: string,
claimType?: string | Array<string>,
renderProperties?: Claim => Node, renderProperties?: Claim => Node,
includeSupportAction?: boolean, includeSupportAction?: boolean,
}; };
@ -74,6 +75,7 @@ function ClaimListDiscover(props: Props) {
headerLabel, headerLabel,
header, header,
name, name,
claimType,
renderProperties, renderProperties,
includeSupportAction, includeSupportAction,
} = props; } = props;
@ -96,6 +98,7 @@ function ClaimListDiscover(props: Props) {
order_by: Array<string>, order_by: Array<string>,
release_time?: string, release_time?: string,
name?: string, name?: string,
claim_type?: string | Array<string>,
} = { } = {
page_size: PAGE_SIZE, page_size: PAGE_SIZE,
page, page,
@ -155,6 +158,10 @@ function ClaimListDiscover(props: Props) {
} }
} }
if (claimType) {
options.claim_type = claimType;
}
const hasMatureTags = tags && tags.some(t => MATURE_TAGS.includes(t)); const hasMatureTags = tags && tags.some(t => MATURE_TAGS.includes(t));
const claimSearchCacheQuery = createNormalizedClaimSearchKey(options); const claimSearchCacheQuery = createNormalizedClaimSearchKey(options);
const uris = claimSearchByQuery[claimSearchCacheQuery] || []; const uris = claimSearchByQuery[claimSearchCacheQuery] || [];

View file

@ -59,7 +59,7 @@ function ChannelsFollowingDiscover(props: Props) {
if (followedTags.length > 0 && followedTags.length < 5) { if (followedTags.length > 0 && followedTags.length < 5) {
const followedRows = followedTags.map((tag: Tag) => ({ const followedRows = followedTags.map((tag: Tag) => ({
title: `Trending Channels for #${toCapitalCase(tag.name)}`, title: `Trending Channels for #${toCapitalCase(tag.name)}`,
link: `/$/${PAGES.TAGS}?t=${tag.name}`, link: `/$/${PAGES.TAGS}?t=${tag.name}&claim_type=channel`,
options: { options: {
claimType: 'channel', claimType: 'channel',
pageSize: 4, pageSize: 4,
@ -72,7 +72,7 @@ function ChannelsFollowingDiscover(props: Props) {
if (followedTags.length > 4) { if (followedTags.length > 4) {
rowData.push({ rowData.push({
title: 'Trending For Your Tags', title: 'Trending For Your Tags',
link: `/$/${PAGES.TAGS_FOLLOWING}`, link: `/$/${PAGES.TAGS_FOLLOWING}?claim_type=channel`,
options: { options: {
claimType: 'channel', claimType: 'channel',
tags: followedTags.map(tag => tag.name), tags: followedTags.map(tag => tag.name),

View file

@ -25,6 +25,7 @@ function TagsPage(props: Props) {
const isHovering = useHover(buttonRef); const isHovering = useHover(buttonRef);
const urlParams = new URLSearchParams(search); const urlParams = new URLSearchParams(search);
const claimType = urlParams.get('claim_type');
const tagsQuery = urlParams.get('t') || ''; const tagsQuery = urlParams.get('t') || '';
const tags = tagsQuery.split(','); const tags = tagsQuery.split(',');
// Eventually allow more than one tag on this page // Eventually allow more than one tag on this page
@ -47,6 +48,7 @@ function TagsPage(props: Props) {
return ( return (
<Page> <Page>
<ClaimListDiscover <ClaimListDiscover
claimType={claimType}
headerLabel={ headerLabel={
<span> <span>
<Icon icon={ICONS.TAG} size={10} /> <Icon icon={ICONS.TAG} size={10} />