mirror of
https://github.com/gethomepage/homepage.git
synced 2026-01-12 12:02:09 +08:00
Change lidarr to artist instead of album
This commit is contained in:
@@ -9,23 +9,21 @@ export default function Component({ service }) {
|
||||
|
||||
const { widget } = service;
|
||||
|
||||
// album API endpoint can get massive, so we prevent calling if not included in fields see https://github.com/benphelps/homepage/discussions/1577
|
||||
const showAlbums = widget.fields?.includes('albums') || !widget.fields;
|
||||
const { data: albumsData, error: albumsError } = useWidgetAPI(widget, showAlbums ? "album" : "");
|
||||
const { data: artistsData, error: artistsError } = useWidgetAPI(widget, "artist");
|
||||
const { data: wantedData, error: wantedError } = useWidgetAPI(widget, "wanted/missing");
|
||||
const { data: queueData, error: queueError } = useWidgetAPI(widget, "queue/status");
|
||||
|
||||
if (albumsError || wantedError || queueError) {
|
||||
const finalError = albumsError ?? wantedError ?? queueError;
|
||||
if (artistsError || wantedError || queueError) {
|
||||
const finalError = artistsError ?? wantedError ?? queueError;
|
||||
return <Container service={service} error={finalError} />;
|
||||
}
|
||||
|
||||
if ((showAlbums && !albumsData) || !wantedData || !queueData) {
|
||||
if (!artistsData || !wantedData || !queueData) {
|
||||
return (
|
||||
<Container service={service}>
|
||||
<Block label="lidarr.wanted" />
|
||||
<Block label="lidarr.queued" />
|
||||
<Block label="lidarr.albums" />
|
||||
<Block label="lidarr.artists" />
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
@@ -34,7 +32,7 @@ export default function Component({ service }) {
|
||||
<Container service={service}>
|
||||
<Block label="lidarr.wanted" value={t("common.number", { value: wantedData.totalRecords })} />
|
||||
<Block label="lidarr.queued" value={t("common.number", { value: queueData.totalCount })} />
|
||||
{showAlbums && <Block label="lidarr.albums" value={t("common.number", { value: albumsData?.have })} />}
|
||||
<Block label="lidarr.artists" value={t("common.number", { value: artistsData.length })} />
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user