Skip to content

fix: par-799 #3745

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
Jan 14, 2025
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
17 changes: 9 additions & 8 deletions packages/common/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -477,15 +477,16 @@
return getChainById(chainId) !== undefined;
}

export function isLitUnavailable(chainId: number) {

Check warning on line 480 in packages/common/src/index.ts

View workflow job for this annotation

GitHub Actions / lint-test-typecheck

'chainId' is defined but never used. Allowed unused args must match /^_/u
return [
4201, // LUKSO_TESTNET,
42, // LUKSO,
713715, // SEI_DEVNET,
1329, // SEI_MAINNET,
1088, // METIS
].includes(chainId);
return true;
// return [
// 4201, // LUKSO_TESTNET,
// 42, // LUKSO,
// 713715, // SEI_DEVNET,
// 1329, // SEI_MAINNET,
// 1088, // METIS
// ].includes(chainId);
}

export * from "./chains";
export * from "./programWhitelist";
export * from "./programWhitelist";
2 changes: 2 additions & 0 deletions packages/data-layer/src/data-layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,8 @@ export class DataLayer {
id: round.strategyAddress,
strategyName: round.strategyName,
},
applicationQuestions:
round.applicationMetadata?.applicationSchema?.questions,
approvedProjects: projects,
uniqueDonorsCount: round.uniqueDonorsCount,
},
Expand Down
8 changes: 7 additions & 1 deletion packages/data-layer/src/data.types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { VerifiableCredential } from "@gitcoinco/passport-sdk-types";
import { Address } from "viem";
import { RoundApplicationMetadata } from "./roundApplication.types";
import {
RoundApplicationMetadata,
RoundApplicationQuestion,
} from "./roundApplication.types";
export type RoundPayoutType =
| "allov1.Direct"
| "allov1.QF"
Expand Down Expand Up @@ -256,6 +259,7 @@ export type RoundWithApplications = Omit<RoundGetRound, "applications"> & {
export type RoundForExplorer = Omit<RoundGetRound, "applications"> & {
applications: (Application & { anchorAddress: Address })[];
uniqueDonorsCount?: number;
applicationMetadata?: RoundApplicationMetadata;
};

export type BaseDonorValues = {
Expand Down Expand Up @@ -471,6 +475,8 @@ export interface Round {
info: string;
};
};

applicationQuestions?: RoundApplicationQuestion[];
/**
* Pointer to round metadata in a decentralized storage e.g IPFS, Ceramic etc.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,13 @@ import { useGap } from "../api/gap";
import { StatList } from "./OSO/ImpactStats";
import { useOSO } from "../api/oso";
import { CheckIcon, ShoppingCartIcon } from "@heroicons/react/24/outline";
import { Application, useDataLayer } from "data-layer";
import {
Application,
BaseQuestion,
Round,
RoundApplicationQuestion,
useDataLayer,
} from "data-layer";
import { DefaultLayout } from "../common/DefaultLayout";
import {
mapApplicationToProject,
Expand Down Expand Up @@ -114,9 +120,11 @@ export default function ViewProjectDetails() {
},
dataLayer
);
const { round: roundDetails } = useRoundById(Number(chainId), roundId);

const projectToRender = application && mapApplicationToProject(application);
const round = application && mapApplicationToRound(application);

round && (round.chainId = Number(chainId));
const isSybilDefenseEnabled =
round?.roundMetadata?.quadraticFundingConfig?.sybilDefense === true ||
Expand Down Expand Up @@ -207,6 +215,7 @@ export default function ViewProjectDetails() {
<Detail text={description} testID="project-metadata" />
<ApplicationFormAnswers
answers={projectToRender.grantApplicationFormAnswers}
round={roundDetails}
/>
</>
) : (
Expand Down Expand Up @@ -234,7 +243,7 @@ export default function ViewProjectDetails() {
),
},
],
[stats, grants, projectToRender, description, isLoading]
[stats, grants, projectToRender, description, impacts, roundDetails]
);

const handleTabChange = (tabIndex: number) => {
Expand Down Expand Up @@ -460,9 +469,27 @@ function Detail(props: { text: string; testID: string }) {

function ApplicationFormAnswers(props: {
answers: GrantApplicationFormAnswer[];
round: Round | undefined;
}) {
// only show answers that are not empty and are not marked as hidden
const answers = props.answers.filter((a) => !!a.answer && !a.hidden);
const roundQuestions = props.round?.applicationQuestions as (BaseQuestion &
RoundApplicationQuestion)[];
let answers: GrantApplicationFormAnswer[] = [];
if (roundQuestions) {
answers = roundQuestions
.filter((q) => !q.hidden && !q.encrypted)
.map((q) => ({
...props.answers.find(
(a) =>
a.questionId === q.id && a.question === q.title && a.type === q.type
),
question: q.title,
}))
.filter((a): a is GrantApplicationFormAnswer => !!a.answer);
}

if (answers.length === 0) {
answers = props.answers.filter((a) => !!a.answer && !a.hidden);
}

if (answers.length === 0) {
return null;
Expand Down
Loading