diff --git a/src/main/features/core/lyrics/genius.ts b/src/main/features/core/lyrics/genius.ts index e6be19642..3908ec734 100644 --- a/src/main/features/core/lyrics/genius.ts +++ b/src/main/features/core/lyrics/genius.ts @@ -1,13 +1,14 @@ import axios, { AxiosResponse } from 'axios'; import { load } from 'cheerio'; +import { orderSearchResults } from './shared'; + import { InternetProviderLyricResponse, InternetProviderLyricSearchResponse, LyricSearchQuery, LyricSource, -} from '.'; -import { orderSearchResults } from './shared'; +} from '/@/shared/types/domain/lyric-domain-types'; const SEARCH_URL = 'https://genius.com/api/search/song'; diff --git a/src/main/features/core/lyrics/index.ts b/src/main/features/core/lyrics/index.ts index e20d19902..aebbad61e 100644 --- a/src/main/features/core/lyrics/index.ts +++ b/src/main/features/core/lyrics/index.ts @@ -17,36 +17,13 @@ import { getSearchResults as searchNetease, } from './netease'; +import { + InternetProviderLyricResponse, + InternetProviderLyricSearchResponse, + LyricSource, +} from '/@/shared/types/domain/lyric-domain-types'; import { Song } from '/@/shared/types/domain/song-domain-types'; -export enum LyricSource { - GENIUS = 'Genius', - LRCLIB = 'lrclib.net', - NETEASE = 'NetEase', -} - -export type FullLyricsMetadata = Omit & { - lyrics: LyricsResponse; - remote: boolean; - source: string; -}; - -export type InternetProviderLyricResponse = { - artist: string; - id: string; - lyrics: string; - name: string; - source: LyricSource; -}; - -export type InternetProviderLyricSearchResponse = { - artist: string; - id: string; - name: string; - score?: number; - source: LyricSource; -}; - export type LyricGetQuery = { remoteSongId: string; remoteSource: LyricSource; diff --git a/src/main/features/core/lyrics/lrclib.ts b/src/main/features/core/lyrics/lrclib.ts index d2ac0512b..743b8bb57 100644 --- a/src/main/features/core/lyrics/lrclib.ts +++ b/src/main/features/core/lyrics/lrclib.ts @@ -1,13 +1,14 @@ // Credits to https://github.com/tranxuanthang/lrcget for API implementation import axios, { AxiosResponse } from 'axios'; +import { orderSearchResults } from './shared'; + import { InternetProviderLyricResponse, InternetProviderLyricSearchResponse, LyricSearchQuery, LyricSource, -} from '.'; -import { orderSearchResults } from './shared'; +} from '/@/shared/types/domain/lyric-domain-types'; const FETCH_URL = 'https://lrclib.net/api/get'; const SEEARCH_URL = 'https://lrclib.net/api/search'; diff --git a/src/main/features/core/lyrics/netease.ts b/src/main/features/core/lyrics/netease.ts index e06429108..31fad9fef 100644 --- a/src/main/features/core/lyrics/netease.ts +++ b/src/main/features/core/lyrics/netease.ts @@ -1,43 +1,20 @@ import axios, { AxiosResponse } from 'axios'; +import { store } from '../settings'; +import { orderSearchResults } from './shared'; + import { InternetProviderLyricResponse, InternetProviderLyricSearchResponse, LyricSearchQuery, LyricSource, -} from '.'; -import { store } from '../settings'; -import { orderSearchResults } from './shared'; +} from '/@/shared/types/domain/lyric-domain-types'; const SEARCH_URL = 'https://music.163.com/api/search/get'; const LYRICS_URL = 'https://music.163.com/api/song/lyric'; // Adapted from https://github.com/NyaomiDEV/Sunamu/blob/master/src/main/lyricproviders/netease.ts -export interface Result { - hasMore: boolean; - songCount: number; - songs: Song[]; -} - -export interface Song { - album: Album; - alias: string[]; - artists: Artist[]; - copyrightId: number; - duration: number; - fee: number; - ftype: number; - id: number; - mark: number; - mvid: number; - name: string; - rtype: number; - rUrl: null; - status: number; - transNames?: string[]; -} - interface Album { artist: Artist; copyrightId: number; @@ -69,6 +46,30 @@ interface NetEaseResponse { result: Result; } +interface Result { + hasMore: boolean; + songCount: number; + songs: Song[]; +} + +interface Song { + album: Album; + alias: string[]; + artists: Artist[]; + copyrightId: number; + duration: number; + fee: number; + ftype: number; + id: number; + mark: number; + mvid: number; + name: string; + rtype: number; + rUrl: null; + status: number; + transNames?: string[]; +} + export async function getLyricsBySongId(songId: string): Promise { let result: AxiosResponse; try { diff --git a/src/renderer/api/query-keys.ts b/src/renderer/api/query-keys.ts index d14444c0f..7b96c2898 100644 --- a/src/renderer/api/query-keys.ts +++ b/src/renderer/api/query-keys.ts @@ -1,27 +1,31 @@ -import type { +import { QueryFunctionContext } from '@tanstack/react-query'; + +import { AlbumDetailQuery, AlbumListQuery } from '/@/shared/types/domain/album-domain-types'; +import { AlbumArtistDetailQuery, AlbumArtistListQuery, - AlbumDetailQuery, - AlbumListQuery, ArtistListQuery, - GenreListQuery, +} from '/@/shared/types/domain/artist-domain-types'; +import { GenreListQuery } from '/@/shared/types/domain/genre-domain-types'; +import { LyricSearchQuery, + LyricSource, LyricsQuery, +} from '/@/shared/types/domain/lyric-domain-types'; +import { PlaylistDetailQuery, PlaylistListQuery, PlaylistSongListQuery, +} from '/@/shared/types/domain/playlist-domain-types'; +import { SearchQuery } from '/@/shared/types/domain/search-domain-types'; +import { RandomSongListQuery, - SearchQuery, SimilarSongsQuery, SongDetailQuery, SongListQuery, TopSongListQuery, - UserListQuery, -} from '/@/shared/types/domain-types'; - -import { QueryFunctionContext } from '@tanstack/react-query'; - -import { LyricSource } from '/@/shared/types/domain-types'; +} from '/@/shared/types/domain/song-domain-types'; +import { UserListQuery } from '/@/shared/types/domain/user-domain-types'; export const splitPaginatedQuery = (key: any) => { const { limit, startIndex, ...filter } = key || {}; diff --git a/src/renderer/components/audio-player/index.tsx b/src/renderer/components/audio-player/index.tsx index ddb6dc146..11a895d94 100644 --- a/src/renderer/components/audio-player/index.tsx +++ b/src/renderer/components/audio-player/index.tsx @@ -1,4 +1,3 @@ -import type { Song } from '/@/shared/types/domain-types'; import type { CrossfadeStyle } from '/@/shared/types/types'; import type { ReactPlayerProps } from 'react-player'; @@ -20,9 +19,11 @@ import { gaplessHandler, } from '/@/renderer/components/audio-player/utils/list-handlers'; import { useWebAudio } from '/@/renderer/features/player/hooks/use-webaudio'; -import { getServerById, TranscodingConfig, usePlaybackSettings, useSpeed } from '/@/renderer/store'; +import { TranscodingConfig, usePlaybackSettings, useSpeed } from '/@/renderer/store'; import { useSettingsStore, useSettingsStoreActions } from '/@/renderer/store/settings.store'; import { toast } from '/@/shared/components/toast/toast'; +import { QueueSong } from '/@/shared/types/domain/player-domain-types'; +import { Song } from '/@/shared/types/domain/song-domain-types'; import { PlaybackStyle, PlayerStatus } from '/@/shared/types/types'; export type AudioPlayerProgress = { @@ -57,27 +58,28 @@ const getDuration = (ref: any) => { const EMPTY_SOURCE = 'data:audio/mp3;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU2LjM2LjEwMAAAAAAAAAAAAAAA//OEAAAAAAAAAAAAAAAAAAAAAAAASW5mbwAAAA8AAAAEAAABIADAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV6urq6urq6urq6urq6urq6urq6urq6urq6v////////////////////////////////8AAAAATGF2YzU2LjQxAAAAAAAAAAAAAAAAJAAAAAAAAAAAASDs90hvAAAAAAAAAAAAAAAAAAAA//MUZAAAAAGkAAAAAAAAA0gAAAAATEFN//MUZAMAAAGkAAAAAAAAA0gAAAAARTMu//MUZAYAAAGkAAAAAAAAA0gAAAAAOTku//MUZAkAAAGkAAAAAAAAA0gAAAAANVVV'; -const useSongUrl = (transcode: TranscodingConfig, current: boolean, song?: Song): null | string => { +const useSongUrl = ( + transcode: TranscodingConfig, + current: boolean, + song?: QueueSong, +): null | string => { const prior = useRef(['', '']); return useMemo(() => { - if (song?.serverId) { + if (song?._serverId) { // If we are the current track, we do not want a transcoding // reconfiguration to force a restart. - if (current && prior.current[0] === song.uniqueId) { - return prior.current[1]; + if (current && prior.current[0] === song._uniqueId) { + return prior.current[1] as string; } if (!transcode.enabled) { // transcoding disabled; save the result - prior.current = [song.uniqueId, song.streamUrl]; + prior.current = [song._uniqueId, song.streamUrl]; return song.streamUrl; } const result = api.controller.getTranscodingUrl({ - apiClientProps: { - server: getServerById(song.serverId), - }, query: { base: song.streamUrl, ...transcode, @@ -85,14 +87,14 @@ const useSongUrl = (transcode: TranscodingConfig, current: boolean, song?: Song) })!; // transcoding enabled; save the updated result - prior.current = [song.uniqueId, result]; + prior.current = [song._uniqueId, result]; return result; } // no track; clear result prior.current = ['', '']; return null; - }, [current, song?.uniqueId, song?.serverId, song?.streamUrl, transcode]); + }, [song?._serverId, song?._uniqueId, song?.streamUrl, current, transcode]); }; export interface AudioPlayerRef { diff --git a/src/renderer/components/card/card-controls.tsx b/src/renderer/components/card/card-controls.tsx index c01ac30da..d8314b81c 100644 --- a/src/renderer/components/card/card-controls.tsx +++ b/src/renderer/components/card/card-controls.tsx @@ -13,7 +13,7 @@ import { ActionIcon } from '/@/shared/components/action-icon/action-icon'; import { Button } from '/@/shared/components/button/button'; import { Group } from '/@/shared/components/group/group'; import { Icon } from '/@/shared/components/icon/icon'; -import { LibraryItem } from '/@/shared/types/domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; import { Play } from '/@/shared/types/types'; export const CardControls = ({ diff --git a/src/renderer/components/card/card-rows.tsx b/src/renderer/components/card/card-rows.tsx index afbd9c44a..428a89a53 100644 --- a/src/renderer/components/card/card-rows.tsx +++ b/src/renderer/components/card/card-rows.tsx @@ -3,18 +3,21 @@ import formatDuration from 'format-duration'; import React from 'react'; import { generatePath } from 'react-router'; import { Link } from 'react-router-dom'; +import { Song } from 'src/main/features/core/lyrics/netease'; import styles from './card-rows.module.css'; import { AppRoute } from '/@/renderer/router/routes'; import { formatDateAbsolute, formatDateRelative, formatRating } from '/@/renderer/utils/format'; import { Text } from '/@/shared/components/text/text'; -import { Album, AlbumArtist, Artist, Playlist, Song } from '/@/shared/types/domain-types'; +import { Album } from '/@/shared/types/domain/album-domain-types'; +import { Artist } from '/@/shared/types/domain/artist-domain-types'; +import { Playlist } from '/@/shared/types/domain/playlist-domain-types'; import { CardRow } from '/@/shared/types/types'; interface CardRowsProps { data: any; - rows: CardRow[] | CardRow[] | CardRow[]; + rows: CardRow[] | CardRow[]; } export const CardRows = ({ data, rows }: CardRowsProps) => { diff --git a/src/renderer/components/card/poster-card.tsx b/src/renderer/components/card/poster-card.tsx index ba314d8b9..00c65dc01 100644 --- a/src/renderer/components/card/poster-card.tsx +++ b/src/renderer/components/card/poster-card.tsx @@ -8,12 +8,14 @@ import { GridCardControls } from '/@/renderer/components/virtual-grid/grid-card/ import { Image } from '/@/shared/components/image/image'; import { Skeleton } from '/@/shared/components/skeleton/skeleton'; import { Stack } from '/@/shared/components/stack/stack'; -import { Album, AlbumArtist, Artist, LibraryItem } from '/@/shared/types/domain-types'; +import { Album } from '/@/shared/types/domain/album-domain-types'; +import { Artist } from '/@/shared/types/domain/artist-domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; import { CardRoute, CardRow, Play, PlayQueueAddOptions } from '/@/shared/types/types'; interface BaseGridCardProps { controls: { - cardRows: CardRow[] | CardRow[] | CardRow[]; + cardRows: CardRow[] | CardRow[]; handleFavorite: (options: { id: string[]; isFavorite: boolean; diff --git a/src/renderer/components/feature-carousel/feature-carousel.tsx b/src/renderer/components/feature-carousel/feature-carousel.tsx index ee6ed5a2f..80d47f945 100644 --- a/src/renderer/components/feature-carousel/feature-carousel.tsx +++ b/src/renderer/components/feature-carousel/feature-carousel.tsx @@ -20,7 +20,8 @@ import { Image } from '/@/shared/components/image/image'; import { Stack } from '/@/shared/components/stack/stack'; import { TextTitle } from '/@/shared/components/text-title/text-title'; import { Text } from '/@/shared/components/text/text'; -import { Album, LibraryItem } from '/@/shared/types/domain-types'; +import { Album } from '/@/shared/types/domain/album-domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; import { Play } from '/@/shared/types/types'; const variants: Variants = { diff --git a/src/renderer/components/grid-carousel/grid-carousel.tsx b/src/renderer/components/grid-carousel/grid-carousel.tsx index 2075003b3..1a7c1dca7 100644 --- a/src/renderer/components/grid-carousel/grid-carousel.tsx +++ b/src/renderer/components/grid-carousel/grid-carousel.tsx @@ -24,13 +24,9 @@ import { Group } from '/@/shared/components/group/group'; import { Icon } from '/@/shared/components/icon/icon'; import { Stack } from '/@/shared/components/stack/stack'; import { TextTitle } from '/@/shared/components/text-title/text-title'; -import { - Album, - AlbumArtist, - Artist, - LibraryItem, - RelatedArtist, -} from '/@/shared/types/domain-types'; +import { Album } from '/@/shared/types/domain/album-domain-types'; +import { Artist, RelatedArtist } from '/@/shared/types/domain/artist-domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; import { CardRoute, CardRow } from '/@/shared/types/types'; const getSlidesPerView = (windowWidth: number) => { diff --git a/src/renderer/components/virtual-grid/grid-card/default-card.tsx b/src/renderer/components/virtual-grid/grid-card/default-card.tsx index b337952ea..0c7ea7888 100644 --- a/src/renderer/components/virtual-grid/grid-card/default-card.tsx +++ b/src/renderer/components/virtual-grid/grid-card/default-card.tsx @@ -10,20 +10,17 @@ import { GridCardControls } from '/@/renderer/components/virtual-grid/grid-card/ import { Image } from '/@/shared/components/image/image'; import { Skeleton } from '/@/shared/components/skeleton/skeleton'; import { Stack } from '/@/shared/components/stack/stack'; -import { - Album, - AlbumArtist, - Artist, - LibraryItem, - Playlist, - Song, -} from '/@/shared/types/domain-types'; +import { Album } from '/@/shared/types/domain/album-domain-types'; +import { Artist } from '/@/shared/types/domain/artist-domain-types'; +import { Playlist } from '/@/shared/types/domain/playlist-domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; +import { Song } from '/@/shared/types/domain/song-domain-types'; import { CardRoute, CardRow, Play, PlayQueueAddOptions } from '/@/shared/types/types'; interface BaseGridCardProps { columnIndex: number; controls: { - cardRows: CardRow[]; + cardRows: CardRow[]; handleFavorite: (options: { id: string[]; isFavorite: boolean; diff --git a/src/renderer/components/virtual-grid/grid-card/grid-card-controls.tsx b/src/renderer/components/virtual-grid/grid-card/grid-card-controls.tsx index 82c9401aa..8e3ce3d09 100644 --- a/src/renderer/components/virtual-grid/grid-card/grid-card-controls.tsx +++ b/src/renderer/components/virtual-grid/grid-card/grid-card-controls.tsx @@ -13,7 +13,7 @@ import { usePlayButtonBehavior } from '/@/renderer/store/settings.store'; import { ActionIcon } from '/@/shared/components/action-icon/action-icon'; import { Button } from '/@/shared/components/button/button'; import { Icon } from '/@/shared/components/icon/icon'; -import { LibraryItem } from '/@/shared/types/domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; import { Play, PlayQueueAddOptions } from '/@/shared/types/types'; export const GridCardControls = ({ diff --git a/src/renderer/components/virtual-grid/grid-card/poster-card.tsx b/src/renderer/components/virtual-grid/grid-card/poster-card.tsx index fb8d5befc..f1b795833 100644 --- a/src/renderer/components/virtual-grid/grid-card/poster-card.tsx +++ b/src/renderer/components/virtual-grid/grid-card/poster-card.tsx @@ -10,20 +10,17 @@ import { GridCardControls } from '/@/renderer/components/virtual-grid/grid-card/ import { Image } from '/@/shared/components/image/image'; import { Skeleton } from '/@/shared/components/skeleton/skeleton'; import { Stack } from '/@/shared/components/stack/stack'; -import { - Album, - AlbumArtist, - Artist, - LibraryItem, - Playlist, - Song, -} from '/@/shared/types/domain-types'; +import { Album } from '/@/shared/types/domain/album-domain-types'; +import { Artist } from '/@/shared/types/domain/artist-domain-types'; +import { Playlist } from '/@/shared/types/domain/playlist-domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; +import { Song } from '/@/shared/types/domain/song-domain-types'; import { CardRoute, CardRow, Play, PlayQueueAddOptions } from '/@/shared/types/types'; interface BaseGridCardProps { columnIndex: number; controls: { - cardRows: CardRow[]; + cardRows: CardRow[]; handleFavorite: (options: { id: string[]; isFavorite: boolean; diff --git a/src/renderer/components/virtual-grid/virtual-grid-wrapper.tsx b/src/renderer/components/virtual-grid/virtual-grid-wrapper.tsx index 820b37e1d..7453e0a03 100644 --- a/src/renderer/components/virtual-grid/virtual-grid-wrapper.tsx +++ b/src/renderer/components/virtual-grid/virtual-grid-wrapper.tsx @@ -14,7 +14,9 @@ import { FixedSizeList } from 'react-window'; import styles from './virtual-grid-wrapper.module.css'; import { GridCard } from '/@/renderer/components/virtual-grid/grid-card'; -import { Album, AlbumArtist, Artist, LibraryItem } from '/@/shared/types/domain-types'; +import { Album } from '/@/shared/types/domain/album-domain-types'; +import { Artist } from '/@/shared/types/domain/artist-domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; const createItemData = memoize( ( @@ -72,7 +74,7 @@ export const VirtualGridWrapper = ({ width, ...rest }: Omit & { - cardRows: CardRow[]; + cardRows: CardRow[]; columnCount: number; display: ListDisplayType; handleFavorite?: (options: { diff --git a/src/renderer/components/virtual-grid/virtual-infinite-grid.tsx b/src/renderer/components/virtual-grid/virtual-infinite-grid.tsx index 4263439d3..1f2fb5091 100644 --- a/src/renderer/components/virtual-grid/virtual-infinite-grid.tsx +++ b/src/renderer/components/virtual-grid/virtual-infinite-grid.tsx @@ -14,7 +14,8 @@ import { import InfiniteLoader from 'react-window-infinite-loader'; import { VirtualGridWrapper } from '/@/renderer/components/virtual-grid/virtual-grid-wrapper'; -import { AnyLibraryItem, Genre, LibraryItem } from '/@/shared/types/domain-types'; +import { Genre } from '/@/shared/types/domain/genre-domain-types'; +import { AnyLibraryItem, LibraryItem } from '/@/shared/types/domain/shared-domain-types'; import { ListDisplayType } from '/@/shared/types/types'; export type VirtualInfiniteGridRef = { diff --git a/src/renderer/components/virtual-table/cells/album-artist-cell.tsx b/src/renderer/components/virtual-table/cells/album-artist-cell.tsx index 059de9cda..d63f98a94 100644 --- a/src/renderer/components/virtual-table/cells/album-artist-cell.tsx +++ b/src/renderer/components/virtual-table/cells/album-artist-cell.tsx @@ -1,4 +1,3 @@ -import type { AlbumArtist, Artist } from '/@/shared/types/domain-types'; import type { ICellRendererParams } from '@ag-grid-community/core'; import React from 'react'; @@ -10,6 +9,7 @@ import { AppRoute } from '/@/renderer/router/routes'; import { Separator } from '/@/shared/components/separator/separator'; import { Skeleton } from '/@/shared/components/skeleton/skeleton'; import { Text } from '/@/shared/components/text/text'; +import { Artist } from '/@/shared/types/domain/artist-domain-types'; export const AlbumArtistCell = ({ data, value }: ICellRendererParams) => { if (value === undefined) { @@ -23,7 +23,7 @@ export const AlbumArtistCell = ({ data, value }: ICellRendererParams) => { return ( - {value?.map((item: AlbumArtist | Artist, index: number) => ( + {value?.map((item: Artist, index: number) => ( {index > 0 && } {item.id ? ( diff --git a/src/renderer/components/virtual-table/cells/artist-cell.tsx b/src/renderer/components/virtual-table/cells/artist-cell.tsx index bbbb66a74..284eda667 100644 --- a/src/renderer/components/virtual-table/cells/artist-cell.tsx +++ b/src/renderer/components/virtual-table/cells/artist-cell.tsx @@ -1,4 +1,3 @@ -import type { AlbumArtist, Artist } from '/@/shared/types/domain-types'; import type { ICellRendererParams } from '@ag-grid-community/core'; import React from 'react'; @@ -10,6 +9,7 @@ import { AppRoute } from '/@/renderer/router/routes'; import { Separator } from '/@/shared/components/separator/separator'; import { Skeleton } from '/@/shared/components/skeleton/skeleton'; import { Text } from '/@/shared/components/text/text'; +import { Artist } from '/@/shared/types/domain/artist-domain-types'; export const ArtistCell = ({ data, value }: ICellRendererParams) => { if (value === undefined) { @@ -23,7 +23,7 @@ export const ArtistCell = ({ data, value }: ICellRendererParams) => { return ( - {value?.map((item: AlbumArtist | Artist, index: number) => ( + {value?.map((item: Artist, index: number) => ( {index > 0 && } {item.id ? ( diff --git a/src/renderer/components/virtual-table/cells/combined-title-cell-controls.tsx b/src/renderer/components/virtual-table/cells/combined-title-cell-controls.tsx index 573cd8a80..6ade009de 100644 --- a/src/renderer/components/virtual-table/cells/combined-title-cell-controls.tsx +++ b/src/renderer/components/virtual-table/cells/combined-title-cell-controls.tsx @@ -5,7 +5,7 @@ import styles from './combined-title-cell-controls.module.css'; import { usePlayQueueAdd } from '/@/renderer/features/player'; import { usePlayButtonBehavior } from '/@/renderer/store/settings.store'; import { ActionIcon } from '/@/shared/components/action-icon/action-icon'; -import { LibraryItem } from '/@/shared/types/domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; import { Play } from '/@/shared/types/types'; export const ListCoverControls = ({ diff --git a/src/renderer/components/virtual-table/cells/combined-title-cell.tsx b/src/renderer/components/virtual-table/cells/combined-title-cell.tsx index ba21d7e31..5167f4e7c 100644 --- a/src/renderer/components/virtual-table/cells/combined-title-cell.tsx +++ b/src/renderer/components/virtual-table/cells/combined-title-cell.tsx @@ -12,7 +12,7 @@ import { SEPARATOR_STRING } from '/@/shared/api/utils'; import { Image } from '/@/shared/components/image/image'; import { Skeleton } from '/@/shared/components/skeleton/skeleton'; import { Text } from '/@/shared/components/text/text'; -import { AlbumArtist, Artist } from '/@/shared/types/domain-types'; +import { Artist } from '/@/shared/types/domain/artist-domain-types'; export const CombinedTitleCell = ({ context, @@ -74,7 +74,7 @@ export const CombinedTitleCell = ({ {artists?.length ? ( - artists.map((artist: AlbumArtist | Artist, index: number) => ( + artists.map((artist: Artist, index: number) => ( {index > 0 ? SEPARATOR_STRING : null} {artist.id ? ( diff --git a/src/renderer/components/virtual-table/cells/genre-cell.tsx b/src/renderer/components/virtual-table/cells/genre-cell.tsx index e1755dbcb..edfad5a39 100644 --- a/src/renderer/components/virtual-table/cells/genre-cell.tsx +++ b/src/renderer/components/virtual-table/cells/genre-cell.tsx @@ -1,4 +1,3 @@ -import type { AlbumArtist, Artist } from '/@/shared/types/domain-types'; import type { ICellRendererParams } from '@ag-grid-community/core'; import React from 'react'; @@ -8,13 +7,14 @@ import { CellContainer } from '/@/renderer/components/virtual-table/cells/generi import { useGenreRoute } from '/@/renderer/hooks/use-genre-route'; import { Separator } from '/@/shared/components/separator/separator'; import { Text } from '/@/shared/components/text/text'; +import { Artist } from '/@/shared/types/domain/artist-domain-types'; export const GenreCell = ({ data, value }: ICellRendererParams) => { const genrePath = useGenreRoute(); return ( - {value?.map((item: AlbumArtist | Artist, index: number) => ( + {value?.map((item: Artist, index: number) => ( {index > 0 && } = ( diff --git a/src/renderer/features/action-required/components/server-required.tsx b/src/renderer/features/action-required/components/server-required.tsx index 45335db1b..34a526a0d 100644 --- a/src/renderer/features/action-required/components/server-required.tsx +++ b/src/renderer/features/action-required/components/server-required.tsx @@ -18,7 +18,7 @@ import { Icon } from '/@/shared/components/icon/icon'; import { ScrollArea } from '/@/shared/components/scroll-area/scroll-area'; import { Stack } from '/@/shared/components/stack/stack'; import { Text } from '/@/shared/components/text/text'; -import { ServerListItem, ServerType } from '/@/shared/types/domain-types'; +import { ServerListItem, ServerType } from '/@/shared/types/domain/server-domain-types'; const localSettings = isElectron() ? window.api.localSettings : null; diff --git a/src/renderer/features/albums/components/album-detail-content.tsx b/src/renderer/features/albums/components/album-detail-content.tsx index 2d4506835..012bb4a0c 100644 --- a/src/renderer/features/albums/components/album-detail-content.tsx +++ b/src/renderer/features/albums/components/album-detail-content.tsx @@ -49,13 +49,9 @@ import { Group } from '/@/shared/components/group/group'; import { Popover } from '/@/shared/components/popover/popover'; import { Spoiler } from '/@/shared/components/spoiler/spoiler'; import { Stack } from '/@/shared/components/stack/stack'; -import { - AlbumListQuery, - AlbumListSort, - LibraryItem, - QueueSong, - SortOrder, -} from '/@/shared/types/domain-types'; +import { AlbumListQuery, AlbumListSort } from '/@/shared/types/domain/album-domain-types'; +import { QueueSong } from '/@/shared/types/domain/player-domain-types'; +import { LibraryItem, ListSortOrder } from '/@/shared/types/domain/shared-domain-types'; import { Play } from '/@/shared/types/types'; const isFullWidthRow = (node: RowNode) => { @@ -170,7 +166,7 @@ export const AlbumDetailContent = ({ background, tableRef }: AlbumDetailContentP : undefined, limit: 15, sortBy: AlbumListSort.YEAR, - sortOrder: SortOrder.DESC, + sortOrder: ListSortOrder.DESC, startIndex: 0, }, serverId: server?.id, @@ -180,7 +176,7 @@ export const AlbumDetailContent = ({ background, tableRef }: AlbumDetailContentP genres: detailQuery.data?.genres.length ? [detailQuery.data.genres[0].id] : undefined, limit: 15, sortBy: AlbumListSort.RANDOM, - sortOrder: SortOrder.ASC, + sortOrder: ListSortOrder.ASC, startIndex: 0, }; diff --git a/src/renderer/features/albums/components/album-detail-header.tsx b/src/renderer/features/albums/components/album-detail-header.tsx index fae91f6a7..e16a4fbd7 100644 --- a/src/renderer/features/albums/components/album-detail-header.tsx +++ b/src/renderer/features/albums/components/album-detail-header.tsx @@ -16,7 +16,9 @@ import { Group } from '/@/shared/components/group/group'; import { Rating } from '/@/shared/components/rating/rating'; import { Stack } from '/@/shared/components/stack/stack'; import { Text } from '/@/shared/components/text/text'; -import { AlbumDetailResponse, LibraryItem, ServerType } from '/@/shared/types/domain-types'; +import { AlbumDetailResponse } from '/@/shared/types/domain/album-domain-types'; +import { ServerType } from '/@/shared/types/domain/server-domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; interface AlbumDetailHeaderProps { background: { diff --git a/src/renderer/features/albums/components/album-list-grid-view.tsx b/src/renderer/features/albums/components/album-list-grid-view.tsx index d7b53a439..0db4a098e 100644 --- a/src/renderer/features/albums/components/album-list-grid-view.tsx +++ b/src/renderer/features/albums/components/album-list-grid-view.tsx @@ -21,8 +21,8 @@ import { AlbumListQuery, AlbumListResponse, AlbumListSort, - LibraryItem, -} from '/@/shared/types/domain-types'; +} from '/@/shared/types/domain/album-domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; import { CardRow, ListDisplayType } from '/@/shared/types/types'; export const AlbumListGridView = ({ gridRef, itemCount }: any) => { diff --git a/src/renderer/features/albums/components/album-list-header-filters.tsx b/src/renderer/features/albums/components/album-list-header-filters.tsx index 0fcdeea62..76a984fb7 100644 --- a/src/renderer/features/albums/components/album-list-header-filters.tsx +++ b/src/renderer/features/albums/components/album-list-header-filters.tsx @@ -34,158 +34,154 @@ import { DropdownMenu } from '/@/shared/components/dropdown-menu/dropdown-menu'; import { Flex } from '/@/shared/components/flex/flex'; import { Group } from '/@/shared/components/group/group'; import { Icon } from '/@/shared/components/icon/icon'; -import { - AlbumListQuery, - AlbumListSort, - LibraryItem, - ServerType, - SortOrder, -} from '/@/shared/types/domain-types'; +import { AlbumListQuery, AlbumListSort } from '/@/shared/types/domain/album-domain-types'; +import { ServerType } from '/@/shared/types/domain/server-domain-types'; +import { LibraryItem, ListSortOrder } from '/@/shared/types/domain/shared-domain-types'; import { ListDisplayType, Play, TableColumn } from '/@/shared/types/types'; const FILTERS = { jellyfin: [ { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.albumArtist', { postProcess: 'titleCase' }), value: AlbumListSort.ALBUM_ARTIST, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.communityRating', { postProcess: 'titleCase' }), value: AlbumListSort.COMMUNITY_RATING, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.criticRating', { postProcess: 'titleCase' }), value: AlbumListSort.CRITIC_RATING, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.name', { postProcess: 'titleCase' }), value: AlbumListSort.NAME, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.playCount', { postProcess: 'titleCase' }), value: AlbumListSort.PLAY_COUNT, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.random', { postProcess: 'titleCase' }), value: AlbumListSort.RANDOM, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.recentlyAdded', { postProcess: 'titleCase' }), value: AlbumListSort.RECENTLY_ADDED, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.releaseDate', { postProcess: 'titleCase' }), value: AlbumListSort.RELEASE_DATE, }, ], navidrome: [ { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.albumArtist', { postProcess: 'titleCase' }), value: AlbumListSort.ALBUM_ARTIST, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.artist', { postProcess: 'titleCase' }), value: AlbumListSort.ARTIST, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.duration', { postProcess: 'titleCase' }), value: AlbumListSort.DURATION, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.mostPlayed', { postProcess: 'titleCase' }), value: AlbumListSort.PLAY_COUNT, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.name', { postProcess: 'titleCase' }), value: AlbumListSort.NAME, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.random', { postProcess: 'titleCase' }), value: AlbumListSort.RANDOM, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.rating', { postProcess: 'titleCase' }), value: AlbumListSort.RATING, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.recentlyAdded', { postProcess: 'titleCase' }), value: AlbumListSort.RECENTLY_ADDED, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.recentlyPlayed', { postProcess: 'titleCase' }), value: AlbumListSort.RECENTLY_PLAYED, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.songCount', { postProcess: 'titleCase' }), value: AlbumListSort.SONG_COUNT, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.favorited', { postProcess: 'titleCase' }), value: AlbumListSort.FAVORITED, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.releaseYear', { postProcess: 'titleCase' }), value: AlbumListSort.YEAR, }, ], subsonic: [ { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.albumArtist', { postProcess: 'titleCase' }), value: AlbumListSort.ALBUM_ARTIST, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.mostPlayed', { postProcess: 'titleCase' }), value: AlbumListSort.PLAY_COUNT, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.name', { postProcess: 'titleCase' }), value: AlbumListSort.NAME, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.random', { postProcess: 'titleCase' }), value: AlbumListSort.RANDOM, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.recentlyAdded', { postProcess: 'titleCase' }), value: AlbumListSort.RECENTLY_ADDED, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.recentlyPlayed', { postProcess: 'titleCase' }), value: AlbumListSort.RECENTLY_PLAYED, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.favorited', { postProcess: 'titleCase' }), value: AlbumListSort.FAVORITED, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.releaseYear', { postProcess: 'titleCase' }), value: AlbumListSort.YEAR, }, @@ -299,7 +295,7 @@ export const AlbumListHeaderFilters = ({ customFilters, data: { sortBy: e.currentTarget.value as AlbumListSort, - sortOrder: sortOrder || SortOrder.ASC, + sortOrder: sortOrder || ListSortOrder.ASC, }, itemType: LibraryItem.ALBUM, key: pageKey, @@ -337,7 +333,8 @@ export const AlbumListHeaderFilters = ({ ); const handleToggleSortOrder = useCallback(() => { - const newSortOrder = filter.sortOrder === SortOrder.ASC ? SortOrder.DESC : SortOrder.ASC; + const newSortOrder = + filter.sortOrder === ListSortOrder.ASC ? ListSortOrder.DESC : ListSortOrder.ASC; const updatedFilters = setFilter({ customFilters, data: { sortOrder: newSortOrder }, diff --git a/src/renderer/features/albums/components/album-list-header.tsx b/src/renderer/features/albums/components/album-list-header.tsx index daa672371..cbc402ffc 100644 --- a/src/renderer/features/albums/components/album-list-header.tsx +++ b/src/renderer/features/albums/components/album-list-header.tsx @@ -16,7 +16,8 @@ import { titleCase } from '/@/renderer/utils'; import { Flex } from '/@/shared/components/flex/flex'; import { Group } from '/@/shared/components/group/group'; import { Stack } from '/@/shared/components/stack/stack'; -import { AlbumListQuery, LibraryItem } from '/@/shared/types/domain-types'; +import { AlbumListQuery } from '/@/shared/types/domain/album-domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; interface AlbumListHeaderProps { genreId?: string; diff --git a/src/renderer/features/albums/components/album-list-table-view.tsx b/src/renderer/features/albums/components/album-list-table-view.tsx index 05c06303b..27f651f69 100644 --- a/src/renderer/features/albums/components/album-list-table-view.tsx +++ b/src/renderer/features/albums/components/album-list-table-view.tsx @@ -4,7 +4,7 @@ import { useVirtualTable } from '/@/renderer/components/virtual-table/hooks/use- import { useListContext } from '/@/renderer/context/list-context'; import { ALBUM_CONTEXT_MENU_ITEMS } from '/@/renderer/features/context-menu/context-menu-items'; import { useCurrentServer } from '/@/renderer/store'; -import { LibraryItem } from '/@/shared/types/domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; export const AlbumListTableView = ({ itemCount, tableRef }: any) => { const server = useCurrentServer(); diff --git a/src/renderer/features/albums/components/jellyfin-album-filters.tsx b/src/renderer/features/albums/components/jellyfin-album-filters.tsx index 9a76b2034..c82e8b73d 100644 --- a/src/renderer/features/albums/components/jellyfin-album-filters.tsx +++ b/src/renderer/features/albums/components/jellyfin-album-filters.tsx @@ -14,13 +14,10 @@ import { SpinnerIcon } from '/@/shared/components/spinner/spinner'; import { Stack } from '/@/shared/components/stack/stack'; import { Text } from '/@/shared/components/text/text'; import { YesNoSelect } from '/@/shared/components/yes-no-select/yes-no-select'; -import { - AlbumArtistListSort, - AlbumListQuery, - GenreListSort, - LibraryItem, - SortOrder, -} from '/@/shared/types/domain-types'; +import { AlbumListQuery } from '/@/shared/types/domain/album-domain-types'; +import { AlbumArtistListSort } from '/@/shared/types/domain/artist-domain-types'; +import { GenreListSort } from '/@/shared/types/domain/genre-domain-types'; +import { LibraryItem, ListSortOrder } from '/@/shared/types/domain/shared-domain-types'; interface JellyfinAlbumFiltersProps { customFilters?: Partial; @@ -50,7 +47,7 @@ export const JellyfinAlbumFilters = ({ query: { musicFolderId: filter?.musicFolderId, sortBy: GenreListSort.NAME, - sortOrder: SortOrder.ASC, + sortOrder: ListSortOrder.ASC, startIndex: 0, }, serverId, @@ -178,7 +175,7 @@ export const JellyfinAlbumFilters = ({ }, query: { sortBy: AlbumArtistListSort.NAME, - sortOrder: SortOrder.ASC, + sortOrder: ListSortOrder.ASC, startIndex: 0, }, serverId, diff --git a/src/renderer/features/albums/components/navidrome-album-filters.tsx b/src/renderer/features/albums/components/navidrome-album-filters.tsx index 672c6caff..77c5e6434 100644 --- a/src/renderer/features/albums/components/navidrome-album-filters.tsx +++ b/src/renderer/features/albums/components/navidrome-album-filters.tsx @@ -16,13 +16,10 @@ import { Stack } from '/@/shared/components/stack/stack'; import { Switch } from '/@/shared/components/switch/switch'; import { Text } from '/@/shared/components/text/text'; import { YesNoSelect } from '/@/shared/components/yes-no-select/yes-no-select'; -import { - AlbumArtistListSort, - AlbumListQuery, - GenreListSort, - LibraryItem, - SortOrder, -} from '/@/shared/types/domain-types'; +import { AlbumListQuery } from '/@/shared/types/domain/album-domain-types'; +import { AlbumArtistListSort } from '/@/shared/types/domain/artist-domain-types'; +import { GenreListSort } from '/@/shared/types/domain/genre-domain-types'; +import { LibraryItem, ListSortOrder } from '/@/shared/types/domain/shared-domain-types'; interface NavidromeAlbumFiltersProps { customFilters?: Partial; @@ -50,7 +47,7 @@ export const NavidromeAlbumFilters = ({ }, query: { sortBy: GenreListSort.NAME, - sortOrder: SortOrder.ASC, + sortOrder: ListSortOrder.ASC, startIndex: 0, }, serverId, @@ -194,7 +191,7 @@ export const NavidromeAlbumFilters = ({ query: { // searchTerm: debouncedSearchTerm, sortBy: AlbumArtistListSort.NAME, - sortOrder: SortOrder.ASC, + sortOrder: ListSortOrder.ASC, startIndex: 0, }, serverId, diff --git a/src/renderer/features/albums/components/subsonic-album-filters.tsx b/src/renderer/features/albums/components/subsonic-album-filters.tsx index 356b5bdeb..6fcfb2251 100644 --- a/src/renderer/features/albums/components/subsonic-album-filters.tsx +++ b/src/renderer/features/albums/components/subsonic-album-filters.tsx @@ -14,13 +14,10 @@ import { SpinnerIcon } from '/@/shared/components/spinner/spinner'; import { Stack } from '/@/shared/components/stack/stack'; import { Switch } from '/@/shared/components/switch/switch'; import { Text } from '/@/shared/components/text/text'; -import { - AlbumArtistListSort, - AlbumListQuery, - GenreListSort, - LibraryItem, - SortOrder, -} from '/@/shared/types/domain-types'; +import { AlbumListQuery } from '/@/shared/types/domain/album-domain-types'; +import { AlbumArtistListSort } from '/@/shared/types/domain/artist-domain-types'; +import { GenreListSort } from '/@/shared/types/domain/genre-domain-types'; +import { LibraryItem, ListSortOrder } from '/@/shared/types/domain/shared-domain-types'; interface SubsonicAlbumFiltersProps { disableArtistFilter?: boolean; @@ -47,7 +44,7 @@ export const SubsonicAlbumFilters = ({ }, query: { sortBy: AlbumArtistListSort.NAME, - sortOrder: SortOrder.ASC, + sortOrder: ListSortOrder.ASC, startIndex: 0, }, serverId, @@ -80,7 +77,7 @@ export const SubsonicAlbumFilters = ({ }, query: { sortBy: GenreListSort.NAME, - sortOrder: SortOrder.ASC, + sortOrder: ListSortOrder.ASC, startIndex: 0, }, serverId, diff --git a/src/renderer/features/albums/queries/album-detail-query.ts b/src/renderer/features/albums/queries/album-detail-query.ts index 7e1f7cbf2..2e64c5bc7 100644 --- a/src/renderer/features/albums/queries/album-detail-query.ts +++ b/src/renderer/features/albums/queries/album-detail-query.ts @@ -1,11 +1,11 @@ import type { QueryHookArgs } from '/@/renderer/lib/react-query'; -import type { AlbumDetailQuery } from '/@/shared/types/domain-types'; import { useQuery } from '@tanstack/react-query'; import { controller } from '/@/renderer/api/controller'; import { queryKeys } from '/@/renderer/api/query-keys'; import { getServerById } from '/@/renderer/store'; +import { AlbumDetailQuery } from '/@/shared/types/domain/album-domain-types'; export const useAlbumDetail = (args: QueryHookArgs) => { const { options, query, serverId } = args; diff --git a/src/renderer/features/albums/queries/album-list-count-query.ts b/src/renderer/features/albums/queries/album-list-count-query.ts index 4b4c8929a..91a3159fc 100644 --- a/src/renderer/features/albums/queries/album-list-count-query.ts +++ b/src/renderer/features/albums/queries/album-list-count-query.ts @@ -1,11 +1,11 @@ import type { QueryHookArgs } from '/@/renderer/lib/react-query'; -import type { AlbumListQuery } from '/@/shared/types/domain-types'; import { useQuery } from '@tanstack/react-query'; import { api } from '/@/renderer/api'; import { queryKeys } from '/@/renderer/api/query-keys'; import { getServerById } from '/@/renderer/store'; +import { AlbumListQuery } from '/@/shared/types/domain/album-domain-types'; export const useAlbumListCount = (args: QueryHookArgs) => { const { options, query, serverId } = args; diff --git a/src/renderer/features/albums/queries/album-list-query.ts b/src/renderer/features/albums/queries/album-list-query.ts index a82c4e585..70a0461c1 100644 --- a/src/renderer/features/albums/queries/album-list-query.ts +++ b/src/renderer/features/albums/queries/album-list-query.ts @@ -1,5 +1,4 @@ import type { QueryHookArgs } from '/@/renderer/lib/react-query'; -import type { AlbumListQuery, AlbumListResponse } from '/@/shared/types/domain-types'; import { useInfiniteQuery, useQuery } from '@tanstack/react-query'; @@ -7,6 +6,7 @@ import { api } from '/@/renderer/api'; import { controller } from '/@/renderer/api/controller'; import { queryKeys } from '/@/renderer/api/query-keys'; import { getServerById } from '/@/renderer/store'; +import { AlbumListQuery, AlbumListResponse } from '/@/shared/types/domain/album-domain-types'; export const useAlbumList = (args: QueryHookArgs) => { const { options, query, serverId } = args; diff --git a/src/renderer/features/albums/routes/album-detail-route.tsx b/src/renderer/features/albums/routes/album-detail-route.tsx index 32f936758..8d162afb1 100644 --- a/src/renderer/features/albums/routes/album-detail-route.tsx +++ b/src/renderer/features/albums/routes/album-detail-route.tsx @@ -12,7 +12,7 @@ import { AnimatedPage, LibraryHeaderBar } from '/@/renderer/features/shared'; import { useFastAverageColor } from '/@/renderer/hooks'; import { useCurrentServer, useGeneralSettings } from '/@/renderer/store'; import { usePlayButtonBehavior } from '/@/renderer/store/settings.store'; -import { LibraryItem } from '/@/shared/types/domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; const AlbumDetailRoute = () => { const tableRef = useRef(null); diff --git a/src/renderer/features/albums/routes/album-list-route.tsx b/src/renderer/features/albums/routes/album-list-route.tsx index 095958a66..c8fea9365 100644 --- a/src/renderer/features/albums/routes/album-list-route.tsx +++ b/src/renderer/features/albums/routes/album-list-route.tsx @@ -16,12 +16,9 @@ import { usePlayQueueAdd } from '/@/renderer/features/player'; import { AnimatedPage } from '/@/renderer/features/shared'; import { queryClient } from '/@/renderer/lib/react-query'; import { useCurrentServer, useListFilterByKey } from '/@/renderer/store'; -import { - AlbumListQuery, - GenreListSort, - LibraryItem, - SortOrder, -} from '/@/shared/types/domain-types'; +import { AlbumListQuery } from '/@/shared/types/domain/album-domain-types'; +import { GenreListSort } from '/@/shared/types/domain/genre-domain-types'; +import { LibraryItem, ListSortOrder } from '/@/shared/types/domain/shared-domain-types'; import { Play } from '/@/shared/types/types'; const AlbumListRoute = () => { @@ -60,7 +57,7 @@ const AlbumListRoute = () => { }, query: { sortBy: GenreListSort.NAME, - sortOrder: SortOrder.ASC, + sortOrder: ListSortOrder.ASC, startIndex: 0, }, serverId: server?.id, diff --git a/src/renderer/features/albums/routes/dummy-album-detail-route.tsx b/src/renderer/features/albums/routes/dummy-album-detail-route.tsx index ccc816367..492334195 100644 --- a/src/renderer/features/albums/routes/dummy-album-detail-route.tsx +++ b/src/renderer/features/albums/routes/dummy-album-detail-route.tsx @@ -33,7 +33,8 @@ import { Icon } from '/@/shared/components/icon/icon'; import { Spoiler } from '/@/shared/components/spoiler/spoiler'; import { Stack } from '/@/shared/components/stack/stack'; import { Text } from '/@/shared/components/text/text'; -import { LibraryItem, SongDetailResponse } from '/@/shared/types/domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; +import { SongDetailResponse } from '/@/shared/types/domain/song-domain-types'; const DummyAlbumDetailRoute = () => { const cq = useContainerQuery(); diff --git a/src/renderer/features/artists/components/album-artist-detail-content.tsx b/src/renderer/features/artists/components/album-artist-detail-content.tsx index aad0e5b58..ccf144e66 100644 --- a/src/renderer/features/artists/components/album-artist-detail-content.tsx +++ b/src/renderer/features/artists/components/album-artist-detail-content.tsx @@ -35,15 +35,10 @@ import { Group } from '/@/shared/components/group/group'; import { Spoiler } from '/@/shared/components/spoiler/spoiler'; import { Stack } from '/@/shared/components/stack/stack'; import { TextTitle } from '/@/shared/components/text-title/text-title'; -import { - Album, - AlbumArtist, - AlbumListSort, - LibraryItem, - QueueSong, - ServerType, - SortOrder, -} from '/@/shared/types/domain-types'; +import { Album, AlbumListSort } from '/@/shared/types/domain/album-domain-types'; +import { QueueSong } from '/@/shared/types/domain/player-domain-types'; +import { ServerType } from '/@/shared/types/domain/server-domain-types'; +import { LibraryItem, ListSortOrder } from '/@/shared/types/domain/shared-domain-types'; import { CardRow, Play, TableColumn } from '/@/shared/types/types'; interface AlbumArtistDetailContentProps { @@ -106,7 +101,7 @@ export const AlbumArtistDetailContent = ({ background }: AlbumArtistDetailConten compilation: false, limit: 15, sortBy: AlbumListSort.RELEASE_DATE, - sortOrder: SortOrder.DESC, + sortOrder: ListSortOrder.DESC, startIndex: 0, }, serverId: server?.id, @@ -121,7 +116,7 @@ export const AlbumArtistDetailContent = ({ background }: AlbumArtistDetailConten compilation: true, limit: 15, sortBy: AlbumListSort.RELEASE_DATE, - sortOrder: SortOrder.DESC, + sortOrder: ListSortOrder.DESC, startIndex: 0, }, serverId: server?.id, diff --git a/src/renderer/features/artists/components/album-artist-detail-header.tsx b/src/renderer/features/artists/components/album-artist-detail-header.tsx index f15748598..c573575df 100644 --- a/src/renderer/features/artists/components/album-artist-detail-header.tsx +++ b/src/renderer/features/artists/components/album-artist-detail-header.tsx @@ -11,7 +11,8 @@ import { Group } from '/@/shared/components/group/group'; import { Rating } from '/@/shared/components/rating/rating'; import { Stack } from '/@/shared/components/stack/stack'; import { Text } from '/@/shared/components/text/text'; -import { LibraryItem, ServerType } from '/@/shared/types/domain-types'; +import { ServerType } from '/@/shared/types/domain/server-domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; interface AlbumArtistDetailHeaderProps { background?: string; diff --git a/src/renderer/features/artists/components/album-artist-detail-top-songs-list-content.tsx b/src/renderer/features/artists/components/album-artist-detail-top-songs-list-content.tsx index 5d4eb5dc2..636f7dfb7 100644 --- a/src/renderer/features/artists/components/album-artist-detail-top-songs-list-content.tsx +++ b/src/renderer/features/artists/components/album-artist-detail-top-songs-list-content.tsx @@ -12,7 +12,9 @@ import { SONG_CONTEXT_MENU_ITEMS } from '/@/renderer/features/context-menu/conte import { usePlayQueueAdd } from '/@/renderer/features/player'; import { useCurrentServer } from '/@/renderer/store'; import { usePlayButtonBehavior } from '/@/renderer/store/settings.store'; -import { LibraryItem, QueueSong, SongListQuery } from '/@/shared/types/domain-types'; +import { QueueSong } from '/@/shared/types/domain/player-domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; +import { SongListQuery } from '/@/shared/types/domain/song-domain-types'; interface AlbumArtistSongListContentProps { data: QueueSong[]; diff --git a/src/renderer/features/artists/components/album-artist-detail-top-songs-list-header.tsx b/src/renderer/features/artists/components/album-artist-detail-top-songs-list-header.tsx index e0287391e..f0b4d4988 100644 --- a/src/renderer/features/artists/components/album-artist-detail-top-songs-list-header.tsx +++ b/src/renderer/features/artists/components/album-artist-detail-top-songs-list-header.tsx @@ -6,7 +6,7 @@ import { LibraryHeaderBar } from '/@/renderer/features/shared'; import { usePlayButtonBehavior } from '/@/renderer/store/settings.store'; import { Badge } from '/@/shared/components/badge/badge'; import { SpinnerIcon } from '/@/shared/components/spinner/spinner'; -import { QueueSong } from '/@/shared/types/domain-types'; +import { QueueSong } from '/@/shared/types/domain/player-domain-types'; import { Play } from '/@/shared/types/types'; interface AlbumArtistDetailTopSongsListHeaderProps { diff --git a/src/renderer/features/artists/components/album-artist-list-grid-view.tsx b/src/renderer/features/artists/components/album-artist-list-grid-view.tsx index ff00468c4..f7df0773f 100644 --- a/src/renderer/features/artists/components/album-artist-list-grid-view.tsx +++ b/src/renderer/features/artists/components/album-artist-list-grid-view.tsx @@ -17,12 +17,11 @@ import { useHandleFavorite } from '/@/renderer/features/shared/hooks/use-handle- import { AppRoute } from '/@/renderer/router/routes'; import { useCurrentServer, useListStoreActions, useListStoreByKey } from '/@/renderer/store'; import { - AlbumArtist, AlbumArtistListQuery, AlbumArtistListResponse, AlbumArtistListSort, - LibraryItem, -} from '/@/shared/types/domain-types'; +} from '/@/shared/types/domain/artist-domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; import { CardRow, ListDisplayType } from '/@/shared/types/types'; interface AlbumArtistListGridViewProps { diff --git a/src/renderer/features/artists/components/album-artist-list-header-filters.tsx b/src/renderer/features/artists/components/album-artist-list-header-filters.tsx index 3ff393185..94e3169cf 100644 --- a/src/renderer/features/artists/components/album-artist-list-header-filters.tsx +++ b/src/renderer/features/artists/components/album-artist-list-header-filters.tsx @@ -34,91 +34,90 @@ import { Icon } from '/@/shared/components/icon/icon'; import { AlbumArtistListQuery, AlbumArtistListSort, - LibraryItem, - ServerType, - SortOrder, -} from '/@/shared/types/domain-types'; +} from '/@/shared/types/domain/artist-domain-types'; +import { ServerType } from '/@/shared/types/domain/server-domain-types'; +import { LibraryItem, ListSortOrder } from '/@/shared/types/domain/shared-domain-types'; import { ListDisplayType } from '/@/shared/types/types'; const FILTERS = { jellyfin: [ { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.album', { postProcess: 'titleCase' }), value: AlbumArtistListSort.ALBUM, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.duration', { postProcess: 'titleCase' }), value: AlbumArtistListSort.DURATION, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.name', { postProcess: 'titleCase' }), value: AlbumArtistListSort.NAME, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.random', { postProcess: 'titleCase' }), value: AlbumArtistListSort.RANDOM, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.recentlyAdded', { postProcess: 'titleCase' }), value: AlbumArtistListSort.RECENTLY_ADDED, }, - // { defaultOrder: SortOrder.DESC, name: 'Release Date', value: AlbumArtistListSort.RELEASE_DATE }, + // { defaultOrder: ListSortOrder.DESC, name: 'Release Date', value: AlbumArtistListSort.RELEASE_DATE }, ], navidrome: [ { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.albumCount', { postProcess: 'titleCase' }), value: AlbumArtistListSort.ALBUM_COUNT, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.isFavorited', { postProcess: 'titleCase' }), value: AlbumArtistListSort.FAVORITED, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.mostPlayed', { postProcess: 'titleCase' }), value: AlbumArtistListSort.PLAY_COUNT, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.name', { postProcess: 'titleCase' }), value: AlbumArtistListSort.NAME, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.rating', { postProcess: 'titleCase' }), value: AlbumArtistListSort.RATING, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.songCount', { postProcess: 'titleCase' }), value: AlbumArtistListSort.SONG_COUNT, }, ], subsonic: [ { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.albumCount', { postProcess: 'titleCase' }), value: AlbumArtistListSort.ALBUM_COUNT, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.isFavorited', { postProcess: 'titleCase' }), value: AlbumArtistListSort.FAVORITED, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.name', { postProcess: 'titleCase' }), value: AlbumArtistListSort.NAME, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.rating', { postProcess: 'titleCase' }), value: AlbumArtistListSort.RATING, }, @@ -270,7 +269,7 @@ export const AlbumArtistListHeaderFilters = ({ const updatedFilters = setFilter({ data: { sortBy: e.currentTarget.value as AlbumArtistListSort, - sortOrder: sortOrder || SortOrder.ASC, + sortOrder: sortOrder || ListSortOrder.ASC, }, itemType: LibraryItem.ALBUM_ARTIST, key: pageKey, @@ -306,7 +305,8 @@ export const AlbumArtistListHeaderFilters = ({ ); const handleToggleSortOrder = useCallback(() => { - const newSortOrder = filter.sortOrder === SortOrder.ASC ? SortOrder.DESC : SortOrder.ASC; + const newSortOrder = + filter.sortOrder === ListSortOrder.ASC ? ListSortOrder.DESC : ListSortOrder.ASC; const updatedFilters = setFilter({ data: { sortOrder: newSortOrder }, itemType: LibraryItem.ALBUM_ARTIST, diff --git a/src/renderer/features/artists/components/album-artist-list-header.tsx b/src/renderer/features/artists/components/album-artist-list-header.tsx index 0eea53178..593d6e626 100644 --- a/src/renderer/features/artists/components/album-artist-list-header.tsx +++ b/src/renderer/features/artists/components/album-artist-list-header.tsx @@ -15,7 +15,8 @@ import { AlbumArtistListFilter, useCurrentServer } from '/@/renderer/store'; import { Flex } from '/@/shared/components/flex/flex'; import { Group } from '/@/shared/components/group/group'; import { Stack } from '/@/shared/components/stack/stack'; -import { AlbumArtistListQuery, LibraryItem } from '/@/shared/types/domain-types'; +import { AlbumArtistListQuery } from '/@/shared/types/domain/artist-domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; interface AlbumArtistListHeaderProps { gridRef: MutableRefObject; diff --git a/src/renderer/features/artists/components/album-artist-list-table-view.tsx b/src/renderer/features/artists/components/album-artist-list-table-view.tsx index ef291f2c3..64c38b584 100644 --- a/src/renderer/features/artists/components/album-artist-list-table-view.tsx +++ b/src/renderer/features/artists/components/album-artist-list-table-view.tsx @@ -8,7 +8,7 @@ import { useVirtualTable } from '/@/renderer/components/virtual-table/hooks/use- import { useListContext } from '/@/renderer/context/list-context'; import { ARTIST_CONTEXT_MENU_ITEMS } from '/@/renderer/features/context-menu/context-menu-items'; import { useCurrentServer } from '/@/renderer/store'; -import { LibraryItem } from '/@/shared/types/domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; interface AlbumArtistListTableViewProps { itemCount?: number; diff --git a/src/renderer/features/artists/components/artist-list-grid-view.tsx b/src/renderer/features/artists/components/artist-list-grid-view.tsx index 3a81c803e..312289477 100644 --- a/src/renderer/features/artists/components/artist-list-grid-view.tsx +++ b/src/renderer/features/artists/components/artist-list-grid-view.tsx @@ -18,12 +18,11 @@ import { AppRoute } from '/@/renderer/router/routes'; import { useCurrentServer, useListStoreActions } from '/@/renderer/store'; import { useListStoreByKey } from '/@/renderer/store/list.store'; import { - AlbumArtist, ArtistListQuery, ArtistListResponse, ArtistListSort, - LibraryItem, -} from '/@/shared/types/domain-types'; +} from '/@/shared/types/domain/artist-domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; import { CardRow, ListDisplayType } from '/@/shared/types/types'; interface ArtistListGridViewProps { diff --git a/src/renderer/features/artists/components/artist-list-header-filters.tsx b/src/renderer/features/artists/components/artist-list-header-filters.tsx index 456c69dba..d1320b82b 100644 --- a/src/renderer/features/artists/components/artist-list-header-filters.tsx +++ b/src/renderer/features/artists/components/artist-list-header-filters.tsx @@ -33,93 +33,89 @@ import { Flex } from '/@/shared/components/flex/flex'; import { Group } from '/@/shared/components/group/group'; import { Icon } from '/@/shared/components/icon/icon'; import { Select } from '/@/shared/components/select/select'; -import { - ArtistListQuery, - ArtistListSort, - LibraryItem, - ServerType, - SortOrder, -} from '/@/shared/types/domain-types'; +import { ArtistListQuery, ArtistListSort } from '/@/shared/types/domain/artist-domain-types'; +import { ServerType } from '/@/shared/types/domain/server-domain-types'; +import { LibraryItem, ListSortOrder } from '/@/shared/types/domain/shared-domain-types'; import { ListDisplayType } from '/@/shared/types/types'; const FILTERS = { jellyfin: [ { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.album', { postProcess: 'titleCase' }), value: ArtistListSort.ALBUM, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.duration', { postProcess: 'titleCase' }), value: ArtistListSort.DURATION, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.name', { postProcess: 'titleCase' }), value: ArtistListSort.NAME, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.random', { postProcess: 'titleCase' }), value: ArtistListSort.RANDOM, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.recentlyAdded', { postProcess: 'titleCase' }), value: ArtistListSort.RECENTLY_ADDED, }, ], navidrome: [ { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.albumCount', { postProcess: 'titleCase' }), value: ArtistListSort.ALBUM_COUNT, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.isFavorited', { postProcess: 'titleCase' }), value: ArtistListSort.FAVORITED, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.mostPlayed', { postProcess: 'titleCase' }), value: ArtistListSort.PLAY_COUNT, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.name', { postProcess: 'titleCase' }), value: ArtistListSort.NAME, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.rating', { postProcess: 'titleCase' }), value: ArtistListSort.RATING, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.songCount', { postProcess: 'titleCase' }), value: ArtistListSort.SONG_COUNT, }, ], subsonic: [ { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.albumCount', { postProcess: 'titleCase' }), value: ArtistListSort.ALBUM_COUNT, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.isFavorited', { postProcess: 'titleCase' }), value: ArtistListSort.FAVORITED, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.name', { postProcess: 'titleCase' }), value: ArtistListSort.NAME, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.rating', { postProcess: 'titleCase' }), value: ArtistListSort.RATING, }, @@ -276,7 +272,7 @@ export const ArtistListHeaderFilters = ({ gridRef, tableRef }: ArtistListHeaderF const updatedFilters = setFilter({ data: { sortBy: e.currentTarget.value as ArtistListSort, - sortOrder: sortOrder || SortOrder.ASC, + sortOrder: sortOrder || ListSortOrder.ASC, }, itemType: LibraryItem.ARTIST, key: pageKey, @@ -312,7 +308,8 @@ export const ArtistListHeaderFilters = ({ gridRef, tableRef }: ArtistListHeaderF ); const handleToggleSortOrder = useCallback(() => { - const newSortOrder = filter.sortOrder === SortOrder.ASC ? SortOrder.DESC : SortOrder.ASC; + const newSortOrder = + filter.sortOrder === ListSortOrder.ASC ? ListSortOrder.DESC : ListSortOrder.ASC; const updatedFilters = setFilter({ data: { sortOrder: newSortOrder }, itemType: LibraryItem.ARTIST, diff --git a/src/renderer/features/artists/components/artist-list-header.tsx b/src/renderer/features/artists/components/artist-list-header.tsx index 0a0e65e96..ef78adefd 100644 --- a/src/renderer/features/artists/components/artist-list-header.tsx +++ b/src/renderer/features/artists/components/artist-list-header.tsx @@ -15,7 +15,8 @@ import { ArtistListFilter, useCurrentServer } from '/@/renderer/store'; import { Flex } from '/@/shared/components/flex/flex'; import { Group } from '/@/shared/components/group/group'; import { Stack } from '/@/shared/components/stack/stack'; -import { ArtistListQuery, LibraryItem } from '/@/shared/types/domain-types'; +import { ArtistListQuery } from '/@/shared/types/domain/artist-domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; interface ArtistListHeaderProps { gridRef: MutableRefObject; diff --git a/src/renderer/features/artists/components/artist-list-table-view.tsx b/src/renderer/features/artists/components/artist-list-table-view.tsx index 88285b0dc..630f304c1 100644 --- a/src/renderer/features/artists/components/artist-list-table-view.tsx +++ b/src/renderer/features/artists/components/artist-list-table-view.tsx @@ -8,7 +8,7 @@ import { useVirtualTable } from '/@/renderer/components/virtual-table/hooks/use- import { useListContext } from '/@/renderer/context/list-context'; import { ARTIST_CONTEXT_MENU_ITEMS } from '/@/renderer/features/context-menu/context-menu-items'; import { useCurrentServer } from '/@/renderer/store'; -import { LibraryItem } from '/@/shared/types/domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; interface ArtistListTableViewProps { itemCount?: number; diff --git a/src/renderer/features/artists/queries/album-artist-detail-query.ts b/src/renderer/features/artists/queries/album-artist-detail-query.ts index 0355526f3..2686773e1 100644 --- a/src/renderer/features/artists/queries/album-artist-detail-query.ts +++ b/src/renderer/features/artists/queries/album-artist-detail-query.ts @@ -1,11 +1,10 @@ -import type { AlbumArtistDetailQuery } from '/@/shared/types/domain-types'; - import { useQuery } from '@tanstack/react-query'; import { api } from '/@/renderer/api'; import { queryKeys } from '/@/renderer/api/query-keys'; import { QueryHookArgs } from '/@/renderer/lib/react-query'; import { getServerById } from '/@/renderer/store'; +import { AlbumArtistDetailQuery } from '/@/shared/types/domain/artist-domain-types'; export const useAlbumArtistDetail = (args: QueryHookArgs) => { const { options, query, serverId } = args || {}; diff --git a/src/renderer/features/artists/queries/album-artist-list-count-query.ts b/src/renderer/features/artists/queries/album-artist-list-count-query.ts index cf5e56104..3952f03f6 100644 --- a/src/renderer/features/artists/queries/album-artist-list-count-query.ts +++ b/src/renderer/features/artists/queries/album-artist-list-count-query.ts @@ -4,7 +4,7 @@ import { api } from '/@/renderer/api'; import { queryKeys } from '/@/renderer/api/query-keys'; import { QueryHookArgs } from '/@/renderer/lib/react-query'; import { getServerById } from '/@/renderer/store'; -import { AlbumArtistListQuery } from '/@/shared/types/domain-types'; +import { AlbumArtistListQuery } from '/@/shared/types/domain/artist-domain-types'; export const useAlbumArtistListCount = (args: QueryHookArgs) => { const { options, query, serverId } = args; diff --git a/src/renderer/features/artists/queries/album-artist-list-query.ts b/src/renderer/features/artists/queries/album-artist-list-query.ts index 0f053d3d4..31ce6759b 100644 --- a/src/renderer/features/artists/queries/album-artist-list-query.ts +++ b/src/renderer/features/artists/queries/album-artist-list-query.ts @@ -1,11 +1,10 @@ -import type { AlbumArtistListQuery } from '/@/shared/types/domain-types'; - import { useQuery } from '@tanstack/react-query'; import { api } from '/@/renderer/api'; import { queryKeys } from '/@/renderer/api/query-keys'; import { QueryHookArgs } from '/@/renderer/lib/react-query'; import { getServerById } from '/@/renderer/store'; +import { AlbumArtistListQuery } from '/@/shared/types/domain/artist-domain-types'; export const useAlbumArtistList = (args: QueryHookArgs) => { const { options, query, serverId } = args || {}; diff --git a/src/renderer/features/artists/queries/artist-info-query.ts b/src/renderer/features/artists/queries/artist-info-query.ts index 379e4d1e8..a302a6150 100644 --- a/src/renderer/features/artists/queries/artist-info-query.ts +++ b/src/renderer/features/artists/queries/artist-info-query.ts @@ -1,11 +1,10 @@ -import type { AlbumArtistDetailQuery } from '/@/shared/types/domain-types'; - import { useQuery } from '@tanstack/react-query'; import { api } from '/@/renderer/api'; import { queryKeys } from '/@/renderer/api/query-keys'; import { QueryHookArgs } from '/@/renderer/lib/react-query'; import { getServerById } from '/@/renderer/store'; +import { AlbumArtistDetailQuery } from '/@/shared/types/domain/artist-domain-types'; export const useAlbumArtistInfo = (args: QueryHookArgs) => { const { options, query, serverId } = args || {}; diff --git a/src/renderer/features/artists/queries/artist-list-count-query.ts b/src/renderer/features/artists/queries/artist-list-count-query.ts index f3f73cc96..453c2c1f0 100644 --- a/src/renderer/features/artists/queries/artist-list-count-query.ts +++ b/src/renderer/features/artists/queries/artist-list-count-query.ts @@ -4,7 +4,7 @@ import { api } from '/@/renderer/api'; import { queryKeys } from '/@/renderer/api/query-keys'; import { QueryHookArgs } from '/@/renderer/lib/react-query'; import { getServerById } from '/@/renderer/store'; -import { ArtistListQuery } from '/@/shared/types/domain-types'; +import { ArtistListQuery } from '/@/shared/types/domain/artist-domain-types'; export const useArtistListCount = (args: QueryHookArgs) => { const { options, query, serverId } = args; diff --git a/src/renderer/features/artists/queries/top-songs-list-query.ts b/src/renderer/features/artists/queries/top-songs-list-query.ts index 860394ab9..19f8d20a1 100644 --- a/src/renderer/features/artists/queries/top-songs-list-query.ts +++ b/src/renderer/features/artists/queries/top-songs-list-query.ts @@ -1,11 +1,11 @@ import type { QueryHookArgs } from '/@/renderer/lib/react-query'; -import type { TopSongListQuery } from '/@/shared/types/domain-types'; import { useQuery } from '@tanstack/react-query'; import { api } from '/@/renderer/api'; import { queryKeys } from '/@/renderer/api/query-keys'; import { getServerById } from '/@/renderer/store'; +import { TopSongListQuery } from '/@/shared/types/domain/song-domain-types'; export const useTopSongsList = (args: QueryHookArgs) => { const { options, query, serverId } = args || {}; diff --git a/src/renderer/features/artists/routes/album-artist-detail-route.tsx b/src/renderer/features/artists/routes/album-artist-detail-route.tsx index 92d82d41e..ea6ef5d80 100644 --- a/src/renderer/features/artists/routes/album-artist-detail-route.tsx +++ b/src/renderer/features/artists/routes/album-artist-detail-route.tsx @@ -10,7 +10,7 @@ import { AnimatedPage, LibraryHeaderBar } from '/@/renderer/features/shared'; import { useFastAverageColor } from '/@/renderer/hooks'; import { useCurrentServer } from '/@/renderer/store'; import { usePlayButtonBehavior } from '/@/renderer/store/settings.store'; -import { LibraryItem } from '/@/shared/types/domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; const AlbumArtistDetailRoute = () => { const scrollAreaRef = useRef(null); diff --git a/src/renderer/features/artists/routes/album-artist-detail-top-songs-list-route.tsx b/src/renderer/features/artists/routes/album-artist-detail-top-songs-list-route.tsx index bad43fdaf..47229b07a 100644 --- a/src/renderer/features/artists/routes/album-artist-detail-top-songs-list-route.tsx +++ b/src/renderer/features/artists/routes/album-artist-detail-top-songs-list-route.tsx @@ -10,7 +10,7 @@ import { useAlbumArtistDetail } from '/@/renderer/features/artists/queries/album import { useTopSongsList } from '/@/renderer/features/artists/queries/top-songs-list-query'; import { AnimatedPage } from '/@/renderer/features/shared'; import { useCurrentServer } from '/@/renderer/store/auth.store'; -import { LibraryItem } from '/@/shared/types/domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; const AlbumArtistDetailTopSongsListRoute = () => { const tableRef = useRef(null); diff --git a/src/renderer/features/artists/routes/album-artist-list-route.tsx b/src/renderer/features/artists/routes/album-artist-list-route.tsx index 56c555603..f30bff5df 100644 --- a/src/renderer/features/artists/routes/album-artist-list-route.tsx +++ b/src/renderer/features/artists/routes/album-artist-list-route.tsx @@ -10,7 +10,8 @@ import { useAlbumArtistListCount } from '/@/renderer/features/artists/queries/al import { AnimatedPage } from '/@/renderer/features/shared'; import { useCurrentServer } from '/@/renderer/store/auth.store'; import { useListFilterByKey } from '/@/renderer/store/list.store'; -import { AlbumArtistListQuery, LibraryItem } from '/@/shared/types/domain-types'; +import { AlbumArtistListQuery } from '/@/shared/types/domain/artist-domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; const AlbumArtistListRoute = () => { const gridRef = useRef(null); diff --git a/src/renderer/features/artists/routes/artist-list-route.tsx b/src/renderer/features/artists/routes/artist-list-route.tsx index 8113651d9..7cb874d46 100644 --- a/src/renderer/features/artists/routes/artist-list-route.tsx +++ b/src/renderer/features/artists/routes/artist-list-route.tsx @@ -10,7 +10,8 @@ import { useArtistListCount } from '/@/renderer/features/artists/queries/artist- import { AnimatedPage } from '/@/renderer/features/shared'; import { useCurrentServer } from '/@/renderer/store/auth.store'; import { useListFilterByKey } from '/@/renderer/store/list.store'; -import { ArtistListQuery, LibraryItem } from '/@/shared/types/domain-types'; +import { ArtistListQuery } from '/@/shared/types/domain/artist-domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; const ArtistListRoute = () => { const gridRef = useRef(null); diff --git a/src/renderer/features/context-menu/context-menu-provider.tsx b/src/renderer/features/context-menu/context-menu-provider.tsx index 39732b44f..e7f7aca47 100644 --- a/src/renderer/features/context-menu/context-menu-provider.tsx +++ b/src/renderer/features/context-menu/context-menu-provider.tsx @@ -57,13 +57,12 @@ import { Rating } from '/@/shared/components/rating/rating'; import { Stack } from '/@/shared/components/stack/stack'; import { Text } from '/@/shared/components/text/text'; import { toast } from '/@/shared/components/toast/toast'; +import { ServerFeature, ServerType } from '/@/shared/types/domain/server-domain-types'; import { AnyLibraryItem, AnyLibraryItems, LibraryItem, - ServerType, -} from '/@/shared/types/domain-types'; -import { ServerFeature } from '/@/shared/types/features-types'; +} from '/@/shared/types/domain/shared-domain-types'; import { Play, PlaybackType } from '/@/shared/types/types'; type ContextMenuContextProps = { diff --git a/src/renderer/features/context-menu/events.ts b/src/renderer/features/context-menu/events.ts index 6165ea137..8605793ff 100644 --- a/src/renderer/features/context-menu/events.ts +++ b/src/renderer/features/context-menu/events.ts @@ -1,6 +1,6 @@ import { GridOptions, RowNode } from '@ag-grid-community/core'; -import { LibraryItem } from '/@/shared/types/domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; import { createUseExternalEvents } from '/@/shared/utils/create-use-external-events'; export type ContextMenuEvents = { diff --git a/src/renderer/features/context-menu/hooks/use-handle-context-menu.ts b/src/renderer/features/context-menu/hooks/use-handle-context-menu.ts index 350421de5..06a8d428b 100644 --- a/src/renderer/features/context-menu/hooks/use-handle-context-menu.ts +++ b/src/renderer/features/context-menu/hooks/use-handle-context-menu.ts @@ -2,14 +2,11 @@ import { CellContextMenuEvent, GridApi } from '@ag-grid-community/core'; import sortBy from 'lodash/sortBy'; import { openContextMenu, SetContextMenuItems } from '/@/renderer/features/context-menu/events'; -import { - Album, - AlbumArtist, - Artist, - LibraryItem, - QueueSong, - Song, -} from '/@/shared/types/domain-types'; +import { Album } from '/@/shared/types/domain/album-domain-types'; +import { Artist } from '/@/shared/types/domain/artist-domain-types'; +import { QueueSong } from '/@/shared/types/domain/player-domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; +import { Song } from '/@/shared/types/domain/song-domain-types'; export const useHandleTableContextMenu = ( itemType: LibraryItem, diff --git a/src/renderer/features/discord-rpc/use-discord-rpc.ts b/src/renderer/features/discord-rpc/use-discord-rpc.ts index 63ba35bfd..9beeb38c5 100644 --- a/src/renderer/features/discord-rpc/use-discord-rpc.ts +++ b/src/renderer/features/discord-rpc/use-discord-rpc.ts @@ -11,8 +11,9 @@ import { useGeneralSettings, usePlayerStore, } from '/@/renderer/store'; -import { QueueSong, ServerType } from '/@/shared/types/domain-types'; -import { PlayerStatus } from '/@/shared/types/types'; +import { QueueSong } from '/@/shared/types/domain/player-domain-types'; +import { ServerType } from '/@/shared/types/domain/server-domain-types'; +import { PlayerStatus, PlayerStatus } from '/@/shared/types/types'; const discordRpc = isElectron() ? window.api.discordRpc : null; diff --git a/src/renderer/features/genres/components/genre-list-grid-view.tsx b/src/renderer/features/genres/components/genre-list-grid-view.tsx index c95a850f5..7b23817bd 100644 --- a/src/renderer/features/genres/components/genre-list-grid-view.tsx +++ b/src/renderer/features/genres/components/genre-list-grid-view.tsx @@ -15,13 +15,13 @@ import { useListContext } from '/@/renderer/context/list-context'; import { usePlayQueueAdd } from '/@/renderer/features/player'; import { useGenreRoute } from '/@/renderer/hooks/use-genre-route'; import { useCurrentServer, useListStoreActions, useListStoreByKey } from '/@/renderer/store'; +import { Album } from '/@/shared/types/domain/album-domain-types'; import { - Album, Genre, GenreListQuery, GenreListResponse, - LibraryItem, -} from '/@/shared/types/domain-types'; +} from '/@/shared/types/domain/genre-domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; import { CardRow, ListDisplayType } from '/@/shared/types/types'; export const GenreListGridView = ({ gridRef, itemCount }: any) => { diff --git a/src/renderer/features/genres/components/genre-list-header-filters.tsx b/src/renderer/features/genres/components/genre-list-header-filters.tsx index e58fea6eb..cac843fd4 100644 --- a/src/renderer/features/genres/components/genre-list-header-filters.tsx +++ b/src/renderer/features/genres/components/genre-list-header-filters.tsx @@ -33,33 +33,29 @@ import { DropdownMenu } from '/@/shared/components/dropdown-menu/dropdown-menu'; import { Flex } from '/@/shared/components/flex/flex'; import { Group } from '/@/shared/components/group/group'; import { Icon } from '/@/shared/components/icon/icon'; -import { - GenreListQuery, - GenreListSort, - LibraryItem, - ServerType, - SortOrder, -} from '/@/shared/types/domain-types'; +import { GenreListQuery, GenreListSort } from '/@/shared/types/domain/genre-domain-types'; +import { ServerType } from '/@/shared/types/domain/server-domain-types'; +import { LibraryItem, ListSortOrder } from '/@/shared/types/domain/shared-domain-types'; import { ListDisplayType } from '/@/shared/types/types'; const FILTERS = { jellyfin: [ { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.name', { postProcess: 'titleCase' }), value: GenreListSort.NAME, }, ], navidrome: [ { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.name', { postProcess: 'titleCase' }), value: GenreListSort.NAME, }, ], subsonic: [ { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.name', { postProcess: 'titleCase' }), value: GenreListSort.NAME, }, @@ -137,7 +133,7 @@ export const GenreListHeaderFilters = ({ customFilters, data: { sortBy: e.currentTarget.value as GenreListSort, - sortOrder: sortOrder || SortOrder.ASC, + sortOrder: sortOrder || ListSortOrder.ASC, }, itemType: LibraryItem.GENRE, key: pageKey, @@ -175,7 +171,8 @@ export const GenreListHeaderFilters = ({ ); const handleToggleSortOrder = useCallback(() => { - const newSortOrder = filter.sortOrder === SortOrder.ASC ? SortOrder.DESC : SortOrder.ASC; + const newSortOrder = + filter.sortOrder === ListSortOrder.ASC ? ListSortOrder.DESC : ListSortOrder.ASC; const updatedFilters = setFilter({ customFilters, data: { sortOrder: newSortOrder }, diff --git a/src/renderer/features/genres/components/genre-list-header.tsx b/src/renderer/features/genres/components/genre-list-header.tsx index e44bbee82..ad395a781 100644 --- a/src/renderer/features/genres/components/genre-list-header.tsx +++ b/src/renderer/features/genres/components/genre-list-header.tsx @@ -15,7 +15,8 @@ import { GenreListFilter, useCurrentServer } from '/@/renderer/store'; import { Flex } from '/@/shared/components/flex/flex'; import { Group } from '/@/shared/components/group/group'; import { Stack } from '/@/shared/components/stack/stack'; -import { GenreListQuery, LibraryItem } from '/@/shared/types/domain-types'; +import { GenreListQuery } from '/@/shared/types/domain/genre-domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; interface GenreListHeaderProps { gridRef: MutableRefObject; diff --git a/src/renderer/features/genres/components/genre-list-table-view.tsx b/src/renderer/features/genres/components/genre-list-table-view.tsx index 825e40233..aa844d241 100644 --- a/src/renderer/features/genres/components/genre-list-table-view.tsx +++ b/src/renderer/features/genres/components/genre-list-table-view.tsx @@ -11,7 +11,7 @@ import { useListContext } from '/@/renderer/context/list-context'; import { GENRE_CONTEXT_MENU_ITEMS } from '/@/renderer/features/context-menu/context-menu-items'; import { useGenreRoute } from '/@/renderer/hooks/use-genre-route'; import { useCurrentServer } from '/@/renderer/store'; -import { LibraryItem } from '/@/shared/types/domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; interface GenreListTableViewProps { itemCount?: number; diff --git a/src/renderer/features/genres/queries/genre-list-query.ts b/src/renderer/features/genres/queries/genre-list-query.ts index c002adfb4..299e92b0f 100644 --- a/src/renderer/features/genres/queries/genre-list-query.ts +++ b/src/renderer/features/genres/queries/genre-list-query.ts @@ -1,11 +1,11 @@ import type { QueryHookArgs } from '/@/renderer/lib/react-query'; -import type { GenreListQuery } from '/@/shared/types/domain-types'; import { useQuery } from '@tanstack/react-query'; import { api } from '/@/renderer/api'; import { queryKeys } from '/@/renderer/api/query-keys'; import { getServerById } from '/@/renderer/store'; +import { GenreListQuery } from '/@/shared/types/domain/genre-domain-types'; export const useGenreList = (args: QueryHookArgs) => { const { options, query, serverId } = args || {}; diff --git a/src/renderer/features/genres/routes/genre-list-route.tsx b/src/renderer/features/genres/routes/genre-list-route.tsx index 91ebe5714..432f09c92 100644 --- a/src/renderer/features/genres/routes/genre-list-route.tsx +++ b/src/renderer/features/genres/routes/genre-list-route.tsx @@ -10,7 +10,7 @@ import { useGenreList } from '/@/renderer/features/genres/queries/genre-list-que import { AnimatedPage } from '/@/renderer/features/shared'; import { useCurrentServer } from '/@/renderer/store'; import { useListStoreByKey } from '/@/renderer/store/list.store'; -import { GenreListQuery } from '/@/shared/types/domain-types'; +import { GenreListQuery } from '/@/shared/types/domain/genre-domain-types'; const GenreListRoute = () => { const gridRef = useRef(null); diff --git a/src/renderer/features/home/queries/recently-played-query.ts b/src/renderer/features/home/queries/recently-played-query.ts index e58fa1f15..7009ebe88 100644 --- a/src/renderer/features/home/queries/recently-played-query.ts +++ b/src/renderer/features/home/queries/recently-played-query.ts @@ -4,7 +4,8 @@ import { api } from '/@/renderer/api'; import { queryKeys } from '/@/renderer/api/query-keys'; import { QueryHookArgs } from '/@/renderer/lib/react-query'; import { getServerById } from '/@/renderer/store'; -import { AlbumListQuery, AlbumListSort, SortOrder } from '/@/shared/types/domain-types'; +import { AlbumListQuery, AlbumListSort } from '/@/shared/types/domain/album-domain-types'; +import { ListSortOrder } from '/@/shared/types/domain/shared-domain-types'; export const useRecentlyPlayed = (args: QueryHookArgs>) => { const { options, query, serverId } = args; @@ -13,7 +14,7 @@ export const useRecentlyPlayed = (args: QueryHookArgs>) const requestQuery: AlbumListQuery = { limit: 5, sortBy: AlbumListSort.RECENTLY_PLAYED, - sortOrder: SortOrder.ASC, + sortOrder: ListSortOrder.ASC, startIndex: 0, ...query, }; diff --git a/src/renderer/features/home/routes/home-route.tsx b/src/renderer/features/home/routes/home-route.tsx index cd8ff12dc..9cbce5cc8 100644 --- a/src/renderer/features/home/routes/home-route.tsx +++ b/src/renderer/features/home/routes/home-route.tsx @@ -23,13 +23,10 @@ import { Icon } from '/@/shared/components/icon/icon'; import { Spinner } from '/@/shared/components/spinner/spinner'; import { Stack } from '/@/shared/components/stack/stack'; import { TextTitle } from '/@/shared/components/text-title/text-title'; -import { - AlbumListSort, - LibraryItem, - ServerType, - SongListSort, - SortOrder, -} from '/@/shared/types/domain-types'; +import { AlbumListSort } from '/@/shared/types/domain/album-domain-types'; +import { ServerType } from '/@/shared/types/domain/server-domain-types'; +import { LibraryItem, ListSortOrder } from '/@/shared/types/domain/shared-domain-types'; +import { SongListSort } from '/@/shared/types/domain/song-domain-types'; import { Platform } from '/@/shared/types/types'; const HomeRoute = () => { @@ -50,7 +47,7 @@ const HomeRoute = () => { query: { limit: 20, sortBy: AlbumListSort.RANDOM, - sortOrder: SortOrder.DESC, + sortOrder: ListSortOrder.DESC, startIndex: 0, }, serverId: server?.id, @@ -67,7 +64,7 @@ const HomeRoute = () => { query: { limit: itemsPerPage, sortBy: AlbumListSort.RANDOM, - sortOrder: SortOrder.ASC, + sortOrder: ListSortOrder.ASC, startIndex: 0, }, serverId: server?.id, @@ -80,7 +77,7 @@ const HomeRoute = () => { query: { limit: itemsPerPage, sortBy: AlbumListSort.RECENTLY_PLAYED, - sortOrder: SortOrder.DESC, + sortOrder: ListSortOrder.DESC, startIndex: 0, }, serverId: server?.id, @@ -93,7 +90,7 @@ const HomeRoute = () => { query: { limit: itemsPerPage, sortBy: AlbumListSort.RECENTLY_ADDED, - sortOrder: SortOrder.DESC, + sortOrder: ListSortOrder.DESC, startIndex: 0, }, serverId: server?.id, @@ -107,7 +104,7 @@ const HomeRoute = () => { query: { limit: itemsPerPage, sortBy: AlbumListSort.PLAY_COUNT, - sortOrder: SortOrder.DESC, + sortOrder: ListSortOrder.DESC, startIndex: 0, }, serverId: server?.id, @@ -122,7 +119,7 @@ const HomeRoute = () => { query: { limit: itemsPerPage, sortBy: SongListSort.PLAY_COUNT, - sortOrder: SortOrder.DESC, + sortOrder: ListSortOrder.DESC, startIndex: 0, }, serverId: server?.id, @@ -156,14 +153,14 @@ const HomeRoute = () => { server?.type === ServerType.JELLYFIN ? SongListSort.PLAY_COUNT : AlbumListSort.PLAY_COUNT, - sortOrder: SortOrder.DESC, + sortOrder: ListSortOrder.DESC, title: t('page.home.mostPlayed', { postProcess: 'sentenceCase' }), }, [HomeItem.RANDOM]: { data: random?.data?.items, itemType: LibraryItem.ALBUM, sortBy: AlbumListSort.RANDOM, - sortOrder: SortOrder.ASC, + sortOrder: ListSortOrder.ASC, title: t('page.home.explore', { postProcess: 'sentenceCase' }), }, [HomeItem.RECENTLY_ADDED]: { @@ -173,7 +170,7 @@ const HomeRoute = () => { itemsPerPage, }, sortBy: AlbumListSort.RECENTLY_ADDED, - sortOrder: SortOrder.DESC, + sortOrder: ListSortOrder.DESC, title: t('page.home.newlyAdded', { postProcess: 'sentenceCase' }), }, [HomeItem.RECENTLY_PLAYED]: { @@ -183,7 +180,7 @@ const HomeRoute = () => { itemsPerPage, }, sortBy: AlbumListSort.RECENTLY_PLAYED, - sortOrder: SortOrder.DESC, + sortOrder: ListSortOrder.DESC, title: t('page.home.recentlyPlayed', { postProcess: 'sentenceCase' }), }, }; @@ -207,7 +204,7 @@ const HomeRoute = () => { const invalidateCarouselQuery = (carousel: { itemType: LibraryItem; sortBy: AlbumListSort | SongListSort; - sortOrder: SortOrder; + sortOrder: ListSortOrder; }) => { if (carousel.itemType === LibraryItem.ALBUM) { queryClient.invalidateQueries({ diff --git a/src/renderer/features/item-details/components/item-details-modal.tsx b/src/renderer/features/item-details/components/item-details-modal.tsx index e6bba6be6..df000ddc8 100644 --- a/src/renderer/features/item-details/components/item-details-modal.tsx +++ b/src/renderer/features/item-details/components/item-details-modal.tsx @@ -16,18 +16,14 @@ import { Separator } from '/@/shared/components/separator/separator'; import { Spoiler } from '/@/shared/components/spoiler/spoiler'; import { Table } from '/@/shared/components/table/table'; import { Text } from '/@/shared/components/text/text'; -import { - Album, - AlbumArtist, - AnyLibraryItem, - LibraryItem, - Playlist, - RelatedArtist, - Song, -} from '/@/shared/types/domain-types'; +import { Album } from '/@/shared/types/domain/album-domain-types'; +import { RelatedArtist } from '/@/shared/types/domain/artist-domain-types'; +import { Playlist } from '/@/shared/types/domain/playlist-domain-types'; +import { AnyLibraryItem, LibraryItem } from '/@/shared/types/domain/shared-domain-types'; +import { Song } from '/@/shared/types/domain/song-domain-types'; export type ItemDetailsModalProps = { - item: Album | AlbumArtist | Playlist | Song; + item: Album | Playlist | Song; }; type ItemDetailRow = { diff --git a/src/renderer/features/lyrics/components/lyrics-search-form.tsx b/src/renderer/features/lyrics/components/lyrics-search-form.tsx index 55beec9d3..7f9983007 100644 --- a/src/renderer/features/lyrics/components/lyrics-search-form.tsx +++ b/src/renderer/features/lyrics/components/lyrics-search-form.tsx @@ -20,7 +20,7 @@ import { InternetProviderLyricSearchResponse, LyricSource, LyricsOverride, -} from '/@/shared/types/domain-types'; +} from '/@/shared/types/domain/lyric-domain-types'; interface SearchResultProps { data: InternetProviderLyricSearchResponse; diff --git a/src/renderer/features/lyrics/lyrics-actions.tsx b/src/renderer/features/lyrics/lyrics-actions.tsx index 3fa3fbc08..c61dd6458 100644 --- a/src/renderer/features/lyrics/lyrics-actions.tsx +++ b/src/renderer/features/lyrics/lyrics-actions.tsx @@ -15,7 +15,7 @@ import { Group } from '/@/shared/components/group/group'; import { NumberInput } from '/@/shared/components/number-input/number-input'; import { Select } from '/@/shared/components/select/select'; import { Tooltip } from '/@/shared/components/tooltip/tooltip'; -import { LyricsOverride } from '/@/shared/types/domain-types'; +import { LyricsOverride } from '/@/shared/types/domain/lyric-domain-types'; interface LyricsActionsProps { index: number; diff --git a/src/renderer/features/lyrics/lyrics.tsx b/src/renderer/features/lyrics/lyrics.tsx index d3f37975b..816b4e190 100644 --- a/src/renderer/features/lyrics/lyrics.tsx +++ b/src/renderer/features/lyrics/lyrics.tsx @@ -28,7 +28,11 @@ import { Group } from '/@/shared/components/group/group'; import { Icon } from '/@/shared/components/icon/icon'; import { Spinner } from '/@/shared/components/spinner/spinner'; import { Text } from '/@/shared/components/text/text'; -import { FullLyricsMetadata, LyricSource, LyricsOverride } from '/@/shared/types/domain-types'; +import { + FullLyricsMetadata, + LyricSource, + LyricsOverride, +} from '/@/shared/types/domain/lyric-domain-types'; export const Lyrics = () => { const currentSong = useCurrentSong(); diff --git a/src/renderer/features/lyrics/queries/lyric-query.ts b/src/renderer/features/lyrics/queries/lyric-query.ts index 918a83610..74df61214 100644 --- a/src/renderer/features/lyrics/queries/lyric-query.ts +++ b/src/renderer/features/lyrics/queries/lyric-query.ts @@ -11,12 +11,11 @@ import { InternetProviderLyricResponse, LyricGetQuery, LyricsQuery, - QueueSong, - ServerType, StructuredLyric, SynchronizedLyricsArray, -} from '/@/shared/types/domain-types'; -import { ServerFeature } from '/@/shared/types/features-types'; +} from '/@/shared/types/domain/lyric-domain-types'; +import { QueueSong } from '/@/shared/types/domain/player-domain-types'; +import { ServerFeature, ServerType } from '/@/shared/types/domain/server-domain-types'; const lyricsIpc = isElectron() ? window.api.lyrics : null; diff --git a/src/renderer/features/lyrics/queries/lyric-search-query.ts b/src/renderer/features/lyrics/queries/lyric-search-query.ts index a911521cf..542020c22 100644 --- a/src/renderer/features/lyrics/queries/lyric-search-query.ts +++ b/src/renderer/features/lyrics/queries/lyric-search-query.ts @@ -7,7 +7,7 @@ import { InternetProviderLyricSearchResponse, LyricSearchQuery, LyricSource, -} from '/@/shared/types/domain-types'; +} from '/@/shared/types/domain/lyric-domain-types'; const lyricsIpc = isElectron() ? window.api.lyrics : null; diff --git a/src/renderer/features/lyrics/synchronized-lyrics.tsx b/src/renderer/features/lyrics/synchronized-lyrics.tsx index 6f952bc7e..6ff2d680d 100644 --- a/src/renderer/features/lyrics/synchronized-lyrics.tsx +++ b/src/renderer/features/lyrics/synchronized-lyrics.tsx @@ -17,7 +17,10 @@ import { useSeeked, useSetCurrentTime, } from '/@/renderer/store'; -import { FullLyricsMetadata, SynchronizedLyricsArray } from '/@/shared/types/domain-types'; +import { + FullLyricsMetadata, + SynchronizedLyricsArray, +} from '/@/shared/types/domain/lyric-domain-types'; import { PlaybackType, PlayerStatus } from '/@/shared/types/types'; const mpvPlayer = isElectron() ? window.api.mpvPlayer : null; diff --git a/src/renderer/features/lyrics/unsynchronized-lyrics.tsx b/src/renderer/features/lyrics/unsynchronized-lyrics.tsx index 8ed6e4e43..9b9f05657 100644 --- a/src/renderer/features/lyrics/unsynchronized-lyrics.tsx +++ b/src/renderer/features/lyrics/unsynchronized-lyrics.tsx @@ -4,7 +4,7 @@ import styles from './unsynchronized-lyrics.module.css'; import { LyricLine } from '/@/renderer/features/lyrics/lyric-line'; import { useLyricsSettings } from '/@/renderer/store'; -import { FullLyricsMetadata } from '/@/shared/types/domain-types'; +import { FullLyricsMetadata } from '/@/shared/types/domain/lyric-domain-types'; export interface UnsynchronizedLyricsProps extends Omit { lyrics: string; diff --git a/src/renderer/features/now-playing/components/drawer-play-queue.tsx b/src/renderer/features/now-playing/components/drawer-play-queue.tsx index 06f610470..2e9725664 100644 --- a/src/renderer/features/now-playing/components/drawer-play-queue.tsx +++ b/src/renderer/features/now-playing/components/drawer-play-queue.tsx @@ -5,7 +5,7 @@ import { useRef } from 'react'; import { PlayQueue } from '/@/renderer/features/now-playing/components/play-queue'; import { PlayQueueListControls } from '/@/renderer/features/now-playing/components/play-queue-list-controls'; import { Flex } from '/@/shared/components/flex/flex'; -import { Song } from '/@/shared/types/domain-types'; +import { Song } from '/@/shared/types/domain/song-domain-types'; export const DrawerPlayQueue = () => { const queueRef = useRef }>(null); diff --git a/src/renderer/features/now-playing/components/play-queue-list-controls.tsx b/src/renderer/features/now-playing/components/play-queue-list-controls.tsx index e85c20089..26f80d780 100644 --- a/src/renderer/features/now-playing/components/play-queue-list-controls.tsx +++ b/src/renderer/features/now-playing/components/play-queue-list-controls.tsx @@ -13,7 +13,7 @@ import { setQueue, setQueueNext } from '/@/renderer/utils/set-transcoded-queue-d import { ActionIcon } from '/@/shared/components/action-icon/action-icon'; import { Group } from '/@/shared/components/group/group'; import { Popover } from '/@/shared/components/popover/popover'; -import { Song } from '/@/shared/types/domain-types'; +import { Song } from '/@/shared/types/domain/song-domain-types'; import { PlaybackType, TableType } from '/@/shared/types/types'; const mpvPlayer = isElectron() ? window.api.mpvPlayer : null; diff --git a/src/renderer/features/now-playing/components/play-queue.tsx b/src/renderer/features/now-playing/components/play-queue.tsx index 0ac8cf2e7..d2e9a3bf2 100644 --- a/src/renderer/features/now-playing/components/play-queue.tsx +++ b/src/renderer/features/now-playing/components/play-queue.tsx @@ -40,7 +40,8 @@ import { useTableSettings, } from '/@/renderer/store/settings.store'; import { setQueue, setQueueNext } from '/@/renderer/utils/set-transcoded-queue-data'; -import { LibraryItem, QueueSong } from '/@/shared/types/domain-types'; +import { QueueSong } from '/@/shared/types/domain/player-domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; import { PlaybackType, TableType } from '/@/shared/types/types'; const mpvPlayer = isElectron() ? window.api.mpvPlayer : null; diff --git a/src/renderer/features/now-playing/components/sidebar-play-queue.tsx b/src/renderer/features/now-playing/components/sidebar-play-queue.tsx index 89c165c20..b18a0b47e 100644 --- a/src/renderer/features/now-playing/components/sidebar-play-queue.tsx +++ b/src/renderer/features/now-playing/components/sidebar-play-queue.tsx @@ -8,7 +8,7 @@ import { VirtualGridContainer } from '/@/renderer/components/virtual-grid'; import { PlayQueue } from '/@/renderer/features/now-playing/components/play-queue'; import { useWindowSettings } from '/@/renderer/store/settings.store'; import { Box } from '/@/shared/components/box/box'; -import { Song } from '/@/shared/types/domain-types'; +import { Song } from '/@/shared/types/domain/song-domain-types'; import { Platform } from '/@/shared/types/types'; export const SidebarPlayQueue = () => { diff --git a/src/renderer/features/now-playing/routes/now-playing-route.tsx b/src/renderer/features/now-playing/routes/now-playing-route.tsx index f20f16adb..6379ad06d 100644 --- a/src/renderer/features/now-playing/routes/now-playing-route.tsx +++ b/src/renderer/features/now-playing/routes/now-playing-route.tsx @@ -1,4 +1,3 @@ -import type { Song } from '/@/shared/types/domain-types'; import type { AgGridReact as AgGridReactType } from '@ag-grid-community/react/lib/agGridReact'; import { useRef } from 'react'; @@ -8,6 +7,7 @@ import { NowPlayingHeader } from '/@/renderer/features/now-playing/components/no import { PlayQueue } from '/@/renderer/features/now-playing/components/play-queue'; import { PlayQueueListControls } from '/@/renderer/features/now-playing/components/play-queue-list-controls'; import { AnimatedPage } from '/@/renderer/features/shared'; +import { Song } from '/@/shared/types/domain/song-domain-types'; const NowPlayingRoute = () => { const queueRef = useRef }>(null); diff --git a/src/renderer/features/player/components/full-screen-player-image.tsx b/src/renderer/features/player/components/full-screen-player-image.tsx index 84db03e64..5d694ac66 100644 --- a/src/renderer/features/player/components/full-screen-player-image.tsx +++ b/src/renderer/features/player/components/full-screen-player-image.tsx @@ -18,7 +18,7 @@ import { Group } from '/@/shared/components/group/group'; import { Icon } from '/@/shared/components/icon/icon'; import { Stack } from '/@/shared/components/stack/stack'; import { Text } from '/@/shared/components/text/text'; -import { PlayerData, QueueSong } from '/@/shared/types/domain-types'; +import { PlayerData, QueueSong } from '/@/shared/types/domain/player-domain-types'; const imageVariants: Variants = { closed: { diff --git a/src/renderer/features/player/components/left-controls.tsx b/src/renderer/features/player/components/left-controls.tsx index 4019ebe15..b623fe9e0 100644 --- a/src/renderer/features/player/components/left-controls.tsx +++ b/src/renderer/features/player/components/left-controls.tsx @@ -24,7 +24,7 @@ import { Image } from '/@/shared/components/image/image'; import { Separator } from '/@/shared/components/separator/separator'; import { Text } from '/@/shared/components/text/text'; import { Tooltip } from '/@/shared/components/tooltip/tooltip'; -import { LibraryItem } from '/@/shared/types/domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; export const LeftControls = () => { const { t } = useTranslation(); diff --git a/src/renderer/features/player/components/right-controls.tsx b/src/renderer/features/player/components/right-controls.tsx index 91f0af963..7e7033015 100644 --- a/src/renderer/features/player/components/right-controls.tsx +++ b/src/renderer/features/player/components/right-controls.tsx @@ -24,7 +24,10 @@ import { Flex } from '/@/shared/components/flex/flex'; import { Group } from '/@/shared/components/group/group'; import { Rating } from '/@/shared/components/rating/rating'; import { Slider } from '/@/shared/components/slider/slider'; -import { LibraryItem, QueueSong, ServerType, Song } from '/@/shared/types/domain-types'; +import { QueueSong } from '/@/shared/types/domain/player-domain-types'; +import { ServerType } from '/@/shared/types/domain/server-domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; +import { Song } from '/@/shared/types/domain/song-domain-types'; const ipc = isElectron() ? window.api.ipc : null; const remote = isElectron() ? window.api.remote : null; diff --git a/src/renderer/features/player/components/shuffle-all-modal.tsx b/src/renderer/features/player/components/shuffle-all-modal.tsx index 23c98f4bf..e1a189a01 100644 --- a/src/renderer/features/player/components/shuffle-all-modal.tsx +++ b/src/renderer/features/player/components/shuffle-all-modal.tsx @@ -19,17 +19,12 @@ import { Icon } from '/@/shared/components/icon/icon'; import { NumberInput } from '/@/shared/components/number-input/number-input'; import { Select } from '/@/shared/components/select/select'; import { Stack } from '/@/shared/components/stack/stack'; -import { - GenreListResponse, - GenreListSort, - MusicFolderListResponse, - Played, - RandomSongListQuery, - ServerListItem, - ServerType, - SortOrder, -} from '/@/shared/types/domain-types'; +import { GenreListResponse, GenreListSort } from '/@/shared/types/domain/genre-domain-types'; +import { Played } from '/@/shared/types/domain/player-domain-types'; +import { ServerListItem, ServerType } from '/@/shared/types/domain/server-domain-types'; +import { RandomSongListQuery } from '/@/shared/types/domain/song-domain-types'; import { Play, PlayQueueAddOptions } from '/@/shared/types/types'; +import { ListSortOrder } from '/@/shared/types/domain/shared-domain-types'; interface ShuffleAllSlice extends RandomSongListQuery { actions: { @@ -262,7 +257,7 @@ export const openShuffleAllModal = async ( }, query: { sortBy: GenreListSort.NAME, - sortOrder: SortOrder.ASC, + sortOrder: ListSortOrder.ASC, startIndex: 0, }, }), diff --git a/src/renderer/features/player/hooks/use-handle-playqueue-add.ts b/src/renderer/features/player/hooks/use-handle-playqueue-add.ts index 8a8ccbdc4..ba252ece8 100644 --- a/src/renderer/features/player/hooks/use-handle-playqueue-add.ts +++ b/src/renderer/features/player/hooks/use-handle-playqueue-add.ts @@ -20,13 +20,10 @@ import { useCurrentServer, usePlayerControls, usePlayerStore } from '/@/renderer import { useGeneralSettings, usePlaybackType } from '/@/renderer/store/settings.store'; import { setQueue, setQueueNext } from '/@/renderer/utils/set-transcoded-queue-data'; import { toast } from '/@/shared/components/toast/toast'; -import { - instanceOfCancellationError, - LibraryItem, - QueueSong, - Song, - SongListResponse, -} from '/@/shared/types/domain-types'; +import { instanceOfCancellationError } from '/@/shared/types/domain/api-domain-types'; +import { QueueSong } from '/@/shared/types/domain/player-domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; +import { Song, SongListResponse } from '/@/shared/types/domain/song-domain-types'; import { Play, PlaybackType, PlayQueueAddOptions } from '/@/shared/types/types'; const getRootQueryKey = (itemType: LibraryItem, serverId: string) => { diff --git a/src/renderer/features/player/hooks/use-scrobble.ts b/src/renderer/features/player/hooks/use-scrobble.ts index bb52cbded..590a96aa4 100644 --- a/src/renderer/features/player/hooks/use-scrobble.ts +++ b/src/renderer/features/player/hooks/use-scrobble.ts @@ -2,7 +2,8 @@ import { useCallback, useEffect, useRef, useState } from 'react'; import { useSendScrobble } from '/@/renderer/features/player/mutations/scrobble-mutation'; import { useAppStore, usePlaybackSettings, usePlayerStore } from '/@/renderer/store'; -import { QueueSong, ServerType } from '/@/shared/types/domain-types'; +import { QueueSong } from '/@/shared/types/domain/player-domain-types'; +import { ServerType } from '/@/shared/types/domain/server-domain-types'; import { PlayerStatus } from '/@/shared/types/types'; /* diff --git a/src/renderer/features/player/mutations/scrobble-mutation.ts b/src/renderer/features/player/mutations/scrobble-mutation.ts index ca8357348..b8dcc0f46 100644 --- a/src/renderer/features/player/mutations/scrobble-mutation.ts +++ b/src/renderer/features/player/mutations/scrobble-mutation.ts @@ -5,7 +5,7 @@ import { api } from '/@/renderer/api'; import { MutationOptions } from '/@/renderer/lib/react-query'; import { getServerById, useIncrementQueuePlayCount } from '/@/renderer/store'; import { usePlayEvent } from '/@/renderer/store/event.store'; -import { ScrobbleArgs, ScrobbleResponse } from '/@/shared/types/domain-types'; +import { ScrobbleRequest, ScrobbleResponse } from '/@/shared/types/domain/user-domain-types'; export const useSendScrobble = (options?: MutationOptions) => { const incrementPlayCount = useIncrementQueuePlayCount(); @@ -14,7 +14,7 @@ export const useSendScrobble = (options?: MutationOptions) => { return useMutation< ScrobbleResponse, AxiosError, - Omit, + Omit, null >({ mutationFn: (args) => { diff --git a/src/renderer/features/player/update-remote-song.tsx b/src/renderer/features/player/update-remote-song.tsx index 8e7146a14..8381d0be1 100644 --- a/src/renderer/features/player/update-remote-song.tsx +++ b/src/renderer/features/player/update-remote-song.tsx @@ -1,6 +1,6 @@ import isElectron from 'is-electron'; -import { QueueSong } from '/@/shared/types/domain-types'; +import { QueueSong } from '/@/shared/types/domain/player-domain-types'; const remote = isElectron() ? window.api.remote : null; const mediaSession = navigator.mediaSession; diff --git a/src/renderer/features/player/utils.ts b/src/renderer/features/player/utils.ts index fb4c58f9e..0ba49ab14 100644 --- a/src/renderer/features/player/utils.ts +++ b/src/renderer/features/player/utils.ts @@ -2,15 +2,15 @@ import { QueryClient } from '@tanstack/react-query'; import { api } from '/@/renderer/api'; import { queryKeys } from '/@/renderer/api/query-keys'; +import { PlaylistSongListQuery } from '/@/shared/types/domain/playlist-domain-types'; +import { ServerListItem } from '/@/shared/types/domain/server-domain-types'; import { - PlaylistSongListQuery, - ServerListItem, SongDetailQuery, SongListQuery, SongListResponse, SongListSort, - SortOrder, -} from '/@/shared/types/domain-types'; +} from '/@/shared/types/domain/song-domain-types'; +import { ListSortOrder } from '/@/shared/types/domain/shared-domain-types'; export const getPlaylistSongsById = async (args: { id: string; @@ -23,7 +23,7 @@ export const getPlaylistSongsById = async (args: { const queryFilter: PlaylistSongListQuery = { id, sortBy: SongListSort.ID, - sortOrder: SortOrder.ASC, + sortOrder: ListSortOrder.ASC, startIndex: 0, ...query, }; @@ -61,7 +61,7 @@ export const getAlbumSongsById = async (args: { const queryFilter: SongListQuery = { albumIds: id, sortBy: SongListSort.ALBUM, - sortOrder: SortOrder.ASC, + sortOrder: ListSortOrder.ASC, startIndex: 0, ...query, }; @@ -105,7 +105,7 @@ export const getGenreSongsById = async (args: { const queryFilter: SongListQuery = { genreIds: [genreId], sortBy: SongListSort.GENRE, - sortOrder: SortOrder.ASC, + sortOrder: ListSortOrder.ASC, startIndex: 0, ...query, }; @@ -149,7 +149,7 @@ export const getAlbumArtistSongsById = async (args: { const queryFilter: SongListQuery = { albumArtistIds: id || [], sortBy: SongListSort.ALBUM_ARTIST, - sortOrder: SortOrder.ASC, + sortOrder: ListSortOrder.ASC, startIndex: 0, ...query, }; @@ -186,7 +186,7 @@ export const getArtistSongsById = async (args: { const queryFilter: SongListQuery = { artistIds: id, sortBy: SongListSort.ALBUM, - sortOrder: SortOrder.ASC, + sortOrder: ListSortOrder.ASC, startIndex: 0, ...query, }; @@ -221,7 +221,7 @@ export const getSongsByQuery = async (args: { const queryFilter: SongListQuery = { sortBy: SongListSort.ALBUM, - sortOrder: SortOrder.ASC, + sortOrder: ListSortOrder.ASC, startIndex: 0, ...query, }; diff --git a/src/renderer/features/playlists/components/add-to-playlist-context-modal.tsx b/src/renderer/features/playlists/components/add-to-playlist-context-modal.tsx index 4732a7586..74e0192a3 100644 --- a/src/renderer/features/playlists/components/add-to-playlist-context-modal.tsx +++ b/src/renderer/features/playlists/components/add-to-playlist-context-modal.tsx @@ -16,12 +16,9 @@ import { MultiSelect } from '/@/shared/components/multi-select/multi-select'; import { Stack } from '/@/shared/components/stack/stack'; import { Switch } from '/@/shared/components/switch/switch'; import { toast } from '/@/shared/components/toast/toast'; -import { - PlaylistListSort, - SongListQuery, - SongListSort, - SortOrder, -} from '/@/shared/types/domain-types'; +import { PlaylistListSort } from '/@/shared/types/domain/playlist-domain-types'; +import { SongListQuery, SongListSort } from '/@/shared/types/domain/song-domain-types'; +import { ListSortOrder } from '/@/shared/types/domain/shared-domain-types'; export const AddToPlaylistContextModal = ({ id, @@ -48,7 +45,7 @@ export const AddToPlaylistContextModal = ({ }, }, sortBy: PlaylistListSort.NAME, - sortOrder: SortOrder.ASC, + sortOrder: ListSortOrder.ASC, startIndex: 0, }, serverId: server?.id, @@ -74,7 +71,7 @@ export const AddToPlaylistContextModal = ({ const query: SongListQuery = { albumIds: [albumId], sortBy: SongListSort.ALBUM, - sortOrder: SortOrder.ASC, + sortOrder: ListSortOrder.ASC, startIndex: 0, }; @@ -92,7 +89,7 @@ export const AddToPlaylistContextModal = ({ const query: SongListQuery = { artistIds: [artistId], sortBy: SongListSort.ARTIST, - sortOrder: SortOrder.ASC, + sortOrder: ListSortOrder.ASC, startIndex: 0, }; @@ -165,7 +162,7 @@ export const AddToPlaylistContextModal = ({ query: { id: playlistId, sortBy: SongListSort.ID, - sortOrder: SortOrder.ASC, + sortOrder: ListSortOrder.ASC, startIndex: 0, }, }); diff --git a/src/renderer/features/playlists/components/create-playlist-form.tsx b/src/renderer/features/playlists/components/create-playlist-form.tsx index 01bcac38e..f1efa7c25 100644 --- a/src/renderer/features/playlists/components/create-playlist-form.tsx +++ b/src/renderer/features/playlists/components/create-playlist-form.tsx @@ -18,8 +18,9 @@ import { TextInput } from '/@/shared/components/text-input/text-input'; import { Text } from '/@/shared/components/text/text'; import { Textarea } from '/@/shared/components/textarea/textarea'; import { toast } from '/@/shared/components/toast/toast'; -import { CreatePlaylistBody, ServerType, SongListSort } from '/@/shared/types/domain-types'; -import { ServerFeature } from '/@/shared/types/features-types'; +import { CreatePlaylistBody } from '/@/shared/types/domain/playlist-domain-types'; +import { ServerFeature, ServerType } from '/@/shared/types/domain/server-domain-types'; +import { SongListSort } from '/@/shared/types/domain/song-domain-types'; interface CreatePlaylistFormProps { onCancel: () => void; diff --git a/src/renderer/features/playlists/components/playlist-detail-song-list-content.tsx b/src/renderer/features/playlists/components/playlist-detail-song-list-content.tsx index 8caedb55c..f66228dbb 100644 --- a/src/renderer/features/playlists/components/playlist-detail-song-list-content.tsx +++ b/src/renderer/features/playlists/components/playlist-detail-song-list-content.tsx @@ -40,15 +40,12 @@ import { } from '/@/renderer/store'; import { PersistedTableColumn, usePlayButtonBehavior } from '/@/renderer/store/settings.store'; import { toast } from '/@/shared/components/toast/toast'; -import { - LibraryItem, - PlaylistSongListQuery, - QueueSong, - Song, - SongListSort, - SortOrder, -} from '/@/shared/types/domain-types'; -import { ListDisplayType, ServerType } from '/@/shared/types/types'; +import { QueueSong } from '/@/shared/types/domain/player-domain-types'; +import { PlaylistSongListQuery } from '/@/shared/types/domain/playlist-domain-types'; +import { ServerType } from '/@/shared/types/domain/server-domain-types'; +import { LibraryItem, ListSortOrder } from '/@/shared/types/domain/shared-domain-types'; +import { Song, SongListSort } from '/@/shared/types/domain/song-domain-types'; +import { ListDisplayType } from '/@/shared/types/types'; interface PlaylistDetailContentProps { songs?: Song[]; @@ -66,7 +63,7 @@ export const PlaylistDetailSongListContent = ({ songs, tableRef }: PlaylistDetai const filters: Partial = useMemo(() => { return { sortBy: page?.table.id[playlistId]?.filter?.sortBy || SongListSort.ID, - sortOrder: page?.table.id[playlistId]?.filter?.sortOrder || SortOrder.ASC, + sortOrder: page?.table.id[playlistId]?.filter?.sortOrder || ListSortOrder.ASC, }; }, [page?.table.id, playlistId]); diff --git a/src/renderer/features/playlists/components/playlist-detail-song-list-header-filters.tsx b/src/renderer/features/playlists/components/playlist-detail-song-list-header-filters.tsx index 8b1c7e0fc..9680710c9 100644 --- a/src/renderer/features/playlists/components/playlist-detail-song-list-header-filters.tsx +++ b/src/renderer/features/playlists/components/playlist-detail-song-list-header-filters.tsx @@ -40,213 +40,210 @@ import { Icon } from '/@/shared/components/icon/icon'; import { ConfirmModal } from '/@/shared/components/modal/modal'; import { Text } from '/@/shared/components/text/text'; import { toast } from '/@/shared/components/toast/toast'; -import { - LibraryItem, - PlaylistSongListQuery, - ServerType, - SongListSort, - SortOrder, -} from '/@/shared/types/domain-types'; +import { PlaylistSongListQuery } from '/@/shared/types/domain/playlist-domain-types'; +import { ServerType } from '/@/shared/types/domain/server-domain-types'; +import { LibraryItem, ListSortOrder } from '/@/shared/types/domain/shared-domain-types'; +import { SongListSort } from '/@/shared/types/domain/song-domain-types'; import { ListDisplayType, Play } from '/@/shared/types/types'; const FILTERS = { jellyfin: [ { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.id', { postProcess: 'titleCase' }), value: SongListSort.ID, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.album', { postProcess: 'titleCase' }), value: SongListSort.ALBUM, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.albumArtist', { postProcess: 'titleCase' }), value: SongListSort.ALBUM_ARTIST, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.artist', { postProcess: 'titleCase' }), value: SongListSort.ARTIST, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.duration', { postProcess: 'titleCase' }), value: SongListSort.DURATION, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.playCount', { postProcess: 'titleCase' }), value: SongListSort.PLAY_COUNT, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.name', { postProcess: 'titleCase' }), value: SongListSort.NAME, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.random', { postProcess: 'titleCase' }), value: SongListSort.RANDOM, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.recentlyAdded', { postProcess: 'titleCase' }), value: SongListSort.RECENTLY_ADDED, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.recentlyPlayed', { postProcess: 'titleCase' }), value: SongListSort.RECENTLY_PLAYED, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.releaseDate', { postProcess: 'titleCase' }), value: SongListSort.RELEASE_DATE, }, ], navidrome: [ { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.id', { postProcess: 'titleCase' }), value: SongListSort.ID, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.album', { postProcess: 'titleCase' }), value: SongListSort.ALBUM, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.albumArtist', { postProcess: 'titleCase' }), value: SongListSort.ALBUM_ARTIST, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.artist', { postProcess: 'titleCase' }), value: SongListSort.ARTIST, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.bpm', { postProcess: 'titleCase' }), value: SongListSort.BPM, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('common.channel', { count: 2, postProcess: 'titleCase' }), value: SongListSort.CHANNELS, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.comment', { postProcess: 'titleCase' }), value: SongListSort.COMMENT, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.duration', { postProcess: 'titleCase' }), value: SongListSort.DURATION, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.isFavorited', { postProcess: 'titleCase' }), value: SongListSort.FAVORITED, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.playCount', { postProcess: 'titleCase' }), value: SongListSort.GENRE, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.name', { postProcess: 'titleCase' }), value: SongListSort.NAME, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.playCount', { postProcess: 'titleCase' }), value: SongListSort.PLAY_COUNT, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.rating', { postProcess: 'titleCase' }), value: SongListSort.RATING, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.recentlyAdded', { postProcess: 'titleCase' }), value: SongListSort.RECENTLY_ADDED, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.recentlyPlayed', { postProcess: 'titleCase' }), value: SongListSort.RECENTLY_PLAYED, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.releaseYear', { postProcess: 'titleCase' }), value: SongListSort.YEAR, }, ], subsonic: [ { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.id', { postProcess: 'titleCase' }), value: SongListSort.ID, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.album', { postProcess: 'titleCase' }), value: SongListSort.ALBUM, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.albumArtist', { postProcess: 'titleCase' }), value: SongListSort.ALBUM_ARTIST, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.artist', { postProcess: 'titleCase' }), value: SongListSort.ARTIST, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.duration', { postProcess: 'titleCase' }), value: SongListSort.DURATION, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.isFavorited', { postProcess: 'titleCase' }), value: SongListSort.FAVORITED, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.genre', { postProcess: 'titleCase' }), value: SongListSort.GENRE, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.name', { postProcess: 'titleCase' }), value: SongListSort.NAME, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.rating', { postProcess: 'titleCase' }), value: SongListSort.RATING, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.recentlyAdded', { postProcess: 'titleCase' }), value: SongListSort.RECENTLY_ADDED, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.recentlyPlayed', { postProcess: 'titleCase' }), value: SongListSort.RECENTLY_PLAYED, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.releaseYear', { postProcess: 'titleCase' }), value: SongListSort.YEAR, }, @@ -272,7 +269,7 @@ export const PlaylistDetailSongListHeaderFilters = ({ const page = usePlaylistDetailStore(); const filters: Partial = { sortBy: page?.table.id[playlistId]?.filter?.sortBy || SongListSort.ID, - sortOrder: page?.table.id[playlistId]?.filter?.sortOrder || SortOrder.ASC, + sortOrder: page?.table.id[playlistId]?.filter?.sortOrder || ListSortOrder.ASC, }; const detailQuery = usePlaylistDetail({ query: { id: playlistId }, serverId: server?.id }); @@ -371,7 +368,7 @@ export const PlaylistDetailSongListHeaderFilters = ({ const updatedFilters = setFilter(playlistId, { sortBy: e.currentTarget.value as SongListSort, - sortOrder: sortOrder || SortOrder.ASC, + sortOrder: sortOrder || ListSortOrder.ASC, }); handleFilterChange(updatedFilters); @@ -380,7 +377,8 @@ export const PlaylistDetailSongListHeaderFilters = ({ ); const handleToggleSortOrder = useCallback(() => { - const newSortOrder = filters.sortOrder === SortOrder.ASC ? SortOrder.DESC : SortOrder.ASC; + const newSortOrder = + filters.sortOrder === ListSortOrder.ASC ? ListSortOrder.DESC : ListSortOrder.ASC; const updatedFilters = setFilter(playlistId, { sortOrder: newSortOrder }); handleFilterChange(updatedFilters); }, [filters.sortOrder, handleFilterChange, playlistId, setFilter]); @@ -498,7 +496,7 @@ export const PlaylistDetailSongListHeaderFilters = ({ diff --git a/src/renderer/features/playlists/components/playlist-detail-song-list-header.tsx b/src/renderer/features/playlists/components/playlist-detail-song-list-header.tsx index 90fded260..a8c209ed1 100644 --- a/src/renderer/features/playlists/components/playlist-detail-song-list-header.tsx +++ b/src/renderer/features/playlists/components/playlist-detail-song-list-header.tsx @@ -14,7 +14,7 @@ import { usePlayButtonBehavior } from '/@/renderer/store/settings.store'; import { Badge } from '/@/shared/components/badge/badge'; import { SpinnerIcon } from '/@/shared/components/spinner/spinner'; import { Stack } from '/@/shared/components/stack/stack'; -import { LibraryItem } from '/@/shared/types/domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; import { Play } from '/@/shared/types/types'; interface PlaylistDetailHeaderProps { diff --git a/src/renderer/features/playlists/components/playlist-list-grid-view.tsx b/src/renderer/features/playlists/components/playlist-list-grid-view.tsx index 1b0a22b72..85e64486e 100644 --- a/src/renderer/features/playlists/components/playlist-list-grid-view.tsx +++ b/src/renderer/features/playlists/components/playlist-list-grid-view.tsx @@ -18,12 +18,12 @@ import { AppRoute } from '/@/renderer/router/routes'; import { useCurrentServer, useListStoreByKey } from '/@/renderer/store'; import { useListStoreActions } from '/@/renderer/store/list.store'; import { - LibraryItem, Playlist, PlaylistListQuery, PlaylistListResponse, PlaylistListSort, -} from '/@/shared/types/domain-types'; +} from '/@/shared/types/domain/playlist-domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; import { CardRow, ListDisplayType } from '/@/shared/types/types'; interface PlaylistListGridViewProps { diff --git a/src/renderer/features/playlists/components/playlist-list-header-filters.tsx b/src/renderer/features/playlists/components/playlist-list-header-filters.tsx index a27a7e8ed..9a8c144d1 100644 --- a/src/renderer/features/playlists/components/playlist-list-header-filters.tsx +++ b/src/renderer/features/playlists/components/playlist-list-header-filters.tsx @@ -32,93 +32,89 @@ import { DropdownMenu } from '/@/shared/components/dropdown-menu/dropdown-menu'; import { Flex } from '/@/shared/components/flex/flex'; import { Group } from '/@/shared/components/group/group'; import { Icon } from '/@/shared/components/icon/icon'; -import { - LibraryItem, - PlaylistListQuery, - PlaylistListSort, - ServerType, - SortOrder, -} from '/@/shared/types/domain-types'; +import { PlaylistListQuery, PlaylistListSort } from '/@/shared/types/domain/playlist-domain-types'; +import { ServerType } from '/@/shared/types/domain/server-domain-types'; +import { LibraryItem, ListSortOrder } from '/@/shared/types/domain/shared-domain-types'; import { ListDisplayType } from '/@/shared/types/types'; const FILTERS = { jellyfin: [ { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.duration', { postProcess: 'titleCase' }), value: PlaylistListSort.DURATION, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.name', { postProcess: 'titleCase' }), value: PlaylistListSort.NAME, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.songCount', { postProcess: 'titleCase' }), value: PlaylistListSort.SONG_COUNT, }, ], navidrome: [ { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.duration', { postProcess: 'titleCase' }), value: PlaylistListSort.DURATION, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.name', { postProcess: 'titleCase' }), value: PlaylistListSort.NAME, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.owner', { postProcess: 'titleCase' }), value: PlaylistListSort.OWNER, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.isPublic', { postProcess: 'titleCase' }), value: PlaylistListSort.PUBLIC, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.songCount', { postProcess: 'titleCase' }), value: PlaylistListSort.SONG_COUNT, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.recentlyUpdated', { postProcess: 'titleCase' }), value: PlaylistListSort.UPDATED_AT, }, ], subsonic: [ { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.duration', { postProcess: 'titleCase' }), value: PlaylistListSort.DURATION, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.name', { postProcess: 'titleCase' }), value: PlaylistListSort.NAME, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.owner', { postProcess: 'titleCase' }), value: PlaylistListSort.OWNER, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.isPublic', { postProcess: 'titleCase' }), value: PlaylistListSort.PUBLIC, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.songCount', { postProcess: 'titleCase' }), value: PlaylistListSort.SONG_COUNT, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.recentlyUpdated', { postProcess: 'titleCase' }), value: PlaylistListSort.UPDATED_AT, }, @@ -260,7 +256,7 @@ export const PlaylistListHeaderFilters = ({ const updatedFilters = setFilter({ data: { sortBy: e.currentTarget.value as PlaylistListSort, - sortOrder: sortOrder || SortOrder.ASC, + sortOrder: sortOrder || ListSortOrder.ASC, }, itemType: LibraryItem.PLAYLIST, key: pageKey, @@ -272,7 +268,8 @@ export const PlaylistListHeaderFilters = ({ ); const handleToggleSortOrder = useCallback(() => { - const newSortOrder = filter.sortOrder === SortOrder.ASC ? SortOrder.DESC : SortOrder.ASC; + const newSortOrder = + filter.sortOrder === ListSortOrder.ASC ? ListSortOrder.DESC : ListSortOrder.ASC; const updatedFilters = setFilter({ data: { sortOrder: newSortOrder }, itemType: LibraryItem.PLAYLIST, diff --git a/src/renderer/features/playlists/components/playlist-list-header.tsx b/src/renderer/features/playlists/components/playlist-list-header.tsx index 73ccf598e..363414042 100644 --- a/src/renderer/features/playlists/components/playlist-list-header.tsx +++ b/src/renderer/features/playlists/components/playlist-list-header.tsx @@ -17,7 +17,8 @@ import { Flex } from '/@/shared/components/flex/flex'; import { Group } from '/@/shared/components/group/group'; import { SpinnerIcon } from '/@/shared/components/spinner/spinner'; import { Stack } from '/@/shared/components/stack/stack'; -import { LibraryItem, PlaylistListQuery } from '/@/shared/types/domain-types'; +import { PlaylistListQuery } from '/@/shared/types/domain/playlist-domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; interface PlaylistListHeaderProps { gridRef: MutableRefObject; diff --git a/src/renderer/features/playlists/components/playlist-list-table-view.tsx b/src/renderer/features/playlists/components/playlist-list-table-view.tsx index 89804b79b..c5e3eed2c 100644 --- a/src/renderer/features/playlists/components/playlist-list-table-view.tsx +++ b/src/renderer/features/playlists/components/playlist-list-table-view.tsx @@ -10,7 +10,7 @@ import { useVirtualTable } from '/@/renderer/components/virtual-table/hooks/use- import { PLAYLIST_CONTEXT_MENU_ITEMS } from '/@/renderer/features/context-menu/context-menu-items'; import { AppRoute } from '/@/renderer/router/routes'; import { useCurrentServer } from '/@/renderer/store'; -import { LibraryItem } from '/@/shared/types/domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; interface PlaylistListTableViewProps { itemCount?: number; diff --git a/src/renderer/features/playlists/components/playlist-query-builder.tsx b/src/renderer/features/playlists/components/playlist-query-builder.tsx index c34ec7931..ccc84bb20 100644 --- a/src/renderer/features/playlists/components/playlist-query-builder.tsx +++ b/src/renderer/features/playlists/components/playlist-query-builder.tsx @@ -32,8 +32,10 @@ import { Icon } from '/@/shared/components/icon/icon'; import { NumberInput } from '/@/shared/components/number-input/number-input'; import { ScrollArea } from '/@/shared/components/scroll-area/scroll-area'; import { Select } from '/@/shared/components/select/select'; -import { PlaylistListSort, SongListSort, SortOrder } from '/@/shared/types/domain-types'; +import { PlaylistListSort } from '/@/shared/types/domain/playlist-domain-types'; +import { SongListSort } from '/@/shared/types/domain/song-domain-types'; import { QueryBuilderGroup, QueryBuilderRule } from '/@/shared/types/types'; +import { ListSortOrder } from '/@/shared/types/domain/shared-domain-types'; type AddArgs = { groupIndex: number[]; @@ -109,7 +111,7 @@ export const PlaylistQueryBuilder = forwardRef( ); const { data: playlists } = usePlaylistList({ - query: { sortBy: PlaylistListSort.NAME, sortOrder: SortOrder.ASC, startIndex: 0 }, + query: { sortBy: PlaylistListSort.NAME, sortOrder: ListSortOrder.ASC, startIndex: 0 }, serverId: server?.id, }); diff --git a/src/renderer/features/playlists/components/save-as-playlist-form.tsx b/src/renderer/features/playlists/components/save-as-playlist-form.tsx index 304b1a8fe..2a8aa7ecd 100644 --- a/src/renderer/features/playlists/components/save-as-playlist-form.tsx +++ b/src/renderer/features/playlists/components/save-as-playlist-form.tsx @@ -13,9 +13,8 @@ import { toast } from '/@/shared/components/toast/toast'; import { CreatePlaylistBody, CreatePlaylistResponse, - ServerType, -} from '/@/shared/types/domain-types'; -import { ServerFeature } from '/@/shared/types/features-types'; +} from '/@/shared/types/domain/playlist-domain-types'; +import { ServerFeature, ServerType } from '/@/shared/types/domain/server-domain-types'; interface SaveAsPlaylistFormProps { body: Partial; diff --git a/src/renderer/features/playlists/components/update-playlist-form.tsx b/src/renderer/features/playlists/components/update-playlist-form.tsx index 51635c525..28b841a51 100644 --- a/src/renderer/features/playlists/components/update-playlist-form.tsx +++ b/src/renderer/features/playlists/components/update-playlist-form.tsx @@ -1,5 +1,6 @@ import { useForm } from '@mantine/form'; import { closeAllModals, openModal } from '@mantine/modals'; +import { User } from '@xhayper/discord-rpc'; import { useTranslation } from 'react-i18next'; import i18n from '/@/i18n/i18n'; @@ -18,16 +19,16 @@ import { TextInput } from '/@/shared/components/text-input/text-input'; import { toast } from '/@/shared/components/toast/toast'; import { PlaylistDetailResponse, - ServerListItem, - ServerType, - SortOrder, UpdatePlaylistBody, UpdatePlaylistQuery, - User, - UserListQuery, - UserListSort, -} from '/@/shared/types/domain-types'; -import { ServerFeature } from '/@/shared/types/features-types'; +} from '/@/shared/types/domain/playlist-domain-types'; +import { + ServerFeature, + ServerListItem, + ServerType, +} from '/@/shared/types/domain/server-domain-types'; +import { UserListQuery, UserListSort } from '/@/shared/types/domain/user-domain-types'; +import { ListSortOrder } from '/@/shared/types/domain/shared-domain-types'; interface UpdatePlaylistFormProps { body: Partial; @@ -165,7 +166,7 @@ export const openUpdatePlaylistModal = async (args: { const query: UserListQuery = { sortBy: UserListSort.NAME, - sortOrder: SortOrder.ASC, + sortOrder: ListSortOrder.ASC, startIndex: 0, }; diff --git a/src/renderer/features/playlists/mutations/add-to-playlist-mutation.ts b/src/renderer/features/playlists/mutations/add-to-playlist-mutation.ts index b699fdb7a..144c6e479 100644 --- a/src/renderer/features/playlists/mutations/add-to-playlist-mutation.ts +++ b/src/renderer/features/playlists/mutations/add-to-playlist-mutation.ts @@ -5,7 +5,10 @@ import { api } from '/@/renderer/api'; import { queryKeys } from '/@/renderer/api/query-keys'; import { MutationHookArgs } from '/@/renderer/lib/react-query'; import { getServerById } from '/@/renderer/store'; -import { AddToPlaylistArgs, AddToPlaylistResponse } from '/@/shared/types/domain-types'; +import { + AddToPlaylistArgs, + AddToPlaylistResponse, +} from '/@/shared/types/domain/playlist-domain-types'; export const useAddToPlaylist = (args: MutationHookArgs) => { const { options } = args || {}; diff --git a/src/renderer/features/playlists/mutations/create-playlist-mutation.ts b/src/renderer/features/playlists/mutations/create-playlist-mutation.ts index f61a06540..7e55683b1 100644 --- a/src/renderer/features/playlists/mutations/create-playlist-mutation.ts +++ b/src/renderer/features/playlists/mutations/create-playlist-mutation.ts @@ -5,7 +5,7 @@ import { api } from '/@/renderer/api'; import { queryKeys } from '/@/renderer/api/query-keys'; import { MutationHookArgs } from '/@/renderer/lib/react-query'; import { getServerById } from '/@/renderer/store'; -import { CreatePlaylistArgs, CreatePlaylistResponse } from '/@/shared/types/domain-types'; +import { CreatePlaylistResponse } from '/@/shared/types/domain/playlist-domain-types'; export const useCreatePlaylist = (args: MutationHookArgs) => { const { options } = args || {}; diff --git a/src/renderer/features/playlists/mutations/delete-playlist-mutation.ts b/src/renderer/features/playlists/mutations/delete-playlist-mutation.ts index 23bc32cbc..6655fa6f3 100644 --- a/src/renderer/features/playlists/mutations/delete-playlist-mutation.ts +++ b/src/renderer/features/playlists/mutations/delete-playlist-mutation.ts @@ -5,7 +5,7 @@ import { api } from '/@/renderer/api'; import { queryKeys } from '/@/renderer/api/query-keys'; import { MutationHookArgs } from '/@/renderer/lib/react-query'; import { getServerById, useCurrentServer } from '/@/renderer/store'; -import { DeletePlaylistArgs, DeletePlaylistResponse } from '/@/shared/types/domain-types'; +import { DeletePlaylistResponse } from '/@/shared/types/domain/playlist-domain-types'; export const useDeletePlaylist = (args: MutationHookArgs) => { const { options } = args || {}; diff --git a/src/renderer/features/playlists/mutations/remove-from-playlist-mutation.ts b/src/renderer/features/playlists/mutations/remove-from-playlist-mutation.ts index fdd57da69..098577e21 100644 --- a/src/renderer/features/playlists/mutations/remove-from-playlist-mutation.ts +++ b/src/renderer/features/playlists/mutations/remove-from-playlist-mutation.ts @@ -1,11 +1,11 @@ import { useMutation, useQueryClient } from '@tanstack/react-query'; -import { AxiosError } from 'axios'; +import { AxiosError, AxiosError } from 'axios'; import { api } from '/@/renderer/api'; import { queryKeys } from '/@/renderer/api/query-keys'; import { MutationOptions } from '/@/renderer/lib/react-query'; import { getServerById } from '/@/renderer/store'; -import { RemoveFromPlaylistArgs, RemoveFromPlaylistResponse } from '/@/shared/types/domain-types'; +import { RemoveFromPlaylistResponse } from '/@/shared/types/domain/playlist-domain-types'; export const useRemoveFromPlaylist = (options?: MutationOptions) => { const queryClient = useQueryClient(); diff --git a/src/renderer/features/playlists/mutations/update-playlist-mutation.ts b/src/renderer/features/playlists/mutations/update-playlist-mutation.ts index ecafefd84..fd5183dcc 100644 --- a/src/renderer/features/playlists/mutations/update-playlist-mutation.ts +++ b/src/renderer/features/playlists/mutations/update-playlist-mutation.ts @@ -5,7 +5,7 @@ import { api } from '/@/renderer/api'; import { queryKeys } from '/@/renderer/api/query-keys'; import { MutationHookArgs } from '/@/renderer/lib/react-query'; import { getServerById } from '/@/renderer/store'; -import { UpdatePlaylistArgs, UpdatePlaylistResponse } from '/@/shared/types/domain-types'; +import { UpdatePlaylistResponse } from '/@/shared/types/domain/playlist-domain-types'; export const useUpdatePlaylist = (args: MutationHookArgs) => { const { options } = args || {}; diff --git a/src/renderer/features/playlists/queries/playlist-detail-query.ts b/src/renderer/features/playlists/queries/playlist-detail-query.ts index 94148bf3c..4bb687d71 100644 --- a/src/renderer/features/playlists/queries/playlist-detail-query.ts +++ b/src/renderer/features/playlists/queries/playlist-detail-query.ts @@ -1,11 +1,11 @@ import type { QueryHookArgs } from '/@/renderer/lib/react-query'; -import type { PlaylistDetailQuery } from '/@/shared/types/domain-types'; import { useQuery } from '@tanstack/react-query'; import { api } from '/@/renderer/api'; import { queryKeys } from '/@/renderer/api/query-keys'; import { getServerById } from '/@/renderer/store'; +import { PlaylistDetailQuery } from '/@/shared/types/domain/playlist-domain-types'; export const usePlaylistDetail = (args: QueryHookArgs) => { const { options, query, serverId } = args || {}; diff --git a/src/renderer/features/playlists/queries/playlist-list-query.ts b/src/renderer/features/playlists/queries/playlist-list-query.ts index 702fcadf0..38d8296a8 100644 --- a/src/renderer/features/playlists/queries/playlist-list-query.ts +++ b/src/renderer/features/playlists/queries/playlist-list-query.ts @@ -1,11 +1,11 @@ import type { QueryOptions } from '/@/renderer/lib/react-query'; -import type { PlaylistListQuery } from '/@/shared/types/domain-types'; import { useQuery } from '@tanstack/react-query'; import { api } from '/@/renderer/api'; import { queryKeys } from '/@/renderer/api/query-keys'; import { getServerById } from '/@/renderer/store'; +import { PlaylistListQuery } from '/@/shared/types/domain/playlist-domain-types'; export const usePlaylistList = (args: { options?: QueryOptions; diff --git a/src/renderer/features/playlists/queries/playlist-song-list-query.ts b/src/renderer/features/playlists/queries/playlist-song-list-query.ts index 15585b28a..4c46e438a 100644 --- a/src/renderer/features/playlists/queries/playlist-song-list-query.ts +++ b/src/renderer/features/playlists/queries/playlist-song-list-query.ts @@ -1,11 +1,11 @@ import type { QueryHookArgs } from '/@/renderer/lib/react-query'; -import type { PlaylistSongListQuery } from '/@/shared/types/domain-types'; import { useQuery } from '@tanstack/react-query'; import { api } from '/@/renderer/api'; import { queryKeys } from '/@/renderer/api/query-keys'; import { getServerById } from '/@/renderer/store'; +import { PlaylistSongListQuery } from '/@/shared/types/domain/playlist-domain-types'; export const usePlaylistSongList = (args: QueryHookArgs) => { const { options, query, serverId } = args || {}; diff --git a/src/renderer/features/playlists/routes/playlist-detail-song-list-route.tsx b/src/renderer/features/playlists/routes/playlist-detail-song-list-route.tsx index 09a24346c..7f42a2d22 100644 --- a/src/renderer/features/playlists/routes/playlist-detail-song-list-route.tsx +++ b/src/renderer/features/playlists/routes/playlist-detail-song-list-route.tsx @@ -22,12 +22,10 @@ import { Box } from '/@/shared/components/box/box'; import { Group } from '/@/shared/components/group/group'; import { Text } from '/@/shared/components/text/text'; import { toast } from '/@/shared/components/toast/toast'; -import { - PlaylistSongListQuery, - ServerType, - SongListSort, - SortOrder, -} from '/@/shared/types/domain-types'; +import { PlaylistSongListQuery } from '/@/shared/types/domain/playlist-domain-types'; +import { ServerType } from '/@/shared/types/domain/server-domain-types'; +import { SongListSort } from '/@/shared/types/domain/song-domain-types'; +import { ListSortOrder } from '/@/shared/types/domain/shared-domain-types'; const PlaylistDetailSongListRoute = () => { const { t } = useTranslation(); @@ -150,7 +148,7 @@ const PlaylistDetailSongListRoute = () => { const page = usePlaylistDetailStore(); const filters: Partial = { sortBy: page?.table.id[playlistId]?.filter?.sortBy || SongListSort.ID, - sortOrder: page?.table.id[playlistId]?.filter?.sortOrder || SortOrder.ASC, + sortOrder: page?.table.id[playlistId]?.filter?.sortOrder || ListSortOrder.ASC, }; const itemCountCheck = usePlaylistSongList({ diff --git a/src/renderer/features/playlists/routes/playlist-list-route.tsx b/src/renderer/features/playlists/routes/playlist-list-route.tsx index fc81f77f3..bb8b4cf3e 100644 --- a/src/renderer/features/playlists/routes/playlist-list-route.tsx +++ b/src/renderer/features/playlists/routes/playlist-list-route.tsx @@ -10,7 +10,11 @@ import { PlaylistListHeader } from '/@/renderer/features/playlists/components/pl import { usePlaylistList } from '/@/renderer/features/playlists/queries/playlist-list-query'; import { AnimatedPage } from '/@/renderer/features/shared'; import { useCurrentServer, useListStoreByKey } from '/@/renderer/store'; -import { PlaylistListSort, PlaylistSongListQuery, SortOrder } from '/@/shared/types/domain-types'; +import { + PlaylistListSort, + PlaylistSongListQuery, +} from '/@/shared/types/domain/playlist-domain-types'; +import { ListSortOrder } from '/@/shared/types/domain/shared-domain-types'; const PlaylistListRoute = () => { const gridRef = useRef(null); @@ -29,7 +33,7 @@ const PlaylistListRoute = () => { ...filter, limit: 1, sortBy: PlaylistListSort.NAME, - sortOrder: SortOrder.ASC, + sortOrder: ListSortOrder.ASC, startIndex: 0, }, serverId: server?.id, diff --git a/src/renderer/features/search/components/command-palette.tsx b/src/renderer/features/search/components/command-palette.tsx index bef4fd41d..0e14c63ba 100644 --- a/src/renderer/features/search/components/command-palette.tsx +++ b/src/renderer/features/search/components/command-palette.tsx @@ -22,7 +22,7 @@ import { Kbd } from '/@/shared/components/kbd/kbd'; import { Modal } from '/@/shared/components/modal/modal'; import { Spinner } from '/@/shared/components/spinner/spinner'; import { TextInput } from '/@/shared/components/text-input/text-input'; -import { LibraryItem } from '/@/shared/types/domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; interface CommandPaletteProps { modalProps: (typeof useDisclosure)['arguments']; diff --git a/src/renderer/features/search/components/home-commands.tsx b/src/renderer/features/search/components/home-commands.tsx index ed2e6245e..239d047b9 100644 --- a/src/renderer/features/search/components/home-commands.tsx +++ b/src/renderer/features/search/components/home-commands.tsx @@ -9,7 +9,8 @@ import { CreatePlaylistForm } from '/@/renderer/features/playlists'; import { Command, CommandPalettePages } from '/@/renderer/features/search/components/command'; import { AppRoute } from '/@/renderer/router/routes'; import { useCurrentServer } from '/@/renderer/store'; -import { LibraryItem, ServerType } from '/@/shared/types/domain-types'; +import { ServerType } from '/@/shared/types/domain/server-domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; interface HomeCommandsProps { handleClose: () => void; diff --git a/src/renderer/features/search/components/library-command-item.tsx b/src/renderer/features/search/components/library-command-item.tsx index aa275315d..8ff9d312f 100644 --- a/src/renderer/features/search/components/library-command-item.tsx +++ b/src/renderer/features/search/components/library-command-item.tsx @@ -8,7 +8,7 @@ import { Flex } from '/@/shared/components/flex/flex'; import { Group } from '/@/shared/components/group/group'; import { Image } from '/@/shared/components/image/image'; import { Text } from '/@/shared/components/text/text'; -import { LibraryItem } from '/@/shared/types/domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; import { Play, PlayQueueAddOptions } from '/@/shared/types/types'; interface LibraryCommandItemProps { diff --git a/src/renderer/features/search/components/search-content.tsx b/src/renderer/features/search/components/search-content.tsx index 4e9353502..277f6df02 100644 --- a/src/renderer/features/search/components/search-content.tsx +++ b/src/renderer/features/search/components/search-content.tsx @@ -17,7 +17,9 @@ import { import { usePlayQueueAdd } from '/@/renderer/features/player'; import { AppRoute } from '/@/renderer/router/routes'; import { useCurrentServer, useListStoreByKey, usePlayButtonBehavior } from '/@/renderer/store'; -import { LibraryItem, QueueSong, SongListQuery } from '/@/shared/types/domain-types'; +import { QueueSong } from '/@/shared/types/domain/player-domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; +import { SongListQuery } from '/@/shared/types/domain/song-domain-types'; interface SearchContentProps { tableRef: MutableRefObject; diff --git a/src/renderer/features/search/components/search-header.tsx b/src/renderer/features/search/components/search-header.tsx index 8f62cbbe6..66e900223 100644 --- a/src/renderer/features/search/components/search-header.tsx +++ b/src/renderer/features/search/components/search-header.tsx @@ -16,12 +16,10 @@ import { Button } from '/@/shared/components/button/button'; import { Flex } from '/@/shared/components/flex/flex'; import { Group } from '/@/shared/components/group/group'; import { Stack } from '/@/shared/components/stack/stack'; -import { - AlbumArtistListQuery, - AlbumListQuery, - LibraryItem, - SongListQuery, -} from '/@/shared/types/domain-types'; +import { AlbumListQuery } from '/@/shared/types/domain/album-domain-types'; +import { AlbumArtistListQuery } from '/@/shared/types/domain/artist-domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; +import { SongListQuery } from '/@/shared/types/domain/song-domain-types'; interface SearchHeaderProps { navigationId: string; diff --git a/src/renderer/features/search/components/server-commands.tsx b/src/renderer/features/search/components/server-commands.tsx index b41a6792c..ce7118a19 100644 --- a/src/renderer/features/search/components/server-commands.tsx +++ b/src/renderer/features/search/components/server-commands.tsx @@ -7,7 +7,7 @@ import { Command, CommandPalettePages } from '/@/renderer/features/search/compon import { ServerList } from '/@/renderer/features/servers'; import { AppRoute } from '/@/renderer/router/routes'; import { useAuthStoreActions, useServerList } from '/@/renderer/store'; -import { ServerListItem } from '/@/shared/types/domain-types'; +import { ServerListItem } from '/@/shared/types/domain/server-domain-types'; interface ServerCommandsProps { handleClose: () => void; diff --git a/src/renderer/features/search/queries/search-query.ts b/src/renderer/features/search/queries/search-query.ts index 5dd4c5e62..b71c2dbee 100644 --- a/src/renderer/features/search/queries/search-query.ts +++ b/src/renderer/features/search/queries/search-query.ts @@ -4,7 +4,7 @@ import { api } from '/@/renderer/api'; import { queryKeys } from '/@/renderer/api/query-keys'; import { QueryHookArgs } from '/@/renderer/lib/react-query'; import { getServerById } from '/@/renderer/store'; -import { SearchQuery } from '/@/shared/types/domain-types'; +import { SearchQuery } from '/@/shared/types/domain/search-domain-types'; export const useSearch = (args: QueryHookArgs) => { const { options, query, serverId } = args; diff --git a/src/renderer/features/servers/components/add-server-form.tsx b/src/renderer/features/servers/components/add-server-form.tsx index c9768e0d9..8f7437fcc 100644 --- a/src/renderer/features/servers/components/add-server-form.tsx +++ b/src/renderer/features/servers/components/add-server-form.tsx @@ -20,8 +20,9 @@ import { Stack } from '/@/shared/components/stack/stack'; import { TextInput } from '/@/shared/components/text-input/text-input'; import { Text } from '/@/shared/components/text/text'; import { toast } from '/@/shared/components/toast/toast'; -import { AuthenticationResponse } from '/@/shared/types/domain-types'; -import { ServerType, toServerType } from '/@/shared/types/types'; +import { AuthenticationResponse } from '/@/shared/types/domain/auth-domain-types'; +import { ServerType } from '/@/shared/types/domain/server-domain-types'; +import { toServerType } from '/@/shared/types/types'; const localSettings = isElectron() ? window.api.localSettings : null; diff --git a/src/renderer/features/servers/components/edit-server-form.tsx b/src/renderer/features/servers/components/edit-server-form.tsx index 8765b33e8..a1f63cea4 100644 --- a/src/renderer/features/servers/components/edit-server-form.tsx +++ b/src/renderer/features/servers/components/edit-server-form.tsx @@ -19,7 +19,8 @@ import { Stack } from '/@/shared/components/stack/stack'; import { TextInput } from '/@/shared/components/text-input/text-input'; import { toast } from '/@/shared/components/toast/toast'; import { Tooltip } from '/@/shared/components/tooltip/tooltip'; -import { AuthenticationResponse, ServerListItem, ServerType } from '/@/shared/types/domain-types'; +import { AuthenticationResponse } from '/@/shared/types/domain/auth-domain-types'; +import { ServerListItem, ServerType } from '/@/shared/types/domain/server-domain-types'; const localSettings = isElectron() ? window.api.localSettings : null; diff --git a/src/renderer/features/servers/components/server-list-item.tsx b/src/renderer/features/servers/components/server-list-item.tsx index 112263c17..e695f2028 100644 --- a/src/renderer/features/servers/components/server-list-item.tsx +++ b/src/renderer/features/servers/components/server-list-item.tsx @@ -12,7 +12,7 @@ import { Group } from '/@/shared/components/group/group'; import { Icon } from '/@/shared/components/icon/icon'; import { Stack } from '/@/shared/components/stack/stack'; import { Table } from '/@/shared/components/table/table'; -import { ServerListItem as ServerItem } from '/@/shared/types/domain-types'; +import { ServerListItem as ServerItem } from '/@/shared/types/domain/server-domain-types'; const localSettings = isElectron() ? window.api.localSettings : null; diff --git a/src/renderer/features/servers/components/server-list.tsx b/src/renderer/features/servers/components/server-list.tsx index 0e1423a05..6a186e08c 100644 --- a/src/renderer/features/servers/components/server-list.tsx +++ b/src/renderer/features/servers/components/server-list.tsx @@ -19,7 +19,7 @@ import { ContextModalVars } from '/@/shared/components/modal/modal'; import { Stack } from '/@/shared/components/stack/stack'; import { Switch } from '/@/shared/components/switch/switch'; import { Text } from '/@/shared/components/text/text'; -import { ServerType } from '/@/shared/types/domain-types'; +import { ServerType } from '/@/shared/types/domain/server-domain-types'; const localSettings = isElectron() ? window.api.localSettings : null; diff --git a/src/renderer/features/settings/components/playback/lyric-settings.tsx b/src/renderer/features/settings/components/playback/lyric-settings.tsx index 8c1886aac..88c69098d 100644 --- a/src/renderer/features/settings/components/playback/lyric-settings.tsx +++ b/src/renderer/features/settings/components/playback/lyric-settings.tsx @@ -12,7 +12,7 @@ import { NumberInput } from '/@/shared/components/number-input/number-input'; import { Select } from '/@/shared/components/select/select'; import { Switch } from '/@/shared/components/switch/switch'; import { TextInput } from '/@/shared/components/text-input/text-input'; -import { LyricSource } from '/@/shared/types/domain-types'; +import { LyricSource } from '/@/shared/types/domain/lyric-domain-types'; const localSettings = isElectron() ? window.api.localSettings : null; diff --git a/src/renderer/features/shared/components/library-header.tsx b/src/renderer/features/shared/components/library-header.tsx index 5518f7337..aab5356ce 100644 --- a/src/renderer/features/shared/components/library-header.tsx +++ b/src/renderer/features/shared/components/library-header.tsx @@ -11,7 +11,7 @@ import { useGeneralSettings } from '/@/renderer/store'; import { Center } from '/@/shared/components/center/center'; import { Image } from '/@/shared/components/image/image'; import { Text } from '/@/shared/components/text/text'; -import { LibraryItem } from '/@/shared/types/domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; interface LibraryHeaderProps { background?: string; diff --git a/src/renderer/features/shared/components/order-toggle-button.tsx b/src/renderer/features/shared/components/order-toggle-button.tsx index 561e468fb..2f527c026 100644 --- a/src/renderer/features/shared/components/order-toggle-button.tsx +++ b/src/renderer/features/shared/components/order-toggle-button.tsx @@ -1,12 +1,12 @@ import { useTranslation } from 'react-i18next'; import { ActionIcon, ActionIconProps } from '/@/shared/components/action-icon/action-icon'; -import { SortOrder } from '/@/shared/types/domain-types'; +import { ListSortOrder } from '/@/shared/types/domain/shared-domain-types'; interface OrderToggleButtonProps { buttonProps?: Partial; onToggle: () => void; - sortOrder: SortOrder; + sortOrder: ListSortOrder; } export const OrderToggleButton = ({ buttonProps, onToggle, sortOrder }: OrderToggleButtonProps) => { @@ -14,14 +14,14 @@ export const OrderToggleButton = ({ buttonProps, onToggle, sortOrder }: OrderTog return ( ; diff --git a/src/renderer/features/shared/mutations/create-favorite-mutation.ts b/src/renderer/features/shared/mutations/create-favorite-mutation.ts index 154ae7621..00effdf53 100644 --- a/src/renderer/features/shared/mutations/create-favorite-mutation.ts +++ b/src/renderer/features/shared/mutations/create-favorite-mutation.ts @@ -7,13 +7,10 @@ import { queryKeys } from '/@/renderer/api/query-keys'; import { MutationHookArgs } from '/@/renderer/lib/react-query'; import { getServerById, useSetAlbumListItemDataById, useSetQueueFavorite } from '/@/renderer/store'; import { useFavoriteEvent } from '/@/renderer/store/event.store'; -import { - AlbumArtistDetailResponse, - AlbumDetailResponse, - FavoriteArgs, - FavoriteResponse, - LibraryItem, -} from '/@/shared/types/domain-types'; +import { AlbumDetailResponse } from '/@/shared/types/domain/album-domain-types'; +import { AlbumArtistDetailResponse } from '/@/shared/types/domain/artist-domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; +import { FavoriteResponse } from '/@/shared/types/domain/user-domain-types'; const remote = isElectron() ? window.api.remote : null; diff --git a/src/renderer/features/shared/mutations/delete-favorite-mutation.ts b/src/renderer/features/shared/mutations/delete-favorite-mutation.ts index 2b68c58cc..81169cb97 100644 --- a/src/renderer/features/shared/mutations/delete-favorite-mutation.ts +++ b/src/renderer/features/shared/mutations/delete-favorite-mutation.ts @@ -7,13 +7,10 @@ import { queryKeys } from '/@/renderer/api/query-keys'; import { MutationHookArgs } from '/@/renderer/lib/react-query'; import { getServerById, useSetAlbumListItemDataById, useSetQueueFavorite } from '/@/renderer/store'; import { useFavoriteEvent } from '/@/renderer/store/event.store'; -import { - AlbumArtistDetailResponse, - AlbumDetailResponse, - FavoriteArgs, - FavoriteResponse, - LibraryItem, -} from '/@/shared/types/domain-types'; +import { AlbumDetailResponse } from '/@/shared/types/domain/album-domain-types'; +import { AlbumArtistDetailResponse } from '/@/shared/types/domain/artist-domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; +import { FavoriteResponse } from '/@/shared/types/domain/user-domain-types'; const remote = isElectron() ? window.api.remote : null; diff --git a/src/renderer/features/shared/mutations/set-rating-mutation.ts b/src/renderer/features/shared/mutations/set-rating-mutation.ts index ad37c9745..e177c9ebf 100644 --- a/src/renderer/features/shared/mutations/set-rating-mutation.ts +++ b/src/renderer/features/shared/mutations/set-rating-mutation.ts @@ -7,16 +7,10 @@ import { queryKeys } from '/@/renderer/api/query-keys'; import { MutationHookArgs } from '/@/renderer/lib/react-query'; import { getServerById, useSetAlbumListItemDataById, useSetQueueRating } from '/@/renderer/store'; import { useRatingEvent } from '/@/renderer/store/event.store'; -import { - Album, - AlbumArtist, - AlbumArtistDetailResponse, - AlbumDetailResponse, - AnyLibraryItems, - LibraryItem, - RatingResponse, - SetRatingArgs, -} from '/@/shared/types/domain-types'; +import { Album, AlbumDetailResponse } from '/@/shared/types/domain/album-domain-types'; +import { AlbumArtistDetailResponse } from '/@/shared/types/domain/artist-domain-types'; +import { AnyLibraryItems, LibraryItem } from '/@/shared/types/domain/shared-domain-types'; +import { RatingResponse, SetRatingRequest } from '/@/shared/types/domain/user-domain-types'; const remote = isElectron() ? window.api.remote : null; @@ -30,7 +24,7 @@ export const useSetRating = (args: MutationHookArgs) => { return useMutation< RatingResponse, AxiosError, - Omit, + Omit, { previous: undefined | { items: AnyLibraryItems } } >({ mutationFn: (args) => { diff --git a/src/renderer/features/shared/queries/music-folders-query.ts b/src/renderer/features/shared/queries/music-folders-query.ts index d6b4aa194..510c73599 100644 --- a/src/renderer/features/shared/queries/music-folders-query.ts +++ b/src/renderer/features/shared/queries/music-folders-query.ts @@ -4,9 +4,9 @@ import { api } from '/@/renderer/api'; import { queryKeys } from '/@/renderer/api/query-keys'; import { QueryHookArgs } from '/@/renderer/lib/react-query'; import { getServerById } from '/@/renderer/store'; -import { MusicFolderListQuery } from '/@/shared/types/domain-types'; +import { ServerMusicFolderListQuery } from '/@/shared/types/domain/server-domain-types'; -export const useMusicFolders = (args: QueryHookArgs) => { +export const useMusicFolders = (args: QueryHookArgs) => { const { options, serverId } = args || {}; const server = getServerById(serverId); diff --git a/src/renderer/features/sharing/mutations/share-item-mutation.ts b/src/renderer/features/sharing/mutations/share-item-mutation.ts index 38fb8e420..918d28a57 100644 --- a/src/renderer/features/sharing/mutations/share-item-mutation.ts +++ b/src/renderer/features/sharing/mutations/share-item-mutation.ts @@ -4,7 +4,8 @@ import { AxiosError } from 'axios'; import { api } from '/@/renderer/api'; import { MutationHookArgs } from '/@/renderer/lib/react-query'; import { getServerById } from '/@/renderer/store'; -import { AnyLibraryItems, ShareItemArgs, ShareItemResponse } from '/@/shared/types/domain-types'; +import { AnyLibraryItems } from '/@/shared/types/domain/shared-domain-types'; +import { ShareItemRequest, ShareItemResponse } from '/@/shared/types/domain/user-domain-types'; export const useShareItem = (args: MutationHookArgs) => { const { options } = args || {}; @@ -12,7 +13,7 @@ export const useShareItem = (args: MutationHookArgs) => { return useMutation< ShareItemResponse, AxiosError, - Omit, + Omit, { previous: undefined | { items: AnyLibraryItems } } >({ mutationFn: (args) => { diff --git a/src/renderer/features/sidebar/components/sidebar-icon.tsx b/src/renderer/features/sidebar/components/sidebar-icon.tsx index 96c53d540..a36e9d253 100644 --- a/src/renderer/features/sidebar/components/sidebar-icon.tsx +++ b/src/renderer/features/sidebar/components/sidebar-icon.tsx @@ -23,7 +23,7 @@ import { import { generatePath } from 'react-router'; import { AppRoute } from '/@/renderer/router/routes'; -import { LibraryItem } from '/@/shared/types/domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; interface SidebarIconProps { active?: boolean; diff --git a/src/renderer/features/sidebar/components/sidebar-playlist-list.tsx b/src/renderer/features/sidebar/components/sidebar-playlist-list.tsx index 894230789..38f377760 100644 --- a/src/renderer/features/sidebar/components/sidebar-playlist-list.tsx +++ b/src/renderer/features/sidebar/components/sidebar-playlist-list.tsx @@ -17,13 +17,9 @@ import { ActionIcon } from '/@/shared/components/action-icon/action-icon'; import { ButtonProps } from '/@/shared/components/button/button'; import { Group } from '/@/shared/components/group/group'; import { Text } from '/@/shared/components/text/text'; -import { - LibraryItem, - Playlist, - PlaylistListSort, - ServerType, - SortOrder, -} from '/@/shared/types/domain-types'; +import { Playlist, PlaylistListSort } from '/@/shared/types/domain/playlist-domain-types'; +import { ServerType } from '/@/shared/types/domain/server-domain-types'; +import { LibraryItem, ListSortOrder } from '/@/shared/types/domain/shared-domain-types'; import { Play } from '/@/shared/types/types'; interface PlaylistRowButtonProps extends Omit { @@ -145,7 +141,7 @@ export const SidebarPlaylistList = () => { const playlistsQuery = usePlaylistList({ query: { sortBy: PlaylistListSort.NAME, - sortOrder: SortOrder.ASC, + sortOrder: ListSortOrder.ASC, startIndex: 0, }, serverId: server?.id, @@ -261,7 +257,7 @@ export const SidebarSharedPlaylistList = () => { const playlistsQuery = usePlaylistList({ query: { sortBy: PlaylistListSort.NAME, - sortOrder: SortOrder.ASC, + sortOrder: ListSortOrder.ASC, startIndex: 0, }, serverId: server?.id, diff --git a/src/renderer/features/similar-songs/components/similar-songs-list.tsx b/src/renderer/features/similar-songs/components/similar-songs-list.tsx index cd36a76d9..73e4a3624 100644 --- a/src/renderer/features/similar-songs/components/similar-songs-list.tsx +++ b/src/renderer/features/similar-songs/components/similar-songs-list.tsx @@ -12,7 +12,8 @@ import { useHandlePlayQueueAdd } from '/@/renderer/features/player/hooks/use-han import { useSimilarSongs } from '/@/renderer/features/similar-songs/queries/similar-song-queries'; import { usePlayButtonBehavior, useTableSettings } from '/@/renderer/store'; import { Spinner } from '/@/shared/components/spinner/spinner'; -import { LibraryItem, Song } from '/@/shared/types/domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; +import { Song } from '/@/shared/types/domain/song-domain-types'; export type SimilarSongsListProps = { count?: number; diff --git a/src/renderer/features/similar-songs/queries/similar-song-queries.tsx b/src/renderer/features/similar-songs/queries/similar-song-queries.tsx index 5e712bcd2..8d7fca687 100644 --- a/src/renderer/features/similar-songs/queries/similar-song-queries.tsx +++ b/src/renderer/features/similar-songs/queries/similar-song-queries.tsx @@ -4,7 +4,7 @@ import { api } from '/@/renderer/api'; import { queryKeys } from '/@/renderer/api/query-keys'; import { QueryHookArgs } from '/@/renderer/lib/react-query'; import { getServerById } from '/@/renderer/store'; -import { SimilarSongsQuery } from '/@/shared/types/domain-types'; +import { SimilarSongsQuery } from '/@/shared/types/domain/song-domain-types'; export const useSimilarSongs = (args: QueryHookArgs) => { const { options, query, serverId } = args || {}; diff --git a/src/renderer/features/songs/components/jellyfin-song-filters.tsx b/src/renderer/features/songs/components/jellyfin-song-filters.tsx index e1130a679..39f178c57 100644 --- a/src/renderer/features/songs/components/jellyfin-song-filters.tsx +++ b/src/renderer/features/songs/components/jellyfin-song-filters.tsx @@ -12,7 +12,9 @@ import { NumberInput } from '/@/shared/components/number-input/number-input'; import { Stack } from '/@/shared/components/stack/stack'; import { Text } from '/@/shared/components/text/text'; import { YesNoSelect } from '/@/shared/components/yes-no-select/yes-no-select'; -import { GenreListSort, LibraryItem, SongListQuery, SortOrder } from '/@/shared/types/domain-types'; +import { GenreListSort } from '/@/shared/types/domain/genre-domain-types'; +import { LibraryItem, ListSortOrder } from '/@/shared/types/domain/shared-domain-types'; +import { SongListQuery } from '/@/shared/types/domain/song-domain-types'; interface JellyfinSongFiltersProps { customFilters?: Partial; @@ -39,7 +41,7 @@ export const JellyfinSongFilters = ({ query: { musicFolderId: filter?.musicFolderId, sortBy: GenreListSort.NAME, - sortOrder: SortOrder.ASC, + sortOrder: ListSortOrder.ASC, startIndex: 0, }, serverId, diff --git a/src/renderer/features/songs/components/navidrome-song-filters.tsx b/src/renderer/features/songs/components/navidrome-song-filters.tsx index 824f1a415..90ea8f32c 100644 --- a/src/renderer/features/songs/components/navidrome-song-filters.tsx +++ b/src/renderer/features/songs/components/navidrome-song-filters.tsx @@ -13,7 +13,9 @@ import { NumberInput } from '/@/shared/components/number-input/number-input'; import { Stack } from '/@/shared/components/stack/stack'; import { Text } from '/@/shared/components/text/text'; import { YesNoSelect } from '/@/shared/components/yes-no-select/yes-no-select'; -import { GenreListSort, LibraryItem, SongListQuery, SortOrder } from '/@/shared/types/domain-types'; +import { GenreListSort } from '/@/shared/types/domain/genre-domain-types'; +import { LibraryItem, ListSortOrder } from '/@/shared/types/domain/shared-domain-types'; +import { SongListQuery } from '/@/shared/types/domain/song-domain-types'; interface NavidromeSongFiltersProps { customFilters?: Partial; @@ -37,7 +39,7 @@ export const NavidromeSongFilters = ({ const genreListQuery = useGenreList({ query: { sortBy: GenreListSort.NAME, - sortOrder: SortOrder.ASC, + sortOrder: ListSortOrder.ASC, startIndex: 0, }, serverId, diff --git a/src/renderer/features/songs/components/song-list-grid-view.tsx b/src/renderer/features/songs/components/song-list-grid-view.tsx index c19a51f34..74b96143c 100644 --- a/src/renderer/features/songs/components/song-list-grid-view.tsx +++ b/src/renderer/features/songs/components/song-list-grid-view.tsx @@ -18,13 +18,13 @@ import { useHandleFavorite } from '/@/renderer/features/shared/hooks/use-handle- import { AppRoute } from '/@/renderer/router/routes'; import { useCurrentServer, useListStoreActions, useListStoreByKey } from '/@/renderer/store'; import { useEventStore } from '/@/renderer/store/event.store'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; import { - LibraryItem, Song, SongListQuery, SongListResponse, SongListSort, -} from '/@/shared/types/domain-types'; +} from '/@/shared/types/domain/song-domain-types'; import { CardRow, ListDisplayType } from '/@/shared/types/types'; interface SongListGridViewProps { diff --git a/src/renderer/features/songs/components/song-list-header-filters.tsx b/src/renderer/features/songs/components/song-list-header-filters.tsx index d019fa013..17a783ba2 100644 --- a/src/renderer/features/songs/components/song-list-header-filters.tsx +++ b/src/renderer/features/songs/components/song-list-header-filters.tsx @@ -35,153 +35,149 @@ import { DropdownMenu } from '/@/shared/components/dropdown-menu/dropdown-menu'; import { Flex } from '/@/shared/components/flex/flex'; import { Group } from '/@/shared/components/group/group'; import { Icon } from '/@/shared/components/icon/icon'; -import { - LibraryItem, - ServerType, - SongListQuery, - SongListSort, - SortOrder, -} from '/@/shared/types/domain-types'; +import { ServerType } from '/@/shared/types/domain/server-domain-types'; +import { LibraryItem, ListSortOrder } from '/@/shared/types/domain/shared-domain-types'; +import { SongListQuery, SongListSort } from '/@/shared/types/domain/song-domain-types'; import { ListDisplayType, Play } from '/@/shared/types/types'; const FILTERS = { jellyfin: [ { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.album', { postProcess: 'titleCase' }), value: SongListSort.ALBUM, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.albumArtist', { postProcess: 'titleCase' }), value: SongListSort.ALBUM_ARTIST, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.artist', { postProcess: 'titleCase' }), value: SongListSort.ARTIST, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.duration', { postProcess: 'titleCase' }), value: SongListSort.DURATION, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.playCount', { postProcess: 'titleCase' }), value: SongListSort.PLAY_COUNT, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.name', { postProcess: 'titleCase' }), value: SongListSort.NAME, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.random', { postProcess: 'titleCase' }), value: SongListSort.RANDOM, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.recentlyAdded', { postProcess: 'titleCase' }), value: SongListSort.RECENTLY_ADDED, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.recentlyPlayed', { postProcess: 'titleCase' }), value: SongListSort.RECENTLY_PLAYED, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.releaseDate', { postProcess: 'titleCase' }), value: SongListSort.RELEASE_DATE, }, ], navidrome: [ { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.album', { postProcess: 'titleCase' }), value: SongListSort.ALBUM, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.albumArtist', { postProcess: 'titleCase' }), value: SongListSort.ALBUM_ARTIST, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.artist', { postProcess: 'titleCase' }), value: SongListSort.ARTIST, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.bpm', { postProcess: 'titleCase' }), value: SongListSort.BPM, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('common.channel', { count: 2, postProcess: 'titleCase' }), value: SongListSort.CHANNELS, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.comment', { postProcess: 'titleCase' }), value: SongListSort.COMMENT, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.duration', { postProcess: 'titleCase' }), value: SongListSort.DURATION, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.isFavorited', { postProcess: 'titleCase' }), value: SongListSort.FAVORITED, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.genre', { postProcess: 'titleCase' }), value: SongListSort.GENRE, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.name', { postProcess: 'titleCase' }), value: SongListSort.NAME, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.playCount', { postProcess: 'titleCase' }), value: SongListSort.PLAY_COUNT, }, { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.random', { postProcess: 'titleCase' }), value: SongListSort.RANDOM, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.rating', { postProcess: 'titleCase' }), value: SongListSort.RATING, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.recentlyAdded', { postProcess: 'titleCase' }), value: SongListSort.RECENTLY_ADDED, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.recentlyPlayed', { postProcess: 'titleCase' }), value: SongListSort.RECENTLY_PLAYED, }, { - defaultOrder: SortOrder.DESC, + defaultOrder: ListSortOrder.DESC, name: i18n.t('filter.releaseYear', { postProcess: 'titleCase' }), value: SongListSort.YEAR, }, ], subsonic: [ { - defaultOrder: SortOrder.ASC, + defaultOrder: ListSortOrder.ASC, name: i18n.t('filter.name', { postProcess: 'titleCase' }), value: SongListSort.NAME, }, @@ -240,7 +236,7 @@ export const SongListHeaderFilters = ({ customFilters, data: { sortBy: e.currentTarget.value as SongListSort, - sortOrder: sortOrder || SortOrder.ASC, + sortOrder: sortOrder || ListSortOrder.ASC, }, itemType: LibraryItem.SONG, key: pageKey, @@ -306,7 +302,8 @@ export const SongListHeaderFilters = ({ ); const handleToggleSortOrder = useCallback(() => { - const newSortOrder = filter.sortOrder === SortOrder.ASC ? SortOrder.DESC : SortOrder.ASC; + const newSortOrder = + filter.sortOrder === ListSortOrder.ASC ? ListSortOrder.DESC : ListSortOrder.ASC; const updatedFilters = setFilter({ customFilters, data: { sortOrder: newSortOrder }, diff --git a/src/renderer/features/songs/components/song-list-header.tsx b/src/renderer/features/songs/components/song-list-header.tsx index c05c343b1..bf3f660c2 100644 --- a/src/renderer/features/songs/components/song-list-header.tsx +++ b/src/renderer/features/songs/components/song-list-header.tsx @@ -16,7 +16,8 @@ import { usePlayButtonBehavior } from '/@/renderer/store/settings.store'; import { Flex } from '/@/shared/components/flex/flex'; import { Group } from '/@/shared/components/group/group'; import { Stack } from '/@/shared/components/stack/stack'; -import { LibraryItem, SongListQuery } from '/@/shared/types/domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; +import { SongListQuery } from '/@/shared/types/domain/song-domain-types'; interface SongListHeaderProps { genreId?: string; diff --git a/src/renderer/features/songs/components/song-list-table-view.tsx b/src/renderer/features/songs/components/song-list-table-view.tsx index 26fcffce1..b64839e79 100644 --- a/src/renderer/features/songs/components/song-list-table-view.tsx +++ b/src/renderer/features/songs/components/song-list-table-view.tsx @@ -16,7 +16,9 @@ import { useCurrentStatus, usePlayButtonBehavior, } from '/@/renderer/store'; -import { LibraryItem, QueueSong, SongListQuery } from '/@/shared/types/domain-types'; +import { QueueSong } from '/@/shared/types/domain/player-domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; +import { SongListQuery } from '/@/shared/types/domain/song-domain-types'; interface SongListTableViewProps { itemCount?: number; diff --git a/src/renderer/features/songs/components/subsonic-song-filter.tsx b/src/renderer/features/songs/components/subsonic-song-filter.tsx index 3c15aec30..d67660ec3 100644 --- a/src/renderer/features/songs/components/subsonic-song-filter.tsx +++ b/src/renderer/features/songs/components/subsonic-song-filter.tsx @@ -10,7 +10,9 @@ import { Select } from '/@/shared/components/select/select'; import { Stack } from '/@/shared/components/stack/stack'; import { Switch } from '/@/shared/components/switch/switch'; import { Text } from '/@/shared/components/text/text'; -import { GenreListSort, LibraryItem, SongListQuery, SortOrder } from '/@/shared/types/domain-types'; +import { GenreListSort } from '/@/shared/types/domain/genre-domain-types'; +import { LibraryItem, ListSortOrder } from '/@/shared/types/domain/shared-domain-types'; +import { SongListQuery } from '/@/shared/types/domain/song-domain-types'; interface SubsonicSongFiltersProps { customFilters?: Partial; @@ -34,7 +36,7 @@ export const SubsonicSongFilters = ({ const genreListQuery = useGenreList({ query: { sortBy: GenreListSort.NAME, - sortOrder: SortOrder.ASC, + sortOrder: ListSortOrder.ASC, startIndex: 0, }, serverId, diff --git a/src/renderer/features/songs/queries/song-list-count-query.ts b/src/renderer/features/songs/queries/song-list-count-query.ts index 767b8f4c5..8eb5fb709 100644 --- a/src/renderer/features/songs/queries/song-list-count-query.ts +++ b/src/renderer/features/songs/queries/song-list-count-query.ts @@ -1,11 +1,11 @@ import type { QueryHookArgs } from '/@/renderer/lib/react-query'; -import type { SongListQuery } from '/@/shared/types/domain-types'; import { useQuery } from '@tanstack/react-query'; import { api } from '/@/renderer/api'; import { queryKeys } from '/@/renderer/api/query-keys'; import { getServerById } from '/@/renderer/store'; +import { SongListQuery } from '/@/shared/types/domain/song-domain-types'; export const useSongListCount = (args: QueryHookArgs) => { const { options, query, serverId } = args; diff --git a/src/renderer/features/songs/queries/song-list-query.ts b/src/renderer/features/songs/queries/song-list-query.ts index 71f61784d..e18d4985b 100644 --- a/src/renderer/features/songs/queries/song-list-query.ts +++ b/src/renderer/features/songs/queries/song-list-query.ts @@ -1,11 +1,11 @@ import type { QueryHookArgs } from '/@/renderer/lib/react-query'; -import type { SongListQuery } from '/@/shared/types/domain-types'; import { useQuery } from '@tanstack/react-query'; import { controller } from '/@/renderer/api/controller'; import { queryKeys } from '/@/renderer/api/query-keys'; import { getServerById } from '/@/renderer/store'; +import { SongListQuery } from '/@/shared/types/domain/song-domain-types'; export const useSongList = (args: QueryHookArgs, imageSize?: number) => { const { options, query, serverId } = args || {}; diff --git a/src/renderer/features/songs/routes/song-list-route.tsx b/src/renderer/features/songs/routes/song-list-route.tsx index c64d0153c..3d5b2ccad 100644 --- a/src/renderer/features/songs/routes/song-list-route.tsx +++ b/src/renderer/features/songs/routes/song-list-route.tsx @@ -13,7 +13,9 @@ import { SongListContent } from '/@/renderer/features/songs/components/song-list import { SongListHeader } from '/@/renderer/features/songs/components/song-list-header'; import { useSongListCount } from '/@/renderer/features/songs/queries/song-list-count-query'; import { useCurrentServer, useListFilterByKey } from '/@/renderer/store'; -import { GenreListSort, LibraryItem, SongListQuery, SortOrder } from '/@/shared/types/domain-types'; +import { GenreListSort } from '/@/shared/types/domain/genre-domain-types'; +import { LibraryItem, ListSortOrder } from '/@/shared/types/domain/shared-domain-types'; +import { SongListQuery } from '/@/shared/types/domain/song-domain-types'; import { Play } from '/@/shared/types/types'; const TrackListRoute = () => { @@ -53,7 +55,7 @@ const TrackListRoute = () => { }, query: { sortBy: GenreListSort.NAME, - sortOrder: SortOrder.ASC, + sortOrder: ListSortOrder.ASC, startIndex: 0, }, serverId: server?.id, diff --git a/src/renderer/features/tag/queries/use-tag-list.ts b/src/renderer/features/tag/queries/use-tag-list.ts index 737afe223..88cdff35f 100644 --- a/src/renderer/features/tag/queries/use-tag-list.ts +++ b/src/renderer/features/tag/queries/use-tag-list.ts @@ -5,8 +5,8 @@ import { queryKeys } from '/@/renderer/api/query-keys'; import { QueryHookArgs } from '/@/renderer/lib/react-query'; import { getServerById } from '/@/renderer/store'; import { hasFeature } from '/@/shared/api/utils'; -import { TagQuery } from '/@/shared/types/domain-types'; -import { ServerFeature } from '/@/shared/types/features-types'; +import { ServerFeature } from '/@/shared/types/domain/server-domain-types'; +import { TagQuery } from '/@/shared/types/domain/tag-domain-types'; export const useTagList = (args: QueryHookArgs) => { const { options, query, serverId } = args || {}; diff --git a/src/renderer/features/titlebar/components/app-menu.tsx b/src/renderer/features/titlebar/components/app-menu.tsx index 9c56a35e9..043d5bff7 100644 --- a/src/renderer/features/titlebar/components/app-menu.tsx +++ b/src/renderer/features/titlebar/components/app-menu.tsx @@ -20,7 +20,7 @@ import { import { DropdownMenu } from '/@/shared/components/dropdown-menu/dropdown-menu'; import { Icon } from '/@/shared/components/icon/icon'; import { toast } from '/@/shared/components/toast/toast'; -import { ServerListItem, ServerType } from '/@/shared/types/domain-types'; +import { ServerListItem, ServerType } from '/@/shared/types/domain/server-domain-types'; const browser = isElectron() ? window.api.browser : null; const localSettings = isElectron() ? window.api.localSettings : null; diff --git a/src/renderer/features/users/queries/user-list-query.ts b/src/renderer/features/users/queries/user-list-query.ts index 3b4399eaa..44c8ab513 100644 --- a/src/renderer/features/users/queries/user-list-query.ts +++ b/src/renderer/features/users/queries/user-list-query.ts @@ -1,11 +1,11 @@ import type { QueryHookArgs } from '/@/renderer/lib/react-query'; -import type { UserListQuery } from '/@/shared/types/domain-types'; import { useQuery } from '@tanstack/react-query'; import { api } from '/@/renderer/api'; import { queryKeys } from '/@/renderer/api/query-keys'; import { getServerById } from '/@/renderer/store'; +import { UserListQuery } from '/@/shared/types/domain/user-domain-types'; export const useUserList = (args: QueryHookArgs) => { const { options, query, serverId } = args || {}; diff --git a/src/renderer/hooks/use-list-filter-refresh.ts b/src/renderer/hooks/use-list-filter-refresh.ts index 8202bec8b..3cbfe1bf9 100644 --- a/src/renderer/hooks/use-list-filter-refresh.ts +++ b/src/renderer/hooks/use-list-filter-refresh.ts @@ -8,7 +8,9 @@ import { MutableRefObject, useCallback, useMemo } from 'react'; import { api } from '/@/renderer/api'; import { queryKeys } from '/@/renderer/api/query-keys'; import { VirtualInfiniteGridRef } from '/@/renderer/components/virtual-grid'; -import { BasePaginatedResponse, LibraryItem, ServerListItem } from '/@/shared/types/domain-types'; +import { BasePaginatedResponse } from '/@/shared/types/adapter/api-controller-types'; +import { ServerListItem } from '/@/shared/types/domain/server-domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; export interface UseHandleListFilterChangeProps { isClientSideSort?: boolean; diff --git a/src/renderer/hooks/use-server-authenticated.ts b/src/renderer/hooks/use-server-authenticated.ts index d23544cd7..9f0861e6f 100644 --- a/src/renderer/hooks/use-server-authenticated.ts +++ b/src/renderer/hooks/use-server-authenticated.ts @@ -5,8 +5,10 @@ import { useCallback, useEffect, useRef, useState } from 'react'; import { api } from '/@/renderer/api'; import { useAuthStoreActions, useCurrentServer } from '/@/renderer/store'; import { toast } from '/@/shared/components/toast/toast'; -import { SongListSort, SortOrder } from '/@/shared/types/domain-types'; -import { AuthState, ServerListItem, ServerType } from '/@/shared/types/types'; +import { ServerListItem, ServerType } from '/@/shared/types/domain/server-domain-types'; +import { SongListSort } from '/@/shared/types/domain/song-domain-types'; +import { AuthState } from '/@/shared/types/types'; +import { ListSortOrder } from '/@/shared/types/domain/shared-domain-types'; const localSettings = isElectron() ? window.api.localSettings : null; @@ -30,7 +32,7 @@ export const useServerAuthenticated = () => { query: { limit: 1, sortBy: SongListSort.NAME, - sortOrder: SortOrder.ASC, + sortOrder: ListSortOrder.ASC, startIndex: 0, }, }); diff --git a/src/renderer/hooks/use-song-change.ts b/src/renderer/hooks/use-song-change.ts index 7bf54c887..ed1040cb6 100644 --- a/src/renderer/hooks/use-song-change.ts +++ b/src/renderer/hooks/use-song-change.ts @@ -3,7 +3,7 @@ import { AgGridReact } from '@ag-grid-community/react'; import { MutableRefObject, useCallback, useEffect } from 'react'; import { useEventStore, UserEvent } from '/@/renderer/store/event.store'; -import { Song } from '/@/shared/types/domain-types'; +import { Song } from '/@/shared/types/domain/song-domain-types'; export const useSongChange = ( handler: (ids: string[], event: UserEvent) => void, diff --git a/src/renderer/store/album-artist.store.ts b/src/renderer/store/album-artist.store.ts index 6627988ab..8cdfd6cfd 100644 --- a/src/renderer/store/album-artist.store.ts +++ b/src/renderer/store/album-artist.store.ts @@ -4,10 +4,14 @@ import { createWithEqualityFn } from 'zustand/traditional'; import { DataTableProps } from '/@/renderer/store/settings.store'; import { mergeOverridingColumns } from '/@/renderer/store/utils'; -import { AlbumArtistListArgs, AlbumArtistListSort, SortOrder } from '/@/shared/types/domain-types'; +import { + AlbumArtistListRequest, + AlbumArtistListSort, +} from '/@/shared/types/domain/artist-domain-types'; +import { ListSortOrder } from '/@/shared/types/domain/shared-domain-types'; import { ListDisplayType, TableColumn, TablePagination } from '/@/shared/types/types'; -export type AlbumArtistListFilter = Omit; +export type AlbumArtistListFilter = Omit; export interface AlbumArtistSlice extends AlbumArtistState { actions: { @@ -71,7 +75,7 @@ export const useAlbumArtistStore = createWithEqualityFn()( filter: { musicFolderId: undefined, sortBy: AlbumArtistListSort.NAME, - sortOrder: SortOrder.ASC, + sortOrder: ListSortOrder.ASC, }, grid: { scrollOffset: 0, diff --git a/src/renderer/store/list.store.ts b/src/renderer/store/list.store.ts index a6c75aa9d..0306b54ba 100644 --- a/src/renderer/store/list.store.ts +++ b/src/renderer/store/list.store.ts @@ -5,31 +5,29 @@ import { createWithEqualityFn } from 'zustand/traditional'; import { DataTableProps, PersistedTableColumn } from '/@/renderer/store/settings.store'; import { mergeOverridingColumns } from '/@/renderer/store/utils'; +import { AlbumListRequest, AlbumListSort } from '/@/shared/types/domain/album-domain-types'; import { - AlbumArtistListArgs, + AlbumArtistListRequest, AlbumArtistListSort, - AlbumListArgs, - AlbumListSort, - ArtistListArgs, - GenreListArgs, - GenreListSort, - LibraryItem, - PlaylistListArgs, + ArtistListRequest, +} from '/@/shared/types/domain/artist-domain-types'; +import { GenreListRequest, GenreListSort } from '/@/shared/types/domain/genre-domain-types'; +import { + PlaylistListRequest, PlaylistListSort, - SongListArgs, - SongListSort, - SortOrder, -} from '/@/shared/types/domain-types'; +} from '/@/shared/types/domain/playlist-domain-types'; +import { LibraryItem, ListSortOrder } from '/@/shared/types/domain/shared-domain-types'; +import { SongListRequest, SongListSort } from '/@/shared/types/domain/song-domain-types'; import { ListDisplayType, TableColumn, TablePagination } from '/@/shared/types/types'; export const generatePageKey = (page: string, id?: string) => { return id ? `${page}_${id}` : page; }; -export type AlbumArtistListFilter = Omit; -export type AlbumListFilter = Omit; -export type ArtistListFilter = Omit; -export type GenreListFilter = Omit; +export type AlbumArtistListFilter = Omit; +export type AlbumListFilter = Omit; +export type ArtistListFilter = Omit; +export type GenreListFilter = Omit; export type ListDeterministicArgs = { key: ListKey }; export type ListGridProps = { itemGap?: number; @@ -95,9 +93,9 @@ export type ListTableProps = DataTableProps & { scrollOffset: number; }; -export type PlaylistListFilter = Omit; +export type PlaylistListFilter = Omit; -export type SongListFilter = Omit; +export type SongListFilter = Omit; type FilterType = | AlbumArtistListFilter @@ -147,13 +145,13 @@ export const useListStore = createWithEqualityFn()( state.item.album.filter = { musicFolderId: undefined, sortBy: AlbumListSort.RECENTLY_ADDED, - sortOrder: SortOrder.DESC, + sortOrder: ListSortOrder.DESC, } as AlbumListFilter; state.item.song.filter = { musicFolderId: undefined, sortBy: SongListSort.RECENTLY_ADDED, - sortOrder: SortOrder.DESC, + sortOrder: ListSortOrder.DESC, } as SongListFilter; }); }, @@ -349,7 +347,7 @@ export const useListStore = createWithEqualityFn()( display: ListDisplayType.GRID, filter: { sortBy: AlbumListSort.RECENTLY_ADDED, - sortOrder: SortOrder.DESC, + sortOrder: ListSortOrder.DESC, }, grid: { itemGap: 10, itemSize: 200, scrollOffset: 0 }, table: { @@ -390,7 +388,7 @@ export const useListStore = createWithEqualityFn()( display: ListDisplayType.GRID, filter: { sortBy: AlbumArtistListSort.NAME, - sortOrder: SortOrder.DESC, + sortOrder: ListSortOrder.DESC, }, grid: { itemGap: 10, itemSize: 200, scrollOffset: 0 }, table: { @@ -419,7 +417,7 @@ export const useListStore = createWithEqualityFn()( display: ListDisplayType.GRID, filter: { sortBy: AlbumListSort.RECENTLY_ADDED, - sortOrder: SortOrder.DESC, + sortOrder: ListSortOrder.DESC, }, grid: { itemGap: 10, itemSize: 200, scrollOffset: 0 }, table: { @@ -460,7 +458,7 @@ export const useListStore = createWithEqualityFn()( display: ListDisplayType.TABLE, filter: { sortBy: SongListSort.RECENTLY_ADDED, - sortOrder: SortOrder.DESC, + sortOrder: ListSortOrder.DESC, }, grid: { itemGap: 10, itemSize: 200, scrollOffset: 0 }, table: { @@ -497,7 +495,7 @@ export const useListStore = createWithEqualityFn()( display: ListDisplayType.TABLE, filter: { sortBy: SongListSort.ALBUM, - sortOrder: SortOrder.ASC, + sortOrder: ListSortOrder.ASC, }, table: { autoFit: true, @@ -518,7 +516,7 @@ export const useListStore = createWithEqualityFn()( filter: { role: '', sortBy: AlbumArtistListSort.NAME, - sortOrder: SortOrder.DESC, + sortOrder: ListSortOrder.DESC, }, grid: { itemGap: 10, itemSize: 200, scrollOffset: 0 }, table: { @@ -547,7 +545,7 @@ export const useListStore = createWithEqualityFn()( display: ListDisplayType.TABLE, filter: { sortBy: GenreListSort.NAME, - sortOrder: SortOrder.ASC, + sortOrder: ListSortOrder.ASC, }, grid: { itemGap: 10, itemSize: 200, scrollOffset: 0 }, table: { @@ -576,7 +574,7 @@ export const useListStore = createWithEqualityFn()( display: ListDisplayType.GRID, filter: { sortBy: PlaylistListSort.NAME, - sortOrder: SortOrder.DESC, + sortOrder: ListSortOrder.DESC, }, grid: { itemGap: 10, itemSize: 200, scrollOffset: 0 }, table: { @@ -609,7 +607,7 @@ export const useListStore = createWithEqualityFn()( display: ListDisplayType.TABLE, filter: { sortBy: SongListSort.RECENTLY_ADDED, - sortOrder: SortOrder.DESC, + sortOrder: ListSortOrder.DESC, }, grid: { itemGap: 10, itemSize: 200, scrollOffset: 0 }, table: { diff --git a/src/renderer/store/player.store.ts b/src/renderer/store/player.store.ts index eeabefd8a..0fea86d91 100644 --- a/src/renderer/store/player.store.ts +++ b/src/renderer/store/player.store.ts @@ -8,7 +8,7 @@ import { immer } from 'zustand/middleware/immer'; import { shallow } from 'zustand/shallow'; import { createWithEqualityFn } from 'zustand/traditional'; -import { PlayerData, QueueData, QueueSong } from '/@/shared/types/domain-types'; +import { PlayerData, QueueData, QueueSong } from '/@/shared/types/domain/player-domain-types'; import { Play, PlayerRepeat, PlayerShuffle, PlayerStatus } from '/@/shared/types/types'; export interface PlayerSlice extends PlayerState { diff --git a/src/renderer/store/playlist.store.ts b/src/renderer/store/playlist.store.ts index a5396152f..08645026f 100644 --- a/src/renderer/store/playlist.store.ts +++ b/src/renderer/store/playlist.store.ts @@ -5,8 +5,9 @@ import { createWithEqualityFn } from 'zustand/traditional'; import { PlaylistListFilter, SongListFilter } from '/@/renderer/store/list.store'; import { DataTableProps } from '/@/renderer/store/settings.store'; import { mergeOverridingColumns } from '/@/renderer/store/utils'; -import { PlaylistListSort, SortOrder } from '/@/shared/types/domain-types'; +import { PlaylistListSort, PlaylistListSort } from '/@/shared/types/domain/playlist-domain-types'; import { ListDisplayType, TableColumn, TablePagination } from '/@/shared/types/types'; +import { ListSortOrder } from '/@/shared/types/domain/shared-domain-types'; export interface PlaylistSlice extends PlaylistState { actions: { @@ -156,7 +157,7 @@ export const usePlaylistStore = createWithEqualityFn()( filter: { musicFolderId: undefined, sortBy: PlaylistListSort.NAME, - sortOrder: SortOrder.ASC, + sortOrder: ListSortOrder.ASC, }, table: { autoFit: true, diff --git a/src/renderer/store/settings.store.ts b/src/renderer/store/settings.store.ts index de1e03082..670fe47d3 100644 --- a/src/renderer/store/settings.store.ts +++ b/src/renderer/store/settings.store.ts @@ -14,7 +14,8 @@ import { usePlayerStore } from '/@/renderer/store/player.store'; import { mergeOverridingColumns } from '/@/renderer/store/utils'; import { randomString } from '/@/renderer/utils'; import { AppTheme } from '/@/shared/themes/app-theme-types'; -import { LibraryItem, LyricSource } from '/@/shared/types/domain-types'; +import { LyricSource } from '/@/shared/types/domain/lyric-domain-types'; +import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; import { CrossfadeStyle, FontType, diff --git a/src/renderer/utils/format.tsx b/src/renderer/utils/format.tsx index 335556d15..969ced3c7 100644 --- a/src/renderer/utils/format.tsx +++ b/src/renderer/utils/format.tsx @@ -1,11 +1,11 @@ -import type { Album, AlbumArtist, Song } from '/@/shared/types/domain-types'; - import dayjs from 'dayjs'; import relativeTime from 'dayjs/plugin/relativeTime'; import utc from 'dayjs/plugin/utc'; import formatDuration from 'format-duration'; import { Rating } from '/@/shared/components/rating/rating'; +import { Album } from '/@/shared/types/domain/album-domain-types'; +import { Song } from '/@/shared/types/domain/song-domain-types'; dayjs.extend(relativeTime); dayjs.extend(utc); diff --git a/src/renderer/utils/set-transcoded-queue-data.ts b/src/renderer/utils/set-transcoded-queue-data.ts index f7a7d13fa..c1f8657d8 100644 --- a/src/renderer/utils/set-transcoded-queue-data.ts +++ b/src/renderer/utils/set-transcoded-queue-data.ts @@ -1,9 +1,8 @@ -import type { PlayerData, QueueSong } from '/@/shared/types/domain-types'; - import isElectron from 'is-electron'; import { api } from '/@/renderer/api'; import { getServerById, useSettingsStore } from '/@/renderer/store'; +import { PlayerData, QueueSong, QueueSong } from '/@/shared/types/domain/player-domain-types'; const mpvPlayer = isElectron() ? window.api.mpvPlayer : null; diff --git a/src/shared/api/jellyfin/jellyfin-normalize.ts b/src/shared/api/jellyfin/jellyfin-normalize.ts index daac3d960..8e8c519b0 100644 --- a/src/shared/api/jellyfin/jellyfin-normalize.ts +++ b/src/shared/api/jellyfin/jellyfin-normalize.ts @@ -3,7 +3,6 @@ import { z } from 'zod'; import { JFAlbum, JFGenre, JFMusicFolder, JFPlaylist } from '/@/shared/api/jellyfin.types'; import { jfType } from '/@/shared/api/jellyfin/jellyfin-types'; -import { LibraryItem } from '/@/shared/types/domain-types'; import { Album } from '/@/shared/types/domain/album-domain-types'; import { Artist, RelatedArtist } from '/@/shared/types/domain/artist-domain-types'; import { Genre } from '/@/shared/types/domain/genre-domain-types'; diff --git a/src/shared/api/navidrome/navidrome-normalize.ts b/src/shared/api/navidrome/navidrome-normalize.ts index 2408e73d5..4cbec35a2 100644 --- a/src/shared/api/navidrome/navidrome-normalize.ts +++ b/src/shared/api/navidrome/navidrome-normalize.ts @@ -4,7 +4,6 @@ import z from 'zod'; import { NDGenre } from '/@/shared/api/navidrome.types'; import { ndType } from '/@/shared/api/navidrome/navidrome-types'; import { ssType } from '/@/shared/api/subsonic/subsonic-types'; -import { LibraryItem } from '/@/shared/types/domain-types'; import { Album } from '/@/shared/types/domain/album-domain-types'; import { Artist, RelatedArtist } from '/@/shared/types/domain/artist-domain-types'; import { Genre } from '/@/shared/types/domain/genre-domain-types'; @@ -145,13 +144,13 @@ const normalizeSong = ( album: item.album, albumId: item.albumId, ...getArtists(item), + _itemType: LibraryItem.SONG, artistName: item.artist, bitDepth: item.bitDepth || null, bitRate: item.bitRate, bpm: item.bpm ? item.bpm : null, channels: item.channels ? item.channels : null, comment: item.comment ? item.comment : null, - isCompilation: item.compilation, container: item.suffix, createdDate: item.createdAt.split('T')[0], discNumber: item.discNumber, @@ -170,8 +169,7 @@ const normalizeSong = ( id, imagePlaceholderUrl, imageUrl, - _itemType: LibraryItem.SONG, - userLastPlayedDate: normalizePlayDate(item), + isCompilation: item.compilation, lyrics: item.lyrics ? item.lyrics : null, name: item.title, // Thankfully, Windows is merciful and allows a mix of separators. So, we can use the @@ -198,6 +196,7 @@ const normalizeSong = ( uniqueId: nanoid(), updatedDate: item.updatedAt, userFavorite: item.starred || false, + userLastPlayedDate: normalizePlayDate(item), userRating: item.rating || null, }; }; @@ -223,6 +222,9 @@ const normalizeAlbum = ( return { albumArtist: item.albumArtist, ...getArtists(item), + _itemType: LibraryItem.ALBUM, + _serverId: server?.id || 'unknown', + _serverType: ServerType.NAVIDROME, backdropImageUrl: imageBackdropUrl, comment: item.comment || null, createdAt: item.createdAt.split('T')[0], @@ -236,10 +238,9 @@ const normalizeAlbum = ( id: item.id, imagePlaceholderUrl, imageUrl, - isCompilation: item.compilation, - _itemType: LibraryItem.ALBUM, - lastPlayedAt: normalizePlayDate(item), + isCompilation: item.compilation, + lastPlayedAt: normalizePlayDate(item), mbzId: item.mbzAlbumId || null, name: item.name, originalDate: item.originalDate @@ -253,8 +254,6 @@ const normalizeAlbum = ( : new Date(Date.UTC(item.minYear, 0, 1)) ).toISOString(), releaseYear: item.minYear, - _serverId: server?.id || 'unknown', - _serverType: ServerType.NAVIDROME, size: item.size, songCount: item.songCount, songs: item.songs ? item.songs.map((song) => normalizeSong(song, server)) : undefined, @@ -301,6 +300,8 @@ const normalizeAlbumArtist = ( } return { + _serverId: server?.id || 'unknown', + _serverType: ServerType.NAVIDROME, albumCount, backgroundImageUrl: null, biography: item.biography || null, @@ -314,12 +315,9 @@ const normalizeAlbumArtist = ( id: item.id, imageUrl: imageUrl || null, itemType: LibraryItem.ALBUM_ARTIST, - userLastPlayedDate: normalizePlayDate(item), mbzId: item.mbzArtistId || null, name: item.name, playCount: item.playCount || 0, - _serverId: server?.id || 'unknown', - _serverType: ServerType.NAVIDROME, similarArtists: item.similarArtists?.map((artist) => ({ id: artist.id, @@ -328,6 +326,7 @@ const normalizeAlbumArtist = ( })) || null, songCount, userFavorite: item.starred, + userLastPlayedDate: normalizePlayDate(item), userRating: item.rating, }; }; @@ -347,20 +346,20 @@ const normalizePlaylist = ( const imagePlaceholderUrl = null; return { + _itemType: LibraryItem.PLAYLIST, + _serverId: server?.id || 'unknown', + _serverType: ServerType.NAVIDROME, description: item.comment, duration: item.duration * 1000, genres: [], id: item.id, imagePlaceholderUrl, imageUrl, - _itemType: LibraryItem.PLAYLIST, name: item.name, owner: item.ownerName, ownerId: item.ownerId, public: item.public, rules: item?.rules || null, - _serverId: server?.id || 'unknown', - _serverType: ServerType.NAVIDROME, size: item.size, songCount: item.songCount, sync: item.sync, @@ -369,10 +368,10 @@ const normalizePlaylist = ( const normalizeGenre = (item: NDGenre): Genre => { return { + _itemType: LibraryItem.GENRE, albumCount: undefined, id: item.id, imageUrl: null, - _itemType: LibraryItem.GENRE, name: item.name, songCount: undefined, }; diff --git a/src/shared/types/domain/player-domain-types.ts b/src/shared/types/domain/player-domain-types.ts index 5099057d0..3e29af135 100644 --- a/src/shared/types/domain/player-domain-types.ts +++ b/src/shared/types/domain/player-domain-types.ts @@ -30,7 +30,7 @@ export interface QueueData { } export type QueueSong = Song & { - uniqueId: string; + _uniqueId: string; }; export type TranscodingQuery = { diff --git a/src/shared/types/domain/shared-domain-types.ts b/src/shared/types/domain/shared-domain-types.ts index e01ce6e40..4d9ead745 100644 --- a/src/shared/types/domain/shared-domain-types.ts +++ b/src/shared/types/domain/shared-domain-types.ts @@ -1,7 +1,7 @@ import { JFSortOrder } from '/@/shared/api/jellyfin.types'; import { NDSortOrder } from '/@/shared/api/navidrome.types'; import { Album } from '/@/shared/types/domain/album-domain-types'; -import { Artist, Artist, RelatedArtist } from '/@/shared/types/domain/artist-domain-types'; +import { Artist, RelatedArtist } from '/@/shared/types/domain/artist-domain-types'; import { QueueSong } from '/@/shared/types/domain/player-domain-types'; import { Playlist } from '/@/shared/types/domain/playlist-domain-types'; import { Song } from '/@/shared/types/domain/song-domain-types'; @@ -14,6 +14,7 @@ export enum LibraryItem { PLAYLIST = 'playlist', SONG = 'song', } + export enum ListSortOrder { ASC = 'ASC', DESC = 'DESC', diff --git a/src/shared/types/types.ts b/src/shared/types/types.ts index a5bd78b44..b5176dcdc 100644 --- a/src/shared/types/types.ts +++ b/src/shared/types/types.ts @@ -1,6 +1,5 @@ import { AppRoute } from '@ts-rest/core'; import { ReactNode } from 'react'; -import { Song } from 'src/main/features/core/lyrics/netease'; import { Album } from '/@/shared/types/domain/album-domain-types'; import { Artist } from '/@/shared/types/domain/artist-domain-types'; @@ -8,6 +7,7 @@ import { QueueSong } from '/@/shared/types/domain/player-domain-types'; import { Playlist } from '/@/shared/types/domain/playlist-domain-types'; import { ServerType } from '/@/shared/types/domain/server-domain-types'; import { LibraryItem } from '/@/shared/types/domain/shared-domain-types'; +import { Song } from '/@/shared/types/domain/song-domain-types'; export enum ListDisplayType { CARD = 'card',