koel/resources/assets/js/composables/useSongListControls.ts

42 lines
915 B
TypeScript
Raw Normal View History

import { useRouter } from '@/composables'
export const useSongListControls = () => {
const { isCurrentScreen } = useRouter()
const getSongListControlsConfig = () => {
const config: SongListControlsConfig = {
play: true,
addTo: {
queue: true,
2023-08-20 22:35:58 +00:00
favorites: true
},
clearQueue: false,
deletePlaylist: false,
refresh: false,
filter: false
}
config.clearQueue = isCurrentScreen('Queue')
config.addTo.queue = !isCurrentScreen('Queue')
config.addTo.favorites = !isCurrentScreen('Favorites')
config.deletePlaylist = isCurrentScreen('Playlist')
config.refresh = isCurrentScreen('Playlist')
config.filter = isCurrentScreen(
'Queue',
'Artist',
'Album',
'Favorites',
'RecentlyPlayed',
'Playlist',
'Search.Songs'
)
return config
}
return {
getSongListControlsConfig
}
}