Files
homepage/src/widgets/plex/component.jsx
T
dependabot[bot]andshamoon 81accd8dbe
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
Chore(deps-dev): Bump eslint-config-next from 15.5.22 to 16.3.3 (#7082)
Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com>
2026-09-01 10:52:46 -07:00

40 lines
1.2 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: plexData, error: plexAPIError } = useWidgetAPI(widget, "unified", {
refreshInterval: 5000,
});
if (plexAPIError) {
return <Container service={service} error={plexAPIError} />;
}
if (!plexData) {
return (
<Container service={service}>
<Block label="plex.streams" />
<Block label="plex.albums" />
<Block label="plex.movies" />
<Block label="plex.tv" />
</Container>
);
}
return (
<Container service={service}>
<Block label="plex.streams" value={t("common.number", { value: plexData.streams })} />
<Block label="plex.albums" value={t("common.number", { value: plexData.albums })} />
<Block label="plex.movies" value={t("common.number", { value: plexData.movies })} />
<Block label="plex.tv" value={t("common.number", { value: plexData.tv })} />
</Container>
);
}