From c34fa29b6be27faf637defec00979b7ace7f5c54 Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Tue, 21 Nov 2023 16:19:57 -0500 Subject: [PATCH] add better ipfs support --- src/containers/Accounts/AccountHeader/index.tsx | 3 ++- src/containers/shared/components/DomainLink.tsx | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/containers/Accounts/AccountHeader/index.tsx b/src/containers/Accounts/AccountHeader/index.tsx index ef354f487..3c04aff64 100644 --- a/src/containers/Accounts/AccountHeader/index.tsx +++ b/src/containers/Accounts/AccountHeader/index.tsx @@ -12,6 +12,7 @@ import SocketContext from '../../shared/SocketContext' import InfoIcon from '../../shared/images/info.svg' import { useLanguage } from '../../shared/hooks' import Currency from '../../shared/components/Currency' +import DomainLink from '../../shared/components/DomainLink' const CURRENCY_OPTIONS = { style: 'currency', @@ -267,7 +268,7 @@ const AccountHeader = (props: AccountHeaderProps) => { {info.domain && (
  • {t('domain')}: - {info.domain} +
  • )} {info.emailHash && ( diff --git a/src/containers/shared/components/DomainLink.tsx b/src/containers/shared/components/DomainLink.tsx index 9fef0df07..abc37f7b1 100644 --- a/src/containers/shared/components/DomainLink.tsx +++ b/src/containers/shared/components/DomainLink.tsx @@ -20,7 +20,13 @@ const DomainLink = (props: Props) => { const domainHasProtocol = PROTOCOL_REGEX.test(decodedDomain) // If decoded domain does not have a protocol, add one ; otherwise, don't - const href = domainHasProtocol ? decodedDomain : `https://${decodedDomain}` + let href = domainHasProtocol ? decodedDomain : `https://${decodedDomain}` + console.log(href) + + if (href.startsWith('ipfs://')) { + href = href.replace('ipfs://', 'https://ipfs.io/ipfs/') + } + console.log(href) return (