From 5db6666d0460aa2fa08e6b8b1dcf7efdba680a76 Mon Sep 17 00:00:00 2001
From: Connor Needham <129120300+ConnorNeed@users.noreply.github.com>
Date: Sat, 18 Jul 2026 06:34:44 +0000
Subject: [PATCH] feat: better style of network link panel
---
.../panels/NetworkHealthTelemetryPanel.tsx | 133 +++++++-----------
1 file changed, 51 insertions(+), 82 deletions(-)
diff --git a/src/components/panels/NetworkHealthTelemetryPanel.tsx b/src/components/panels/NetworkHealthTelemetryPanel.tsx
index 02b6efa..9f11f6e 100644
--- a/src/components/panels/NetworkHealthTelemetryPanel.tsx
+++ b/src/components/panels/NetworkHealthTelemetryPanel.tsx
@@ -3,16 +3,6 @@
import React, { useEffect, useState } from "react";
import ROSLIB from "roslib";
import { useROS } from "@/ros/ROSContext";
-import {
- BarChart,
- Bar,
- XAxis,
- YAxis,
- Tooltip,
- ResponsiveContainer,
- Cell,
- LabelList,
-} from "recharts";
const dotStyle = (up: boolean): React.CSSProperties => ({
width: 12,
@@ -177,23 +167,45 @@ const NetworkHealthTelemetryPanel: React.FC = () => {
const toMbps = (bitsPerSecond: number) => bitsPerSecond / 1_000_000;
- const throughputData = [
+ const telemetryRows = [
{
- name: "TX",
- Throughput: toMbps(stats.throughputTx),
- Capacity: toMbps(stats.bandwidthTx),
+ name: "Signal Strength",
+ value: stats.signalStrength.toFixed(2),
+ unit: "dBm",
+ good: stats.signalStrength > -70 && stats.signalStrength < -20,
},
{
- name: "RX",
- Throughput: toMbps(stats.throughputRx),
- Capacity: toMbps(stats.bandwidthRx),
+ name: "Noise Floor",
+ value: stats.noiseFloor.toFixed(2),
+ unit: "dBm",
+ good: stats.noiseFloor < -85,
+ },
+ {
+ name: "CCQ TX",
+ value: stats.ccqTx.toFixed(2),
+ unit: "%",
+ good: stats.ccqTx >= 90,
+ },
+ {
+ name: "Downlink",
+ value: `${toMbps(stats.throughputTx).toFixed(2)} / ${toMbps(
+ stats.bandwidthTx
+ ).toFixed(2)}`,
+ unit: "Mbps",
+ good:
+ stats.bandwidthTx > 0 &&
+ stats.throughputTx / stats.bandwidthTx < 0.8,
+ },
+ {
+ name: "Uplink",
+ value: `${toMbps(stats.throughputRx).toFixed(2)} / ${toMbps(
+ stats.bandwidthRx
+ ).toFixed(2)}`,
+ unit: "Mbps",
+ good:
+ stats.bandwidthRx > 0 &&
+ stats.throughputRx / stats.bandwidthRx < 0.8,
},
- ];
-
- const telemetryRows = [
- { name: "Signal Strength", value: stats.signalStrength.toFixed(2), unit: "dBm" },
- { name: "Noise Floor", value: stats.noiseFloor.toFixed(2), unit: "dBm" },
- { name: "CCQ TX", value: stats.ccqTx.toFixed(2), unit: "%" },
];
return (
@@ -212,13 +224,13 @@ const NetworkHealthTelemetryPanel: React.FC = () => {
- |
+ |
Host
|
-
+ |
RTT (ms)
|
-
+ |
Status
|
@@ -226,11 +238,11 @@ const NetworkHealthTelemetryPanel: React.FC = () => {
{pingRows.map((r) => (
- | {r.name} |
-
+ | {r.name} |
+
{r.rttMs === -1 ? "Offline" : r.rttMs}
|
-
+ |
|
@@ -243,75 +255,32 @@ const NetworkHealthTelemetryPanel: React.FC = () => {
- |
+ |
Metric
|
-
+ |
Value
|
+
+ Status
+ |
{telemetryRows.map((row) => (
- | {row.name} |
-
+ | {row.name} |
+
{row.value} {row.unit}
|
+
+
+ |
))}
-
-
-
-
-
- Math.max(1, Math.floor(dataMax * 1.2))]}
- stroke="#ccc"
- tick={{ fill: "#ccc" }}
- />
-
-
-
-
-
- {throughputData.map((entry, index) => (
- | 0 && entry.Throughput / entry.Capacity > 0.85
- ? "#ef4444"
- : "#3b82f6"
- }
- />
- ))}
- |
-
-
-
-
);
};