diff --git a/frontend/src/components/ChainStatus.tsx b/frontend/src/components/ChainStatus.tsx deleted file mode 100644 index c7aa1a4..0000000 --- a/frontend/src/components/ChainStatus.tsx +++ /dev/null @@ -1,63 +0,0 @@ -'use client'; - -// The site-sync pill in the header on every page, from GET /api/v1/chain every 15 s, classified -// here against the build's own pin (src/lib/chainPin.ts) with the shared rules -// (src/lib/chainStatus.ts). The data on the page stays visible whatever the state. - -import { useChain } from '@/hooks/useApi'; -import { EXPECTED_CHAIN } from '@/lib/chainPin'; -import { classify, tone, type ChainView, type Classification } from '@/lib/chainStatus'; -import { cn } from '@/lib/utils'; -import { useFmt, useT } from '@/i18n/client'; - -const TONE_TEXT = { - positive: 'text-positive', - warning: 'text-warning', - negative: 'text-negative', - mute: 'text-mute', -} as const; - -/** The page's view and its verdict; `null` until the first answer (or failure) arrives. */ -function useChainStatus(): { view: ChainView | undefined; status: Classification | null } { - const { data, error, isLoading } = useChain(); - if (isLoading && !data && !error) return { view: undefined, status: null }; - // A failed poll classifies as unreachable even while SWR still holds the last good view. - const status = classify(error ? null : (data ?? null), EXPECTED_CHAIN, Date.now()); - return { view: data, status }; -} - -export function ChainPill({ className }: { className?: string }) { - const { t, locale } = useT(); - const fmt = useFmt(); - const { view, status } = useChainStatus(); - const state = status?.state ?? null; - const label = t(`chainStatus.states.${state ?? 'checking'}`); - return ( - - - {t('chainStatus.pill', { chain: EXPECTED_CHAIN.chain_id })} - - {label} - {view && view.head_height > 0 && ( - <> - - #{fmt.number(view.head_height)} - > - )} - - ); -} diff --git a/frontend/src/components/Header.tsx b/frontend/src/components/Header.tsx index 8a332fb..c0e4542 100644 --- a/frontend/src/components/Header.tsx +++ b/frontend/src/components/Header.tsx @@ -10,7 +10,6 @@ import { useMe } from '@/hooks/useApi'; import { L, useT } from '@/i18n/client'; import { stripLocale } from '@/i18n/locales'; import { LanguageMenu } from './LanguageMenu'; -import { ChainPill } from './ChainStatus'; const navLinks = [ { href: '/', key: 'dashboard' }, @@ -122,12 +121,6 @@ export function Header() { - {/* The site-sync pill, on its own line under the top bar: the bar is already full at - every width (the nav on wide screens, the brand and buttons on a phone). */} -