import styles from './AutoRefreshIndicator.module.css'; export interface AutoRefreshIndicatorProps { active: boolean; pulseKey?: number; label?: string; error?: boolean; onClick?: () => void; } export function AutoRefreshIndicator({ active, pulseKey, label = 'Live', error = false, onClick, }: AutoRefreshIndicatorProps) { const stateClass = error ? styles.error : active ? styles.active : styles.inactive; const titleText = error ? 'Refresh failed — click to retry' : active ? 'Auto-refreshing' : 'Auto-refresh stopped'; return (
(e.key === 'Enter' || e.key === ' ') && onClick() : undefined} > {pulseKey !== undefined && pulseKey > 0 && } {error ? 'Error' : label}
); }