refactor: reduce verbosity and dead code across new integrations
- Remove dead widget.audiobookshelf/navidrome i18n blocks (76 lines) - Simplify audio-stats router (remove duplicated kind casts) - Remove redundant defaultDisplayOptions in audio-stats component - Dedup fetch helpers in uptime-kuma (fetchOkAsync) and paperless-ngx (fetchAuthenticatedAsync) - Simplify navidrome asArray helper and getArtistCountAsync - Simplify uptime-kuma averageUptimePercent and status derivation
This commit is contained in:
6 files changed
+34
-173
No files matched your search
@@ -4,29 +4,11 @@ import { clientApi } from "@homarr/api/client";
|
||||
|
||||
import type { WidgetComponentProps } from "../definition";
|
||||
import { AudioStatsContent } from "./audio-stats-content";
|
||||
import type { AudioStatsDisplayOptions } from "./shared";
|
||||
|
||||
const defaultDisplayOptions: AudioStatsDisplayOptions = {
|
||||
showArtists: true,
|
||||
showAlbums: true,
|
||||
showSongs: true,
|
||||
showNowPlaying: true,
|
||||
showNowPlayingList: true,
|
||||
maxNowPlayingItems: 3,
|
||||
showLibraryCount: true,
|
||||
showAudiobooks: true,
|
||||
showPodcasts: true,
|
||||
showListeningTime: true,
|
||||
showActiveSessions: true,
|
||||
compactMode: false,
|
||||
};
|
||||
|
||||
export default function AudioStatsWidget({ integrationIds, options, width }: WidgetComponentProps<"audioStats">) {
|
||||
const [response] = clientApi.widget.audioStats.getStats.useSuspenseQuery({
|
||||
integrationId: integrationIds[0] ?? "",
|
||||
});
|
||||
|
||||
const displayOptions = { ...defaultDisplayOptions, ...options };
|
||||
|
||||
return <AudioStatsContent backend={response.kind} stats={response.data} options={displayOptions} width={width} />;
|
||||
return <AudioStatsContent backend={response.kind} stats={response.data} options={options} width={width} />;
|
||||
}
|
||||
Reference in new issue
Block a user