mirror of
https://github.com/gethomepage/homepage.git
synced 2025-12-07 09:35:54 -08:00
added widget for xteve (#731)
* added xteve widget * eslint fixes * xteve code cleanup Co-authored-by: Marcus Kimpenhaus <k@AirM2.kimpenhaus.net> Co-authored-by: Michael Shamoon <4887959+shamoon@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
3a27486c34
commit
43a11eadfc
35
src/widgets/xteve/component.jsx
Normal file
35
src/widgets/xteve/component.jsx
Normal file
@@ -0,0 +1,35 @@
|
||||
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: xteveData, error: xteveError } = useWidgetAPI(widget, "api");
|
||||
|
||||
if (xteveError) {
|
||||
return <Container error={xteveError} />;
|
||||
}
|
||||
|
||||
if (!xteveData) {
|
||||
return (
|
||||
<Container service={service}>
|
||||
<Block label="xteve.streams_all" />
|
||||
<Block label="xteve.streams_active " />
|
||||
<Block label="xteve.streams_xepg" />
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Container service={service}>
|
||||
<Block label="xteve.streams_all" value={t("common.number", { value: xteveData["streams.all"] ?? 0 })} />
|
||||
<Block label="xteve.streams_active" value={t("common.number", { value: xteveData["streams.active"] ?? 0 })} />
|
||||
<Block label="xteve.streams_xepg" value={t("common.number", { value: xteveData["streams.xepg"] ?? 0 })} />
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user