From a0f428bc0673074b25dfa8872a7b21bdb2b60c8b Mon Sep 17 00:00:00 2001 From: maryjaf Date: Sun, 2 Mar 2025 13:15:58 +0330 Subject: [PATCH] fix donate button for deactive projects --- .../Recurring/RecurringDonationCard.tsx | 21 +++++++++++++++++-- .../ProjectPublicActions.tsx | 7 ++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/components/views/donate/Recurring/RecurringDonationCard.tsx b/src/components/views/donate/Recurring/RecurringDonationCard.tsx index 859fc20557..08ee5ea49b 100644 --- a/src/components/views/donate/Recurring/RecurringDonationCard.tsx +++ b/src/components/views/donate/Recurring/RecurringDonationCard.tsx @@ -23,6 +23,7 @@ import Image from 'next/image'; import Link from 'next/link'; import { useIntl } from 'react-intl'; import BigNumber from 'bignumber.js'; +import { EProjectStatus } from '@/apollo/types/gqlEnums'; import { AddressZero, ONE_MONTH_SECONDS } from '@/lib/constants/constants'; import { FlowRateTooltip } from '@/components/GIVeconomyPages/GIVstream.sc'; import { IconWithTooltip } from '@/components/IconWithToolTip'; @@ -97,6 +98,7 @@ export function mapValueInverse(value: number) { export const RecurringDonationCard = () => { const { project, selectedRecurringToken, tokenStreams } = useDonateData(); const isGivethProject = Number(project.id!) === config.GIVETH_PROJECT_ID; + const isActive = project.status?.name === EProjectStatus.ACTIVE; const [amount, setAmount] = useState(0n); const [perMonthAmount, setPerMonthAmount] = useState(0n); const [isUpdating, setIsUpdating] = useState(false); @@ -135,7 +137,6 @@ export const RecurringDonationCard = () => { : selectedRecurringToken?.token.id, address: address, }); - useEffect(() => { if (!selectedRecurringToken || !balance) return; if (selectedRecurringToken.token.isSuperToken) { @@ -749,10 +750,26 @@ export const RecurringDonationCard = () => { + {!isActive && ( +
+ +
+ )} )} diff --git a/src/components/views/project/projectActionCard/ProjectPublicActions.tsx b/src/components/views/project/projectActionCard/ProjectPublicActions.tsx index 0d9fcc8724..b213ed6312 100644 --- a/src/components/views/project/projectActionCard/ProjectPublicActions.tsx +++ b/src/components/views/project/projectActionCard/ProjectPublicActions.tsx @@ -130,7 +130,12 @@ export const ProjectPublicActions = () => { )} - + !isActive && e.preventDefault()} + style={{ pointerEvents: !isActive ? 'none' : 'auto' }} + >