Skip to content

Commit 9f688cb

Browse files
committed
fix: hide button when round has ended
fixes #3556
1 parent 0a59293 commit 9f688cb

File tree

8 files changed

+50
-29
lines changed

8 files changed

+50
-29
lines changed

packages/round-manager/src/features/common/useApplicationsByRoundId.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { useAccount } from "wagmi";
2-
import { GrantApplication } from "../../features/api/types";
32
import { useDataLayer } from "data-layer";
43
import useSWR from "swr";
54
import { convertApplications } from "../api/utils";

packages/round-manager/src/features/round/ApplicationsApproved.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ import { errorModalDelayMs } from "../../constants";
3333
import ErrorModal from "../common/ErrorModal";
3434
import { getRoundStrategyType, useAllo } from "common";
3535

36-
export default function ApplicationsApproved() {
36+
export default function ApplicationsApproved(props: {
37+
roundHasEnded: boolean
38+
}) {
3739
const { id } = useParams();
3840
const allo = useAllo();
3941

@@ -177,7 +179,7 @@ const { data: applications, isLoading } = useApplicationsByRoundId(id);
177179

178180
return (
179181
<>
180-
{approvedApplications && approvedApplications.length > 0 && (
182+
{!props.roundHasEnded && approvedApplications && approvedApplications.length > 0 && (
181183
<div className="flex items-center justify-end mb-4">
182184
<span className="text-grey-400 text-sm mr-6">
183185
Save in gas fees by approving/rejecting multiple applications at

packages/round-manager/src/features/round/ApplicationsRejected.tsx

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ import ErrorModal from "../common/ErrorModal";
3333
import { errorModalDelayMs } from "../../constants";
3434
import { getRoundStrategyType, useAllo } from "common";
3535

36-
export default function ApplicationsRejected() {
36+
export default function ApplicationsRejected(props: {
37+
roundHasEnded: boolean;
38+
}) {
3739
const { id } = useParams();
3840
const allo = useAllo();
3941

@@ -175,21 +177,24 @@ export default function ApplicationsRejected() {
175177

176178
return (
177179
<>
178-
{rejectedApplications && rejectedApplications.length > 0 ? (
179-
<div className="flex items-center justify-end mb-4">
180-
<span className="text-grey-400 text-sm mr-6">
181-
Save in gas fees by approving/rejecting multiple applications at
182-
once.
183-
</span>
184-
{bulkSelectRejected ? (
185-
<Cancel onClick={() => setBulkSelectRejected(false)} />
186-
) : (
187-
<Select onClick={() => setBulkSelectRejected(true)} />
188-
)}
189-
</div>
190-
) : (
191-
<div className="text-center">No Rejected Applications</div>
192-
)}
180+
{!props.roundHasEnded &&
181+
<>
182+
{rejectedApplications && rejectedApplications.length > 0 ? (
183+
<div className="flex items-center justify-end mb-4">
184+
<span className="text-grey-400 text-sm mr-6">
185+
Save in gas fees by approving/rejecting multiple applications at
186+
once.
187+
</span>
188+
{bulkSelectRejected ? (
189+
<Cancel onClick={() => setBulkSelectRejected(false)} />
190+
) : (
191+
<Select onClick={() => setBulkSelectRejected(true)} />
192+
)}
193+
</div>
194+
) : (
195+
<div className="text-center">No Rejected Applications</div>
196+
)}
197+
</>}
193198
<CardsContainer>
194199
{!isLoading &&
195200
rejectedApplications?.map((application, index) => (

packages/round-manager/src/features/round/ApplicationsToApproveReject.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,14 @@ export async function exportAndDownloadCSV(
7272

7373
type Props = {
7474
isDirectRound?: boolean;
75+
roundHasEnded: boolean;
7576
};
7677

7778
// Approve or reject applications received in bulk, both in QF & direct grants
7879

7980
export default function ApplicationsToApproveReject({
8081
isDirectRound = false,
82+
roundHasEnded
8183
}: Props) {
8284
const { id } = useParams();
8385
const { chainId } = useAccount();
@@ -273,7 +275,7 @@ export default function ApplicationsToApproveReject({
273275
)}
274276
</Button>
275277
)}
276-
{filteredApplications && filteredApplications.length > 0 && (
278+
{!roundHasEnded && filteredApplications && filteredApplications.length > 0 && (
277279
<div className="flex items-center justify-end ml-auto">
278280
<span className="text-grey-400 text-sm mr-6">
279281
Save in gas fees by approving/rejecting multiple applications at

packages/round-manager/src/features/round/ApplicationsToReview.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ import { useAccount } from "wagmi";
4242

4343
// Move applications received in direct grants to In Review
4444

45-
export default function ApplicationsToReview() {
45+
export default function ApplicationsToReview(props: {
46+
roundHasEnded: boolean;
47+
}) {
4648
const { id } = useParams();
4749
const { chainId } = useAccount();
4850

@@ -239,7 +241,7 @@ export default function ApplicationsToReview() {
239241
)}
240242
</Button>
241243
)}
242-
{filteredApplications && filteredApplications.length > 0 && (
244+
{!props.roundHasEnded && filteredApplications && filteredApplications.length > 0 && (
243245
<div className="flex items-center justify-end ml-auto">
244246
<span className="text-grey-400 text-sm mr-6">
245247
Save in gas fees by moving multiple applications to "In Review"

packages/round-manager/src/features/round/GrantApplications.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ function GrantApplications(props: {
2121
fetchRoundStatus: ProgressStatus;
2222
chainId: string;
2323
roundId: string | undefined;
24+
roundHasEnded: boolean;
2425
}) {
2526
// Filter applications into pending, approved, rejected & in-review
2627
const pendingApplications = (props.applications || [])
@@ -148,25 +149,27 @@ function GrantApplications(props: {
148149
<Tab.Panels>
149150
<Tab.Panel>
150151
{props.isDirectRound ? (
151-
<ApplicationsToReview />
152+
<ApplicationsToReview roundHasEnded={props.roundHasEnded} />
152153
) : (
153154
<ApplicationsToApproveReject
154155
isDirectRound={Boolean(props.isDirectRound)}
156+
roundHasEnded={props.roundHasEnded}
155157
/>
156158
)}
157159
</Tab.Panel>
158160
{props.isDirectRound && (
159161
<Tab.Panel>
160162
<ApplicationsToApproveReject
161163
isDirectRound={Boolean(props.isDirectRound)}
164+
roundHasEnded={props.roundHasEnded}
162165
/>
163166
</Tab.Panel>
164167
)}
165168
<Tab.Panel>
166-
<ApplicationsApproved />
169+
<ApplicationsApproved roundHasEnded={props.roundHasEnded} />
167170
</Tab.Panel>
168171
<Tab.Panel>
169-
<ApplicationsRejected />
172+
<ApplicationsRejected roundHasEnded={props.roundHasEnded} />
170173
</Tab.Panel>
171174
</Tab.Panels>
172175
</Tab.Group>

packages/round-manager/src/features/round/ViewApplicationPage.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,12 +492,20 @@ export default function ViewApplicationPage() {
492492
? getRoundStrategyType(application.payoutStrategy.strategyName)
493493
: undefined;
494494

495+
const hasRoundEnded = round ? moment().isAfter(round?.roundEndTime) : false;
496+
495497
const showReviewButton = () =>
496498
strategyType === "DirectGrants" &&
497499
application?.status === "PENDING" &&
498-
application?.inReview === false;
500+
application?.inReview === false &&
501+
!hasRoundEnded;
499502

500503
const showApproveReject = () => {
504+
console.log("showApproveReject", application?.status, hasRoundEnded);
505+
if (hasRoundEnded) {
506+
return false;
507+
}
508+
501509
if (strategyType !== "DirectGrants") {
502510
return true;
503511
}

packages/round-manager/src/features/round/ViewRoundPage.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ export default function ViewRoundPage() {
6969
id.toLowerCase()
7070
);
7171

72-
console.log("round", round);
73-
7472
const isRoundFetched =
7573
fetchRoundStatus == ProgressStatus.IS_SUCCESS && !error;
7674
const { data: applications } = useApplicationsByRoundId(id);
@@ -88,14 +86,15 @@ export default function ViewRoundPage() {
8886
: true);
8987
const roundNotFound = fetchRoundStatus === ProgressStatus.IS_ERROR;
9088

89+
const roundHasEnded = round ? moment().isAfter(round?.roundEndTime) : false;
90+
9191
useEffect(() => {
9292
if (roundChainId !== chain?.id) {
9393
switchChain({ connector, chainId: roundChainId as number });
9494
}
9595
}, [chain?.id, roundChainId, connector, switchChain]);
9696

9797
const strategyName = round?.payoutStrategy.strategyName;
98-
console.log("strategyName", strategyName);
9998
const badgeColor =
10099
strategyName === "MERKLE" ? "gradient-border-qf" : "gradient-border-direct";
101100

@@ -388,6 +387,7 @@ export default function ViewRoundPage() {
388387
fetchRoundStatus={fetchRoundStatus}
389388
chainId={`${chain?.id}`}
390389
roundId={id}
390+
roundHasEnded={roundHasEnded}
391391
/>
392392
</Tab.Panel>
393393
{!isDirectRound(round) && (

0 commit comments

Comments
 (0)