From 4aca56baea81e4acfa5e496910a65279898c73e7 Mon Sep 17 00:00:00 2001 From: alireza-sharifpour Date: Tue, 25 Jul 2023 14:48:35 +0330 Subject: [PATCH 01/27] removed isSameAddress functionality and checkbox --- src/components/views/create/CreateProject.tsx | 72 ++++++++----------- 1 file changed, 28 insertions(+), 44 deletions(-) diff --git a/src/components/views/create/CreateProject.tsx b/src/components/views/create/CreateProject.tsx index 92873c8859..a2aec689a8 100644 --- a/src/components/views/create/CreateProject.tsx +++ b/src/components/views/create/CreateProject.tsx @@ -47,7 +47,6 @@ import { Shadow } from '@/components/styled-components/Shadow'; import { deviceSize, mediaQueries } from '@/lib/constants/constants'; // import useLeaveConfirm from '@/hooks/useLeaveConfirm'; import config from '@/configuration'; -import CheckBox from '@/components/Checkbox'; import Guidelines from '@/components/views/create/Guidelines'; import useDetectDevice from '@/hooks/useDetectDevice'; import { setShowFooter } from '@/features/general/general.slice'; @@ -173,9 +172,7 @@ const CreateProject: FC = ({ project }) => { const [optimismAddressActive, setOptimismAddressActive] = useState( isEditMode ? !!prevOptimismAddress : true, ); - const [isSameAddress, setIsSameAddress] = useState( - isEditMode ? isSamePrevAddresses : true, - ); + const [isLoading, setIsLoading] = useState(false); const [resolvedENS, setResolvedENS] = useState(''); @@ -199,34 +196,33 @@ const CreateProject: FC = ({ project }) => { draft, } = formData; - if (isSameAddress) { - const address = isAddressENS(mainAddress) - ? resolvedENS - : mainAddress; - const checksumAddress = utils.getAddress(address); - addresses.push( - { - address: checksumAddress, - networkId: MAINNET_NETWORK_NUMBER, - }, - { - address: checksumAddress, - networkId: XDAI_NETWORK_NUMBER, - }, - { - address: checksumAddress, - networkId: POLYGON_NETWORK_NUMBER, - }, - { - address: checksumAddress, - networkId: CELO_NETWORK_NUMBER, - }, - { - address: checksumAddress, - networkId: OPTIMISM_NETWORK_NUMBER, - }, - ); - } else { + const address = isAddressENS(mainAddress) + ? resolvedENS + : mainAddress; + const checksumAddress = utils.getAddress(address); + addresses.push( + { + address: checksumAddress, + networkId: MAINNET_NETWORK_NUMBER, + }, + { + address: checksumAddress, + networkId: XDAI_NETWORK_NUMBER, + }, + { + address: checksumAddress, + networkId: POLYGON_NETWORK_NUMBER, + }, + { + address: checksumAddress, + networkId: CELO_NETWORK_NUMBER, + }, + { + address: checksumAddress, + networkId: OPTIMISM_NETWORK_NUMBER, + }, + ); + { if (mainnetAddressActive) { const address = isAddressENS(mainAddress) ? resolvedENS @@ -370,16 +366,8 @@ const CreateProject: FC = ({ project }) => { id: 'label.you_can_set_a_custom_ethereum_address', })} - = ({ project }) => { /> {}} @@ -426,7 +413,6 @@ const CreateProject: FC = ({ project }) => { /> {}} @@ -449,7 +435,6 @@ const CreateProject: FC = ({ project }) => { /> {}} @@ -472,7 +457,6 @@ const CreateProject: FC = ({ project }) => { /> {}} From f9430276ea73d185521afdd19f0d0efa50f6ca70 Mon Sep 17 00:00:00 2001 From: alireza-sharifpour Date: Tue, 25 Jul 2023 14:49:10 +0330 Subject: [PATCH 02/27] Made isSame address value false on walletAddressInput --- src/components/views/create/WalletAddressInput.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/views/create/WalletAddressInput.tsx b/src/components/views/create/WalletAddressInput.tsx index 6046e52dd5..2fa46b9970 100644 --- a/src/components/views/create/WalletAddressInput.tsx +++ b/src/components/views/create/WalletAddressInput.tsx @@ -31,7 +31,7 @@ import { networksParams } from '@/helpers/blockchain'; interface IProps { networkId: number; userAddresses: string[]; - sameAddress: boolean; + sameAddress?: boolean; isActive: boolean; setIsActive: (active: boolean) => void; resolvedENS?: string; @@ -41,7 +41,7 @@ interface IProps { const WalletAddressInput: FC = ({ networkId, userAddresses, - sameAddress, + sameAddress = false, isActive, setIsActive, resolvedENS, From b01161362f3654eb8ff9f4c3f9d23200ccd73bd9 Mon Sep 17 00:00:00 2001 From: alireza-sharifpour Date: Tue, 25 Jul 2023 16:08:47 +0330 Subject: [PATCH 03/27] Created CreateProjectAddAddressModal --- .../create/CreateProjectAddAddressModal.tsx | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/components/views/create/CreateProjectAddAddressModal.tsx diff --git a/src/components/views/create/CreateProjectAddAddressModal.tsx b/src/components/views/create/CreateProjectAddAddressModal.tsx new file mode 100644 index 0000000000..fc06f9a4da --- /dev/null +++ b/src/components/views/create/CreateProjectAddAddressModal.tsx @@ -0,0 +1,28 @@ +import { IconWalletOutline24 } from '@giveth/ui-design-system'; +import React from 'react'; +import { Modal } from '@/components/modals/Modal'; +import { useModalAnimation } from '@/hooks/useModalAnimation'; + +interface ICreateProjectAddAddressModal { + setShowModal: (show: boolean) => void; +} + +const CreateProjectAddAddressModal = ({ + setShowModal, +}: ICreateProjectAddAddressModal) => { + const { isAnimating, closeModal } = useModalAnimation(setShowModal); + + return ( + } + > + CreateProjectAddAddressModal + + ); +}; + +export default CreateProjectAddAddressModal; From 1916a339499bc62e778b861dc15f50d5119adfa4 Mon Sep 17 00:00:00 2001 From: alireza-sharifpour Date: Wed, 26 Jul 2023 13:01:18 +0330 Subject: [PATCH 04/27] Added walletAddressInput to CreateProjectAddAddressModal --- .../create/CreateProjectAddAddressModal.tsx | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/components/views/create/CreateProjectAddAddressModal.tsx b/src/components/views/create/CreateProjectAddAddressModal.tsx index fc06f9a4da..4daaa94ae8 100644 --- a/src/components/views/create/CreateProjectAddAddressModal.tsx +++ b/src/components/views/create/CreateProjectAddAddressModal.tsx @@ -2,13 +2,22 @@ import { IconWalletOutline24 } from '@giveth/ui-design-system'; import React from 'react'; import { Modal } from '@/components/modals/Modal'; import { useModalAnimation } from '@/hooks/useModalAnimation'; +import WalletAddressInput from './WalletAddressInput'; interface ICreateProjectAddAddressModal { setShowModal: (show: boolean) => void; + networkId: number; + isActive: boolean; + setIsActive: (active: boolean) => void; + userAddresses: string[]; } const CreateProjectAddAddressModal = ({ setShowModal, + networkId, + isActive, + setIsActive, + userAddresses, }: ICreateProjectAddAddressModal) => { const { isAnimating, closeModal } = useModalAnimation(setShowModal); @@ -20,7 +29,13 @@ const CreateProjectAddAddressModal = ({ headerTitle='Add an Address' headerIcon={} > - CreateProjectAddAddressModal + {}} + /> ); }; From f596bbb81b0c1e7454bf22abb3c9260a69f69d65 Mon Sep 17 00:00:00 2001 From: alireza-sharifpour Date: Wed, 26 Jul 2023 13:03:41 +0330 Subject: [PATCH 05/27] Removed Active checkbox from WalletAddressInput --- .../views/create/WalletAddressInput.tsx | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/src/components/views/create/WalletAddressInput.tsx b/src/components/views/create/WalletAddressInput.tsx index 2fa46b9970..33067a9264 100644 --- a/src/components/views/create/WalletAddressInput.tsx +++ b/src/components/views/create/WalletAddressInput.tsx @@ -20,7 +20,6 @@ import { gqlAddressValidation } from '@/components/views/create/helpers'; import { IconGnosisChain } from '@/components/Icons/GnosisChain'; import { Shadow } from '@/components/styled-components/Shadow'; import { Flex, FlexCenter } from '@/components/styled-components/Flex'; -import CheckBox from '@/components/Checkbox'; import { getAddressFromENS, isAddressENS } from '@/lib/wallet'; import InlineToast, { EToastType } from '@/components/toasts/InlineToast'; import useDelay from '@/hooks/useDelay'; @@ -33,7 +32,6 @@ interface IProps { userAddresses: string[]; sameAddress?: boolean; isActive: boolean; - setIsActive: (active: boolean) => void; resolvedENS?: string; setResolvedENS: (resolvedENS: string) => void; } @@ -42,8 +40,7 @@ const WalletAddressInput: FC = ({ networkId, userAddresses, sameAddress = false, - isActive, - setIsActive, + isActive = true, resolvedENS, setResolvedENS, }) => { @@ -272,19 +269,6 @@ const WalletAddressInput: FC = ({ })} - {!isHidden && ( - - - - )} ); }; From ed494bd4bd1baec6377c362e290c8d27f22a1d6c Mon Sep 17 00:00:00 2001 From: alireza-sharifpour Date: Wed, 26 Jul 2023 15:08:01 +0330 Subject: [PATCH 06/27] removed extra codes --- src/components/views/create/CreateProject.tsx | 118 ++++-------------- 1 file changed, 23 insertions(+), 95 deletions(-) diff --git a/src/components/views/create/CreateProject.tsx b/src/components/views/create/CreateProject.tsx index a2aec689a8..76fbb5baf2 100644 --- a/src/components/views/create/CreateProject.tsx +++ b/src/components/views/create/CreateProject.tsx @@ -98,6 +98,7 @@ const CreateProject: FC = ({ project }) => { const [editProjectMutation] = useMutation(UPDATE_PROJECT); const router = useRouter(); const dispatch = useAppDispatch(); + const [showAddressModal, setShowAddressModal] = useState(false); const isEditMode = !!project; const { title, description, categories, impactLocation, image, addresses } = @@ -153,31 +154,15 @@ const CreateProject: FC = ({ project }) => { [EInputs.optimismAddress]: prevOptimismAddress || '', }, }); - + console.log('Formmm', formMethods.getValues()); const { unregister, handleSubmit, setValue } = formMethods; const [creationSuccessful, setCreationSuccessful] = useState(); - const [mainnetAddressActive, setMainnetAddressActive] = useState( - isEditMode ? !!prevMainAddress : true, - ); - const [gnosisAddressActive, setGnosisAddressActive] = useState( - isEditMode ? !!prevGnosisAddress : true, - ); - const [polygonAddressActive, setPolygonAddressActive] = useState( - isEditMode ? !!prevPolygonAddress : true, - ); - const [celoAddressActive, setCeloAddressActive] = useState( - isEditMode ? !!prevCeloAddress : true, - ); - const [optimismAddressActive, setOptimismAddressActive] = useState( - isEditMode ? !!prevOptimismAddress : true, - ); const [isLoading, setIsLoading] = useState(false); const [resolvedENS, setResolvedENS] = useState(''); // useLeaveConfirm({ shouldConfirm: formChange }); - const onSubmit = async (formData: TInputs) => { try { setIsLoading(true); @@ -195,7 +180,7 @@ const CreateProject: FC = ({ project }) => { image, draft, } = formData; - + console.log('Formdataaddress', formData); const address = isAddressENS(mainAddress) ? resolvedENS : mainAddress; @@ -223,7 +208,7 @@ const CreateProject: FC = ({ project }) => { }, ); { - if (mainnetAddressActive) { + if (mainAddress) { const address = isAddressENS(mainAddress) ? resolvedENS : mainAddress; @@ -233,28 +218,28 @@ const CreateProject: FC = ({ project }) => { networkId: MAINNET_NETWORK_NUMBER, }); } - if (gnosisAddressActive) { + if (gnosisAddress) { const checksumAddress = utils.getAddress(gnosisAddress); addresses.push({ address: checksumAddress, networkId: XDAI_NETWORK_NUMBER, }); } - if (polygonAddressActive) { + if (polygonAddress) { const checksumAddress = utils.getAddress(polygonAddress); addresses.push({ address: checksumAddress, networkId: POLYGON_NETWORK_NUMBER, }); } - if (celoAddressActive) { + if (celoAddress) { const checksumAddress = utils.getAddress(celoAddress); addresses.push({ address: checksumAddress, networkId: CELO_NETWORK_NUMBER, }); } - if (optimismAddressActive) { + if (optimismAddress) { const checksumAddress = utils.getAddress(optimismAddress); addresses.push({ address: checksumAddress, @@ -327,14 +312,17 @@ const CreateProject: FC = ({ project }) => { dispatch(setShowFooter(true)); }; }, []); - + // const addAddress = (addressObj: IAddress) => { + // setAddresses([...addresses, addressObj]); + // }; const { isTablet, isMobile } = useDetectDevice(); const isSmallScreen = isTablet || isMobile; if (creationSuccessful) { return ; } - + console.log('addresses', addresses); + console.log('userAddresses', userAddresses); return ( @@ -368,113 +356,43 @@ const CreateProject: FC = ({ project }) => { { - if ( - !e && - !gnosisAddressActive && - !polygonAddressActive && - !celoAddressActive && - !optimismAddressActive - ) - return showToastError( - formatMessage({ - id: 'label.you_must_select_at_least_one_address', - }), - ); if (!e) unregister(EInputs.mainAddress); - setMainnetAddressActive(e); }} /> {}} setIsActive={e => { - if ( - !e && - !mainnetAddressActive && - !polygonAddressActive && - !celoAddressActive && - !optimismAddressActive - ) - return showToastError( - formatMessage({ - id: 'label.you_must_select_at_least_one_address', - }), - ); if (!e) unregister(EInputs.gnosisAddress); - setGnosisAddressActive(e); }} /> {}} setIsActive={e => { - if ( - !e && - !mainnetAddressActive && - !gnosisAddressActive && - !celoAddressActive && - !optimismAddressActive - ) - return showToastError( - formatMessage({ - id: 'label.you_must_select_at_least_one_address', - }), - ); if (!e) unregister(EInputs.polygonAddress); - setPolygonAddressActive(e); }} /> {}} setIsActive={e => { - if ( - !e && - !mainnetAddressActive && - !gnosisAddressActive && - !polygonAddressActive && - !optimismAddressActive - ) - return showToastError( - formatMessage({ - id: 'label.you_must_select_at_least_one_address', - }), - ); if (!e) unregister(EInputs.celoAddress); - setCeloAddressActive(e); }} /> {}} setIsActive={e => { - if ( - !e && - !mainnetAddressActive && - !gnosisAddressActive && - !polygonAddressActive && - !celoAddressActive - ) - return showToastError( - formatMessage({ - id: 'label.you_must_select_at_least_one_address', - }), - ); if (!e) unregister(EInputs.optimismAddress); - setOptimismAddressActive(e); }} /> @@ -546,7 +464,17 @@ const CreateProject: FC = ({ project }) => { )} + {/* {showAddressModal && ( + + )} */} + {!isSmallScreen && ( From 469e21033a25a2f257d4fed3fe75c552dcbfdb18 Mon Sep 17 00:00:00 2001 From: alireza-sharifpour Date: Wed, 26 Jul 2023 15:09:48 +0330 Subject: [PATCH 07/27] removed extra codes --- src/components/views/create/CreateProject.tsx | 15 --------------- .../views/create/WalletAddressInput.tsx | 2 +- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/src/components/views/create/CreateProject.tsx b/src/components/views/create/CreateProject.tsx index 76fbb5baf2..b2243a7e6d 100644 --- a/src/components/views/create/CreateProject.tsx +++ b/src/components/views/create/CreateProject.tsx @@ -359,41 +359,26 @@ const CreateProject: FC = ({ project }) => { userAddresses={userAddresses} resolvedENS={resolvedENS} setResolvedENS={setResolvedENS} - setIsActive={e => { - if (!e) unregister(EInputs.mainAddress); - }} /> {}} - setIsActive={e => { - if (!e) unregister(EInputs.gnosisAddress); - }} /> {}} - setIsActive={e => { - if (!e) unregister(EInputs.polygonAddress); - }} /> {}} - setIsActive={e => { - if (!e) unregister(EInputs.celoAddress); - }} /> {}} - setIsActive={e => { - if (!e) unregister(EInputs.optimismAddress); - }} /> {isEditMode diff --git a/src/components/views/create/WalletAddressInput.tsx b/src/components/views/create/WalletAddressInput.tsx index 33067a9264..85a9b3e6d7 100644 --- a/src/components/views/create/WalletAddressInput.tsx +++ b/src/components/views/create/WalletAddressInput.tsx @@ -31,7 +31,7 @@ interface IProps { networkId: number; userAddresses: string[]; sameAddress?: boolean; - isActive: boolean; + isActive?: boolean; resolvedENS?: string; setResolvedENS: (resolvedENS: string) => void; } From 8d9ae9fbf81cccbe76e1c426cca3cffc43c6d1c7 Mon Sep 17 00:00:00 2001 From: alireza-sharifpour Date: Mon, 31 Jul 2023 11:56:49 +0330 Subject: [PATCH 08/27] added CreateProjectAddAddressModal for Mainnet --- src/components/views/create/CreateProject.tsx | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/components/views/create/CreateProject.tsx b/src/components/views/create/CreateProject.tsx index b2243a7e6d..ac43990f71 100644 --- a/src/components/views/create/CreateProject.tsx +++ b/src/components/views/create/CreateProject.tsx @@ -52,6 +52,8 @@ import useDetectDevice from '@/hooks/useDetectDevice'; import { setShowFooter } from '@/features/general/general.slice'; import { useAppDispatch } from '@/features/hooks'; import NameInput from '@/components/views/create/NameInput'; +import { IAddress } from '../verification/manageFunds/ManageFundsIndex'; +import CreateProjectAddAddressModal from './CreateProjectAddAddressModal'; const { MAINNET_NETWORK_NUMBER, @@ -312,9 +314,10 @@ const CreateProject: FC = ({ project }) => { dispatch(setShowFooter(true)); }; }, []); - // const addAddress = (addressObj: IAddress) => { - // setAddresses([...addresses, addressObj]); - // }; + const addAddress = (addressObj: IAddress) => { + // setAddresses([...addresses, addressObj]); + console.log('AddressObj', addressObj); + }; const { isTablet, isMobile } = useDetectDevice(); const isSmallScreen = isTablet || isMobile; @@ -448,14 +451,14 @@ const CreateProject: FC = ({ project }) => { /> )} + {showAddressModal && ( + + )} - {/* {showAddressModal && ( - - )} */} {!isSmallScreen && ( From 6cbe643ace9f8fd5a7beed924b352329f43c32c6 Mon Sep 17 00:00:00 2001 From: alireza-sharifpour Date: Mon, 31 Jul 2023 15:52:21 +0330 Subject: [PATCH 13/27] added new props --- src/components/views/create/AddressInterface.tsx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/components/views/create/AddressInterface.tsx b/src/components/views/create/AddressInterface.tsx index 5eb63dfaf6..e1f5e934ed 100644 --- a/src/components/views/create/AddressInterface.tsx +++ b/src/components/views/create/AddressInterface.tsx @@ -18,10 +18,15 @@ import { Flex } from '@/components/styled-components/Flex'; interface IAddressInterfaceProps { networkId: number; - address: string; + address?: string; + onButtonClick?: () => void; } -const AddressInterface = ({ networkId, address }: IAddressInterfaceProps) => { +const AddressInterface = ({ + networkId, + address, + onButtonClick, +}: IAddressInterfaceProps) => { const { register, formState: { errors }, @@ -44,8 +49,6 @@ const AddressInterface = ({ networkId, address }: IAddressInterfaceProps) => { ? EInputs.optimismAddress : EInputs.mainAddress; const value = getValues(inputName); - console.log('Value', value); - console.log('inputName', inputName); const { formatMessage } = useIntl(); const hasAddress = !!address; @@ -96,6 +99,7 @@ const AddressInterface = ({ networkId, address }: IAddressInterfaceProps) => { buttonType='texty-secondary' label={hasAddress ? 'Edit Address' : 'Add Address'} icon={} + onClick={onButtonClick} /> @@ -177,7 +181,6 @@ const TopContainer = styled.div` `; const MiddleContainer = styled.div` - border-bottom: 1px solid ${neutralColors.gray[300]}; padding: 24px 0; `; From 3c555c02eed3cdbb6394fc900ad621c3eae848a5 Mon Sep 17 00:00:00 2001 From: alireza-sharifpour Date: Tue, 1 Aug 2023 12:12:03 +0330 Subject: [PATCH 14/27] added resolvedENS to mainnet --- src/components/views/create/CreateProject.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/views/create/CreateProject.tsx b/src/components/views/create/CreateProject.tsx index 3f9af710fd..86f4b013c9 100644 --- a/src/components/views/create/CreateProject.tsx +++ b/src/components/views/create/CreateProject.tsx @@ -496,6 +496,8 @@ const CreateProject: FC = ({ project }) => { networkId={MAINNET_NETWORK_NUMBER} setShowModal={setShowMainnetAddressModal} userAddresses={userAddresses} + setResolvedENS={setResolvedENS} + resolvedENS={resolvedENS} /> )} {showGnosisAddressModal && ( From 7105294f656e80ea54e8603d6dc46796e8cedf2b Mon Sep 17 00:00:00 2001 From: alireza-sharifpour Date: Tue, 1 Aug 2023 12:12:17 +0330 Subject: [PATCH 15/27] added resolvedENS --- .../views/create/CreateProjectAddAddressModal.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/views/create/CreateProjectAddAddressModal.tsx b/src/components/views/create/CreateProjectAddAddressModal.tsx index 982353a389..5c07aac0c1 100644 --- a/src/components/views/create/CreateProjectAddAddressModal.tsx +++ b/src/components/views/create/CreateProjectAddAddressModal.tsx @@ -9,6 +9,8 @@ interface ICreateProjectAddAddressModal { networkId: number; isActive?: boolean; userAddresses: string[]; + setResolvedENS?: (resolvedENS: string) => void; + resolvedENS?: string; } const CreateProjectAddAddressModal = ({ @@ -16,6 +18,8 @@ const CreateProjectAddAddressModal = ({ networkId, isActive = true, userAddresses, + setResolvedENS = () => {}, + resolvedENS, }: ICreateProjectAddAddressModal) => { const { isAnimating, closeModal } = useModalAnimation(setShowModal); @@ -31,7 +35,8 @@ const CreateProjectAddAddressModal = ({ networkId={networkId} isActive={isActive} userAddresses={userAddresses} - setResolvedENS={() => {}} + setResolvedENS={setResolvedENS} + resolvedENS={resolvedENS ?? undefined} /> From e31618a3e092c44009da53b6e67f8690b0994dc3 Mon Sep 17 00:00:00 2001 From: alireza-sharifpour Date: Tue, 1 Aug 2023 12:47:41 +0330 Subject: [PATCH 16/27] changed hasAddress condition --- src/components/views/create/AddressInterface.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/components/views/create/AddressInterface.tsx b/src/components/views/create/AddressInterface.tsx index e1f5e934ed..5743ec8027 100644 --- a/src/components/views/create/AddressInterface.tsx +++ b/src/components/views/create/AddressInterface.tsx @@ -28,10 +28,8 @@ const AddressInterface = ({ onButtonClick, }: IAddressInterfaceProps) => { const { - register, formState: { errors }, getValues, - clearErrors, } = useFormContext(); const isMainnet = networkId === config.MAINNET_NETWORK_NUMBER; @@ -51,7 +49,7 @@ const AddressInterface = ({ const value = getValues(inputName); const { formatMessage } = useIntl(); - const hasAddress = !!address; + const hasAddress = !!address && !errors[inputName]?.message; let caption: string = ''; if (!value) { @@ -125,7 +123,7 @@ const AddressInterface = ({ )} - {address ? address : 'No address added yet!'} + {hasAddress ? address : 'No address added yet!'} From a64bb9150c72d2d2d310f33da7c34909f6197341 Mon Sep 17 00:00:00 2001 From: alireza-sharifpour Date: Tue, 1 Aug 2023 12:47:59 +0330 Subject: [PATCH 17/27] added onsubmit condition --- src/components/views/create/CreateProject.tsx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/components/views/create/CreateProject.tsx b/src/components/views/create/CreateProject.tsx index 86f4b013c9..936b0c8a5b 100644 --- a/src/components/views/create/CreateProject.tsx +++ b/src/components/views/create/CreateProject.tsx @@ -498,6 +498,9 @@ const CreateProject: FC = ({ project }) => { userAddresses={userAddresses} setResolvedENS={setResolvedENS} resolvedENS={resolvedENS} + onSubmit={() => + setShowMainnetAddressModal(false) + } /> )} {showGnosisAddressModal && ( @@ -505,6 +508,9 @@ const CreateProject: FC = ({ project }) => { networkId={XDAI_NETWORK_NUMBER} setShowModal={setShowGnosisAddressModal} userAddresses={userAddresses} + onSubmit={() => + setShowGnosisAddressModal(false) + } /> )} {showPolygonAddressModal && ( @@ -512,6 +518,9 @@ const CreateProject: FC = ({ project }) => { networkId={POLYGON_NETWORK_NUMBER} setShowModal={setShowPolygonAddressModal} userAddresses={userAddresses} + onSubmit={() => + setShowPolygonAddressModal(false) + } /> )} {showCeloAddressModal && ( @@ -519,6 +528,7 @@ const CreateProject: FC = ({ project }) => { networkId={CELO_NETWORK_NUMBER} setShowModal={setShowCeloAddressModal} userAddresses={userAddresses} + onSubmit={() => setShowCeloAddressModal(false)} /> )} {showOptimismAddressModal && ( @@ -526,6 +536,9 @@ const CreateProject: FC = ({ project }) => { networkId={OPTIMISM_NETWORK_NUMBER} setShowModal={setShowOptimismAddressModal} userAddresses={userAddresses} + onSubmit={() => + setShowOptimismAddressModal(false) + } /> )} From 8cb789e4f5252d4e058e179fd285b508c70bf856 Mon Sep 17 00:00:00 2001 From: alireza-sharifpour Date: Tue, 1 Aug 2023 12:48:10 +0330 Subject: [PATCH 18/27] added onsubmit --- src/components/views/create/CreateProjectAddAddressModal.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/views/create/CreateProjectAddAddressModal.tsx b/src/components/views/create/CreateProjectAddAddressModal.tsx index 5c07aac0c1..c5bc483acc 100644 --- a/src/components/views/create/CreateProjectAddAddressModal.tsx +++ b/src/components/views/create/CreateProjectAddAddressModal.tsx @@ -11,6 +11,7 @@ interface ICreateProjectAddAddressModal { userAddresses: string[]; setResolvedENS?: (resolvedENS: string) => void; resolvedENS?: string; + onSubmit?: () => void; } const CreateProjectAddAddressModal = ({ @@ -20,6 +21,7 @@ const CreateProjectAddAddressModal = ({ userAddresses, setResolvedENS = () => {}, resolvedENS, + onSubmit, }: ICreateProjectAddAddressModal) => { const { isAnimating, closeModal } = useModalAnimation(setShowModal); @@ -37,6 +39,7 @@ const CreateProjectAddAddressModal = ({ userAddresses={userAddresses} setResolvedENS={setResolvedENS} resolvedENS={resolvedENS ?? undefined} + onSubmit={onSubmit} /> From b3d77119b37b2289e1477d1fa141da430faed992 Mon Sep 17 00:00:00 2001 From: alireza-sharifpour Date: Tue, 1 Aug 2023 15:57:30 +0330 Subject: [PATCH 19/27] Added ButtonWrapper --- .../views/create/WalletAddressInput.tsx | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/components/views/create/WalletAddressInput.tsx b/src/components/views/create/WalletAddressInput.tsx index 85a9b3e6d7..3e36412ebf 100644 --- a/src/components/views/create/WalletAddressInput.tsx +++ b/src/components/views/create/WalletAddressInput.tsx @@ -1,8 +1,10 @@ import React, { FC, useEffect, useState } from 'react'; import { useIntl } from 'react-intl'; import { + Button, Caption, H6, + mediaQueries, neutralColors, semanticColors, } from '@giveth/ui-design-system'; @@ -34,6 +36,7 @@ interface IProps { isActive?: boolean; resolvedENS?: string; setResolvedENS: (resolvedENS: string) => void; + onSubmit?: () => void; } const WalletAddressInput: FC = ({ @@ -43,6 +46,7 @@ const WalletAddressInput: FC = ({ isActive = true, resolvedENS, setResolvedENS, + onSubmit, }) => { const { register, @@ -165,7 +169,6 @@ const WalletAddressInput: FC = ({ return e; } }; - useEffect(() => { if (sameAddress) { setTimeout(() => setIsHidden(true), 250); @@ -269,6 +272,13 @@ const WalletAddressInput: FC = ({ })} + +