From 28e049425ee0ea6a3d183c8e6df05d2717db3616 Mon Sep 17 00:00:00 2001 From: Psychotoxical <171614930+Psychotoxical@users.noreply.github.com> Date: Tue, 30 Jun 2026 19:48:54 +0200 Subject: [PATCH] refactor(music-network): move enrichment-primary icon/label hooks into music-network/ui --- src/features/nowPlaying/components/Hero.tsx | 4 +--- .../playback/components/playerBar/PlayerTrackInfo.tsx | 4 +--- src/features/stats/pages/Statistics.tsx | 3 +-- src/music-network/index.ts | 2 ++ src/music-network/ui/useEnrichmentPrimaryIcon.ts | 3 ++- src/music-network/ui/useEnrichmentPrimaryLabel.ts | 2 +- 6 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/features/nowPlaying/components/Hero.tsx b/src/features/nowPlaying/components/Hero.tsx index 42914c10..21f364ea 100644 --- a/src/features/nowPlaying/components/Hero.tsx +++ b/src/features/nowPlaying/components/Hero.tsx @@ -7,9 +7,7 @@ import type { ArtistStats, TrackStats } from '@/music-network'; import type { SubsonicOpenArtistRef } from '@/lib/api/subsonicTypes'; import { OpenArtistRefInline } from '@/features/artist'; import { formatTrackTime } from '@/lib/format/formatDuration'; -import { useEnrichmentPrimaryLabel } from '@/hooks/useEnrichmentPrimaryLabel'; -import { useEnrichmentPrimaryIcon } from '@/hooks/useEnrichmentPrimaryIcon'; -import { renderPresetIcon } from '@/music-network'; +import { renderPresetIcon, useEnrichmentPrimaryIcon, useEnrichmentPrimaryLabel } from '@/music-network'; interface HeroProps { track: { title: string; artist: string; album: string; year?: number; diff --git a/src/features/playback/components/playerBar/PlayerTrackInfo.tsx b/src/features/playback/components/playerBar/PlayerTrackInfo.tsx index 9b631219..76261489 100644 --- a/src/features/playback/components/playerBar/PlayerTrackInfo.tsx +++ b/src/features/playback/components/playerBar/PlayerTrackInfo.tsx @@ -15,9 +15,7 @@ import { OpenArtistRefInline } from '@/features/artist'; import StarRating from '@/ui/StarRating'; import { PlaybackBufferingOverlay } from '@/features/playback/components/PlaybackBufferingOverlay'; import { usePlayerStore } from '@/features/playback/store/playerStore'; -import { useEnrichmentPrimaryLabel } from '@/hooks/useEnrichmentPrimaryLabel'; -import { useEnrichmentPrimaryIcon } from '@/hooks/useEnrichmentPrimaryIcon'; -import { renderPresetIcon } from '@/music-network'; +import { renderPresetIcon, useEnrichmentPrimaryIcon, useEnrichmentPrimaryLabel } from '@/music-network'; import { usePlayerBarLayoutStore, type PlayerBarLayoutItemId, diff --git a/src/features/stats/pages/Statistics.tsx b/src/features/stats/pages/Statistics.tsx index a3bc3ca5..be28518a 100644 --- a/src/features/stats/pages/Statistics.tsx +++ b/src/features/stats/pages/Statistics.tsx @@ -12,10 +12,9 @@ import StatisticsTabBar from '@/features/stats/components/StatisticsTabBar'; import { useTranslation } from 'react-i18next'; import { useAuthStore } from '@/store/authStore'; import { useLocation } from 'react-router-dom'; -import { getMusicNetworkRuntime, type RecentTrack, type StatsPeriod, type TopItem } from '@/music-network'; +import { getMusicNetworkRuntime, useEnrichmentPrimaryLabel, type RecentTrack, type StatsPeriod, type TopItem } from '@/music-network'; import { useOfflineBrowseContext } from '@/features/offline'; import { usePlayerStatsRecordingEnabled } from '@/features/stats/hooks/usePlayerStatsRecordingEnabled'; -import { useEnrichmentPrimaryLabel } from '@/hooks/useEnrichmentPrimaryLabel'; // eslint-disable-next-line @typescript-eslint/no-explicit-any function relativeTime(timestamp: number, t: (key: string, opts?: any) => string): string { diff --git a/src/music-network/index.ts b/src/music-network/index.ts index 12c8f4d7..0833bbcd 100644 --- a/src/music-network/index.ts +++ b/src/music-network/index.ts @@ -12,6 +12,8 @@ export { export type { MusicNetworkStore, RuntimeHost } from './runtime/store'; export { listPresets, getPreset } from './registry/presetRegistry'; export { useEnrichmentPrimary, type EnrichmentPrimary } from './ui/useEnrichmentPrimary'; +export { useEnrichmentPrimaryIcon } from './ui/useEnrichmentPrimaryIcon'; +export { useEnrichmentPrimaryLabel } from './ui/useEnrichmentPrimaryLabel'; export { renderPresetIcon } from './ui/presetIcon'; export { default as MusicNetworkIndicator } from './ui/MusicNetworkIndicator'; export { diff --git a/src/music-network/ui/useEnrichmentPrimaryIcon.ts b/src/music-network/ui/useEnrichmentPrimaryIcon.ts index cca2a31c..9a3d88c2 100644 --- a/src/music-network/ui/useEnrichmentPrimaryIcon.ts +++ b/src/music-network/ui/useEnrichmentPrimaryIcon.ts @@ -1,4 +1,5 @@ -import { useEnrichmentPrimary, type PresetIcon } from '../music-network'; +import type { PresetIcon } from '@/music-network'; +import { useEnrichmentPrimary } from './useEnrichmentPrimary'; /** * Manifest icon id of the current enrichment-primary provider, or null when no diff --git a/src/music-network/ui/useEnrichmentPrimaryLabel.ts b/src/music-network/ui/useEnrichmentPrimaryLabel.ts index ce5c9449..3b2c93c6 100644 --- a/src/music-network/ui/useEnrichmentPrimaryLabel.ts +++ b/src/music-network/ui/useEnrichmentPrimaryLabel.ts @@ -1,4 +1,4 @@ -import { useEnrichmentPrimary } from '../music-network'; +import { useEnrichmentPrimary } from './useEnrichmentPrimary'; /** * Display label of the current enrichment-primary account (e.g. "Last.fm",