From 69a3f34784430923eb71b7336f29a117dffe3826 Mon Sep 17 00:00:00 2001 From: Bat <baptiste@gelez.xyz> Date: Sun, 1 Apr 2018 16:21:52 +0100 Subject: [PATCH] Disable previous button if queue is empty --- front/src/components/audio/Player.vue | 6 ++++-- front/src/store/queue.js | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/front/src/components/audio/Player.vue b/front/src/components/audio/Player.vue index 2b0032cf7..31f6dc35a 100644 --- a/front/src/components/audio/Player.vue +++ b/front/src/components/audio/Player.vue @@ -58,8 +58,9 @@ <div class="two wide column controls ui grid"> <div title="Previous track" - class="two wide column control"> - <i @click="previous" class="ui step backward big icon"></i> + class="two wide column control" + :disabled="emptyQueue"> + <i @click="previous" :class="['ui', 'backward', {'disabled': emptyQueue}, 'big', 'icon']"></i> </div> <div v-if="!playing" @@ -204,6 +205,7 @@ export default { ...mapGetters({ currentTrack: 'queue/currentTrack', hasNext: 'queue/hasNext', + emptyQueue: 'queue/isEmpty', durationFormatted: 'player/durationFormatted', currentTimeFormatted: 'player/currentTimeFormatted', progress: 'player/progress' diff --git a/front/src/store/queue.js b/front/src/store/queue.js index 0908f180c..6a26fa1e9 100644 --- a/front/src/store/queue.js +++ b/front/src/store/queue.js @@ -48,7 +48,8 @@ export default { }, hasNext: state => { return state.currentIndex < state.tracks.length - 1 - } + }, + isEmpty: state => state.tracks.length === 0 }, actions: { append ({commit, state, dispatch}, {track, index, skipPlay}) { -- GitLab