diff --git a/packages/data-layer/src/data.types.ts b/packages/data-layer/src/data.types.ts index 2d05d302f2..bf28555e83 100644 --- a/packages/data-layer/src/data.types.ts +++ b/packages/data-layer/src/data.types.ts @@ -501,6 +501,7 @@ export type TimeFilter = { lessThan?: string; greaterThanOrEqualTo?: string; lessThanOrEqualTo?: string; + isNull?: boolean; }; export type TimeFilterVariables = { @@ -508,6 +509,7 @@ export type TimeFilterVariables = { applicationsEndTime?: TimeFilter; donationsStartTime?: TimeFilter; donationsEndTime?: TimeFilter; + or?: TimeFilterVariables[]; }; export type RoundsQueryVariables = { diff --git a/packages/grant-explorer/src/features/api/rounds.ts b/packages/grant-explorer/src/features/api/rounds.ts index 14ded46943..4dbc249367 100644 --- a/packages/grant-explorer/src/features/api/rounds.ts +++ b/packages/grant-explorer/src/features/api/rounds.ts @@ -18,7 +18,7 @@ export const useRounds = ( fetchSpamRounds(), dataLayer.getRounds({ ...variables, - first: 100, + first: 500, chainIds, }), ]); diff --git a/packages/grant-explorer/src/features/discovery/ExploreRoundsPage.tsx b/packages/grant-explorer/src/features/discovery/ExploreRoundsPage.tsx index 0880fb588f..135efc70b2 100644 --- a/packages/grant-explorer/src/features/discovery/ExploreRoundsPage.tsx +++ b/packages/grant-explorer/src/features/discovery/ExploreRoundsPage.tsx @@ -10,6 +10,7 @@ import { RoundsFilter } from "./RoundsFilter"; import { getExplorerPageTitle } from "./utils/getExplorerPageTitle"; import { RoundsGrid } from "./RoundsGrid"; import { getEnabledChains } from "../../app/chainConfig"; +import { useMemo } from "react"; const ExploreRoundsPage = () => { const [params] = useSearchParams(); @@ -18,6 +19,9 @@ const ExploreRoundsPage = () => { // Pass the filter from the search params and build the graphql query const rounds = useFilterRounds(filter, getEnabledChains()); + const publicRounds = useMemo(() => rounds.data?.filter(round => round.roundMetadata.roundType?.toLowerCase() !== "private"), [rounds]); + rounds.data = publicRounds; + const sectionTitle = getExplorerPageTitle(filter); return ( @@ -25,7 +29,7 @@ const ExploreRoundsPage = () => { } > diff --git a/packages/grant-explorer/src/features/discovery/utils/__tests__/createRoundsStatusFilter.test.tsx b/packages/grant-explorer/src/features/discovery/utils/__tests__/createRoundsStatusFilter.test.tsx index 61f8fe222e..be72ee70c0 100644 --- a/packages/grant-explorer/src/features/discovery/utils/__tests__/createRoundsStatusFilter.test.tsx +++ b/packages/grant-explorer/src/features/discovery/utils/__tests__/createRoundsStatusFilter.test.tsx @@ -5,8 +5,9 @@ describe("createRoundsStatusFilter", () => { const filter = createRoundsStatusFilter("active"); expect(filter[0].donationsStartTime?.lessThan).toBeDefined(); - expect(filter[0].donationsEndTime?.greaterThan).toBeDefined(); - expect(filter[0].donationsEndTime?.lessThan).toBeDefined(); + expect(filter[0]?.or!.length).toBe(2); + expect(filter[0]!.or![0]!.donationsEndTime?.greaterThan).toBeDefined(); // Added null check + expect(filter[0]!.or![1]!.donationsEndTime?.isNull).toBeDefined(); }); it("multi selected filters", async () => { const filter = createRoundsStatusFilter( diff --git a/packages/grant-explorer/src/features/discovery/utils/createRoundsStatusFilter.ts b/packages/grant-explorer/src/features/discovery/utils/createRoundsStatusFilter.ts index f12dd358bb..fe8b574f90 100644 --- a/packages/grant-explorer/src/features/discovery/utils/createRoundsStatusFilter.ts +++ b/packages/grant-explorer/src/features/discovery/utils/createRoundsStatusFilter.ts @@ -7,21 +7,19 @@ export const createISOTimestamp = (timestamp = 0) => { }; const ONE_DAY_IN_MILISECONDS = 3600 * 24 * 1000; -const ONE_YEAR_IN_MILISECONDS = ONE_DAY_IN_MILISECONDS * 365 * 1000; function getStatusFilter(status: string): TimeFilterVariables { const currentTimestamp = createISOTimestamp(); - const futureTimestamp = createISOTimestamp(ONE_YEAR_IN_MILISECONDS); switch (status) { case RoundStatus.active: return { // Round must have started and not ended yet donationsStartTime: { lessThan: currentTimestamp }, - donationsEndTime: { - greaterThan: currentTimestamp, - lessThan: futureTimestamp, - }, + or: [ + { donationsEndTime: { greaterThan: currentTimestamp} }, + { donationsEndTime: { isNull: true } }, + ] }; case RoundStatus.taking_applications: return {