import { useTranslation } from 'react-i18next'; export type Metric = 'weight' | 'prints' | 'time'; const METRICS: Metric[] = ['weight', 'prints', 'time']; interface MetricToggleProps { value: Metric; onChange: (metric: Metric) => void; exclude?: Metric[]; } export function MetricToggle({ value, onChange, exclude }: MetricToggleProps) { const { t } = useTranslation(); const labels: Record = { weight: t('stats.filamentByWeight'), prints: t('stats.filamentByPrints'), time: t('stats.filamentByTime'), }; const metrics = exclude ? METRICS.filter(m => !exclude.includes(m)) : METRICS; return (
{metrics.map(m => ( ))}
); }