Skip to content

Commit ec52238

Browse files
feat: show donate button only on chains that support direct donation
1 parent edb8cad commit ec52238

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

packages/grant-explorer/src/features/projects/ViewProject.tsx

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ export default function ViewProject() {
9494
);
9595

9696
const [tokenBalance, setTokenBalance] = useState<bigint>(BigInt("0"));
97+
const directAllocationPoolId = getDirectAllocationPoolId(chainId ?? 1);
9798

9899
useEffect(() => {
99100
const runner = async () => {
@@ -292,21 +293,23 @@ export default function ViewProject() {
292293
<div className="md:flex gap-4 flex-row-reverse">
293294
<div className="mb-4">
294295
<Sidebar projectApplications={projectApplications} />
295-
<button
296-
type="button"
297-
data-testid="direct-allocation-button"
298-
className="w-full block my-0 mx-1 bg-gitcoin-violet-100 py-2 text-center text-sm font-semibold rounded-lg leading-6 text-gitcoin-violet-400 shadow-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
299-
onClick={() => {
300-
if (!isConnected) {
301-
openConnectModal?.();
302-
return;
303-
}
304-
setShowDirectAllocationModal(true);
305-
}}
306-
>
307-
<BoltIcon className="w-4 h-4 inline-block mr-1 mb-1" />
308-
Donate
309-
</button>
296+
{directAllocationPoolId && (
297+
<button
298+
type="button"
299+
data-testid="direct-allocation-button"
300+
className="w-full block my-0 mx-1 bg-gitcoin-violet-100 py-2 text-center text-sm font-semibold rounded-lg leading-6 text-gitcoin-violet-400 shadow-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
301+
onClick={() => {
302+
if (!isConnected) {
303+
openConnectModal?.();
304+
return;
305+
}
306+
setShowDirectAllocationModal(true);
307+
}}
308+
>
309+
<BoltIcon className="w-4 h-4 inline-block mr-1 mb-1" />
310+
Donate
311+
</button>
312+
)}
310313
</div>
311314
<div className="flex-1">
312315
{projectError === undefined ? (

0 commit comments

Comments
 (0)