1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

show network at all times in wallet component

This commit is contained in:
Matthias Kretschmann 2021-05-27 13:01:14 +02:00
parent 10b29c6e37
commit fa682dad1e
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -13,15 +13,12 @@ export default function Network(): ReactElement {
const { config } = useOcean()
const networkIdConfig = (config as ConfigHelperConfig).networkId
const [isEthMainnet, setIsEthMainnet] = useState<boolean>()
const [isSupportedNetwork, setIsSupportedNetwork] = useState<boolean>()
useEffect(() => {
// take network from user when present,
// otherwise use the default configured one of app
const network = networkId || networkIdConfig
const isEthMainnet = network === 1
setIsEthMainnet(isEthMainnet)
// Check networkId against ocean.js ConfigHelper configs
// to figure out if network is supported.
@ -29,7 +26,7 @@ export default function Network(): ReactElement {
setIsSupportedNetwork(isSupportedNetwork)
}, [networkId, networkIdConfig])
return !isEthMainnet && networkId ? (
return networkId ? (
<div className={styles.network}>
{!isSupportedNetwork && (
<Tooltip content="No Ocean Protocol contracts are deployed to this network.">