mirror of
https://github.com/gethomepage/homepage.git
synced 2026-09-30 07:51:17 -07:00
Lint / Linting Checks (push) Has been cancelled
Release Drafter / Update Release Draft (push) Has been cancelled
Docker CI / Docker Build & Push (push) Has been cancelled
Tests / vitest (1) (push) Has been cancelled
Tests / vitest (2) (push) Has been cancelled
Release Drafter / Auto Label PR (push) Has been cancelled
Tests / vitest (3) (push) Has been cancelled
Tests / vitest (4) (push) Has been cancelled
Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com> Signed-off-by: dependabot[bot] <support@github.com>
52 lines
1.6 KiB
React
52 lines
1.6 KiB
React
import { useTranslation } from "next-i18next/pages";
|
|
|
|
import Block from "components/services/widget/block";
|
|
import Container from "components/services/widget/container";
|
|
import useWidgetAPI from "utils/proxy/use-widget-api";
|
|
|
|
export default function Component({ service }) {
|
|
const { t } = useTranslation();
|
|
|
|
const { widget } = service;
|
|
|
|
const { data: jdownloaderData, error: jdownloaderAPIError } = useWidgetAPI(widget, "unified", {
|
|
refreshInterval: 30000,
|
|
});
|
|
|
|
if (jdownloaderAPIError) {
|
|
return <Container service={service} error={jdownloaderAPIError} />;
|
|
}
|
|
|
|
if (!jdownloaderData) {
|
|
return (
|
|
<Container service={service}>
|
|
<Block label="jdownloader.downloadCount" />
|
|
<Block label="jdownloader.downloadTotalBytes" />
|
|
<Block label="jdownloader.downloadBytesRemaining" />
|
|
<Block label="jdownloader.downloadSpeed" />
|
|
</Container>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<Container service={service}>
|
|
<Block label="jdownloader.downloadCount" value={t("common.number", { value: jdownloaderData.downloadCount })} />
|
|
<Block
|
|
label="jdownloader.downloadTotalBytes"
|
|
value={t("common.bytes", { value: jdownloaderData.totalBytes })}
|
|
highlightValue={jdownloaderData.totalBytes}
|
|
/>
|
|
<Block
|
|
label="jdownloader.downloadBytesRemaining"
|
|
value={t("common.bytes", { value: jdownloaderData.bytesRemaining })}
|
|
highlightValue={jdownloaderData.bytesRemaining}
|
|
/>
|
|
<Block
|
|
label="jdownloader.downloadSpeed"
|
|
value={t("common.byterate", { value: jdownloaderData.totalSpeed })}
|
|
highlightValue={jdownloaderData.totalSpeed}
|
|
/>
|
|
</Container>
|
|
);
|
|
}
|