// Copyright 2017-2026 @pezkuwi/app-explorer authors & contributors // SPDX-License-Identifier: Apache-2.0 import type { TabItem } from '@pezkuwi/react-components/types'; import type { KeyedEvent } from '@pezkuwi/react-hooks/ctx/types'; import React, { useMemo, useRef } from 'react'; import { Route, Routes } from 'react-router'; import { Tabs } from '@pezkuwi/react-components'; import { useApi, useBlockAuthors, useBlockEvents } from '@pezkuwi/react-hooks'; import { isFunction } from '@pezkuwi/util'; import Api from './Api/index.js'; import BlockInfo from './BlockInfo/index.js'; import Latency from './Latency/index.js'; import NodeInfo from './NodeInfo/index.js'; import Forks from './Forks.js'; import Main from './Main.js'; import { useTranslation } from './translate.js'; interface Props { basePath: string; className?: string; newEvents?: KeyedEvent[]; } function createItemsRef (t: (key: string, options?: { replace: Record }) => string): TabItem[] { return [ { isRoot: true, name: 'chain', text: t('Chain info') }, { hasParams: true, name: 'query', text: t('Block details') }, { name: 'latency', text: t('Latency') }, { name: 'forks', text: t('Forks') }, { name: 'node', text: t('Node info') }, { // isHidden: true, name: 'api', text: t('API stats') } ]; } function ExplorerApp ({ basePath, className }: Props): React.ReactElement { const { t } = useTranslation(); const { api } = useApi(); const { lastHeaders } = useBlockAuthors(); const { eventCount, events } = useBlockEvents(); const itemsRef = useRef(createItemsRef(t)); const hidden = useMemo( () => isFunction(api.query.babe?.authorities) ? [] : ['forks'], [api] ); return (
); } export default React.memo(ExplorerApp);