koel/resources/assets/js/components/main-wrapper/main-content/queue.vue

105 lines
2.3 KiB
Vue
Raw Normal View History

2015-12-13 04:42:28 +00:00
<template>
2016-06-25 16:05:24 +00:00
<section id="queueWrapper">
<h1 class="heading">
<span title="That's a freaking lot of U's and E's">Current Queue
2016-11-17 08:37:12 +00:00
<controls-toggler :showing-controls="showingControls" @toggleControls="toggleControls"/>
2016-06-25 16:05:24 +00:00
<span class="meta" v-show="meta.songCount">
{{ meta.songCount | pluralize('song') }}
{{ meta.totalLength }}
</span>
</span>
2016-11-17 07:07:12 +00:00
<song-list-controls
2016-11-17 08:37:12 +00:00
v-show="state.songs.length && (!isPhone || showingControls)"
2016-11-17 07:07:12 +00:00
@shuffleAll="shuffleAll"
@shuffleSelected="shuffleSelected"
@clearQueue="clearQueue"
:config="songListControlConfig"
:selectedSongs="selectedSongs"
/>
2016-06-25 16:05:24 +00:00
</h1>
2016-10-31 04:28:12 +00:00
<song-list v-show="state.songs.length" :items="state.songs" :sortable="false" type="queue"/>
2016-06-25 16:05:24 +00:00
<div v-show="!state.songs.length" class="none">
<p>Empty spaces. Abandoned places.</p>
<p v-if="showShufflingAllOption">How about
<a class="start" @click.prevent="shuffleAll">shuffling all songs</a>?
</p>
</div>
</section>
2015-12-13 04:42:28 +00:00
</template>
<script>
2016-06-25 16:05:24 +00:00
import { pluralize } from '../../../utils';
import { queueStore, songStore } from '../../../stores';
import { playback } from '../../../services';
import hasSongList from '../../../mixins/has-song-list';
export default {
name: 'main-wrapper--main-content--queue',
mixins: [hasSongList],
filters: { pluralize },
data() {
return {
state: queueStore.state,
2016-11-17 07:07:12 +00:00
songListControlConfig: {
clearQueue: true,
}
2015-12-13 04:42:28 +00:00
};
2016-06-25 16:05:24 +00:00
},
computed: {
/**
2016-09-23 10:03:33 +00:00
* Determine if we should display a "Shuffle All" link.
2016-06-25 16:05:24 +00:00
*/
showShufflingAllOption() {
return songStore.all.length;
},
},
methods: {
/**
* Shuffle all songs we have.
2016-11-17 07:07:12 +00:00
* Overriding the mixin.
2016-06-25 16:05:24 +00:00
*/
shuffleAll() {
2016-11-17 07:07:12 +00:00
playback.queueAndPlay(this.state.songs.length ? this.state.songs : songStore.all, true);
2016-06-25 16:05:24 +00:00
},
/**
* Clear the queue.
*/
2016-11-17 07:07:12 +00:00
clearQueue() {
2016-06-25 16:05:24 +00:00
queueStore.clear();
},
},
};
2015-12-13 04:42:28 +00:00
</script>
<style lang="sass">
2016-06-25 16:05:24 +00:00
@import "../../../../sass/partials/_vars.scss";
@import "../../../../sass/partials/_mixins.scss";
2015-12-13 04:42:28 +00:00
2016-06-25 16:05:24 +00:00
#queueWrapper {
.none {
color: $color2ndText;
padding: 16px 24px;
2015-12-13 04:42:28 +00:00
2016-06-25 16:05:24 +00:00
a {
color: $colorHighlight;
}
}
2015-12-13 04:42:28 +00:00
2016-06-25 16:05:24 +00:00
button.play-shuffle {
i {
margin-right: 0 !important;
2015-12-13 04:42:28 +00:00
}
2016-06-25 16:05:24 +00:00
}
}
2015-12-13 04:42:28 +00:00
</style>