import StatisticContainer from "@/pages/Statistics/components/StatisticContainer"; import {FontAwesomeIcon} from "@fortawesome/react-fontawesome"; import {faArrowDown, faArrowUp, faPingPongPaddleBall, faWaveSquare} from "@fortawesome/free-solid-svg-icons"; import "./styles.sass"; import {getIconBySpeed} from "@/common/utils/TestUtil"; import {useContext} from "react"; import {ConfigContext} from "@/common/contexts/Config"; import {StatusContext} from "@/common/contexts/Status"; import {PreferencesContext} from "@/common/contexts/Preferences"; import {convertSpeed, getSpeedUnit} from "@/common/utils/FormatUtil"; import {t} from "i18next"; export const LatestTestChart = (props) => { const [config] = useContext(ConfigContext); const [status] = useContext(StatusContext); const [preferences] = useContext(PreferencesContext); const speedUnit = getSpeedUnit(preferences); if (!props.test) return <>; if (config === null) return <>; const hasJitter = props.test.jitter !== null && props.test.jitter !== undefined; return (

{t("latest.ping")}

{(props.test.ping === -1 ? "N/A" : props.test.ping) + " " + t("latest.ping_unit")} {hasJitter && {props.test.jitter}}

{t("latest.up")}

{(props.test.upload === -1 ? "N/A" : convertSpeed(props.test.upload, preferences)) + " " + speedUnit}

{t("latest.down")}

{(props.test.download === -1 ? "N/A" : convertSpeed(props.test.download, preferences)) + " " + speedUnit}

); }