MCPcopy Create free account
hub / github.com/botbotrobotics/BotBrain / PacketLossIndicator

Function PacketLossIndicator

frontend/src/components/robot-header.tsx:962–987  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

960
961// Packet loss indicator
962function 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
990function ConnectionQualityWarning() {

Callers

nothing calls this directly

Calls 3

useNetworkMetricsFunction · 0.85
getPacketLossColorFunction · 0.85
getQualityTextFunction · 0.85

Tested by

no test coverage detected