diff --git a/packages/data-layer/src/data-layer.ts b/packages/data-layer/src/data-layer.ts index 640980500e..21615b3ef3 100644 --- a/packages/data-layer/src/data-layer.ts +++ b/packages/data-layer/src/data-layer.ts @@ -464,7 +464,10 @@ export class DataLayer { return null; } - return response.applications[0]; + const application = response.applications[0]; + application.project.metadata = application.metadata.application.project; + + return application; } async getApplicationsForExplorer({ @@ -485,7 +488,12 @@ export class DataLayer { requestVariables, ); - return response.applications ?? []; + return ( + response.applications.map((application) => { + application.project.metadata = application.metadata.application.project; + return application; + }) ?? [] + ); } /** @@ -795,19 +803,25 @@ export class DataLayer { }, ); - return response.donations.filter((donation) => { - if (donation.round.strategyName !== "allov2.DirectAllocationStrategy") { - return ( - donation.application !== null && - donation.application?.project !== null - ); - } else { - return ( - // DirectAllocationStrategy donations are not linked to applications - donation.application === null - ); - } - }); + return response.donations + .filter((donation) => { + if (donation.round.strategyName !== "allov2.DirectAllocationStrategy") { + return ( + donation.application !== null && + donation.application?.project !== null + ); + } else { + return ( + // DirectAllocationStrategy donations are not linked to applications + donation.application === null + ); + } + }) + .map((donation) => { + donation.application.project.metadata = + donation.application.metadata.application.project; + return donation; + }); } async getPayoutsByChainIdRoundIdProjectId(args: { diff --git a/packages/data-layer/src/data.types.ts b/packages/data-layer/src/data.types.ts index 32c27cefed..7876eacf28 100644 --- a/packages/data-layer/src/data.types.ts +++ b/packages/data-layer/src/data.types.ts @@ -790,6 +790,11 @@ export type Contribution = { strategyName: RoundPayoutType; }; application: { + metadata: { + application: { + project: ProjectMetadata & { id: string }; + }; + }; project: { name: string; metadata?: ProjectMetadata; diff --git a/packages/data-layer/src/queries.ts b/packages/data-layer/src/queries.ts index abce6e7162..d14bb20cea 100644 --- a/packages/data-layer/src/queries.ts +++ b/packages/data-layer/src/queries.ts @@ -332,7 +332,6 @@ export const getApprovedApplication = gql` project { tags id - metadata anchorAddress } } @@ -371,7 +370,6 @@ export const getApplicationsForExplorer = gql` project { tags id - metadata anchorAddress } } @@ -689,7 +687,7 @@ export const getRoundForManager = gql` query getRoundForManager($roundId: String!, $chainId: Int!) { rounds( limit: 1 - where: { + where: { id: { _eq: $roundId }, chainId: { _eq: $chainId }, roundMetadata: { _isNull: false } @@ -723,7 +721,7 @@ export const getRoundsForManagerByAddress = gql` limit: 100 where: { roundMetadata: { _isNull: false }, - chainId: { _in: $chainIds}, + chainId: { _in: $chainIds}, roundRoles: { address: { _eq: $address @@ -771,7 +769,6 @@ export const getRoundForExplorer = gql` anchorAddress project { id - metadata anchorAddress } } @@ -805,9 +802,9 @@ export const getDonationsByDonorAddress = gql` strategyName } application { + metadata project { name - metadata projectType } } diff --git a/packages/grant-explorer/src/features/collections/CollectionCard.tsx b/packages/grant-explorer/src/features/collections/CollectionCard.tsx index c14e429124..554f20698d 100644 --- a/packages/grant-explorer/src/features/collections/CollectionCard.tsx +++ b/packages/grant-explorer/src/features/collections/CollectionCard.tsx @@ -1,5 +1,5 @@ import { CommunityCollection } from "./community"; -import { Badge, BasicCard, CardHeader } from "../common/styles"; +import { BasicCard, CardHeader } from "../common/styles"; import { CollectionBanner } from "../discovery/CardBanner"; import { collectionPath } from "common/src/routes/explorer"; diff --git a/packages/grant-explorer/src/features/discovery/RoundCard.tsx b/packages/grant-explorer/src/features/discovery/RoundCard.tsx index 8d07826710..6d70ac65f5 100644 --- a/packages/grant-explorer/src/features/discovery/RoundCard.tsx +++ b/packages/grant-explorer/src/features/discovery/RoundCard.tsx @@ -6,7 +6,6 @@ import { } from "common"; import { getDaysLeft, getRoundStates } from "../api/utils"; import { - Badge, BasicCard, CardContent, CardDescription, diff --git a/packages/grant-explorer/src/features/projects/__tests__/ViewProject.test.tsx b/packages/grant-explorer/src/features/projects/__tests__/ViewProject.test.tsx index 7e50611eb3..59f3b3356e 100644 --- a/packages/grant-explorer/src/features/projects/__tests__/ViewProject.test.tsx +++ b/packages/grant-explorer/src/features/projects/__tests__/ViewProject.test.tsx @@ -5,7 +5,6 @@ import { formatDateWithOrdinal } from "common"; import { useProject } from "../hooks/useProject"; import { beforeEach, expect, Mock } from "vitest"; import { DataLayer, v2Project } from "data-layer"; -import { mock } from "@wagmi/core"; vi.mock("../../common/Navbar"); vi.mock("../../common/Auth"); diff --git a/packages/grant-explorer/src/features/round/ViewRoundPage/ProjectCard.tsx b/packages/grant-explorer/src/features/round/ViewRoundPage/ProjectCard.tsx index 518e5115de..8d94cc6e1c 100644 --- a/packages/grant-explorer/src/features/round/ViewRoundPage/ProjectCard.tsx +++ b/packages/grant-explorer/src/features/round/ViewRoundPage/ProjectCard.tsx @@ -1,5 +1,5 @@ import { Link } from "react-router-dom"; -import { renderToPlainText, useTokenPrice, TToken } from "common"; +import { renderToPlainText } from "common"; import { CartProject, Project, Round } from "../../api/types"; diff --git a/packages/grant-explorer/src/features/round/__tests__/ViewProjectDetails.test.tsx b/packages/grant-explorer/src/features/round/__tests__/ViewProjectDetails.test.tsx index 1fac9f141b..d8bb70fc35 100644 --- a/packages/grant-explorer/src/features/round/__tests__/ViewProjectDetails.test.tsx +++ b/packages/grant-explorer/src/features/round/__tests__/ViewProjectDetails.test.tsx @@ -77,6 +77,21 @@ const expectedProject: Application = { id: faker.finance.ethereumAddress(), metadata: { application: { + project: { + id: faker.finance.ethereumAddress(), + createdAt: Date.now(), + title: "Project test", + description: "Best project in the world", + website: "test.com", + owners: [], + bannerImg: "banner!", + logoImg: "logo!", + projectTwitter: "twitter.com/project", + projectGithub: "github.com/project", + userGithub: "github.com/user", + lastUpdated: 0, + credentials: {}, + }, answers: [ { answer: "never gonna give you up",