diff --git a/src/components/atoms/EtherscanLink.tsx b/src/components/atoms/EtherscanLink.tsx index 5634e1cfc..8e7cd12be 100644 --- a/src/components/atoms/EtherscanLink.tsx +++ b/src/components/atoms/EtherscanLink.tsx @@ -2,6 +2,7 @@ import React, { ReactElement, ReactNode } from 'react' import { getNetworkName } from '../../utils/wallet' import { ReactComponent as External } from '../../images/external.svg' import styles from './EtherscanLink.module.css' +import { useSiteMetadata } from '../../hooks/useSiteMetadata' export default function EtherscanLink({ networkId, @@ -12,10 +13,15 @@ export default function EtherscanLink({ path: string children: ReactNode }): ReactElement { + const { appConfig } = useSiteMetadata() const url = networkId === 1 ? `https://etherscan.io` - : `https://${getNetworkName(networkId).toLowerCase()}.etherscan.io` + : `https://${ + networkId + ? getNetworkName(networkId).toLowerCase() + : appConfig.network + }.etherscan.io` return ( void }): ReactElement { - const { networkId } = useOcean() + const { networkId, ocean } = useOcean() return ( <> @@ -27,7 +27,12 @@ export default function Actions({ {isLoading ? ( ) : ( - )} diff --git a/src/components/organisms/AssetActions/Pool/Add.tsx b/src/components/organisms/AssetActions/Pool/Add.tsx index 457f44798..f6fad86bd 100644 --- a/src/components/organisms/AssetActions/Pool/Add.tsx +++ b/src/components/organisms/AssetActions/Pool/Add.tsx @@ -207,6 +207,7 @@ export default function Add({ !touched?.amount && setTouched({ amount: true }) handleChange(e) }} + disabled={!ocean} /> )} diff --git a/src/components/organisms/AssetActions/Pool/index.tsx b/src/components/organisms/AssetActions/Pool/index.tsx index 5e59b49f6..645d9e1f7 100644 --- a/src/components/organisms/AssetActions/Pool/index.tsx +++ b/src/components/organisms/AssetActions/Pool/index.tsx @@ -54,7 +54,6 @@ export default function Pool({ ddo }: { ddo: DDO }): ReactElement { const [showAdd, setShowAdd] = useState(false) const [showRemove, setShowRemove] = useState(false) - const [isLoading, setIsLoading] = useState(true) // TODO: put all these variables behind some useEffect // to prevent unneccessary updating on every render @@ -76,8 +75,6 @@ export default function Pool({ ddo }: { ddo: DDO }): ReactElement { if (!ocean || !accountId || !price || !price.value) return async function init() { - setIsLoading(true) - try { // // Get everything which is in the pool @@ -116,8 +113,6 @@ export default function Pool({ ddo }: { ddo: DDO }): ReactElement { setSwapFee(`${Number(swapFee) * 100}`) } catch (error) { Logger.error(error.message) - } finally { - setIsLoading(false) } } init() @@ -125,9 +120,7 @@ export default function Pool({ ddo }: { ddo: DDO }): ReactElement { return ( <> - {isLoading && !userLiquidity ? ( - - ) : showAdd ? ( + {showAdd ? (
={' '} - - + +
Pool @@ -174,8 +167,8 @@ export default function Pool({ ddo }: { ddo: DDO }): ReactElement { } - ocean={`${userLiquidity.ocean}`} - dt={`${userLiquidity.datatoken}`} + ocean={`${userLiquidity?.ocean}`} + dt={`${userLiquidity?.datatoken}`} dtSymbol={dtSymbol} poolShares={poolTokens} conversion={totalUserLiquidityInOcean} @@ -186,8 +179,8 @@ export default function Pool({ ddo }: { ddo: DDO }): ReactElement {