import { Network, WifiOff } from "lucide-react"; import { useTranslation } from "react-i18next"; import type { ServerMetrics } from "@/main-axios.ts"; import { SectionCard } from "@/components/section-card"; interface NetworkWidgetProps { metrics: ServerMetrics | null; metricsHistory: ServerMetrics[]; } export function NetworkWidget({ metrics }: NetworkWidgetProps) { const { t } = useTranslation(); const metricsWithNetwork = metrics as ServerMetrics & { network?: { interfaces?: Array<{ name: string; state: string; ip: string; rx?: string; tx?: string; }>; }; }; const interfaces = metricsWithNetwork?.network?.interfaces ?? []; return ( } >
{interfaces.length === 0 ? (
{t("serverStats.noInterfacesFound")}
) : (
{interfaces.map((iface, i) => (
{iface.name}
{iface.state}
{iface.ip} {(iface.rx || iface.tx) && ( ↓ {iface.rx ?? "—"} / ↑ {iface.tx ?? "—"} )}
))}
)}
); }