Files
explore/ui/pages/Stats.tsx
T
zooqueen 36e0db0b88 fix(explore): real validators + honest-empty stats/DEX + dropdown clip
Investor-grade data, no fabricated placeholders:

- pages/api/pchain.ts: derive node origin via new URL().origin instead of a
  regex that only stripped /ext/bc/C/rpc. Non-C-chain brands (hanzo:
  /ext/bc/hanzo/rpc) built a wrong URL -> HTML 404 -> JSON parse crash, so
  Validators/Total Stake/Connected/Uptime all showed 0/-. Now the P-chain
  proxy resolves correctly and the real validator set + stake render. Parse
  upstream defensively with a clear error instead of an opaque message.

- lib/api/dchain/useDexData.ts: delete all hardcoded DEMO_* markets/orders/
  trades/pools/overview. Return only real D-Chain (DexVM) data or honest-empty.
- ui/dex/DexPage.tsx: honest empty/error states per tab (no fake rows).

- stubs/stats.ts: neutralize STATS_COUNTER (title empty, value 0) so the
  'Placeholder Counter 9.074M' stub can never surface as real data.
- ui/pages/Stats.tsx: gate indexer-backed counters/charts on
  config.features.stats.isEnabled; always show the live chain-sourced Network
  Overview, with an honest 'being indexed' note when no stats microservice.

- ui/snippets/navigation/horizontal/NavLinkGroup.tsx: popover Content defaulted
  to overflow-hidden + tight py, clipping the last nav item (Verified
  Contracts). Override to overflow-visible with padding; bottom-start placement.
2026-06-23 21:06:19 -07:00

88 lines
2.8 KiB
TypeScript

import React from 'react';
import config from 'configs/app';
import useEtherscanRedirects from 'lib/router/useEtherscanRedirects';
import PageTitle from 'ui/shared/Page/PageTitle';
import NetworkStats from 'ui/stats/lux/NetworkStats';
import ChartsWidgetsList from '../stats/ChartsWidgetsList';
import NumberWidgetsList from '../stats/NumberWidgetsList';
import StatsFilters from '../stats/StatsFilters';
import useStats from '../stats/useStats';
// Aggregate counters and historical charts are served by the Blockscout stats
// microservice. On networks where it is not deployed we show the live,
// chain-sourced Network Overview (validators / chains / stake from the P-chain)
// plus an honest note — never fabricated counters.
const hasStatsService = config.features.stats.isEnabled;
const Stats = () => {
const {
isPlaceholderData,
isError,
sections,
currentSection,
handleSectionChange,
interval,
handleIntervalChange,
handleFilterChange,
displayedCharts,
initialFilterQuery,
} = useStats();
useEtherscanRedirects();
return (
<>
<PageTitle
title={ config.meta.seo.enhancedDataEnabled ? `${ config.chain.name } statistic & data` : `${ config.chain.name } stats` }
/>
<NetworkStats/>
{ hasStatsService ? (
<>
<div className="mb-6 sm:mb-8">
<NumberWidgetsList/>
</div>
<div className="mb-6 sm:mb-8">
<StatsFilters
isLoading={ isPlaceholderData }
initialFilterValue={ initialFilterQuery }
sections={ sections }
currentSection={ currentSection }
onSectionChange={ handleSectionChange }
interval={ interval }
onIntervalChange={ handleIntervalChange }
onFilterInputChange={ handleFilterChange }
/>
</div>
<ChartsWidgetsList
initialFilterQuery={ initialFilterQuery }
isError={ isError }
isPlaceholderData={ isPlaceholderData }
charts={ displayedCharts }
interval={ interval }
sections={ sections }
selectedSectionId={ currentSection }
/>
</>
) : (
<div className="mt-8 rounded-lg border border-[var(--color-border-divider)] px-6 py-10 text-center">
<div className="text-base font-medium text-[var(--color-text-primary)]">
Historical statistics are being indexed
</div>
<div className="mt-2 text-sm text-[var(--color-text-secondary)]">
Live network data is shown above. Aggregate counters and charts will
appear here once the analytics indexer is online for { config.chain.name }.
</div>
</div>
) }
</>
);
};
export default Stats;