From 8400fc2e3e235893eca513030c72441609f4caf1 Mon Sep 17 00:00:00 2001 From: Salman Dabbakuti Date: Thu, 20 Jun 2024 18:46:58 +0530 Subject: [PATCH] updated: activities orderby timestamp desc, show first 20 activites for each stream --- client/app/page.js | 6 +++++- client/app/utils/index.js | 16 ++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/client/app/page.js b/client/app/page.js index c0502aa..ab6ca07 100644 --- a/client/app/page.js +++ b/client/app/page.js @@ -1,5 +1,5 @@ "use client"; -import { useEffect, useState, useCallback } from "react"; +import { useEffect, useState, useCallback, act } from "react"; import dayjs from "dayjs"; import relativeTime from "dayjs/plugin/relativeTime"; import { useAddress } from "@thirdweb-dev/react"; @@ -85,6 +85,10 @@ export default function Home() { first: 100, orderBy: "createdAt", orderDirection: "desc", + activites_skip: 0, + activites_first: 20, + activities_orderBy: "timestamp", + activities_orderDirection: "desc", where: { and: filters } diff --git a/client/app/utils/index.js b/client/app/utils/index.js index baa2a06..f4da118 100644 --- a/client/app/utils/index.js +++ b/client/app/utils/index.js @@ -56,7 +56,8 @@ export const supportedTokens = [ } ]; -export const ellipsisAddress = (address) => address.slice(0, 4) + "..." + address.slice(-2); +export const ellipsisAddress = (address) => + address.slice(0, 4) + "..." + address.slice(-2); export const calculateFlowRateInTokenPerMonth = (amount) => { if (isNaN(amount)) return 0; @@ -74,6 +75,11 @@ export const STREAMS_QUERY = gql` $orderBy: Stream_orderBy $orderDirection: OrderDirection $where: Stream_filter + $activities_skip: Int + $activities_first: Int + $activities_orderBy: StreamActivity_orderBy + $activities_orderDirection: OrderDirection + $activities_where: StreamActivity_filter ) { streams( skip: $skip @@ -86,7 +92,13 @@ export const STREAMS_QUERY = gql` sender receiver token - activities { + activities( + skip: $activities_skip + first: $activities_first + orderBy: $activities_orderBy + orderDirection: $activities_orderDirection + where: $activities_where + ) { id type flowRate