"use client"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faArrowDown, faClock, faNetworkWired, faServer } from "@fortawesome/free-solid-svg-icons"; import type { HopChainNode } from "../../types/analysis"; type HopChainVisualisationProps = { hopChain: HopChainNode[]; }; const formatDelay = (delay?: number | null): string | null => { if (delay === null || delay === undefined || Number.isNaN(delay)) { return null; } return `${delay.toFixed(2)}s`; }; export default function HopChainVisualisation({ hopChain }: HopChainVisualisationProps) { if (hopChain.length === 0) { return (

No hop chain data available.

); } return (
{hopChain.map((node, index) => { const delayLabel = formatDelay(node.delay); return (
{node.hostname} {node.ip ? ( {node.ip} ) : null}
{node.timestamp ? ( {node.timestamp} ) : null} {node.serverInfo ? ( {node.serverInfo} ) : null} {delayLabel ? ( +{delayLabel} ) : null}
{index < hopChain.length - 1 ? (
) : null}
); })}
); }