2023-01-27 00:03:52 +01:00
|
|
|
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;
|
|
|
|
|
2023-01-28 14:27:50 +01:00
|
|
|
const { data: immichData } = useWidgetAPI(widget);
|
2023-01-27 00:03:52 +01:00
|
|
|
|
2023-01-28 14:27:50 +01:00
|
|
|
if (immichData?.statusCode) { // Unauthorized
|
|
|
|
return <Container error={immichData?.statusCode} />;
|
2023-01-27 00:03:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Container service={service}>
|
|
|
|
<Block label="immich.users" value={immichData?.usageByUser.length} />
|
|
|
|
<Block label="immich.photos" value={immichData?.photos} />
|
|
|
|
<Block label="immich.videos" value={immichData?.videos} />
|
|
|
|
<Block label="immich.storage" value={immichData?.usage} />
|
|
|
|
</Container>
|
|
|
|
);
|
|
|
|
}
|