diff --git a/src/components/nav/Header.tsx b/src/components/nav/Header.tsx index fcce259..470c9d7 100644 --- a/src/components/nav/Header.tsx +++ b/src/components/nav/Header.tsx @@ -2,7 +2,7 @@ import Image from 'next/future/image'; import Link from 'next/link'; import useDropdownMenu from 'react-accessible-dropdown-menu-hook'; -import { Environment } from '../../consts/appConfig'; +import { Environment, envDisplayValue } from '../../consts/environments'; import { links } from '../../consts/links'; import BookIcon from '../../images/icons/book.svg'; import BugIcon from '../../images/icons/bug.svg'; @@ -118,8 +118,8 @@ function NetworkSelector() { } const envOptions = [ - { value: Environment.Mainnet, display: 'Mainnet' }, - { value: Environment.Testnet2, display: 'Testnet' }, + { value: Environment.Mainnet, display: envDisplayValue[Environment.Mainnet] }, + { value: Environment.Testnet2, display: envDisplayValue[Environment.Testnet2] }, ]; const styles = { diff --git a/src/consts/appConfig.ts b/src/consts/appConfig.ts index 24dbc7d..170c6b2 100644 --- a/src/consts/appConfig.ts +++ b/src/consts/appConfig.ts @@ -1,14 +1,10 @@ -export enum Environment { - Mainnet = 'mainnet', - Testnet2 = 'testnet2', -} +import { Environment } from './environments'; const isDevMode = process?.env?.NODE_ENV === 'development'; const version = process?.env?.NEXT_PUBLIC_VERSION ?? null; export const configs: Record = { mainnet: { - name: 'Hyperlane Explorer', environment: Environment.Mainnet, debug: isDevMode, version, @@ -16,7 +12,6 @@ export const configs: Record = { apiUrl: 'https://abacus-explorer-api.hasura.app/v1/graphql', }, testnet2: { - name: 'Hyperlane Testnet Explorer', environment: Environment.Testnet2, debug: true, version, @@ -26,7 +21,6 @@ export const configs: Record = { }; interface Config { - name: string; environment: Environment; debug: boolean; version: string | null; diff --git a/src/consts/environments.ts b/src/consts/environments.ts new file mode 100644 index 0000000..ae4c6cb --- /dev/null +++ b/src/consts/environments.ts @@ -0,0 +1,9 @@ +export enum Environment { + Mainnet = 'mainnet', + Testnet2 = 'testnet2', +} + +export const envDisplayValue = { + [Environment.Mainnet]: 'Mainnet', + [Environment.Testnet2]: 'Testnet', +}; diff --git a/src/features/debugger/TxDebugger.tsx b/src/features/debugger/TxDebugger.tsx index dd0a96b..f4b37d7 100644 --- a/src/features/debugger/TxDebugger.tsx +++ b/src/features/debugger/TxDebugger.tsx @@ -7,11 +7,15 @@ import { SearchInvalidError, SearchUnknownError, } from '../../components/search/SearchError'; +import { envDisplayValue } from '../../consts/environments'; +import { useStore } from '../../store'; import useDebounce from '../../utils/debounce'; import { sanitizeString } from '../../utils/string'; import { isValidSearchQuery } from '../search/utils'; export function TxDebugger() { + const environment = useStore((s) => s.environment); + // Search text input const [searchInput, setSearchInput] = useState(''); const debouncedSearchInput = useDebounce(searchInput, 750); @@ -34,7 +38,7 @@ export function TxDebugger() {
{/* Content header and filter bar */}
-

{!hasInput ? 'Transaction Debugger' : 'Search Result'}

+

{`Transaction Debugger (${envDisplayValue[environment]})`}

{/* Message list */} {JSON.stringify(txResult)} diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index 8a96908..5227f31 100755 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -14,7 +14,8 @@ import { publicProvider } from 'wagmi/providers/public'; import { ErrorBoundary } from '../components/errors/ErrorBoundary'; import { AppLayout } from '../components/layout/AppLayout'; -import { Environment, configs } from '../consts/appConfig'; +import { configs } from '../consts/appConfig'; +import { Environment } from '../consts/environments'; import { prodChains } from '../consts/networksConfig'; import { useStore } from '../store'; import { Color } from '../styles/Color'; diff --git a/src/store.ts b/src/store.ts index 0c9c751..3ebdf43 100644 --- a/src/store.ts +++ b/src/store.ts @@ -1,6 +1,6 @@ import create from 'zustand'; -import { Environment } from './consts/appConfig'; +import { Environment } from './consts/environments'; // Keeping everything here for now as state is simple // Will refactor into slices as necessary