From 03b01472f897f32d39f21f9187565fc8393c746e Mon Sep 17 00:00:00 2001 From: jeffvli Date: Fri, 6 Feb 2026 05:33:15 -0800 Subject: [PATCH] remove duplicate ServerType enum --- src/main/features/core/autodiscover/index.ts | 3 ++- .../context-menu/actions/set-rating-action.tsx | 3 +-- src/renderer/features/login/routes/login-route.tsx | 12 ++++++++---- src/renderer/features/player/hooks/use-mpris.ts | 4 ++-- .../features/servers/components/add-server-form.tsx | 10 +++++++--- src/shared/api/jellyfin/jellyfin-normalize.ts | 3 ++- src/shared/api/navidrome/navidrome-normalize.ts | 4 +++- src/shared/types/types.ts | 7 +------ 8 files changed, 26 insertions(+), 20 deletions(-) diff --git a/src/main/features/core/autodiscover/index.ts b/src/main/features/core/autodiscover/index.ts index 9155b1011..cc75421b0 100644 --- a/src/main/features/core/autodiscover/index.ts +++ b/src/main/features/core/autodiscover/index.ts @@ -1,7 +1,8 @@ import { createSocket } from 'dgram'; import { ipcMain } from 'electron'; -import { DiscoveredServerItem, ServerType } from '/@/shared/types/types'; +import { ServerType } from '/@/shared/types/domain-types'; +import { DiscoveredServerItem } from '/@/shared/types/types'; type JellyfinResponse = { Address: string; diff --git a/src/renderer/features/context-menu/actions/set-rating-action.tsx b/src/renderer/features/context-menu/actions/set-rating-action.tsx index 7fdc24c1f..d626ba521 100644 --- a/src/renderer/features/context-menu/actions/set-rating-action.tsx +++ b/src/renderer/features/context-menu/actions/set-rating-action.tsx @@ -5,8 +5,7 @@ import { useSetRating } from '/@/renderer/features/shared/hooks/use-set-rating'; import { useCurrentServer, useCurrentServerId, useShowRatings } from '/@/renderer/store'; import { ContextMenu } from '/@/shared/components/context-menu/context-menu'; import { Rating } from '/@/shared/components/rating/rating'; -import { LibraryItem } from '/@/shared/types/domain-types'; -import { ServerType } from '/@/shared/types/types'; +import { LibraryItem, ServerType } from '/@/shared/types/domain-types'; interface SetRatingActionProps { ids: string[]; diff --git a/src/renderer/features/login/routes/login-route.tsx b/src/renderer/features/login/routes/login-route.tsx index f82c920a2..d8ab0f383 100644 --- a/src/renderer/features/login/routes/login-route.tsx +++ b/src/renderer/features/login/routes/login-route.tsx @@ -29,18 +29,22 @@ import { TextTitle } from '/@/shared/components/text-title/text-title'; import { Text } from '/@/shared/components/text/text'; import { toast } from '/@/shared/components/toast/toast'; import { useForm } from '/@/shared/hooks/use-form'; -import { AuthenticationResponse, ServerListItemWithCredential } from '/@/shared/types/domain-types'; -import { ServerType, toServerType } from '/@/shared/types/types'; +import { + AuthenticationResponse, + ServerListItemWithCredential, + ServerType, +} from '/@/shared/types/domain-types'; +import { toServerType } from '/@/shared/types/types'; const localSettings = isElectron() ? window.api.localSettings : null; -const SERVER_ICONS: Record = { +const SERVER_ICONS: Record, string> = { [ServerType.JELLYFIN]: JellyfinIcon, [ServerType.NAVIDROME]: NavidromeIcon, [ServerType.SUBSONIC]: SubsonicIcon, }; -const SERVER_NAMES: Record = { +const SERVER_NAMES: Record, string> = { [ServerType.JELLYFIN]: 'Jellyfin', [ServerType.NAVIDROME]: 'Navidrome', [ServerType.SUBSONIC]: 'OpenSubsonic', diff --git a/src/renderer/features/player/hooks/use-mpris.ts b/src/renderer/features/player/hooks/use-mpris.ts index 98499caf0..20c0be1de 100644 --- a/src/renderer/features/player/hooks/use-mpris.ts +++ b/src/renderer/features/player/hooks/use-mpris.ts @@ -8,8 +8,8 @@ import { useRadioPlayer, } from '/@/renderer/features/radio/hooks/use-radio-player'; import { usePlayerSong, usePlayerStore } from '/@/renderer/store'; -import { LibraryItem, QueueSong } from '/@/shared/types/domain-types'; -import { PlayerShuffle, ServerType } from '/@/shared/types/types'; +import { LibraryItem, QueueSong, ServerType } from '/@/shared/types/domain-types'; +import { PlayerShuffle } from '/@/shared/types/types'; const ipc = isElectron() ? window.api.ipc : null; const utils = isElectron() ? window.api.utils : null; diff --git a/src/renderer/features/servers/components/add-server-form.tsx b/src/renderer/features/servers/components/add-server-form.tsx index 1e23caac6..b01de6936 100644 --- a/src/renderer/features/servers/components/add-server-form.tsx +++ b/src/renderer/features/servers/components/add-server-form.tsx @@ -27,8 +27,12 @@ import { Text } from '/@/shared/components/text/text'; import { toast } from '/@/shared/components/toast/toast'; import { useFocusTrap } from '/@/shared/hooks/use-focus-trap'; import { useForm } from '/@/shared/hooks/use-form'; -import { AuthenticationResponse, ServerListItemWithCredential } from '/@/shared/types/domain-types'; -import { DiscoveredServerItem, ServerType, toServerType } from '/@/shared/types/types'; +import { + AuthenticationResponse, + ServerListItemWithCredential, + ServerType, +} from '/@/shared/types/domain-types'; +import { DiscoveredServerItem, toServerType } from '/@/shared/types/types'; const autodiscover = isElectron() ? window.api.autodiscover : null; const localSettings = isElectron() ? window.api.localSettings : null; @@ -70,7 +74,7 @@ function useAutodiscovery() { return { isDone, servers }; } -const SERVER_TYPES: Record = { +const SERVER_TYPES: Record, ServerDetails> = { [ServerType.JELLYFIN]: { icon: JellyfinIcon, name: 'Jellyfin', diff --git a/src/shared/api/jellyfin/jellyfin-normalize.ts b/src/shared/api/jellyfin/jellyfin-normalize.ts index 67313c90e..7ae048acd 100644 --- a/src/shared/api/jellyfin/jellyfin-normalize.ts +++ b/src/shared/api/jellyfin/jellyfin-normalize.ts @@ -11,9 +11,10 @@ import { MusicFolder, Playlist, RelatedArtist, + ServerType, Song, } from '/@/shared/types/domain-types'; -import { ServerListItem, ServerType } from '/@/shared/types/types'; +import { ServerListItem } from '/@/shared/types/types'; const TICKS_PER_MS = 10000; diff --git a/src/shared/api/navidrome/navidrome-normalize.ts b/src/shared/api/navidrome/navidrome-normalize.ts index 4e00b0337..f7658cc6f 100644 --- a/src/shared/api/navidrome/navidrome-normalize.ts +++ b/src/shared/api/navidrome/navidrome-normalize.ts @@ -1,5 +1,7 @@ import z from 'zod'; +import { ServerType } from '../../types/domain-types'; + import { ndType } from '/@/shared/api/navidrome/navidrome-types'; import { ssType } from '/@/shared/api/subsonic/subsonic-types'; import { replacePathPrefix } from '/@/shared/api/utils'; @@ -14,7 +16,7 @@ import { Song, User, } from '/@/shared/types/domain-types'; -import { ServerListItem, ServerType } from '/@/shared/types/types'; +import { ServerListItem } from '/@/shared/types/types'; const getImageUrl = (args: { url: null | string }) => { const { url } = args; diff --git a/src/shared/types/types.ts b/src/shared/types/types.ts index 11d58b146..7a40f3919 100644 --- a/src/shared/types/types.ts +++ b/src/shared/types/types.ts @@ -9,6 +9,7 @@ import { LibraryItem, Playlist, QueueSong, + ServerType, Song, } from '/@/shared/types/domain-types'; import { ServerFeatures } from '/@/shared/types/features-types'; @@ -51,12 +52,6 @@ export enum Platform { WINDOWS = 'windows', } -export enum ServerType { - JELLYFIN = 'jellyfin', - NAVIDROME = 'navidrome', - SUBSONIC = 'subsonic', -} - export type CardRoute = { route: AppRoute | string; slugs?: RouteSlug[];