Skip to content

fix: explorer not showing DG #3432

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/data-layer/src/data.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -501,13 +501,15 @@ export type TimeFilter = {
lessThan?: string;
greaterThanOrEqualTo?: string;
lessThanOrEqualTo?: string;
isNull?: boolean;
};

export type TimeFilterVariables = {
applicationsStartTime?: TimeFilter;
applicationsEndTime?: TimeFilter;
donationsStartTime?: TimeFilter;
donationsEndTime?: TimeFilter;
or?: TimeFilterVariables[];
};

export type RoundsQueryVariables = {
Expand Down
2 changes: 1 addition & 1 deletion packages/grant-explorer/src/features/api/rounds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const useRounds = (
fetchSpamRounds(),
dataLayer.getRounds({
...variables,
first: 100,
first: 500,
chainIds,
}),
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -18,14 +19,17 @@ 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 (
<GradientLayout showWalletInteraction>
<LandingHero />

<LandingSection
title={`${sectionTitle} (${rounds.data?.length ?? 0})`}
title={`${sectionTitle} (${rounds?.data?.length ?? 0})`}
className="flex-wrap"
action={<RoundsFilter />}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading