mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
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.
88 lines
2.8 KiB
TypeScript
88 lines
2.8 KiB
TypeScript
import { Separator } from '@luxfi/ui/separator';
|
|
import { Tooltip } from '@luxfi/ui/tooltip';
|
|
import React from 'react';
|
|
|
|
import type { NavGroupItem } from 'types/client/navigation';
|
|
|
|
import { useDisclosure } from 'toolkit/hooks/useDisclosure';
|
|
import { Link } from 'toolkit/next/link';
|
|
import IconSvg from 'ui/shared/IconSvg';
|
|
|
|
import LightningLabel from '../LightningLabel';
|
|
import { checkRouteHighlight } from '../utils';
|
|
import NavLink from './NavLink';
|
|
interface Props {
|
|
item: NavGroupItem;
|
|
}
|
|
|
|
const NavLinkGroup = ({ item }: Props) => {
|
|
const { open, onOpenChange } = useDisclosure();
|
|
|
|
const isHighlighted = checkRouteHighlight(item.subItems);
|
|
const hasGroups = item.subItems.some((subItem) => Array.isArray(subItem));
|
|
|
|
const content = hasGroups ? (
|
|
<div className="flex flex-row items-stretch" style={{ gap: '1px' }}>
|
|
{ item.subItems.map((subItem, index) => {
|
|
if (!Array.isArray(subItem)) {
|
|
return <NavLink key={ subItem.text } item={ subItem }/>;
|
|
}
|
|
|
|
return (
|
|
<React.Fragment key={ index }>
|
|
{ index > 0 && <Separator orientation="vertical"/> }
|
|
<ul className="flex flex-col gap-y-1">
|
|
{ subItem.map((navItem) => <NavLink key={ navItem.text } item={ navItem }/>) }
|
|
</ul>
|
|
</React.Fragment>
|
|
);
|
|
}) }
|
|
</div>
|
|
) : (
|
|
<ul className="flex flex-col gap-y-1">
|
|
{ item.subItems.map((subItem) => {
|
|
if (Array.isArray(subItem)) {
|
|
return null;
|
|
}
|
|
return <NavLink key={ subItem.text } item={ subItem }/>;
|
|
}) }
|
|
</ul>
|
|
);
|
|
|
|
return (
|
|
<Tooltip
|
|
variant="popover"
|
|
content={ content }
|
|
onOpenChange={ onOpenChange }
|
|
lazyMount={ false }
|
|
// The popover Content defaults to `overflow-hidden` + tight `py-2`, which
|
|
// clips the last nav item (e.g. "Verified Contracts") of a tall menu list.
|
|
// Override to let the full list render and give it breathing room.
|
|
contentProps={{ className: 'overflow-visible px-1.5 py-2' }}
|
|
positioning={{
|
|
placement: 'bottom-start',
|
|
offset: { mainAxis: 8 },
|
|
}}
|
|
interactive
|
|
>
|
|
<Link
|
|
className="flex items-center px-2 py-1.5 text-sm font-medium rounded-base list-none"
|
|
variant="navigation"
|
|
{ ...(item.isActive ? { 'data-selected': true } : {}) }
|
|
{ ...(open ? { 'data-active': true } : {}) }
|
|
>
|
|
{ item.text }
|
|
{ isHighlighted && (
|
|
<LightningLabel
|
|
iconColor={ item.isActive ? 'link.navigation.bg.selected' : 'link.navigation.bg.group' }
|
|
isCollapsed={ false }
|
|
/>
|
|
) }
|
|
<IconSvg name="arrows/east-mini" className="w-5 h-5 -rotate-90 ml-1"/>
|
|
</Link>
|
|
</Tooltip>
|
|
);
|
|
};
|
|
|
|
export default React.memo(NavLinkGroup);
|