koel/resources/assets/js/components/screens/all-songs.vue

51 lines
1.3 KiB
Vue
Raw Normal View History

2022-04-15 14:24:30 +00:00
<template>
<section id="songsWrapper">
2022-04-15 17:00:08 +00:00
<ScreenHeader>
2022-04-15 14:24:30 +00:00
All Songs
2022-04-15 17:00:08 +00:00
<ControlsToggler :showing-controls="showingControls" @toggleControls="toggleControls"/>
2022-04-15 14:24:30 +00:00
<template v-slot:meta>
2022-04-15 17:00:08 +00:00
<span v-if="meta.songCount">{{ pluralize(meta.songCount, 'song') }} {{ meta.totalLength }}</span>
2022-04-15 14:24:30 +00:00
</template>
<template v-slot:controls>
2022-04-15 17:00:08 +00:00
<SongListControls
2022-04-15 14:24:30 +00:00
v-if="state.songs.length && (!isPhone || showingControls)"
@playAll="playAll"
@playSelected="playSelected"
:songs="state.songs"
:config="songListControlConfig"
:selectedSongs="selectedSongs"
/>
</template>
2022-04-15 17:00:08 +00:00
</ScreenHeader>
2022-04-15 14:24:30 +00:00
2022-04-15 17:00:08 +00:00
<SongList :items="state.songs" type="all-songs" ref="songList"/>
2022-04-15 14:24:30 +00:00
</section>
</template>
2022-04-15 17:00:08 +00:00
<script lang="ts" setup>
2022-04-15 14:24:30 +00:00
import { pluralize } from '@/utils'
import { songStore } from '@/stores'
2022-04-15 17:00:08 +00:00
import { useSongList } from '@/composables'
import { defineAsyncComponent, reactive } from 'vue'
2022-04-15 14:24:30 +00:00
2022-04-15 17:00:08 +00:00
const {
SongList,
SongListControls,
ControlsToggler,
songList,
meta,
selectedSongs,
showingControls,
songListControlConfig,
isPhone,
playAll,
playSelected,
toggleControls
} = useSongList()
2022-04-15 14:24:30 +00:00
2022-04-15 17:00:08 +00:00
const ScreenHeader = defineAsyncComponent(() => import('@/components/ui/screen-header.vue'))
const state = reactive(songStore.state)
2022-04-15 14:24:30 +00:00
</script>