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,
headerLabel?: string | Node,
name?: string,
claimType?: string | Array<string>,
renderProperties?: Claim => Node,
includeSupportAction?: boolean,
};
@ -74,6 +75,7 @@ function ClaimListDiscover(props: Props) {
headerLabel,
header,
name,
claimType,
renderProperties,
includeSupportAction,
} = props;
@ -96,6 +98,7 @@ function ClaimListDiscover(props: Props) {
order_by: Array<string>,
release_time?: string,
name?: string,
claim_type?: string | Array<string>,
} = {
page_size: PAGE_SIZE,
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 claimSearchCacheQuery = createNormalizedClaimSearchKey(options);
const uris = claimSearchByQuery[claimSearchCacheQuery] || [];

View file

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

View file

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