cosmos-explorer/src/navigation/vertical/index.js
2022-04-26 19:32:23 +08:00

105 lines
2.1 KiB
JavaScript

import store from '@/store'
import { isTestnet } from '../../libs/utils'
const modules = [
{
scope: 'normal',
title: 'summary',
route: 'info',
},
{
scope: 'normal',
title: 'blocks',
route: 'blocks',
},
{
scope: 'normal',
title: 'staking',
route: 'staking',
},
{
scope: 'normal',
title: 'governance',
route: 'governance',
exclude: 'emoney',
},
{
scope: 'normal',
title: 'uptime',
route: 'uptime',
},
{
scope: 'normal',
title: 'statesync',
route: 'statesync',
},
{
scope: 'cos-mos',
title: 'gravity',
route: 'gravity',
},
{
scope: 'osmosis',
title: 'trade',
route: 'osmosis-trade',
},
]
function processMenu() {
const chainMenus = []
Object.keys(store.state.chains.config).forEach(chain => {
const menu = {
title: chain,
icon: store.state.chains.config[chain].logo,
}
const { excludes } = store.state.chains.config[chain]
const children = []
modules.forEach(m => {
if (excludes === undefined || excludes.indexOf(m.route) === -1) {
if (m.scope.match('normal') || m.scope.match(chain)) {
children.push({
// header: `item-${chain}-${m.route}`,
title: m.title,
route: { name: m.route, params: { chain } },
})
}
}
})
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
}
export default processMenu()