2022-09-26 15:25:10 +03:00
|
|
|
import Container from "components/services/widget/container";
|
|
|
|
import Block from "components/services/widget/block";
|
2022-09-27 22:59:14 +03:00
|
|
|
import useWidgetAPI from "utils/proxy/use-widget-api";
|
2022-09-04 21:58:42 +03:00
|
|
|
|
2022-09-26 02:23:02 +03:00
|
|
|
export default function Component({ service }) {
|
2022-09-27 22:59:14 +03:00
|
|
|
const { widget } = service;
|
2022-08-25 16:29:26 +03:00
|
|
|
|
2022-09-27 22:59:14 +03:00
|
|
|
const { data: statsData, error: statsError } = useWidgetAPI(widget, "Request/count");
|
2022-08-25 16:29:26 +03:00
|
|
|
|
2022-11-07 09:24:15 -08:00
|
|
|
if (statsError) {
|
|
|
|
return <Container error={statsError} />;
|
2022-08-25 16:29:26 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!statsData) {
|
|
|
|
return (
|
2022-09-29 21:15:25 -07:00
|
|
|
<Container service={service}>
|
|
|
|
<Block label="ombi.pending" />
|
|
|
|
<Block label="ombi.approved" />
|
|
|
|
<Block label="ombi.available" />
|
2022-09-26 15:25:10 +03:00
|
|
|
</Container>
|
2022-08-25 16:29:26 +03:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2022-09-29 21:15:25 -07:00
|
|
|
<Container service={service}>
|
|
|
|
<Block label="ombi.pending" value={statsData.pending} />
|
|
|
|
<Block label="ombi.approved" value={statsData.approved} />
|
|
|
|
<Block label="ombi.available" value={statsData.available} />
|
2022-09-26 15:25:10 +03:00
|
|
|
</Container>
|
2022-08-25 16:29:26 +03:00
|
|
|
);
|
|
|
|
}
|