Skip to content

Commit e75d6b3

Browse files
fix project loading bug (#3550)
* fix project loading bug * fix ui * update to pnpm/action-setup@v4 * fix * fix --------- Co-authored-by: Aditya Anand M C <aditya.anandmc@gmail.com>
1 parent f043116 commit e75d6b3

File tree

11 files changed

+90
-59
lines changed

11 files changed

+90
-59
lines changed

.github/workflows/builder.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ jobs:
1818
with:
1919
fetch-depth: 1
2020

21-
- uses: pnpm/action-setup@v2
21+
- uses: pnpm/action-setup@v4
2222
with:
2323
version: 8
2424

2525
- uses: actions/setup-node@v3
2626
with:
27-
node-version: '16'
27+
node-version: '18'
2828
cache: 'pnpm'
2929

3030
- name: Install Dependencies

.github/workflows/common.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
with:
1818
fetch-depth: 1
1919

20-
- uses: pnpm/action-setup@v2
20+
- uses: pnpm/action-setup@v4
2121
with:
2222
version: 8
2323

.github/workflows/data-layer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
with:
1818
fetch-depth: 1
1919

20-
- uses: pnpm/action-setup@v2
20+
- uses: pnpm/action-setup@v4
2121
with:
2222
version: 8
2323

.github/workflows/grant-explorer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
with:
1818
fetch-depth: 1
1919

20-
- uses: pnpm/action-setup@v2
20+
- uses: pnpm/action-setup@v4
2121
with:
2222
version: 8
2323

.github/workflows/round-manager.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
with:
1818
fetch-depth: 1
1919

20-
- uses: pnpm/action-setup@v2
20+
- uses: pnpm/action-setup@v4
2121
with:
2222
version: 8
2323

.github/workflows/verify-env.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
with:
1818
fetch-depth: 1
1919

20-
- uses: pnpm/action-setup@v2
20+
- uses: pnpm/action-setup@v4
2121
with:
2222
version: 8
2323

packages/round-manager/src/features/api/utils.ts

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
import { BigNumber, ethers } from "ethers";
22
import {
33
ApplicationMetadata,
4+
GrantApplication,
45
InputType,
56
IPFSObject,
67
RevisedMatch,
78
} from "./types";
89
import { useEffect, useState } from "react";
910
import Papa from "papaparse";
1011
import { getChainById } from "common";
12+
import { ProjectApplicationForManager } from "data-layer";
1113

1214
export type SupportType = {
1315
name: string;
@@ -240,3 +242,52 @@ export const useMatchCSVParser = (file: File | null) => {
240242

241243
return { data, loading, error };
242244
};
245+
246+
export const convertApplications = (
247+
dataLayerApplications: ProjectApplicationForManager[]
248+
) => {
249+
const applications: GrantApplication[] = dataLayerApplications.flatMap(
250+
(application) => {
251+
if (application.canonicalProject === null) {
252+
console.error(
253+
`Canonical project not found for application ${application.id}`
254+
);
255+
return [];
256+
}
257+
258+
return [
259+
{
260+
id: application.id,
261+
applicationIndex: Number(application.id),
262+
round: application.roundId,
263+
status: application.status,
264+
metadata: application.metadata,
265+
project: {
266+
...application.metadata.application.project,
267+
owners: application.canonicalProject.roles,
268+
id: application.projectId,
269+
},
270+
projectId: application.projectId,
271+
inReview: application.status === "IN_REVIEW",
272+
recipient: application.metadata.application.recipient,
273+
createdAt: "0",
274+
projectsMetaPtr: { protocol: 1, pointer: "" },
275+
payoutStrategy: {
276+
strategyName: application.round.strategyName,
277+
id: application.round.strategyAddress,
278+
payouts: [],
279+
},
280+
distributionTransaction: application.distributionTransaction,
281+
statusSnapshots: application.statusSnapshots.map((snapshot) => ({
282+
...snapshot,
283+
updatedAt: new Date(snapshot.updatedAt),
284+
})),
285+
anchorAddress: application.anchorAddress,
286+
answers: application.metadata.application.answers,
287+
},
288+
];
289+
}
290+
);
291+
292+
return applications;
293+
};

packages/round-manager/src/features/common/styles.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import tw from "tailwind-styled-components";
33
export const CardsContainer = tw.div`
44
flex
55
flex-row
6-
flex-grow
6+
flex-wrap
77
justify-start
88
w-full
99
`;

packages/round-manager/src/features/common/useApplicationsByRoundId.tsx

Lines changed: 2 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { useAccount } from "wagmi";
22
import { GrantApplication } from "../../features/api/types";
33
import { useDataLayer } from "data-layer";
44
import useSWR from "swr";
5+
import { convertApplications } from "../api/utils";
56

67
export const useApplicationsByRoundId = (roundId: string) => {
78
const dataLayer = useDataLayer();
@@ -21,50 +22,7 @@ export const useApplicationsByRoundId = (roundId: string) => {
2122
chainId,
2223
});
2324

24-
const applications: GrantApplication[] = dataLayerApplications.flatMap(
25-
(application) => {
26-
if (application.canonicalProject === null) {
27-
console.error(
28-
`Canonical project not found for application ${application.id}`
29-
);
30-
return [];
31-
}
32-
33-
return [
34-
{
35-
id: application.id,
36-
applicationIndex: Number(application.id),
37-
round: application.roundId,
38-
status: application.status,
39-
metadata: application.metadata,
40-
project: {
41-
...application.metadata.application.project,
42-
owners: application.canonicalProject.roles,
43-
id: application.projectId,
44-
},
45-
projectId: application.projectId,
46-
inReview: application.status === "IN_REVIEW",
47-
recipient: application.metadata.application.recipient,
48-
createdAt: "0",
49-
projectsMetaPtr: { protocol: 1, pointer: "" },
50-
payoutStrategy: {
51-
strategyName: application.round.strategyName,
52-
id: application.round.strategyAddress,
53-
payouts: [],
54-
},
55-
distributionTransaction: application.distributionTransaction,
56-
statusSnapshots: application.statusSnapshots.map((snapshot) => ({
57-
...snapshot,
58-
updatedAt: new Date(snapshot.updatedAt),
59-
})),
60-
anchorAddress: application.anchorAddress,
61-
answers: application.metadata.application.answers,
62-
},
63-
];
64-
}
65-
);
66-
67-
return applications;
25+
return convertApplications(dataLayerApplications);
6826
},
6927
{
7028
onError: (error) => {

packages/round-manager/src/features/round/ApplicationsApproved.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export default function ApplicationsApproved() {
4141
throw new Error("id is undefined");
4242
}
4343

44-
const { data: applications, isLoading } = useApplicationsByRoundId(id);
44+
const { data: applications, isLoading } = useApplicationsByRoundId(id);
4545

4646
const approvedApplications =
4747
applications?.filter(

0 commit comments

Comments
 (0)