import { formatCurrency } from '@/lib/format' import { heatmapLegendBounds, HEATMAP_LOW_HEX, HEATMAP_MID_HEX, HEATMAP_HIGH_MID_HEX, HEATMAP_HIGH_HEX } from '@/lib/colors' import type { HeatmapMode } from '@/lib/colors' import type { ActivitySimResult } from '@/domain/types' interface HeatmapLegendProps { perActivity: ActivitySimResult[] mode: HeatmapMode currency: string } export function HeatmapLegend({ perActivity, mode, currency }: HeatmapLegendProps) { const bounds = heatmapLegendBounds(perActivity, mode) // En modo percentile los extremos son rango (0 = más barata, 100 = más cara), no costo // literal — el percentil no es lineal respecto al costo real. function formatBound(value: number): string { if (bounds.unit === 'rank') return `P${Math.round(value)}` return formatCurrency(value, currency) } return (
Bajo costo
Alto costo
{formatBound(bounds.min)} {formatBound(bounds.mid)} {formatBound(bounds.max)}
) }