mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-10 23:38:46 +00:00
29 lines
906 B
JavaScript
29 lines
906 B
JavaScript
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 { widget } = service;
|
|
|
|
const { data: statisticsData, error: statisticsError } = useWidgetAPI(widget, "statistics");
|
|
|
|
if (statisticsError) {
|
|
return <Container error={statisticsError} />;
|
|
}
|
|
|
|
if (!statisticsData) {
|
|
return (
|
|
<Container service={service}>
|
|
<Block label="paperlessngx.inbox" />
|
|
<Block label="paperlessngx.total" />
|
|
</Container>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<Container service={service}>
|
|
{statisticsData.documents_inbox !== undefined && <Block label="paperlessngx.inbox" value={statisticsData.documents_inbox} />}
|
|
<Block label="paperlessngx.total" value={statisticsData.documents_total} />
|
|
</Container>
|
|
);
|
|
}
|