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