mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
* upgrading to ocean.js 0.14.6 * saving initial changes * creating seperate component for adding tokens * showing datatoken name * adding button for metamask users * using substring as datatoken symbol * removing duplicated code * removing empty div element * removing unneccessary div element * no longer sending the whole DDO * refactoring add token functions * updating function name * no longer sending the whole ddo to the addDataToken component * removing DDO import * small refactor, get web3 provider info in useWeb3 * general AddToken component * cleanup * cleanup, remove symbol shortening * copy, layout tweaks Co-authored-by: Matthias Kretschmann <m@kretschmann.io>
44 lines
1.0 KiB
TypeScript
44 lines
1.0 KiB
TypeScript
import React, { ReactElement, ReactNode, useEffect, useState } from 'react'
|
|
import { ReactComponent as External } from '../../images/external.svg'
|
|
import classNames from 'classnames/bind'
|
|
import { ConfigHelperConfig } from '@oceanprotocol/lib'
|
|
import { useOcean } from '../../providers/Ocean'
|
|
import styles from './ExplorerLink.module.css'
|
|
|
|
const cx = classNames.bind(styles)
|
|
|
|
export default function ExplorerLink({
|
|
path,
|
|
children,
|
|
className
|
|
}: {
|
|
networkId: number
|
|
path: string
|
|
children: ReactNode
|
|
className?: string
|
|
}): ReactElement {
|
|
const { config } = useOcean()
|
|
const [url, setUrl] = useState<string>()
|
|
|
|
const styleClasses = cx({
|
|
link: true,
|
|
[className]: className
|
|
})
|
|
|
|
useEffect(() => {
|
|
setUrl((config as ConfigHelperConfig).explorerUri)
|
|
}, [config])
|
|
|
|
return (
|
|
<a
|
|
href={`${url}/${path}`}
|
|
title={`View on ${(config as ConfigHelperConfig).explorerUri}`}
|
|
target="_blank"
|
|
rel="noreferrer"
|
|
className={styleClasses}
|
|
>
|
|
{children} <External />
|
|
</a>
|
|
)
|
|
}
|