From 6a2c42728eda94d25f1c82df6eec45258319a15c Mon Sep 17 00:00:00 2001 From: eagle Date: Fri, 26 Apr 2024 19:13:33 +0530 Subject: [PATCH] feat: add UploadCustomResults option in round results --- .../ViewRoundResults/ViewRoundResults.tsx | 159 ++++++++++++++---- 1 file changed, 130 insertions(+), 29 deletions(-) diff --git a/packages/round-manager/src/features/round/ViewRoundResults/ViewRoundResults.tsx b/packages/round-manager/src/features/round/ViewRoundResults/ViewRoundResults.tsx index 3d47ded85e..9f338c2ef1 100644 --- a/packages/round-manager/src/features/round/ViewRoundResults/ViewRoundResults.tsx +++ b/packages/round-manager/src/features/round/ViewRoundResults/ViewRoundResults.tsx @@ -239,6 +239,9 @@ function ViewRoundResults({ const matchingTableRef = useRef(null); const [overridesFile, setOverridesFile] = useState(); + const [customResultsFile, setCustomResultsFile] = useState< + undefined | File + >(); const [distributionOption, setDistributionOption] = useState< "keep" | "scale" @@ -265,6 +268,8 @@ function ViewRoundResults({ const shouldShowRevisedTable = areMatchingFundsRevised || Boolean(readyForPayoutTransactionHash); + const shouldShowCustomResultsTable = Boolean(customResultsFile); + const { data: amountFunded } = useContractAmountFunded({ round: round, payoutToken: matchToken, @@ -571,38 +576,62 @@ function ViewRoundResults({ )} - - - + {(sybilDefense === "auto" && isRecommendedDistribution) || + (sybilDefense !== "auto" && !isRecommendedDistribution && ( + <> + + + ))} + {(sybilDefense === "auto" && !isRecommendedDistribution) || + (sybilDefense !== "auto" && isRecommendedDistribution && ( + <> + + + + + ))} + {((sybilDefense === "auto" && !isRecommendedDistribution) || + (sybilDefense !== "auto" && isRecommendedDistribution)) && + !readyForPayoutTransactionHash && ( + <> + + + + )} {!readyForPayoutTransactionHash && ( <> - - void; + reloadMatchingFunds: () => void; + shouldShowCustomResultsTable: boolean; +}) { + const [customResultsDraft, setCustomResultsDraft] = useState< + undefined | File + >(undefined); + return ( +
+ + Upload Results + +
+ Upload a CSV file with your round results. For instructions, click{" "} + + here + + . +
+
+ + If you navigate away from this page, your data will be lost. You will be + able to re-upload data as much as you’d like, but it will not be saved + to the contract until you finalize results. +
+ { + setCustomResultsDraft(file); + }} + /> +
+
+ +
+
+ {props.shouldShowCustomResultsTable && ( + + )} +
+
+
+ ); +} + function FinalizeResultsButton(props: { isReadyForPayout: boolean; isRoundFullyFunded: boolean;