fix: sortable/reorderable song list messed up

This commit is contained in:
Phan An 2024-01-23 00:11:13 +01:00
parent 69368bfbd8
commit 023b504ef6
4 changed files with 5 additions and 10 deletions

View file

@ -87,7 +87,7 @@ const {
onPressEnter,
playSelected,
onScrollBreakpoint
} = useSongList(toRef(songStore.state, 'songs'))
} = useSongList(toRef(songStore.state, 'songs'), { sortable: true })
const { SongListControls, config } = useSongListControls('Songs')

View file

@ -79,7 +79,7 @@ const {
playSelected,
applyFilter,
onScrollBreakpoint
} = useSongList(toRef(queueStore.state, 'songs'))
} = useSongList(toRef(queueStore.state, 'songs'), { reorderable: true, sortable: false })
const { SongListControls, config } = useSongListControls('Queue')

View file

@ -67,7 +67,7 @@ const {
playSelected,
applyFilter,
onScrollBreakpoint
} = useSongList(recentlyPlayedSongs)
} = useSongList(recentlyPlayedSongs, { sortable: false })
const { SongListControls, config } = useSongListControls('RecentlyPlayed')

View file

@ -21,16 +21,11 @@ import ThumbnailStack from '@/components/ui/ThumbnailStack.vue'
export const useSongList = (
songs: Ref<Song[]>,
config: Partial<SongListConfig> = { sortable: true, reorderable: true, collaborative: false }
config: Partial<SongListConfig> = { sortable: true, reorderable: false, collaborative: false }
) => {
const filterKeywords = ref('')
config = reactive(config)
const { isCurrentScreen, go, onRouteChanged } = useRouter()
onRouteChanged(route => {
config.reorderable = route.screen === 'Queue'
config.sortable = !['Queue', 'RecentlyPlayed', 'Search.Songs'].includes(route.screen)
})
const { isCurrentScreen, go } = useRouter()
const songList = ref<InstanceType<typeof SongList>>()