From b606d2ba1518c370952715686445285b5b7211cb Mon Sep 17 00:00:00 2001 From: nick Date: Mon, 18 Nov 2024 16:32:04 -0500 Subject: [PATCH] fix trending list --- uplink-client/src/app/explore/page.tsx | 5 +++-- uplink-hub/packages/v2/src/controllers/channel.ts | 8 ++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/uplink-client/src/app/explore/page.tsx b/uplink-client/src/app/explore/page.tsx index 1d2ca6da..1a993237 100644 --- a/uplink-client/src/app/explore/page.tsx +++ b/uplink-client/src/app/explore/page.tsx @@ -8,7 +8,7 @@ import { ColorCards } from "@/ui/DesignKit/ColorCards"; import { Card, CardContent, CardFooter } from "@/ui/DesignKit/Card"; import { CardHeader, CardTitle } from "@/ui/DesignKit/Card"; import { fetchTrendingChannels, fetchActiveContests } from "@/lib/fetch/fetchChannel"; -import { Channel, concatContractID } from "@/types/channel"; +import { Channel, concatContractID, isInfiniteChannel } from "@/types/channel"; import { parseIpfsUrl } from "@/lib/ipfs"; import { Space } from "@/types/space"; import { fetchFeaturedTokens } from "@/lib/fetch/fetchTokensV2"; @@ -38,7 +38,8 @@ export const metadata: Metadata = { }; const TrendingChannels = async () => { - let trendingChannels = await fetchTrendingChannels(8453) + let trendingChannels = await fetchTrendingChannels(8453).then(data => data.filter(isInfiniteChannel)) + console.log(trendingChannels) if (trendingChannels.length > 0) return ( diff --git a/uplink-hub/packages/v2/src/controllers/channel.ts b/uplink-hub/packages/v2/src/controllers/channel.ts index 30f36063..5e33d475 100644 --- a/uplink-hub/packages/v2/src/controllers/channel.ts +++ b/uplink-hub/packages/v2/src/controllers/channel.ts @@ -9,7 +9,7 @@ import { parseV2Metadata, splitContractID } from "../utils/utils.js"; import { Request, Response, NextFunction } from 'express' import { ContexedRequest } from "../types.js"; import { gql } from '@urql/core' -import { formatGqlTokens, TOKEN_FRAGMENT } from "@tx-kit/sdk/subgraph"; +import { CHANNEL_FRAGMENT, formatGqlTokens, TOKEN_FRAGMENT } from "@tx-kit/sdk/subgraph"; const authorizationController = new AuthorizationController(process.env.REDIS_URL!); @@ -141,12 +141,16 @@ export const getTrendingChannels = async (req: Request, res: Response, next: Nex where: {tokens_: {blockTimestamp_gt: $timestamp}, id_not_in: ["0xa4bc695f857239a0f26c289fee4c936689a0ddad", "0x00c58936afb2b89d6dd8b918c5a44aa1b0a4fdf8"]} limit: 10 ) { - id + ...ChannelFragment + transportLayer { + type + } tokens(first: 10) { ...TokenFragment } } ${TOKEN_FRAGMENT} + ${CHANNEL_FRAGMENT} }`, { timestamp: Math.floor(Date.now() / 1000) - 60 * 60 * 24 * 7 }) // 1 week