diff --git a/src/Address.tsx b/src/Address.tsx index 950b04e..3bfbd41 100644 --- a/src/Address.tsx +++ b/src/Address.tsx @@ -13,6 +13,7 @@ import { faCircleNotch } from "@fortawesome/free-solid-svg-icons/faCircleNotch"; import { faQuestionCircle } from "@fortawesome/free-regular-svg-icons/faQuestionCircle"; import StandardFrame from "./StandardFrame"; import StandardSubtitle from "./StandardSubtitle"; +import AddressOrENSNameNotFound from "./components/AddressOrENSNameNotFound"; import Copy from "./components/Copy"; import NavTab from "./components/NavTab"; import SourcifyLogo from "./sourcify/SourcifyLogo"; @@ -81,9 +82,7 @@ const Address: React.FC = () => { return ( {error ? ( - - "{addressOrName}" is not an ETH address or ENS name. - + ) : ( checksummedAddress && ( <> diff --git a/src/AddressTransaction.tsx b/src/AddressTransaction.tsx index 84d5394..da709ed 100644 --- a/src/AddressTransaction.tsx +++ b/src/AddressTransaction.tsx @@ -1,6 +1,7 @@ import React, { useCallback, useContext } from "react"; import { useNavigate, useParams, useSearchParams } from "react-router-dom"; import StandardFrame from "./StandardFrame"; +import AddressOrENSNameNotFound from "./components/AddressOrENSNameNotFound"; import { ChecksummedAddress } from "./types"; import { transactionURL } from "./url"; import { useTransactionBySenderAndNonce } from "./useErigonHooks"; @@ -47,11 +48,7 @@ const AddressTransaction: React.FC = () => { ); if (error) { - return ( - - "{addressOrName}" is not an ETH address or ENS name. - - ); + return ; } if (txHash) { navigate(transactionURL(txHash)); diff --git a/src/components/AddressOrENSNameNotFound.tsx b/src/components/AddressOrENSNameNotFound.tsx new file mode 100644 index 0000000..6798124 --- /dev/null +++ b/src/components/AddressOrENSNameNotFound.tsx @@ -0,0 +1,15 @@ +import React from "react"; + +type AddressOrENSNameNotFoundProps = { + addressOrENSName: string; +}; + +const AddressOrENSNameNotFound: React.FC = ({ + addressOrENSName, +}) => ( + + "{addressOrENSName}" is not an ETH address or ENS name. + +); + +export default React.memo(AddressOrENSNameNotFound);