add links to menu

This commit is contained in:
liangping 2021-11-18 22:01:19 +08:00
parent e4dab58683
commit d7160ee500
3 changed files with 39 additions and 1 deletions

View File

@ -321,6 +321,11 @@ export function formatTokenAmount(tokenAmount, fraction = 2, denom = 'uatom') {
return parseFloat(amount)
}
export function isTestnet() {
return (window.location.hostname.startsWith('testnet')
|| window.location.search.indexOf('testnet') > -1)
}
export function formatToken(token, IBCDenom = {}, decimals = 2) {
if (token) {
return `${formatTokenAmount(token.amount, decimals, token.denom)} ${formatTokenDenom(IBCDenom[token.denom] || token.denom)}`

View File

@ -1,4 +1,5 @@
import store from '@/store'
import { isTestnet } from '../../libs/data/data'
const modules = [
{
@ -71,6 +72,36 @@ function processMenu() {
menu.children = children
chainMenus.push(menu)
})
chainMenus.push({ header: 'LINKS' })
if (isTestnet()) {
chainMenus.push({
title: 'Mainnet Explorer',
href: 'https://ping.pub',
icon: 'ChromeIcon',
})
} else {
chainMenus.push({
title: 'Testnet Explorer',
href: 'http://testnet.ping.pub',
icon: 'LifeBuoyIcon',
})
}
chainMenus.push({
title: 'Discord',
href: 'https://discord.gg/CmjYVSr6GW',
icon: 'EyeIcon',
})
chainMenus.push({
title: 'Twitter',
href: 'https://twitter.com/ping_pub',
icon: 'TwitterIcon',
})
chainMenus.push({
title: 'Github',
href: 'https://github.com/ping-pub/explorer',
icon: 'GithubIcon',
})
return chainMenus
}

View File

@ -1,7 +1,9 @@
import { isTestnet } from '@/libs/data/data'
let chains = {}
let configs = require.context('../../chains/mainnet', false, /\.json$/)
if (window.location.hostname.startsWith('testnet') || window.location.search.indexOf('testnet') > -1) {
if (isTestnet()) {
configs = require.context('../../chains/testnet', false, /\.json$/)
}