From b3decd327d7bb1487609dfed75e23ca314f88373 Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 5 Oct 2023 13:30:01 +0300 Subject: [PATCH] Disable register button if user is not logged in --- .../domains/registerDomainModal/RegisterDomainModal.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/domains/registerDomainModal/RegisterDomainModal.tsx b/src/components/domains/registerDomainModal/RegisterDomainModal.tsx index 36f70d52f..fea629ab7 100644 --- a/src/components/domains/registerDomainModal/RegisterDomainModal.tsx +++ b/src/components/domains/registerDomainModal/RegisterDomainModal.tsx @@ -1,7 +1,7 @@ import { Button, Modal, Skeleton, Space, Tag } from 'antd' import clsx from 'clsx' import { useEffect, useState } from 'react' -import { useIsMyAddress } from 'src/components/auth/MyAccountsContext' +import { useIsMyAddress, useMyAddress } from 'src/components/auth/MyAccountsContext' import { SelectAccountInput } from 'src/components/common/inputs/SelectAccountInput' import { useBalancesByNetwork } from 'src/components/donate/AmountInput' import { useGetDecimalAndSymbol } from 'src/components/utils/useGetDecimalsAndSymbol' @@ -177,6 +177,7 @@ const RegisterDomainButton = ({ loadingPrice, }: BuyByDotButtonProps) => { const sellerConfig = useSelectSellerConfig() + const myAddress = useMyAddress() const { sellerChain } = sellerConfig || {} const { processingDomains } = useManageDomainContext() const price = useGetPrice(domainSellerKind, domainPrice) @@ -190,7 +191,8 @@ const RegisterDomainButton = ({ const chainProps = isSub ? {} : { decimals: decimal, currency: symbol } - const disableRegisterButton = processingDomains[domainName] || loadingPrice || price === '0' + const disableRegisterButton = + processingDomains[domainName] || loadingPrice || price === '0' || !myAddress const priceValue = withPrice && (
{price ? : <>-}