From 168889c8f093271a5a7642f899a362384c6b3020 Mon Sep 17 00:00:00 2001
From: Mohammad Ranjbar Z
Date: Sun, 15 Sep 2024 14:41:59 +0330
Subject: [PATCH 1/9] Fix Stellar donation card ui things regarding QF
related to #4732
---
lang/en.json | 1 +
src/components/views/donate/DonateIndex.tsx | 11 ++++++--
.../OnTime/DonateQFEligibleNetworks.tsx | 28 +++++++++++++++----
.../QRCodeDonation/QRDonationCard.tsx | 8 ++++++
4 files changed, 40 insertions(+), 8 deletions(-)
diff --git a/lang/en.json b/lang/en.json
index 1c73cb3262..4a6ad2fc2f 100644
--- a/lang/en.json
+++ b/lang/en.json
@@ -179,6 +179,7 @@
"label.archive_donation": "Archive donation",
"label.archive_stream": "Archive Stream",
"label.are_eligible_to_be_matched": "are eligible to be matched.",
+ "label.stellar_is_not_eligible_for_matching": "Stellar is not eligible for this round.\nGo back and make sure you're on the right network.",
"label.are_you_sure": "Are you sure?",
"label.ask_us_a_question": "Ask us a Question",
"label.ask_us_a_question.caption": "Do you have a specific question or a general inquiry that requires a response?",
diff --git a/src/components/views/donate/DonateIndex.tsx b/src/components/views/donate/DonateIndex.tsx
index 9758a8e374..13443c9fb8 100644
--- a/src/components/views/donate/DonateIndex.tsx
+++ b/src/components/views/donate/DonateIndex.tsx
@@ -78,6 +78,9 @@ const DonateIndex: FC = () => {
const [showQRCode, setShowQRCode] = React.useState(
!!router.query.draft_donation,
);
+ const [isQRDonation, _setIsQRDonation] = useState(
+ router.query.chain === ChainType.STELLAR.toLowerCase(),
+ );
const [stopTimer, setStopTimer] = React.useState void)>();
useEffect(() => {
@@ -238,9 +241,10 @@ const DonateIndex: FC = () => {
)}
- {!isSafeEnv && hasActiveQFRound && !isOnSolana && (
-
- )}
+ {!isSafeEnv &&
+ hasActiveQFRound &&
+ !isOnSolana &&
+ !isQRDonation && }
@@ -268,6 +272,7 @@ const DonateIndex: FC = () => {
{!isMobile ? (
(!isRecurringTab && hasActiveQFRound) ||
(isRecurringTab &&
+ !isQRDonation &&
isOnEligibleNetworks) ? (
) : (
diff --git a/src/components/views/donate/OnTime/DonateQFEligibleNetworks.tsx b/src/components/views/donate/OnTime/DonateQFEligibleNetworks.tsx
index 855fc9db53..d547ef7e4f 100644
--- a/src/components/views/donate/OnTime/DonateQFEligibleNetworks.tsx
+++ b/src/components/views/donate/OnTime/DonateQFEligibleNetworks.tsx
@@ -9,6 +9,7 @@ import {
import React, { useState } from 'react';
import styled from 'styled-components';
import { useIntl } from 'react-intl';
+import { useRouter } from 'next/router';
import SwitchNetwork from '@/components/modals/SwitchNetwork';
import { useDonateData } from '@/context/donate.context';
import { getActiveRound } from '@/helpers/qf';
@@ -21,6 +22,11 @@ const DonateQFEligibleNetworks = () => {
const { project } = useDonateData();
const { formatMessage } = useIntl();
+ const router = useRouter();
+ const [isQRDonation, setIsQRDonation] = useState(
+ router.query.chain === ChainType.STELLAR.toLowerCase(),
+ );
+
const { activeStartedRound } = getActiveRound(project.qfRounds);
const eligibleChainNames = activeStartedRound?.eligibleNetworks.map(
@@ -45,11 +51,23 @@ const DonateQFEligibleNetworks = () => {
})}
-
- {formatMessage({ id: 'label.donations_made_on' })}
- {chainsString}
- {formatMessage({ id: 'label.are_eligible_to_be_matched' })}
-
+ {!isQRDonation && (
+
+ {formatMessage({ id: 'label.donations_made_on' })}
+ {chainsString}
+ {formatMessage({ id: 'label.are_eligible_to_be_matched' })}
+
+ )}
+ {isQRDonation && (
+
+ {formatMessage({ id: 'label.donations_made_on' })}
+ {chainsString}
+ {formatMessage({ id: 'label.are_eligible_to_be_matched' })}
+ {formatMessage({
+ id: 'label.stellar_is_not_eligible_for_matching',
+ })}
+
+ )}
setShowModal(true)}>
{formatMessage({ id: 'label.switch_network' })}
diff --git a/src/components/views/donate/OnTime/SelectTokenModal/QRCodeDonation/QRDonationCard.tsx b/src/components/views/donate/OnTime/SelectTokenModal/QRCodeDonation/QRDonationCard.tsx
index 745cf1a89d..05b448b3d0 100644
--- a/src/components/views/donate/OnTime/SelectTokenModal/QRCodeDonation/QRDonationCard.tsx
+++ b/src/components/views/donate/OnTime/SelectTokenModal/QRCodeDonation/QRDonationCard.tsx
@@ -39,6 +39,7 @@ import InlineToast, { EToastType } from '@/components/toasts/InlineToast';
import { useAppSelector } from '@/features/hooks';
import { useModalCallback } from '@/hooks/useModalCallback';
import links from '@/lib/constants/links';
+import DonateQFEligibleNetworks from '@/components/views/donate/OnTime/DonateQFEligibleNetworks';
interface QRDonationCardProps extends IDonationCardProps {
qrAcceptedTokens: IProjectAcceptedToken[];
@@ -62,6 +63,9 @@ export const QRDonationCard: FC = ({
const { formatMessage } = useIntl();
const router = useRouter();
const { isSignedIn, isEnabled } = useAppSelector(state => state.user);
+ const [isQRDonation, _setIsQRDonation] = useState(
+ router.query.chain === ChainType.STELLAR.toLowerCase(),
+ );
const [showDonateModal, setShowDonateModal] = useState(false);
const { modalCallback: signInThenDonate } = useModalCallback(() =>
setShowDonateModal(true),
@@ -69,6 +73,7 @@ export const QRDonationCard: FC = ({
const {
project,
+ hasActiveQFRound,
setQRDonationStatus,
setDraftDonationData,
setPendingDonationExists,
@@ -311,6 +316,9 @@ export const QRDonationCard: FC = ({
$ {usdAmount}
+ {hasActiveQFRound && isQRDonation && (
+
+ )}
Date: Sun, 15 Sep 2024 16:53:19 +0330
Subject: [PATCH 2/9] Change qf guid hin in stellar donate page
related to https://github.com/Giveth/giveth-dapps-v2/issues/4732#issuecomment-2351553304
---
lang/en.json | 2 +-
src/components/PassportBanner.tsx | 228 ++++++++++--------
.../OnTime/DonateQFEligibleNetworks.tsx | 49 ++--
3 files changed, 156 insertions(+), 123 deletions(-)
diff --git a/lang/en.json b/lang/en.json
index 4a6ad2fc2f..add6e0c915 100644
--- a/lang/en.json
+++ b/lang/en.json
@@ -179,7 +179,7 @@
"label.archive_donation": "Archive donation",
"label.archive_stream": "Archive Stream",
"label.are_eligible_to_be_matched": "are eligible to be matched.",
- "label.stellar_is_not_eligible_for_matching": "Stellar is not eligible for this round.\nGo back and make sure you're on the right network.",
+ "label.stellar_is_not_eligible_for_matching": "Stellar is not eligible for this round.",
"label.are_you_sure": "Are you sure?",
"label.ask_us_a_question": "Ask us a Question",
"label.ask_us_a_question.caption": "Do you have a specific question or a general inquiry that requires a response?",
diff --git a/src/components/PassportBanner.tsx b/src/components/PassportBanner.tsx
index e818aa5448..9fc699212d 100644
--- a/src/components/PassportBanner.tsx
+++ b/src/components/PassportBanner.tsx
@@ -123,104 +123,115 @@ export const PassportBanner = () => {
const { isOnSolana, handleSingOutAndSignInWithEVM } = useGeneralWallet();
const [showModal, setShowModal] = useState(false);
const [signWithWallet, setSignWithWallet] = useState(false);
-
+ const router = useRouter();
+ const [isQRDonation, _setIsQRDonation] = useState(
+ router.query.chain === ChainType.STELLAR.toLowerCase(),
+ );
const isGSafeConnector = connector?.id === 'safe';
return !isOnSolana ? (
<>
-
-
-
- {PassportBannerData[qfEligibilityState].icon}
-
-
- {formatMessage(
- {
- id: PassportBannerData[qfEligibilityState]
- .content,
- },
- {
- data:
- qfEligibilityState ===
- EQFElegibilityState.NOT_STARTED &&
- currentRound
- ? smallFormatDate(
- new Date(
- currentRound?.beginDate,
- ),
- )
- : undefined,
- },
- )}
- {currentRound &&
- qfEligibilityState ===
- EQFElegibilityState.RECHECK_ELIGIBILITY && (
- <>
- {' '}
-
- {new Date(currentRound.endDate)
- .toLocaleString(locale || 'en-US', {
- day: 'numeric',
- month: 'short',
- })
- .replace(/,/g, '')}
-
- >
+ {!isQRDonation && (
+
+
+
+ {PassportBannerData[qfEligibilityState].icon}
+
+
+ {formatMessage(
+ {
+ id: PassportBannerData[qfEligibilityState]
+ .content,
+ },
+ {
+ data:
+ qfEligibilityState ===
+ EQFElegibilityState.NOT_STARTED &&
+ currentRound
+ ? smallFormatDate(
+ new Date(
+ currentRound?.beginDate,
+ ),
+ )
+ : undefined,
+ },
)}
-
-
- {qfEligibilityState ===
- EQFElegibilityState.CHECK_ELIGIBILITY && (
- fetchUserMBDScore()}>
-
- {formatMessage({
- id: 'qf_donor_eligibility.banner.link.check_eligibility',
- })}
-
-
- )}
- {qfEligibilityState ===
- EQFElegibilityState.RECHECK_ELIGIBILITY && (
- setShowModal(true)}>
-
- {formatMessage({
- id: 'qf_donor_eligibility.banner.link.recheck_eligibility',
- })}
-
-
- )}
- {qfEligibilityState === EQFElegibilityState.PROCESSING && (
-
- {formatMessage({
- id: 'label.processing',
- })}
-
-
- )}
- {qfEligibilityState ===
- EQFElegibilityState.MORE_INFO_NEEDED && (
- setShowModal(true)}>
-
- {formatMessage({
- id: 'label.add_more_info',
- })}
-
-
- )}
- {qfEligibilityState === EQFElegibilityState.NOT_SIGNED && (
- setSignWithWallet(true)}>
-
+ {currentRound &&
+ qfEligibilityState ===
+ EQFElegibilityState.RECHECK_ELIGIBILITY && (
+ <>
+ {' '}
+
+ {new Date(currentRound.endDate)
+ .toLocaleString(
+ locale || 'en-US',
+ {
+ day: 'numeric',
+ month: 'short',
+ },
+ )
+ .replace(/,/g, '')}
+
+ >
+ )}
+
+
+ {qfEligibilityState ===
+ EQFElegibilityState.CHECK_ELIGIBILITY && (
+ fetchUserMBDScore()}>
+
+ {formatMessage({
+ id: 'qf_donor_eligibility.banner.link.check_eligibility',
+ })}
+
+
+ )}
+ {qfEligibilityState ===
+ EQFElegibilityState.RECHECK_ELIGIBILITY && (
+ setShowModal(true)}>
+
+ {formatMessage({
+ id: 'qf_donor_eligibility.banner.link.recheck_eligibility',
+ })}
+
+
+ )}
+ {qfEligibilityState === EQFElegibilityState.PROCESSING && (
+
{formatMessage({
- id: 'label.sign_message',
+ id: 'label.processing',
})}
-
-
-
- )}
-
- {showModal && (
+
+
+ )}
+ {qfEligibilityState ===
+ EQFElegibilityState.MORE_INFO_NEEDED && (
+ setShowModal(true)}>
+
+ {formatMessage({
+ id: 'label.add_more_info',
+ })}
+
+
+ )}
+ {qfEligibilityState === EQFElegibilityState.NOT_SIGNED && (
+ setSignWithWallet(true)}>
+
+ {formatMessage({
+ id: 'label.sign_message',
+ })}
+
+
+
+ )}
+
+ )}
+ {!isQRDonation && showModal && (
{
handleSign={handleSign}
/>
)}
- {signWithWallet && (
+ {!isQRDonation && signWithWallet && (
{
@@ -242,20 +253,24 @@ export const PassportBanner = () => {
)}
>
) : (
-
-
- {formatMessage({
- id: 'label.to_activate_your_gitcoin_passport',
- })}
-
-
- {formatMessage({
- id: 'label.switch_to_evm',
- })}
-
-
+ <>
+ {!isQRDonation && (
+
+
+ {formatMessage({
+ id: 'label.to_activate_your_gitcoin_passport',
+ })}
+
+
+ {formatMessage({
+ id: 'label.switch_to_evm',
+ })}
+
+
+ )}
+ >
);
};
@@ -271,6 +286,7 @@ export const PassportBannerWrapper = styled(Flex)`
justify-content: center;
gap: 8px;
position: relative;
+
${mediaQueries.tablet} {
flex-direction: row;
}
diff --git a/src/components/views/donate/OnTime/DonateQFEligibleNetworks.tsx b/src/components/views/donate/OnTime/DonateQFEligibleNetworks.tsx
index d547ef7e4f..00f3845cc4 100644
--- a/src/components/views/donate/OnTime/DonateQFEligibleNetworks.tsx
+++ b/src/components/views/donate/OnTime/DonateQFEligibleNetworks.tsx
@@ -16,6 +16,7 @@ import { getActiveRound } from '@/helpers/qf';
import { getChainName } from '@/lib/network';
import { ChainType } from '@/types/config';
import links from '@/lib/constants/links';
+import { slugToProjectDonate } from '@/lib/routeCreators';
const DonateQFEligibleNetworks = () => {
const [showModal, setShowModal] = useState(false);
@@ -66,25 +67,39 @@ const DonateQFEligibleNetworks = () => {
{formatMessage({
id: 'label.stellar_is_not_eligible_for_matching',
})}
+
+
+ {
+ "Go back and make sure you're on the right network"
+ }
+
+
)}
-
- setShowModal(true)}>
- {formatMessage({ id: 'label.switch_network' })}
-
-
-
-
- {formatMessage({ id: 'label.bridge_tokens' })}
+ {!isQRDonation && (
+
+ setShowModal(true)}>
+ {formatMessage({ id: 'label.switch_network' })}
-
-
-
- {showModal && (
+
+
+
+ {formatMessage({ id: 'label.bridge_tokens' })}
+
+
+
+
+ )}
+ {!isQRDonation && showModal && (
Date: Sun, 15 Sep 2024 17:00:32 +0330
Subject: [PATCH 3/9] Undo passport banner changes
---
src/components/PassportBanner.tsx | 228 ++++++++++++++----------------
1 file changed, 106 insertions(+), 122 deletions(-)
diff --git a/src/components/PassportBanner.tsx b/src/components/PassportBanner.tsx
index 9fc699212d..c176eecfbb 100644
--- a/src/components/PassportBanner.tsx
+++ b/src/components/PassportBanner.tsx
@@ -123,115 +123,104 @@ export const PassportBanner = () => {
const { isOnSolana, handleSingOutAndSignInWithEVM } = useGeneralWallet();
const [showModal, setShowModal] = useState(false);
const [signWithWallet, setSignWithWallet] = useState(false);
- const router = useRouter();
- const [isQRDonation, _setIsQRDonation] = useState(
- router.query.chain === ChainType.STELLAR.toLowerCase(),
- );
+
const isGSafeConnector = connector?.id === 'safe';
return !isOnSolana ? (
<>
- {!isQRDonation && (
-
-
-
- {PassportBannerData[qfEligibilityState].icon}
-
-
- {formatMessage(
- {
- id: PassportBannerData[qfEligibilityState]
- .content,
- },
- {
- data:
- qfEligibilityState ===
- EQFElegibilityState.NOT_STARTED &&
- currentRound
- ? smallFormatDate(
- new Date(
- currentRound?.beginDate,
- ),
- )
- : undefined,
- },
- )}
- {currentRound &&
- qfEligibilityState ===
- EQFElegibilityState.RECHECK_ELIGIBILITY && (
- <>
- {' '}
-
- {new Date(currentRound.endDate)
- .toLocaleString(
- locale || 'en-US',
- {
- day: 'numeric',
- month: 'short',
- },
- )
- .replace(/,/g, '')}
-
- >
- )}
-
-
- {qfEligibilityState ===
- EQFElegibilityState.CHECK_ELIGIBILITY && (
- fetchUserMBDScore()}>
-
- {formatMessage({
- id: 'qf_donor_eligibility.banner.link.check_eligibility',
- })}
-
-
- )}
- {qfEligibilityState ===
+
+
+
+ {PassportBannerData[qfEligibilityState].icon}
+
+
+ {formatMessage(
+ {
+ id: PassportBannerData[qfEligibilityState]
+ .content,
+ },
+ {
+ data:
+ qfEligibilityState ===
+ EQFElegibilityState.NOT_STARTED &&
+ currentRound
+ ? smallFormatDate(
+ new Date(
+ currentRound?.beginDate,
+ ),
+ )
+ : undefined,
+ },
+ )}
+ {currentRound &&
+ qfEligibilityState ===
EQFElegibilityState.RECHECK_ELIGIBILITY && (
- setShowModal(true)}>
-
- {formatMessage({
- id: 'qf_donor_eligibility.banner.link.recheck_eligibility',
- })}
-
-
- )}
- {qfEligibilityState === EQFElegibilityState.PROCESSING && (
-
+ <>
+ {' '}
+
+ {new Date(currentRound.endDate)
+ .toLocaleString(locale || 'en-US', {
+ day: 'numeric',
+ month: 'short',
+ })
+ .replace(/,/g, '')}
+
+ >
+ )}
+
+
+ {qfEligibilityState ===
+ EQFElegibilityState.CHECK_ELIGIBILITY && (
+ fetchUserMBDScore()}>
+
{formatMessage({
- id: 'label.processing',
+ id: 'qf_donor_eligibility.banner.link.check_eligibility',
})}
-
-
- )}
- {qfEligibilityState ===
- EQFElegibilityState.MORE_INFO_NEEDED && (
- setShowModal(true)}>
-
- {formatMessage({
- id: 'label.add_more_info',
- })}
-
-
- )}
- {qfEligibilityState === EQFElegibilityState.NOT_SIGNED && (
- setSignWithWallet(true)}>
-
- {formatMessage({
- id: 'label.sign_message',
- })}
-
-
-
- )}
-
- )}
- {!isQRDonation && showModal && (
+
+
+ )}
+ {qfEligibilityState ===
+ EQFElegibilityState.RECHECK_ELIGIBILITY && (
+ setShowModal(true)}>
+
+ {formatMessage({
+ id: 'qf_donor_eligibility.banner.link.recheck_eligibility',
+ })}
+
+
+ )}
+ {qfEligibilityState === EQFElegibilityState.PROCESSING && (
+
+ {formatMessage({
+ id: 'label.processing',
+ })}
+
+
+ )}
+ {qfEligibilityState ===
+ EQFElegibilityState.MORE_INFO_NEEDED && (
+ setShowModal(true)}>
+
+ {formatMessage({
+ id: 'label.add_more_info',
+ })}
+
+
+ )}
+ {qfEligibilityState === EQFElegibilityState.NOT_SIGNED && (
+ setSignWithWallet(true)}>
+
+ {formatMessage({
+ id: 'label.sign_message',
+ })}
+
+
+
+ )}
+
+ {showModal && (
{
handleSign={handleSign}
/>
)}
- {!isQRDonation && signWithWallet && (
+ {signWithWallet && (
{
@@ -253,24 +242,20 @@ export const PassportBanner = () => {
)}
>
) : (
- <>
- {!isQRDonation && (
-
-
- {formatMessage({
- id: 'label.to_activate_your_gitcoin_passport',
- })}
-
-
- {formatMessage({
- id: 'label.switch_to_evm',
- })}
-
-
- )}
- >
+
+
+ {formatMessage({
+ id: 'label.to_activate_your_gitcoin_passport',
+ })}
+
+
+ {formatMessage({
+ id: 'label.switch_to_evm',
+ })}
+
+
);
};
@@ -286,7 +271,6 @@ export const PassportBannerWrapper = styled(Flex)`
justify-content: center;
gap: 8px;
position: relative;
-
${mediaQueries.tablet} {
flex-direction: row;
}
From 5910f3108aefa3a40b51d46b712eaef60cf263b7 Mon Sep 17 00:00:00 2001
From: Mohammad Ranjbar Z
Date: Sun, 15 Sep 2024 17:04:40 +0330
Subject: [PATCH 4/9] Fix linter errors
---
src/components/PassportBanner.tsx | 44 +++++++++++++++----------------
1 file changed, 22 insertions(+), 22 deletions(-)
diff --git a/src/components/PassportBanner.tsx b/src/components/PassportBanner.tsx
index c176eecfbb..e818aa5448 100644
--- a/src/components/PassportBanner.tsx
+++ b/src/components/PassportBanner.tsx
@@ -144,35 +144,35 @@ export const PassportBanner = () => {
{
data:
qfEligibilityState ===
- EQFElegibilityState.NOT_STARTED &&
+ EQFElegibilityState.NOT_STARTED &&
currentRound
? smallFormatDate(
- new Date(
- currentRound?.beginDate,
- ),
- )
+ new Date(
+ currentRound?.beginDate,
+ ),
+ )
: undefined,
},
)}
{currentRound &&
- qfEligibilityState ===
- EQFElegibilityState.RECHECK_ELIGIBILITY && (
- <>
- {' '}
-
- {new Date(currentRound.endDate)
- .toLocaleString(locale || 'en-US', {
- day: 'numeric',
- month: 'short',
- })
- .replace(/,/g, '')}
-
- >
- )}
+ qfEligibilityState ===
+ EQFElegibilityState.RECHECK_ELIGIBILITY && (
+ <>
+ {' '}
+
+ {new Date(currentRound.endDate)
+ .toLocaleString(locale || 'en-US', {
+ day: 'numeric',
+ month: 'short',
+ })
+ .replace(/,/g, '')}
+
+ >
+ )}
{qfEligibilityState ===
- EQFElegibilityState.CHECK_ELIGIBILITY && (
+ EQFElegibilityState.CHECK_ELIGIBILITY && (
fetchUserMBDScore()}>
{formatMessage({
@@ -182,7 +182,7 @@ export const PassportBanner = () => {
)}
{qfEligibilityState ===
- EQFElegibilityState.RECHECK_ELIGIBILITY && (
+ EQFElegibilityState.RECHECK_ELIGIBILITY && (
setShowModal(true)}>
{formatMessage({
@@ -200,7 +200,7 @@ export const PassportBanner = () => {
)}
{qfEligibilityState ===
- EQFElegibilityState.MORE_INFO_NEEDED && (
+ EQFElegibilityState.MORE_INFO_NEEDED && (
setShowModal(true)}>
{formatMessage({
From 8050d7f3c37afedbae2f32091950d9b545ce797f Mon Sep 17 00:00:00 2001
From: Meriem-BM
Date: Mon, 16 Sep 2024 12:08:42 +0100
Subject: [PATCH 5/9] fix: add condition to hide QFSection when its stellar
chain
---
src/components/views/donate/DonateIndex.tsx | 10 ++++----
.../QRCodeDonation/QRDonationCard.tsx | 23 +++++++++++++++++++
2 files changed, 28 insertions(+), 5 deletions(-)
diff --git a/src/components/views/donate/DonateIndex.tsx b/src/components/views/donate/DonateIndex.tsx
index 13443c9fb8..a46dfa19e5 100644
--- a/src/components/views/donate/DonateIndex.tsx
+++ b/src/components/views/donate/DonateIndex.tsx
@@ -78,11 +78,10 @@ const DonateIndex: FC = () => {
const [showQRCode, setShowQRCode] = React.useState(
!!router.query.draft_donation,
);
- const [isQRDonation, _setIsQRDonation] = useState(
- router.query.chain === ChainType.STELLAR.toLowerCase(),
- );
const [stopTimer, setStopTimer] = React.useState void)>();
+ const isQRDonation = router.query.chain === ChainType.STELLAR.toLowerCase();
+
useEffect(() => {
dispatch(setShowHeader(false));
return () => {
@@ -270,9 +269,10 @@ const DonateIndex: FC = () => {
/>
{!isMobile ? (
- (!isRecurringTab && hasActiveQFRound) ||
+ (!isQRDonation &&
+ !isRecurringTab &&
+ hasActiveQFRound) ||
(isRecurringTab &&
- !isQRDonation &&
isOnEligibleNetworks) ? (
) : (
diff --git a/src/components/views/donate/OnTime/SelectTokenModal/QRCodeDonation/QRDonationCard.tsx b/src/components/views/donate/OnTime/SelectTokenModal/QRCodeDonation/QRDonationCard.tsx
index 05b448b3d0..6dfb96fcde 100644
--- a/src/components/views/donate/OnTime/SelectTokenModal/QRCodeDonation/QRDonationCard.tsx
+++ b/src/components/views/donate/OnTime/SelectTokenModal/QRCodeDonation/QRDonationCard.tsx
@@ -40,6 +40,7 @@ import { useAppSelector } from '@/features/hooks';
import { useModalCallback } from '@/hooks/useModalCallback';
import links from '@/lib/constants/links';
import DonateQFEligibleNetworks from '@/components/views/donate/OnTime/DonateQFEligibleNetworks';
+import { ParsedUrlQueryInput } from 'querystring';
interface QRDonationCardProps extends IDonationCardProps {
qrAcceptedTokens: IProjectAcceptedToken[];
@@ -141,20 +142,42 @@ export const QRDonationCard: FC = ({
}, [draftDonationId]);
const goBack = async () => {
+ const prevQuery = router.query;
+
+ const updateQuery = (excludeKey: string) =>
+ Object.keys(prevQuery).reduce((acc, key) => {
+ return key !== excludeKey
+ ? { ...acc, [key]: prevQuery[key] }
+ : acc;
+ }, {});
+
if (showQRCode) {
const draftDonation =
await checkDraftDonationStatus(draftDonationId);
+
if (draftDonation?.status === 'matched') {
setQRDonationStatus('success');
setDraftDonationData(draftDonation);
return;
}
+
await markDraftDonationAsFailed(draftDonationId);
setPendingDonationExists?.(false);
setShowQRCode(false);
+
+ await router.push(
+ { query: updateQuery('draft_donation') },
+ undefined,
+ { shallow: true },
+ );
} else {
setIsQRDonation(false);
+
+ await router.push({ query: updateQuery('chain') }, undefined, {
+ shallow: true,
+ });
}
+
setQRDonationStatus('waiting');
};
From 6f1a6b116473a45250fe797f7d9bb426bea46ca8 Mon Sep 17 00:00:00 2001
From: Meriem-BM
Date: Mon, 16 Sep 2024 12:12:24 +0100
Subject: [PATCH 6/9] fix: linter error
---
.../OnTime/SelectTokenModal/QRCodeDonation/QRDonationCard.tsx | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/components/views/donate/OnTime/SelectTokenModal/QRCodeDonation/QRDonationCard.tsx b/src/components/views/donate/OnTime/SelectTokenModal/QRCodeDonation/QRDonationCard.tsx
index 6dfb96fcde..859aff860b 100644
--- a/src/components/views/donate/OnTime/SelectTokenModal/QRCodeDonation/QRDonationCard.tsx
+++ b/src/components/views/donate/OnTime/SelectTokenModal/QRCodeDonation/QRDonationCard.tsx
@@ -40,7 +40,6 @@ import { useAppSelector } from '@/features/hooks';
import { useModalCallback } from '@/hooks/useModalCallback';
import links from '@/lib/constants/links';
import DonateQFEligibleNetworks from '@/components/views/donate/OnTime/DonateQFEligibleNetworks';
-import { ParsedUrlQueryInput } from 'querystring';
interface QRDonationCardProps extends IDonationCardProps {
qrAcceptedTokens: IProjectAcceptedToken[];
From 0dc52e54f261673317d397a009c32ac5919b061b Mon Sep 17 00:00:00 2001
From: Meriem-BM
Date: Mon, 16 Sep 2024 13:03:52 +0100
Subject: [PATCH 7/9] fix: showing Toast to switch network when Stellar is
picked
---
lang/ca.json | 9 +++--
lang/en.json | 1 +
lang/es.json | 4 ++-
.../OnTime/DonateQFEligibleNetworks.tsx | 34 +++++++++----------
.../QRCodeDonation/QRDonationCard.tsx | 8 ++---
5 files changed, 29 insertions(+), 27 deletions(-)
diff --git a/lang/ca.json b/lang/ca.json
index 51adaf1269..896d035358 100644
--- a/lang/ca.json
+++ b/lang/ca.json
@@ -277,6 +277,8 @@
"label.contributors": "{count, plural, one {contribuïdor} other {contribuïdors}}",
"label.conviction_voting": "Votació per convicció",
"label.copied": "Copiat!",
+ "label.go_back_and_check_network": "Torna enrere i assegura't que estàs a la xarxa correcta.",
+ "label.stellar_is_not_eligible_for_matching": "Stellar no és elegible per aquesta ronda.",
"label.copy_link": "Copiar enllaç",
"label.covenant": "conveni",
"label.created_at": "Creat el",
@@ -1302,7 +1304,7 @@
"label.passport_connected": "Passaport connectat",
"label.increase_passport_score": "Augmenta la puntuació del passaport",
"label.project_owner_address_detected": "Adreça del propietari del projecte detectada",
- "label.project_owner_cant_donate_to_own_project": "No pots donar a un projecte del qual ets propietari. Hi ha milers de projectes a Giveth que busquen el teu suport! Si us plau, tria un altre projecte per donar.",
+ "label.project_owner_cant_donate_to_own_project": "No pots donar a un projecte del qual ets propietari. Hi ha milers de projectes a Giveth que busquen el teu suport! Si us plau, tria un altre projecte per donar.",
"label.qf_donor_eligibility.banner.check_eligibility": "Fes que les teves donacions es igualin! Verifica la teva unicitat amb un clic.",
"label.qf_donor_eligibility.banner.recheck_eligibility": "Fes que les teves donacions es igualin! Augmenta la teva puntuació de Gitcoin Passport abans de",
"label.qf_donor_eligibility.banner.more_info_needed": "Necessitem una mica més d'informació per verificar la teva elegibilitat per QF!",
@@ -1627,7 +1629,8 @@
"project.givback_toast.description.non_verified_public": "Actualment, els GIVbacks només s'atorguen per donacions fetes a projectes elegibles per a GIVbacks a Ethereum. La teva contribució segueix sent important, fins i tot si no genera GIVbacks!",
"project.givback_toast.description.verified_owner": "Impulsa el teu projecte per augmentar la quantitat de GIVbacks que reben els teus donants a Ethereum i augmentar la seva visibilitat entre altres projectes.",
"project.givback_toast.description.verified_owner.note": "Com a propietari d'aquest projecte, no rebràs GIVbacks per donar-hi.",
- "project.givback_toast.description.verified_public": "Les donacions a Ethereum a projectes elegibles per a GIVbacks són recompensades amb GIV. Impulsa aquest projecte per augmentar el seu percentatge de recompenses i fer-lo més visible a la pàgina de projectes!", "project.givback_toast.title.non_verified_owner": "El teu projecte està creant o donant suport a béns públics?",
+ "project.givback_toast.description.verified_public": "Les donacions a Ethereum a projectes elegibles per a GIVbacks són recompensades amb GIV. Impulsa aquest projecte per augmentar el seu percentatge de recompenses i fer-lo més visible a la pàgina de projectes!",
+ "project.givback_toast.title.non_verified_owner": "El teu projecte està creant o donant suport a béns públics?",
"project.givback_toast.title.non_verified_owner_cancelled": "Estat Cancel·lat",
"project.givback_toast.title.non_verified_owner_deactive": "Mode Desactivat",
"project.givback_toast.title.non_verified_owner_draft": "Publica el teu projecte avui!",
@@ -1699,4 +1702,4 @@
"label.devouch.if_you_are_eligible": "Si ets un verificador elegible de Giveth, pots avalar la legitimitat d'aquest projecte, potencialment augmentant els beneficis que rep a Giveth.",
"label.devouch.learn_more_about_devouch": "Més informació sobre DeVouch i la verificació descentralitzada",
"label.devouch.attest_on_devouch": "Certifica a DeVouch"
-}
+}
\ No newline at end of file
diff --git a/lang/en.json b/lang/en.json
index add6e0c915..413f2f27bb 100644
--- a/lang/en.json
+++ b/lang/en.json
@@ -338,6 +338,7 @@
"label.donations": "Donations",
"label.donations_and_projects": "Donations & Projects",
"label.donations_made_on": "Donations made on",
+ "label.go_back_and_check_network": "Go back and make sure you're on the right network.",
"label.donations_received": "Donations Received",
"label.donation_finalized": "Donation Finalized!",
"label.donation_submitted": "Donation submitted",
diff --git a/lang/es.json b/lang/es.json
index 47de99c310..bfc3da2b80 100644
--- a/lang/es.json
+++ b/lang/es.json
@@ -338,6 +338,8 @@
"label.donations": "Donaciones",
"label.donations_and_projects": "Donaciones & Proyectos",
"label.donations_made_on": "Donaciones realizadas el",
+ "label.go_back_and_check_network": "Vuelve atrás y asegúrate de que estás en la red correcta.",
+ "label.stellar_is_not_eligible_for_matching": "Stellar no es elegible para esta ronda.",
"label.donations_received": "Donaciones Recibidas",
"label.donation_finalized": "¡Donación finalizada!",
"label.donation_submitted": "Donación enviada",
@@ -1705,4 +1707,4 @@
"label.devouch.if_you_are_eligible": "Si eres un verificador elegible de Giveth, puedes avalar la legitimidad de este proyecto, potencialmente aumentando los beneficios que recibe en Giveth.",
"label.devouch.learn_more_about_devouch": "Más información sobre DeVouch y la verificación descentralizada",
"label.devouch.attest_on_devouch": "Certificar en DeVouch"
-}
+}
\ No newline at end of file
diff --git a/src/components/views/donate/OnTime/DonateQFEligibleNetworks.tsx b/src/components/views/donate/OnTime/DonateQFEligibleNetworks.tsx
index 00f3845cc4..5bd4be5743 100644
--- a/src/components/views/donate/OnTime/DonateQFEligibleNetworks.tsx
+++ b/src/components/views/donate/OnTime/DonateQFEligibleNetworks.tsx
@@ -6,7 +6,7 @@ import {
neutralColors,
Flex,
} from '@giveth/ui-design-system';
-import React, { useState } from 'react';
+import React, { FC, useState } from 'react';
import styled from 'styled-components';
import { useIntl } from 'react-intl';
import { useRouter } from 'next/router';
@@ -16,17 +16,20 @@ import { getActiveRound } from '@/helpers/qf';
import { getChainName } from '@/lib/network';
import { ChainType } from '@/types/config';
import links from '@/lib/constants/links';
-import { slugToProjectDonate } from '@/lib/routeCreators';
-const DonateQFEligibleNetworks = () => {
+type TDonateQFEligibleNetworksProps = {
+ goBack?: () => void;
+};
+
+const DonateQFEligibleNetworks: FC = ({
+ goBack,
+}) => {
const [showModal, setShowModal] = useState(false);
const { project } = useDonateData();
const { formatMessage } = useIntl();
const router = useRouter();
- const [isQRDonation, setIsQRDonation] = useState(
- router.query.chain === ChainType.STELLAR.toLowerCase(),
- );
+ const isQRDonation = router.query.chain === ChainType.STELLAR.toLowerCase();
const { activeStartedRound } = getActiveRound(project.qfRounds);
@@ -42,6 +45,10 @@ const DonateQFEligibleNetworks = () => {
const chainsString = eligibleChainNames?.join(' & ');
+ const goBackToNetworkSelection = () => {
+ goBack?.();
+ };
+
return (
@@ -67,18 +74,9 @@ const DonateQFEligibleNetworks = () => {
{formatMessage({
id: 'label.stellar_is_not_eligible_for_matching',
})}
-
-
- {
- "Go back and make sure you're on the right network"
- }
-
-
+ goBackToNetworkSelection()} style={{ marginTop: '4px' }}>
+ {formatMessage({ id: 'label.go_back_and_check_network' })}
+
)}
{!isQRDonation && (
diff --git a/src/components/views/donate/OnTime/SelectTokenModal/QRCodeDonation/QRDonationCard.tsx b/src/components/views/donate/OnTime/SelectTokenModal/QRCodeDonation/QRDonationCard.tsx
index 859aff860b..47df7618d6 100644
--- a/src/components/views/donate/OnTime/SelectTokenModal/QRCodeDonation/QRDonationCard.tsx
+++ b/src/components/views/donate/OnTime/SelectTokenModal/QRCodeDonation/QRDonationCard.tsx
@@ -63,10 +63,8 @@ export const QRDonationCard: FC = ({
const { formatMessage } = useIntl();
const router = useRouter();
const { isSignedIn, isEnabled } = useAppSelector(state => state.user);
- const [isQRDonation, _setIsQRDonation] = useState(
- router.query.chain === ChainType.STELLAR.toLowerCase(),
- );
- const [showDonateModal, setShowDonateModal] = useState(false);
+ const isQRDonation = router.query.chain === ChainType.STELLAR.toLowerCase();
+ const [_showDonateModal, setShowDonateModal] = useState(false);
const { modalCallback: signInThenDonate } = useModalCallback(() =>
setShowDonateModal(true),
);
@@ -339,7 +337,7 @@ export const QRDonationCard: FC = ({
{hasActiveQFRound && isQRDonation && (
-
+
)}
Date: Mon, 16 Sep 2024 13:08:01 +0100
Subject: [PATCH 8/9] fix: linter error
---
lang/en.json | 2 +-
.../views/donate/OnTime/DonateQFEligibleNetworks.tsx | 9 +++++++--
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/lang/en.json b/lang/en.json
index 413f2f27bb..2610fd80ab 100644
--- a/lang/en.json
+++ b/lang/en.json
@@ -1709,4 +1709,4 @@
"label.devouch.if_you_are_eligible": "If you are an eligible Giveth Verifier you can vouch for this project's legitimacy, potentially increasing the benefits it receives on Giveth.",
"label.devouch.learn_more_about_devouch": "Learn more about DeVouch & Decentralized Verification",
"label.devouch.attest_on_devouch": "Attest on Devouch"
-}
+}
\ No newline at end of file
diff --git a/src/components/views/donate/OnTime/DonateQFEligibleNetworks.tsx b/src/components/views/donate/OnTime/DonateQFEligibleNetworks.tsx
index 5bd4be5743..b035e8bc4a 100644
--- a/src/components/views/donate/OnTime/DonateQFEligibleNetworks.tsx
+++ b/src/components/views/donate/OnTime/DonateQFEligibleNetworks.tsx
@@ -74,8 +74,13 @@ const DonateQFEligibleNetworks: FC = ({
{formatMessage({
id: 'label.stellar_is_not_eligible_for_matching',
})}
- goBackToNetworkSelection()} style={{ marginTop: '4px' }}>
- {formatMessage({ id: 'label.go_back_and_check_network' })}
+ goBackToNetworkSelection()}
+ style={{ marginTop: '4px' }}
+ >
+ {formatMessage({
+ id: 'label.go_back_and_check_network',
+ })}
)}
From 30a40bab2b5a3270e33269857d323f0782ecfb40 Mon Sep 17 00:00:00 2001
From: Meriem-BM
Date: Mon, 16 Sep 2024 14:21:56 +0100
Subject: [PATCH 9/9] fix: hide AlreadyDonated toast
---
src/components/views/donate/DonateIndex.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/views/donate/DonateIndex.tsx b/src/components/views/donate/DonateIndex.tsx
index a46dfa19e5..4778ab26d6 100644
--- a/src/components/views/donate/DonateIndex.tsx
+++ b/src/components/views/donate/DonateIndex.tsx
@@ -230,7 +230,7 @@ const DonateIndex: FC = () => {
}
/>
)}
- {alreadyDonated && (
+ {alreadyDonated && !isQRDonation && (