Skip to content

Commit

Permalink
updated: activities orderby timestamp desc, show first 20 activites f…
Browse files Browse the repository at this point in the history
…or each stream
  • Loading branch information
Salmandabbakuti committed Jun 20, 2024
1 parent 4e5fc4e commit 8400fc2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
6 changes: 5 additions & 1 deletion client/app/page.js
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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
}
Expand Down
16 changes: 14 additions & 2 deletions client/app/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 8400fc2

Please sign in to comment.