e5f41731ae
* bootstrap next app + add overview page * fix AssetList type * fix up nav stuff * Refactor Nav component and add network components pages * Refactor WorldMap component and update TelegramIcon, GitHubIcon, NymVpnIcon, DiscordIcon, and TwitterIcon components * add service providers page * mixnodes page * delegations page + use material react table for all tables * nodes map page * Refactor StyledLink component and remove unnecessary console.log statements * Refactor ESLint configuration, remove unused dependencies, and update component imports * update deps * Refactor imports and update dependencies * fix dark mode * build single mixnode page * build single gateway page * Refactor handleOnDelegate function to use useCallback in mixnodes page.tsx * Add defaults for constants --------- Co-authored-by: Mark Sinclair <mmsinclair@users.noreply.github.com>
58 lines
1.4 KiB
TypeScript
58 lines
1.4 KiB
TypeScript
import React from 'react'
|
|
import { Button, Typography, Link as MuiLink } from '@mui/material'
|
|
import { useMainContext } from '@/app/context/main'
|
|
|
|
type NetworkTitleProps = {
|
|
showToggleNetwork?: boolean
|
|
}
|
|
|
|
const NetworkTitle = ({ showToggleNetwork }: NetworkTitleProps) => {
|
|
const { environment } = useMainContext()
|
|
|
|
const explorerName =
|
|
`${
|
|
environment && environment.charAt(0).toUpperCase() + environment.slice(1)
|
|
} Explorer` || 'Mainnet Explorer'
|
|
|
|
const switchNetworkText =
|
|
environment === 'mainnet' ? 'Switch to Testnet' : 'Switch to Mainnet'
|
|
const switchNetworkLink =
|
|
environment === 'mainnet'
|
|
? 'https://sandbox-explorer.nymtech.net'
|
|
: 'https://explorer.nymtech.net'
|
|
return (
|
|
<Typography
|
|
variant="h6"
|
|
noWrap
|
|
sx={{
|
|
color: 'nym.networkExplorer.nav.text',
|
|
fontSize: '18px',
|
|
fontWeight: 600,
|
|
}}
|
|
>
|
|
<MuiLink href="/" underline="none" color="inherit" fontWeight={700}>
|
|
{explorerName}
|
|
</MuiLink>
|
|
|
|
{showToggleNetwork && (
|
|
<Button
|
|
variant="outlined"
|
|
color="inherit"
|
|
href={switchNetworkLink}
|
|
sx={{
|
|
textTransform: 'none',
|
|
width: 114,
|
|
fontSize: '12px',
|
|
fontWeight: 600,
|
|
ml: 1,
|
|
}}
|
|
>
|
|
{switchNetworkText}
|
|
</Button>
|
|
)}
|
|
</Typography>
|
|
)
|
|
}
|
|
|
|
export { NetworkTitle }
|