From 1fa6303850fd10923d57149c3df0b37f4a92b8c5 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Mon, 26 Oct 2020 18:27:34 +0100 Subject: [PATCH] fix fallback etherscan link --- src/components/atoms/EtherscanLink.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 (