Skip to content

Commit

Permalink
add better ipfs support
Browse files Browse the repository at this point in the history
  • Loading branch information
mvadari committed Nov 21, 2023
1 parent c32715b commit c34fa29
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/containers/Accounts/AccountHeader/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -267,7 +268,7 @@ const AccountHeader = (props: AccountHeaderProps) => {
{info.domain && (
<li>
<span className="label"> {t('domain')}: </span>
<a href={`http://${info.domain}`}>{info.domain}</a>
<DomainLink domain={info.domain} />
</li>
)}
{info.emailHash && (
Expand Down
8 changes: 7 additions & 1 deletion src/containers/shared/components/DomainLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<a
Expand Down

0 comments on commit c34fa29

Please sign in to comment.