()
| 960 | |
| 961 | // Packet loss indicator |
| 962 | function PacketLossIndicator() { |
| 963 | const networkMetrics = useNetworkMetrics(1000); |
| 964 | const packetLoss = networkMetrics.packetLoss; |
| 965 | |
| 966 | // Color based on packet loss levels |
| 967 | const getPacketLossColor = () => { |
| 968 | if (packetLoss === 0) return 'text-green-600 dark:text-green-400'; |
| 969 | if (packetLoss < 1) return 'text-green-600 dark:text-green-400'; |
| 970 | if (packetLoss < 5) return 'text-yellow-600 dark:text-yellow-400'; |
| 971 | return 'text-red-600 dark:text-red-400'; |
| 972 | }; |
| 973 | |
| 974 | const getQualityText = () => { |
| 975 | if (packetLoss === 0) return 'No loss'; |
| 976 | if (packetLoss < 1) return 'Minimal'; |
| 977 | if (packetLoss < 5) return 'Acceptable'; |
| 978 | return 'High loss'; |
| 979 | }; |
| 980 | |
| 981 | return ( |
| 982 | <div className="text-right"> |
| 983 | <div className={`text-sm font-medium ${getPacketLossColor()}`}>{packetLoss}%</div> |
| 984 | <div className="text-xs text-gray-500 dark:text-gray-400">{getQualityText()}</div> |
| 985 | </div> |
| 986 | ); |
| 987 | } |
| 988 | |
| 989 | // Connection quality warning component |
| 990 | function ConnectionQualityWarning() { |
nothing calls this directly
no test coverage detected