refactor: remove deprecated navidrome/audiobookshelf widgets
Consolidate into the unified Audio Stats widget which adapts its UI based on the linked integration kind — Navidrome shows artists/albums/ songs/now-playing, Audiobookshelf shows libraries/audiobooks/podcasts/ listening-time/sessions. Removes: widget definitions, components, API routers, and the deprecatedWidgetKinds mechanism (no longer needed).
This commit is contained in:
13 files changed
+4
-220
No files matched your search
@@ -9,7 +9,7 @@ import { useScopedI18n } from "@homarr/translation/client";
|
||||
|
||||
import classes from "./component.module.css";
|
||||
import type { AudioStatsBackend, AudioStatsDisplayOptions } from "./shared";
|
||||
import { getGridCols, getIconSize, getVisibleStats, translationScopeByBackend } from "./shared";
|
||||
import { AUDIO_STATS_TRANSLATION_SCOPE, getGridCols, getIconSize, getVisibleStats } from "./shared";
|
||||
|
||||
const rootClassByCompact = {
|
||||
true: classes.rootCompact,
|
||||
@@ -31,7 +31,6 @@ interface AudioStatsContentProps {
|
||||
stats: NavidromeDashboardData | AudiobookshelfDashboardData;
|
||||
options: AudioStatsDisplayOptions;
|
||||
width: number;
|
||||
translationScope?: keyof typeof translationScopeByBackend;
|
||||
}
|
||||
|
||||
export function AudioStatsContent({
|
||||
@@ -39,9 +38,8 @@ export function AudioStatsContent({
|
||||
stats,
|
||||
options,
|
||||
width,
|
||||
translationScope = "audioStats",
|
||||
}: AudioStatsContentProps) {
|
||||
const t = useScopedI18n(translationScopeByBackend[translationScope]);
|
||||
const t = useScopedI18n(AUDIO_STATS_TRANSLATION_SCOPE);
|
||||
const visibleStats = getVisibleStats(backend, options, stats);
|
||||
const compactKey = String(options.compactMode ?? false) as keyof typeof rootClassByCompact;
|
||||
const gridCols = getGridCols(width, visibleStats.length, options.compactMode ?? false);
|
||||
|
||||
@@ -34,7 +34,6 @@ export default function AudioStatsWidget({ integrationIds, options, width }: Wid
|
||||
stats={response.data}
|
||||
options={displayOptions}
|
||||
width={width}
|
||||
translationScope="audioStats"
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -166,8 +166,4 @@ export const getIconSize = (width: number, compact: boolean): number => {
|
||||
return match?.size ?? fallbackIconSize[String(compact) as keyof typeof fallbackIconSize];
|
||||
};
|
||||
|
||||
export const translationScopeByBackend = {
|
||||
navidrome: "widget.navidrome",
|
||||
audiobookshelf: "widget.audiobookshelf",
|
||||
audioStats: "widget.audioStats",
|
||||
} as const;
|
||||
export const AUDIO_STATS_TRANSLATION_SCOPE = "widget.audioStats" as const;
|
||||
Reference in new issue
Block a user