mirror of
https://github.com/koel/koel
synced 2024-12-01 00:09:17 +00:00
fix: properly sort album/artist songs (closes #1486)
This commit is contained in:
parent
f0d792c65f
commit
25c9da4c82
3 changed files with 9 additions and 5 deletions
|
@ -38,7 +38,7 @@
|
||||||
</ScreenHeader>
|
</ScreenHeader>
|
||||||
|
|
||||||
<SongListSkeleton v-if="loading"/>
|
<SongListSkeleton v-if="loading"/>
|
||||||
<SongList v-else ref="songList" @press:enter="onPressEnter" @scroll-breakpoint="onScrollBreakpoint"/>
|
<SongList v-else ref="songList" @sort="sort" @press:enter="onPressEnter" @scroll-breakpoint="onScrollBreakpoint"/>
|
||||||
|
|
||||||
<section v-if="!loading && useLastfm && showingInfo" class="info-wrapper">
|
<section v-if="!loading && useLastfm && showingInfo" class="info-wrapper">
|
||||||
<CloseModalBtn class="close-modal" @click="showingInfo = false"/>
|
<CloseModalBtn class="close-modal" @click="showingInfo = false"/>
|
||||||
|
@ -85,6 +85,7 @@ const {
|
||||||
showingControls,
|
showingControls,
|
||||||
isPhone,
|
isPhone,
|
||||||
duration,
|
duration,
|
||||||
|
sort,
|
||||||
onPressEnter,
|
onPressEnter,
|
||||||
playAll,
|
playAll,
|
||||||
playSelected,
|
playSelected,
|
||||||
|
@ -110,6 +111,8 @@ onMounted(async () => {
|
||||||
albumStore.resolve(id.value),
|
albumStore.resolve(id.value),
|
||||||
songStore.fetchForAlbum(id.value)
|
songStore.fetchForAlbum(id.value)
|
||||||
])
|
])
|
||||||
|
|
||||||
|
sort('track')
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.error(e)
|
logger.error(e)
|
||||||
dialog.value.error('Failed to load album. Please try again.')
|
dialog.value.error('Failed to load album. Please try again.')
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
</ScreenHeader>
|
</ScreenHeader>
|
||||||
|
|
||||||
<SongListSkeleton v-if="loading"/>
|
<SongListSkeleton v-if="loading"/>
|
||||||
<SongList v-else ref="songList" @press:enter="onPressEnter" @scroll-breakpoint="onScrollBreakpoint"/>
|
<SongList v-else ref="songList" @sort="sort" @press:enter="onPressEnter" @scroll-breakpoint="onScrollBreakpoint"/>
|
||||||
|
|
||||||
<section v-if="!loading && useLastfm && showingInfo" class="info-wrapper">
|
<section v-if="!loading && useLastfm && showingInfo" class="info-wrapper">
|
||||||
<CloseModalBtn class="close-modal" @click="showingInfo = false"/>
|
<CloseModalBtn class="close-modal" @click="showingInfo = false"/>
|
||||||
|
@ -82,6 +82,7 @@ const {
|
||||||
showingControls,
|
showingControls,
|
||||||
isPhone,
|
isPhone,
|
||||||
duration,
|
duration,
|
||||||
|
sort,
|
||||||
onPressEnter,
|
onPressEnter,
|
||||||
playAll,
|
playAll,
|
||||||
playSelected,
|
playSelected,
|
||||||
|
|
|
@ -81,11 +81,11 @@ export const useSongList = (songs: Ref<Song[]>, type: SongListType, config: Part
|
||||||
let sortFields: SongListSortField[] = [by]
|
let sortFields: SongListSortField[] = [by]
|
||||||
|
|
||||||
if (by === 'track') {
|
if (by === 'track') {
|
||||||
sortFields.push('disc', 'title')
|
sortFields = ['disc', 'track', 'title']
|
||||||
} else if (by === 'album_name') {
|
} else if (by === 'album_name') {
|
||||||
sortFields.push('artist_name', 'track', 'disc', 'title')
|
sortFields.push('artist_name', 'disc', 'track', 'title')
|
||||||
} else if (by === 'artist_name') {
|
} else if (by === 'artist_name') {
|
||||||
sortFields.push('album_name', 'track', 'disc', 'title')
|
sortFields.push('album_name', 'disc', 'track', 'title')
|
||||||
}
|
}
|
||||||
|
|
||||||
songs.value = orderBy(songs.value, sortFields, order)
|
songs.value = orderBy(songs.value, sortFields, order)
|
||||||
|
|
Loading…
Reference in a new issue