Skip to content
Snippets Groups Projects
Verified Commit a1fd0d82 authored by Eliot Berriot's avatar Eliot Berriot
Browse files

Fixed #53: f shortcut for favorite and avoiding collisions with 'exact' modifier

parent b49f39b2
No related branches found
No related tags found
No related merge requests found
...@@ -5,6 +5,10 @@ Changelog ...@@ -5,6 +5,10 @@ Changelog
0.2.7 (Unreleased) 0.2.7 (Unreleased)
------------------ ------------------
- Shortcuts: can now use the ``f`` shortcut to toggle the currently playing track
as a favorite (#53)
- Shortcuts: avoid collisions between shortcuts by using the exact modifier (#53)
0.2.6 (2017-12-15) 0.2.6 (2017-12-15)
------------------ ------------------
......
...@@ -57,11 +57,12 @@ ...@@ -57,11 +57,12 @@
</div> </div>
</div> </div>
<GlobalEvents <GlobalEvents
@keydown.space.prevent="pauseOrPlay" @keydown.space.prevent.exact="pauseOrPlay"
@keydown.ctrl.left.prevent="queue.previous" @keydown.ctrl.left.prevent.exact="queue.previous"
@keydown.ctrl.right.prevent="queue.next" @keydown.ctrl.right.prevent.exact="queue.next"
@keydown.ctrl.down.prevent="queue.incrementVolume(-0.1)" @keydown.ctrl.down.prevent.exact="queue.incrementVolume(-0.1)"
@keydown.ctrl.up.prevent="queue.incrementVolume(0.1)" @keydown.ctrl.up.prevent.exact="queue.incrementVolume(0.1)"
@keydown.f.prevent.exact="favoriteTracks.toggle(queue.currentTrack.id)"
/> />
</div> </div>
...@@ -70,10 +71,11 @@ ...@@ -70,10 +71,11 @@
<script> <script>
import GlobalEvents from '@/components/utils/global-events' import GlobalEvents from '@/components/utils/global-events'
import favoriteTracks from '@/favorites/tracks'
import queue from '@/audio/queue' import queue from '@/audio/queue'
import radios from '@/radios'
import Track from '@/audio/track' import Track from '@/audio/track'
import TrackFavoriteIcon from '@/components/favorites/TrackFavoriteIcon' import TrackFavoriteIcon from '@/components/favorites/TrackFavoriteIcon'
import radios from '@/radios'
export default { export default {
name: 'player', name: 'player',
...@@ -86,6 +88,7 @@ export default { ...@@ -86,6 +88,7 @@ export default {
sliderVolume: this.currentVolume, sliderVolume: this.currentVolume,
queue: queue, queue: queue,
Track: Track, Track: Track,
favoriteTracks,
radios radios
} }
}, },
......
<template> <template>
<button @click="favoriteTracks.set(track.id, !isFavorite)" v-if="button" :class="['ui', 'pink', {'inverted': isFavorite}, {'favorited': isFavorite}, 'button']"> <button @click="favoriteTracks.set(track.id, !isFavorite)" v-if="button" :class="['ui', 'pink', {'inverted': isFavorite}, {'favorited': isFavorite}, 'button']">
<i class="heart icon"></i> <i class="heart icon"></i>
<template v-if="isFavorite"> <template v-if="isFavorite">
...@@ -24,11 +24,6 @@ export default { ...@@ -24,11 +24,6 @@ export default {
favoriteTracks favoriteTracks
} }
}, },
methods: {
toggleFavorite () {
this.isFavorite = !this.isFavorite
}
},
computed: { computed: {
title () { title () {
if (this.isFavorite) { if (this.isFavorite) {
......
...@@ -33,6 +33,10 @@ export default { ...@@ -33,6 +33,10 @@ export default {
}) })
} }
}, },
toggle (id) {
let isFavorite = this.objects[id]
this.set(id, !isFavorite)
},
fetch (url) { fetch (url) {
// will fetch favorites by batches from API to have them locally // will fetch favorites by batches from API to have them locally
var self = this var self = this
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment