Skip to content

Commit 86dbbc5

Browse files
chore: issue on apply (#3811)
1 parent 338d04f commit 86dbbc5

File tree

6 files changed

+23
-12
lines changed

6 files changed

+23
-12
lines changed

packages/builder/src/components/application/Form.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@ export default function Form({
111111
const allProjectMetadata = state.grantsMetadata;
112112
const { chainID } = state.web3;
113113

114+
console.log("allProjectMetadata", allProjectMetadata);
114115
const projectIds = Object.keys(allProjectMetadata);
116+
console.log("projectIds", projectIds);
115117

116118
return {
117119
anchors: state.projects.anchor,
@@ -139,6 +141,7 @@ export default function Form({
139141
let selectedProjectMetadata: Metadata | undefined;
140142
let createLinkedProject = false;
141143

144+
// VERIFY LOGIC AFTER POPULATING linkedChains
142145
if (selectedProjectID !== undefined && selectedProjectID !== "") {
143146
selectedProjectMetadata =
144147
props.allProjectMetadata[selectedProjectID]?.metadata;
@@ -302,11 +305,15 @@ export default function Form({
302305

303306
useEffect(() => {
304307
const currentOptions = props.projectIDs.map((id): ProjectOption => {
308+
console.log("currentOptions: id", id);
305309
const chainId = props.allProjectMetadata[id]!.metadata!.chainId!;
306-
310+
console.log("currentOptions: chainId", chainId);
307311
const chain = getChainById(chainId);
312+
console.log("currentOptions: chain", chain);
308313
const chainName = chain.prettyName;
314+
console.log("currentOptions: chainName", chainName);
309315
const { icon } = chain;
316+
console.log("currentOptions: icon", icon);
310317

311318
return {
312319
id,
@@ -319,7 +326,7 @@ export default function Form({
319326
};
320327
});
321328
currentOptions.unshift({ id: undefined, title: "", chainInfo: undefined });
322-
329+
console.log("currentOptions: currentOptions", currentOptions);
323330
setProjectOptions(currentOptions);
324331
}, [props.allProjectMetadata]);
325332

@@ -402,6 +409,8 @@ export default function Form({
402409
return null;
403410
}
404411

412+
console.log("answers", answers);
413+
405414
if (input.type === "project") {
406415
return readOnly ? (
407416
<TextInput

packages/data-layer/src/data-layer.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const mockProjects: v2Project[] = [
4646
createdAtBlock: "5146499",
4747
},
4848
],
49-
projectType: "CANONICAL",
49+
projectType: "canonical",
5050
linkedChains: [],
5151
},
5252
];

packages/data-layer/src/data-layer.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ import {
5959
getRoundsForManagerByAddress,
6060
getDirectDonationsByProjectId,
6161
} from "./queries";
62-
import { orderByMapping } from "./utils";
62+
import { mergeCanonicalAndLinkedProjects, orderByMapping } from "./utils";
6363
import {
6464
AttestationService,
6565
type MintingAttestationIdsData,
@@ -250,10 +250,11 @@ export class DataLayer {
250250
);
251251

252252
if (response.projects.length === 0) return null;
253+
console.log("response.projects", response.projects);
253254

254-
// const project = mergeCanonicalAndLinkedProjects(response.projects)[0];
255+
const project = mergeCanonicalAndLinkedProjects(response.projects)[0];
255256

256-
return { project: response.projects[0] };
257+
return { project: project };
257258
}
258259

259260
async getProjectAnchorByIdAndChainId({
@@ -316,7 +317,8 @@ export class DataLayer {
316317
requestVariables,
317318
);
318319

319-
return response.projects;
320+
const mergedProjects = mergeCanonicalAndLinkedProjects(response.projects);
321+
return mergedProjects;
320322
}
321323

322324
/**

packages/data-layer/src/data.types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export type ApplicationStatus =
3232
| "CANCELLED"
3333
| "IN_REVIEW";
3434

35-
export type ProjectType = "CANONICAL" | "LINKED";
35+
export type ProjectType = "canonical" | "linked";
3636

3737
export type GrantApplicationFormAnswer = {
3838
questionId: number;
@@ -208,7 +208,7 @@ export type v2Project = {
208208
nonce?: bigint;
209209
anchorAddress?: string;
210210
/**
211-
* The type of the project - `CANONICAL` or `LINKED`
211+
* The type of the project - `canonical` or `linked`
212212
*/
213213
projectType: ProjectType;
214214
/**

packages/data-layer/src/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ export const mergeCanonicalAndLinkedProjects = (
1212
projects: v2Project[],
1313
): v2Project[] => {
1414
const canonicalProjects = projects.filter(
15-
(project) => project.projectType === "CANONICAL",
15+
(project) => project.projectType === "canonical",
1616
);
1717

1818
const linkedProjects = projects.filter(
19-
(project) => project.projectType === "LINKED",
19+
(project) => project.projectType === "linked",
2020
);
2121
const allProjects: Record<string, v2Project> = {};
2222
for (const project of canonicalProjects) {

packages/grant-explorer/src/features/projects/__tests__/ViewProject.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ const expectedProject: Project = {
103103
createdAtBlock: "",
104104
updatedAtBlock: "",
105105
projectRoles: [],
106-
projectType: "CANONICAL",
106+
projectType: "canonical",
107107
},
108108
};
109109

0 commit comments

Comments
 (0)