"use client"; import Link from "next/link"; import { ConfidenceMeter } from "@/components/ui/confidence"; import { FreshnessLabel } from "@/components/ui/freshness"; import { LivePrice } from "@/components/ui/price"; import { StatusBadge } from "@/components/ui/status-badge"; import { ASSET_CLASS_LABEL } from "@/lib/format"; import { useLiveQuote, useMarketStream } from "@/lib/stream"; import type { Exchange, Instrument, InstrumentCoverage, Quote } from "@/lib/types"; import { CoverageBadge } from "@/components/market/coverage-badge"; /** Sticky quote header: symbol, name, live price + change, status badge, freshness, confidence. */ export function InstrumentHeader({ instrument: i, quote, exchange, coverage }: { instrument: Instrument; quote: Quote | null; exchange: (Exchange & { status?: Exchange["status"] }) | null; coverage?: InstrumentCoverage }) { useMarketStream([`quotes:${i.id}`, `events:${i.id}`]); const live = useLiveQuote(i.id); const sources = live && quote && live.received >= Date.parse(quote.updated_at) ? live.sources : quote?.source_count; const conf = live && quote && live.received >= Date.parse(quote.updated_at) ? live.confidence : quote?.confidence; return (