|
|
@ -11,6 +11,11 @@ export default function Component({ service }) {
|
|
|
|
|
|
|
|
|
|
|
|
const { data: speedtestData, error: speedtestError } = useWidgetAPI(widget, "speedtest/latest");
|
|
|
|
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) {
|
|
|
|
if (speedtestError) {
|
|
|
|
return <Container service={service} error={speedtestError} />;
|
|
|
|
return <Container service={service} error={speedtestError} />;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -29,9 +34,18 @@ export default function Component({ service }) {
|
|
|
|
<Container service={service}>
|
|
|
|
<Container service={service}>
|
|
|
|
<Block
|
|
|
|
<Block
|
|
|
|
label="speedtest.download"
|
|
|
|
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
|
|
|
|
<Block
|
|
|
|
label="speedtest.ping"
|
|
|
|
label="speedtest.ping"
|
|
|
|
value={t("common.ms", {
|
|
|
|
value={t("common.ms", {
|
|
|
|