import React, { useState } from 'react'; import { ReferenceDataStatus } from '../api/types'; import { formatDate, formatNumber } from '../lib/format'; import { CodeCheckDialog } from './CodeCheckDialog'; /** * The chapters in scope (06–08, 22, 61–62, 84–85) hold about 5 800 TARIC * positions. Anything far below that is the demo seed, and a pack checked * against it comes back red for reasons that have nothing to do with the pack. */ const REAL_NOMENCLATURE_FLOOR = 1000; export function Header({ status }: { status: ReferenceDataStatus | null }) { const [checkOpen, setCheckOpen] = useState(false); return (
CargoFlow
setCheckOpen(false)} />
); } function ReferenceChip({ status }: { status: ReferenceDataStatus | null }) { if (status === null) { return ( Checking reference data… ); } const nomenclature = status.counts.nomenclature ?? 0; const measures = status.counts.measures ?? 0; const detail = Object.entries(status.counts) .map(([name, count]) => `${name}: ${formatNumber(count, 0)}`) .join(' · '); if (nomenclature === 0) { return ( No reference data loaded ); } if (nomenclature < REAL_NOMENCLATURE_FLOOR) { return ( Demo data only — {formatNumber(nomenclature, 0)} codes, {formatNumber(measures, 0)}{' '} measures ); } return ( TARIC as of {formatDate(status.referenceAsOf)} · {formatNumber(nomenclature, 0)} codes ); } function Chip({ tone, title, children, }: { tone: 'plain' | 'amber' | 'red'; title: string; children: React.ReactNode; }) { const classes = { plain: 'bg-slate-chip text-slate-chipText', amber: 'border border-confidence-amberLine bg-confidence-amberBg text-confidence-amber', red: 'border border-confidence-redLine bg-confidence-redBg text-confidence-red', }[tone]; return ( {children} ); } export function Footer() { return ( ); } export function Card({ children }: { children: React.ReactNode }) { return
{children}
; }