import { useTranslation } from 'react-i18next'; import { spoolbuddyApi } from '../../api/client'; interface WeightDisplayProps { weight: number | null; weightStable: boolean; deviceOnline: boolean; deviceId: string | null; } export function WeightDisplay({ weight, weightStable, deviceOnline, deviceId }: WeightDisplayProps) { const { t } = useTranslation(); const handleTare = async () => { if (!deviceId) return; try { await spoolbuddyApi.tare(deviceId); } catch (e) { console.error('Failed to tare:', e); } }; const formatWeight = (w: number | null) => { if (w === null) return '--.-'; return w.toFixed(1); }; return (