'use client';
import { cn } from '@/lib/cn';
import { fmtInt } from '@/lib/format';
import { ORBIT_CLASS_COLORS } from '@/lib/site';
import { ORBIT_CLASSES, type GlobeFilters } from './filters';
import type { GlobeData } from './use-positions';
/** Orbit-class legend with live counts; each entry is a toggle (tap target ≥ 44 px on touch via padding). */
export function GlobeLegend({ data, filters, onToggle, className, dense = false }: { data: GlobeData | null; filters: GlobeFilters; onToggle: (cls: string) => void; className?: string; dense?: boolean }) {
return (
{ORBIT_CLASSES.map((c) => {
const idx = data?.legend.cls.indexOf(c) ?? -1;
const count = idx >= 0 ? data?.counts.cls[idx] ?? null : null;
const on = filters.cls.size === 0 || filters.cls.has(c);
const color = ORBIT_CLASS_COLORS[c] ?? 'var(--other)';
return (
-
);
})}
);
}