From 6a90ad748b1ec1209a0e23ab52cd7937075596eb Mon Sep 17 00:00:00 2001 From: kkatusic Date: Mon, 26 Aug 2024 15:00:52 +0200 Subject: [PATCH 1/3] Feature: added recurring tab as default for OP address --- src/components/views/donate/DonationCard.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/components/views/donate/DonationCard.tsx b/src/components/views/donate/DonationCard.tsx index 0e706af8f0..d64b3ecece 100644 --- a/src/components/views/donate/DonationCard.tsx +++ b/src/components/views/donate/DonationCard.tsx @@ -90,6 +90,15 @@ export const DonationCard: FC = ({ }); }, []); + // Check if the 'tab' query parameter is not present in the URL and project 'hasOpAddress' is true. + // If both conditions are met, set the active tab to 'RECURRING' using the setTab function. + // This ensures that the 'RECURRING' tab is active by default if rpoject has Op Address. + useEffect(() => { + if (!router.query.tab && hasOpAddress) { + setTab(ETabs.RECURRING); + } + }, [router.query.tab, hasOpAddress]); + return ( {!isQRDonation ? ( From 1cb4c02484fd5567ccd3dc5144a21c85e0a07152 Mon Sep 17 00:00:00 2001 From: kkatusic Date: Mon, 26 Aug 2024 16:49:39 +0200 Subject: [PATCH 2/3] update useEffect dependency --- src/components/views/donate/DonationCard.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/donate/DonationCard.tsx b/src/components/views/donate/DonationCard.tsx index d64b3ecece..5c4042bcac 100644 --- a/src/components/views/donate/DonationCard.tsx +++ b/src/components/views/donate/DonationCard.tsx @@ -97,7 +97,7 @@ export const DonationCard: FC = ({ if (!router.query.tab && hasOpAddress) { setTab(ETabs.RECURRING); } - }, [router.query.tab, hasOpAddress]); + }, [router.query, hasOpAddress]); return ( From 2474052b9473d6fc8755ede9863d0bb84fd13ff7 Mon Sep 17 00:00:00 2001 From: kkatusic Date: Tue, 27 Aug 2024 14:22:38 +0200 Subject: [PATCH 3/3] fixed typo --- src/components/views/donate/DonationCard.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/donate/DonationCard.tsx b/src/components/views/donate/DonationCard.tsx index 5c4042bcac..1f8eb01e89 100644 --- a/src/components/views/donate/DonationCard.tsx +++ b/src/components/views/donate/DonationCard.tsx @@ -92,7 +92,7 @@ export const DonationCard: FC = ({ // Check if the 'tab' query parameter is not present in the URL and project 'hasOpAddress' is true. // If both conditions are met, set the active tab to 'RECURRING' using the setTab function. - // This ensures that the 'RECURRING' tab is active by default if rpoject has Op Address. + // This ensures that the 'RECURRING' tab is active by default if project has Op Address. useEffect(() => { if (!router.query.tab && hasOpAddress) { setTab(ETabs.RECURRING);