import { useEffect, useState } from 'react'; export function AttendantOpsPanel({ activeChatsCount, isPaused = false, pauseDurationLabel = '00:00', isPresenceLoading = false, onTogglePause, }) { const [secondsOnline, setSecondsOnline] = useState(0); useEffect(() => { if (isPaused) return undefined; const intervalId = window.setInterval(() => { setSecondsOnline((current) => current + 1); }, 1000); return () => window.clearInterval(intervalId); }, [isPaused]); const formatTime = (totalSeconds) => { const hours = Math.floor(totalSeconds / 3600); const minutes = Math.floor((totalSeconds % 3600) / 60); const seconds = totalSeconds % 60; return [hours, minutes, seconds] .map((value) => value.toString().padStart(2, '0')) .filter((value, index) => value !== '00' || index > 0) .join(':'); }; const presenceLabel = isPaused ? 'Tempo em pausa' : 'Tempo online'; const presenceTime = isPaused ? pauseDurationLabel : formatTime(secondsOnline); const statusColor = isPaused ? '#ef4444' : '#10b981'; return (