mirror of
https://github.com/gethomepage/homepage.git
synced 2026-09-12 15:15:58 -07:00
593c18dc4c
Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com> Signed-off-by: dependabot[bot] <support@github.com>
37 lines
1.3 KiB
React
37 lines
1.3 KiB
React
import Block from "components/services/widget/block";
|
|
import Container from "components/services/widget/container";
|
|
import { useTranslation } from "next-i18next/pages";
|
|
|
|
import useWidgetAPI from "utils/proxy/use-widget-api";
|
|
|
|
export default function Component({ service }) {
|
|
const { t } = useTranslation();
|
|
const { widget } = service;
|
|
|
|
const { data: channelsData, error: channelsError } = useWidgetAPI(widget, "status");
|
|
|
|
if (channelsError) {
|
|
return <Container service={service} error={channelsError} />;
|
|
}
|
|
|
|
if (!channelsData) {
|
|
return (
|
|
<Container service={service}>
|
|
<Block label="channelsdvrserver.shows" />
|
|
<Block label="channelsdvrserver.recordings" />
|
|
<Block label="channelsdvrserver.scheduled" />
|
|
<Block label="channelsdvrserver.passes" />
|
|
</Container>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<Container service={service}>
|
|
<Block label="channelsdvrserver.shows" value={t("common.number", { value: channelsData.stats.groups })} />
|
|
<Block label="channelsdvrserver.recordings" value={t("common.number", { value: channelsData.stats.files })} />
|
|
<Block label="channelsdvrserver.scheduled" value={t("common.number", { value: channelsData.stats.jobs })} />
|
|
<Block label="channelsdvrserver.passes" value={t("common.number", { value: channelsData.stats.rules })} />
|
|
</Container>
|
|
);
|
|
}
|