Skip to content

Commit

Permalink
fix: don't estimate when round is not loaded, fix total matching bug,…
Browse files Browse the repository at this point in the history
… fix passport bug
  • Loading branch information
vacekj committed Oct 13, 2023
1 parent a8c9f89 commit e12ee25
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,25 @@ export function RoundInCart(

const estimateText = matchingEstimatesToText(matchingEstimates);

const { passportState, passport } = usePassport({
const { passportState } = usePassport({
address: address ?? "",
});
console.log(passportState);

const isNotEligibleForMatching =
passportState === PassportState.NOT_CONNECTED ||
(passport?.score !== undefined && Number(passport.score) < 1);
const isEligibleForMatching = passportState === PassportState.MATCH_ELIGIBLE;

return (
<div className="my-4 bg-grey-50 rounded-xl">
<div className="flex flex-row items-end pt-4 sm:px-4 px-2 justify-between">
<div className={"flex flex-wrap"}>
<p className="text-xl font-semibold">{round?.roundMetadata?.name}</p>
<p className="text-lg font-bold ml-2">({props.roundCart.length})</p>
<div className={"flex flex-col"}>
<div>
<p className="text-xl font-semibold inline">
{round?.roundMetadata?.name}
</p>
<p className="text-lg font-bold ml-2 inline">
({props.roundCart.length})
</p>
</div>
{minDonationThresholdAmount && (
<div>
<p className="text-sm pt-2">
Expand All @@ -87,7 +92,7 @@ export function RoundInCart(

<div
className={`flex flex-row gap-4 items-center justify-between font-semibold italic ${
isNotEligibleForMatching ? "text-red-400" : "text-teal-500"
isEligibleForMatching ? "text-teal-500" : "text-red-400"
}`}
>
{matchingEstimateError === undefined &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ export function SummaryContainer() {
}
}

const { passportState, passport } = usePassport({
const { passportState } = usePassport({
address: address ?? "",
});

Expand Down Expand Up @@ -323,26 +323,22 @@ export function SummaryContainer() {
return null;
}

const isNotEligibleForMatching =
passportState === PassportState.NOT_CONNECTED ||
(passport?.score !== undefined && Number(passport.score) < 1);
const isEligibleForMatching = passportState === PassportState.MATCH_ELIGIBLE;

return (
<div className="mb-5 block px-[16px] py-4 rounded-lg shadow-lg bg-white border border-violet-400 font-semibold">
<h2 className="text-xl border-b-2 pb-2">Summary</h2>
<div
className={`flex flex-row items-center justify-between mt-4 font-semibold italic ${
isNotEligibleForMatching ? "text-red-400" : "text-teal-500"
isEligibleForMatching ? "text-teal-500" : "text-red-400"
}`}
>
{matchingEstimateError === undefined &&
matchingEstimates !== undefined && (
<>
<div className="flex flex-row mt-4 items-center">
<p>Estimated match</p>
<MatchingEstimateTooltip
isEligible={!isNotEligibleForMatching}
/>
<MatchingEstimateTooltip isEligible={isEligibleForMatching} />
</div>
<div className="flex justify-end mt-4">
<Skeleton isLoaded={!matchingEstimateLoading}>
Expand Down
7 changes: 0 additions & 7 deletions packages/grant-explorer/src/hooks/matchingEstimate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,6 @@ function getMatchingEstimates(
: vote.applicationId,
}));

console.log(
"estimating token ",
params.potentialVotes.map((v) => v.token),
"for chain ",
params.chainId
);

return fetch(
`${process.env.REACT_APP_ALLO_API_URL}/api/v1/chains/${params.chainId}/rounds/${params.roundId}/estimate`,
{
Expand Down

0 comments on commit e12ee25

Please sign in to comment.