import { formatDuration } from '../../utils/format' const ZONE_CONFIG = [ { key: 'z1', label: 'Z1 Recovery', color: '#60a5fa' }, { key: 'z2', label: 'Z2 Base', color: '#34d399' }, { key: 'z3', label: 'Z3 Tempo', color: '#fbbf24' }, { key: 'z4', label: 'Z4 Threshold', color: '#f97316' }, { key: 'z5', label: 'Z5 Max', color: '#f43f5e' }, ] // zones holds the % of time in each zone; multiply by the activity's active time // to show the approximate time spent in each. export default function HRZoneBar({ zones, totalSeconds }) { return (
{/* Stacked bar */}
{ZONE_CONFIG.map(({ key, color }) => { const pct = zones[key] || 0 if (pct < 0.5) return null return (
) })}
{/* Legend */}
{ZONE_CONFIG.map(({ key, label, color }) => { const pct = zones[key] || 0 return (
{label} {pct}% {totalSeconds > 0 && ( {formatDuration(Math.round((pct / 100) * totalSeconds))} )}
) })}
) }