|
|
|
@ -11,6 +11,11 @@ export default function Component({ service }) {
|
|
|
|
|
|
|
|
|
|
const { data: speedtestData, error: speedtestError } = useWidgetAPI(widget, "speedtest/latest");
|
|
|
|
|
|
|
|
|
|
const bitratePrecision =
|
|
|
|
|
!widget?.bitratePrecision || Number.isNaN(widget?.bitratePrecision) || widget?.bitratePrecision < 0
|
|
|
|
|
? 0
|
|
|
|
|
: widget.bitratePrecision;
|
|
|
|
|
|
|
|
|
|
if (speedtestError) {
|
|
|
|
|
return <Container service={service} error={speedtestError} />;
|
|
|
|
|
}
|
|
|
|
@ -29,9 +34,18 @@ export default function Component({ service }) {
|
|
|
|
|
<Container service={service}>
|
|
|
|
|
<Block
|
|
|
|
|
label="speedtest.download"
|
|
|
|
|
value={t("common.bitrate", { value: speedtestData.data.download * 1000 * 1000 })}
|
|
|
|
|
value={t("common.bitrate", {
|
|
|
|
|
value: speedtestData.data.download * 1000 * 1000,
|
|
|
|
|
decimals: bitratePrecision,
|
|
|
|
|
})}
|
|
|
|
|
/>
|
|
|
|
|
<Block
|
|
|
|
|
label="speedtest.upload"
|
|
|
|
|
value={t("common.bitrate", {
|
|
|
|
|
value: speedtestData.data.upload * 1000 * 1000,
|
|
|
|
|
decimals: bitratePrecision,
|
|
|
|
|
})}
|
|
|
|
|
/>
|
|
|
|
|
<Block label="speedtest.upload" value={t("common.bitrate", { value: speedtestData.data.upload * 1000 * 1000 })} />
|
|
|
|
|
<Block
|
|
|
|
|
label="speedtest.ping"
|
|
|
|
|
value={t("common.ms", {
|
|
|
|
|