From 557d935a3186e3aa56623f183f332e5e22a4a4d5 Mon Sep 17 00:00:00 2001 From: Aditya Anand M C Date: Mon, 17 Jun 2024 15:00:15 +0530 Subject: [PATCH] fix --- packages/common/src/icons/AlloV1Black.tsx | 8 + packages/data-layer/src/data.types.ts | 2 + packages/data-layer/src/queries.ts | 6 + .../round-manager/src/features/api/program.ts | 2 + .../round-manager/src/features/api/types.ts | 2 + .../src/features/common/LandingPage.tsx | 10 +- .../src/features/common/types.ts | 6 +- .../src/features/program/ProgramCard.tsx | 14 +- .../src/features/program/ProgramListPage.tsx | 189 +++++++++--------- .../src/features/round/RoundCard.tsx | 4 +- .../src/features/round/RoundListPage.tsx | 150 +++++++------- 11 files changed, 208 insertions(+), 185 deletions(-) create mode 100644 packages/common/src/icons/AlloV1Black.tsx diff --git a/packages/common/src/icons/AlloV1Black.tsx b/packages/common/src/icons/AlloV1Black.tsx new file mode 100644 index 000000000..501697bcf --- /dev/null +++ b/packages/common/src/icons/AlloV1Black.tsx @@ -0,0 +1,8 @@ +export default function AlloV1Black() { + return ( + + + + + ); +} diff --git a/packages/data-layer/src/data.types.ts b/packages/data-layer/src/data.types.ts index 53a256413..2d78cb570 100644 --- a/packages/data-layer/src/data.types.ts +++ b/packages/data-layer/src/data.types.ts @@ -211,6 +211,8 @@ export type v2Project = { * The linked chains to the canonical project */ linkedChains?: number[]; + qfRounds? : string[]; + dgRounds? : string[]; }; /** diff --git a/packages/data-layer/src/queries.ts b/packages/data-layer/src/queries.ts index e3f933b0e..fb4be2c5c 100644 --- a/packages/data-layer/src/queries.ts +++ b/packages/data-layer/src/queries.ts @@ -29,6 +29,12 @@ export const getProgramsByUserAndTag = gql` role createdAtBlock } + qfRounds: rounds(filter: {strategyName: {equalTo: "allov2.DonationVotingMerkleDistributionDirectTransferStrategy"}}) { + id + } + dgRounds: rounds(filter: {strategyName: {equalTo: "allov2.DirectGrantsLiteStrategy"}}) { + id + } } } `; diff --git a/packages/round-manager/src/features/api/program.ts b/packages/round-manager/src/features/api/program.ts index b56b709be..6f53f7e9b 100644 --- a/packages/round-manager/src/features/api/program.ts +++ b/packages/round-manager/src/features/api/program.ts @@ -50,6 +50,8 @@ export async function listPrograms( }, createdByAddress: program.createdByAddress, roles: program.roles, + qfRoundsCount: program.qfRounds?.length || 0, + dgRoundsCount: program.dgRounds?.length || 0, }); } return programs; diff --git a/packages/round-manager/src/features/api/types.ts b/packages/round-manager/src/features/api/types.ts index b9e5b16dd..d37679a36 100644 --- a/packages/round-manager/src/features/api/types.ts +++ b/packages/round-manager/src/features/api/types.ts @@ -111,6 +111,8 @@ export interface Program { tags?: string[]; roles?: AddressAndRole[]; + qfRoundsCount?: number; + dgRoundsCount?: number; } export type InputType = diff --git a/packages/round-manager/src/features/common/LandingPage.tsx b/packages/round-manager/src/features/common/LandingPage.tsx index e0c304d46..127b891e5 100644 --- a/packages/round-manager/src/features/common/LandingPage.tsx +++ b/packages/round-manager/src/features/common/LandingPage.tsx @@ -15,14 +15,12 @@ function LandingPage() { fetchProgramsStatus === ProgressStatus.IS_SUCCESS && !listProgramsError; return ( - <> -
- +
+ -
-
- +
+
); } diff --git a/packages/round-manager/src/features/common/types.ts b/packages/round-manager/src/features/common/types.ts index bce5b7158..fa48ff6fc 100644 --- a/packages/round-manager/src/features/common/types.ts +++ b/packages/round-manager/src/features/common/types.ts @@ -4,14 +4,16 @@ import { GrantApplication, ProgressStatus } from "../api/types"; export type CardProps = { title: string; description: string; - displayDate: string; + footerContent: React.ReactNode; + displayDate?: string; status?: { status: string; style: string; }; // todo: update to Status type strategyType?: string; color?: string; - footerContent: React.ReactNode; + qfRoundsCount?: number; + dgRoundsCount?: number; }; export type SpinnerProps = { diff --git a/packages/round-manager/src/features/program/ProgramCard.tsx b/packages/round-manager/src/features/program/ProgramCard.tsx index 9bdeb4762..a4428a2a5 100644 --- a/packages/round-manager/src/features/program/ProgramCard.tsx +++ b/packages/round-manager/src/features/program/ProgramCard.tsx @@ -10,7 +10,7 @@ import { import { CardProps } from "../common/types"; export const ProgramCard: React.FC = (props: CardProps) => ( - + {props.title} @@ -21,20 +21,20 @@ export const ProgramCard: React.FC = (props: CardProps) => ( {props.description}
- {/* todo: Add badges to props for each round category that exists within the program */} - {props.strategyType === "quadratic" ? ( + {props.qfRoundsCount != 0 &&
- Quadratic funding + {props.qfRoundsCount} Quadratic funding
- ) : ( + } + {props.dgRoundsCount != 0 &&
- Direct Grants + {props.dgRoundsCount} Direct Grants
- )} + }
diff --git a/packages/round-manager/src/features/program/ProgramListPage.tsx b/packages/round-manager/src/features/program/ProgramListPage.tsx index 705da6571..87f49f01c 100644 --- a/packages/round-manager/src/features/program/ProgramListPage.tsx +++ b/packages/round-manager/src/features/program/ProgramListPage.tsx @@ -9,6 +9,7 @@ import { useAlloVersion } from "common/src/components/AlloVersionSwitcher"; import { ExclamationCircleIcon } from "@heroicons/react/solid"; import { ProgramCard } from "./ProgramCard"; import { chunk } from "lodash"; +import AlloV1Black from "common/src/icons/AlloV1Black"; const maxProgramsPerRow = 4; @@ -51,13 +52,9 @@ function ListPrograms() { key={program.id} title={program.metadata.name} description={`${program.operatorWallets.length} ${program.operatorWallets.length === 1 ? "operator" : "operators"}`} - displayDate="" strategyType="quadratic" - // { - // round.strategyName === "allov2.DirectGrantsLiteStrategy" - // ? "direct" - // : "quadratic" - // } + qfRoundsCount={program.qfRoundsCount} + dgRoundsCount={program.dgRoundsCount} footerContent={ <>
@@ -67,19 +64,17 @@ function ListPrograms() { className="rounded-full w-6 h-6 mr-2" />
-
- {program.tags?.includes("allo-v1") && ( - // todo: add the icon for Allo - // - v1 - )} -
+ {program.tags?.includes("allo-v1") && ( +
+ +
+ )}
View details{" "} - +
} @@ -89,94 +84,98 @@ function ListPrograms() { }); return ( -
- {fetchProgramsStatus === ProgressStatus.IN_PROGRESS && ( - - )} - {/* todo: remove when ready */} - {version === "allo-v1" && ( -
-
- - You are currently on Allo v1. To switch to the most current version - of Manager,  - -   -
-
- Click  - - here - -  to learn more about Allo v2. -
-
- )} - {/* {version === "allo-v2" && ()} */} -
-
-
-
- - Programs - - { - setViewAllPrograms(!viewAllPrograms); +
+
+ {fetchProgramsStatus === ProgressStatus.IN_PROGRESS && ( + + )} + {/* todo: remove when ready */} + {version === "allo-v1" && ( +
+
+ + You are currently on Allo v1. To switch to the most current version + of Manager,  + +  
-
- - - - - Create program - - - +
+ Click  + + here + +  to learn more about Allo v2.
-
-
- {isSuccess && hasNoPrograms() && startAProgramCard} - {chunk( - viewAllPrograms - ? ProgramList - : ProgramList.slice(0, maxProgramsPerRow * 2), - maxProgramsPerRow - ).map((programsChunk, rowIndex) => ( -
- {programsChunk.map((program, index) => ( -
- {program} + )} +
+ {/* {version === "allo-v2" && ()} */} + {isSuccess && +
+
+
+ + Programs + + { + setViewAllPrograms(!viewAllPrograms); + }} + > + {viewAllPrograms ? "View less" : "View all"} +
- ))} +
+ + + + + Create program + + + +
+
- ))} -
-
-
+ } +
+ {isSuccess && hasNoPrograms() && startAProgramCard} + {chunk( + viewAllPrograms + ? ProgramList + : ProgramList.slice(0, maxProgramsPerRow * 2), + maxProgramsPerRow + ).map((programsChunk, rowIndex) => ( +
+ {programsChunk.map((program, index) => ( +
+ {program} +
+ ))} +
+ ))} +
+
+
+ ); } diff --git a/packages/round-manager/src/features/round/RoundCard.tsx b/packages/round-manager/src/features/round/RoundCard.tsx index 6543d7334..723d4e02e 100644 --- a/packages/round-manager/src/features/round/RoundCard.tsx +++ b/packages/round-manager/src/features/round/RoundCard.tsx @@ -8,7 +8,7 @@ import { import { CardProps } from "../common/types"; export const RoundCard: React.FC = (props: CardProps) => ( - +
@@ -37,7 +37,7 @@ export const RoundCard: React.FC = (props: CardProps) => (
{/* todo: figure out the status display by dates */} {props.status && props.status.status} diff --git a/packages/round-manager/src/features/round/RoundListPage.tsx b/packages/round-manager/src/features/round/RoundListPage.tsx index ab47d709d..76ccf745d 100644 --- a/packages/round-manager/src/features/round/RoundListPage.tsx +++ b/packages/round-manager/src/features/round/RoundListPage.tsx @@ -85,84 +85,88 @@ function ListRounds() { }); return ( -
- {fetchRoundStatus === ProgressStatus.IN_PROGRESS && ( - - )} - {/* todo: remove when ready */} - {version === "allo-v1" && ( -
-
- - You are currently on Allo v1. To switch to the most current version - of Manager,  - -   -
-
- Click  - - here - -  to learn more about Allo v2. -
-
- )} -
-
-
-
- - Rounds - - { - setViewAllRounds(!viewAllRounds); +
+
+ {fetchRoundStatus === ProgressStatus.IN_PROGRESS && ( + + )} + {/* todo: remove when ready */} + {version === "allo-v1" && ( +
+
+ + You are currently on Allo v1. To switch to the most current version + of Manager,  + +   +
+
+ Click  + + here + +  to learn more about Allo v2.
- -
- - Sort by Recent - - - - Filter by All - - -
-
-
-
- {roundList.length === 0 && ( -
- If you’re an operator of a round and you’re not a program admin, - that round will appear here. + )} + {isSuccess && +
+
+
+
+ + Rounds + + { + setViewAllRounds(!viewAllRounds); + }} + > + {viewAllRounds ? "View less" : "View all"} + +
+ +
+ + Sort by Recent + + + + Filter by All + + +
+
+
+
+
+ {roundList.length === 0 && ( +
+ If you’re an operator of a round and you’re not a program admin, + that round will appear here. +
+ )} + {viewAllRounds ? roundList : roundList.slice(0, maxRoundsPerSite)}
- )} - {viewAllRounds ? roundList : roundList.slice(0, maxRoundsPerSite)} -
-
-
+
+ } +
+ ); }