From e4680f9b9c5322d5bad465966b15ebd16b8f0d8e Mon Sep 17 00:00:00 2001 From: Devedse Date: Thu, 30 May 2024 15:18:32 +0200 Subject: [PATCH] Added component --- src/widgets/develancacheui/component.jsx | 39 ++++++++++++++++++++++++ src/widgets/develancacheui/widget.js | 14 +++++++++ 2 files changed, 53 insertions(+) create mode 100644 src/widgets/develancacheui/component.jsx create mode 100644 src/widgets/develancacheui/widget.js diff --git a/src/widgets/develancacheui/component.jsx b/src/widgets/develancacheui/component.jsx new file mode 100644 index 000000000..ebad9e1b2 --- /dev/null +++ b/src/widgets/develancacheui/component.jsx @@ -0,0 +1,39 @@ +import { useTranslation } from "next-i18next"; + +import Container from "components/services/widget/container"; +import Block from "components/services/widget/block"; +import useWidgetAPI from "utils/proxy/use-widget-api"; + +export default function Component({ service }) { + const { t } = useTranslation(); + + const { widget } = service; + + const { data: downloadStatsData, error: downloadStatsError } = useWidgetAPI(widget, "DownloadStats/GetTotalDownloadStats"); + + if (downloadStatsError) { + return ; + } + + if (!downloadStatsData) { + return ( + + + + + ); + } + + return ( + + + + + ); +} diff --git a/src/widgets/develancacheui/widget.js b/src/widgets/develancacheui/widget.js new file mode 100644 index 000000000..4ee59c38d --- /dev/null +++ b/src/widgets/develancacheui/widget.js @@ -0,0 +1,14 @@ +import genericProxyHandler from "utils/proxy/handlers/generic"; + +const widget = { + api: "{url}/{endpoint}", + proxyHandler: genericProxyHandler, + + mappings: { + "DownloadStats/GetTotalDownloadStats": { + endpoint: "DownloadStats/GetTotalDownloadStats", + } + }, +}; + +export default widget;