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

Merge branch '832-colorized-play-button-in-front-of-the-currently-playing-music' into 'develop'

Resolve "Colorized 'play' button in front of the currently playing music"

Closes #832

See merge request funkwhale/funkwhale!798
parents c55a926d 2c34df61
No related branches found
No related tags found
No related merge requests found
The currently playing track is now highlighted with an orange play icon (#832)
\ No newline at end of file
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<tbody> <tbody>
<tr v-for="track in tracks"> <tr v-for="track in tracks">
<td class="play-cell"> <td class="play-cell">
<play-button class="basic icon" :track="track" :discrete="true"></play-button> <play-button :class="['basic', {orange: isPlaying && track.id === currentTrack.id}, 'icon']" :discrete="true" :track="track"></play-button>
</td> </td>
<td class="content-cell" colspan="5"> <td class="content-cell" colspan="5">
<track-favorite-icon :track="track"></track-favorite-icon> <track-favorite-icon :track="track"></track-favorite-icon>
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
</template> </template>
<script> <script>
import { mapGetters } from "vuex"
import backend from '@/audio/backend' import backend from '@/audio/backend'
import TrackFavoriteIcon from '@/components/favorites/TrackFavoriteIcon' import TrackFavoriteIcon from '@/components/favorites/TrackFavoriteIcon'
import PlayButton from '@/components/audio/PlayButton' import PlayButton from '@/components/audio/PlayButton'
...@@ -64,7 +65,7 @@ import PlayButton from '@/components/audio/PlayButton' ...@@ -64,7 +65,7 @@ import PlayButton from '@/components/audio/PlayButton'
export default { export default {
props: { props: {
album: {type: Object}, album: {type: Object},
mode: {type: String, default: 'rich'} mode: {type: String, default: 'rich'},
}, },
components: { components: {
TrackFavoriteIcon, TrackFavoriteIcon,
...@@ -84,6 +85,12 @@ export default { ...@@ -84,6 +85,12 @@ export default {
} }
return this.album.tracks.slice(0, this.initialTracks) return this.album.tracks.slice(0, this.initialTracks)
}, },
...mapGetters({
currentTrack: "queue/currentTrack",
}),
isPlaying () {
return this.$store.state.player.playing
},
tracksWithAlbum () { tracksWithAlbum () {
// needed to include album data (especially cover) // needed to include album data (especially cover)
// with tracks appended in queue (#795) // with tracks appended in queue (#795)
......
<template> <template>
<tr> <tr>
<td> <td>
<play-button class="basic icon" :discrete="true" :is-playable="playable" :track="track"></play-button> <play-button :class="['basic', {orange: isPlaying && track.id === currentTrack.id}, 'icon']" :discrete="true" :is-playable="playable" :track="track"></play-button>
</td> </td>
<td> <td>
<img class="ui mini image" v-if="track.album.cover.original" v-lazy="$store.getters['instance/absoluteUrl'](track.album.cover.small_square_crop)"> <img class="ui mini image" v-if="track.album.cover.original" v-lazy="$store.getters['instance/absoluteUrl'](track.album.cover.small_square_crop)">
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</template> </template>
<script> <script>
import { mapGetters } from "vuex"
import time from '@/utils/time' import time from '@/utils/time'
import TrackFavoriteIcon from '@/components/favorites/TrackFavoriteIcon' import TrackFavoriteIcon from '@/components/favorites/TrackFavoriteIcon'
import TrackPlaylistIcon from '@/components/playlists/TrackPlaylistIcon' import TrackPlaylistIcon from '@/components/playlists/TrackPlaylistIcon'
...@@ -74,13 +74,19 @@ export default { ...@@ -74,13 +74,19 @@ export default {
} }
}, },
computed: { computed: {
...mapGetters({
currentTrack: "queue/currentTrack",
}),
isPlaying () {
return this.$store.state.player.playing
},
albumArtist () { albumArtist () {
if (this.artist) { if (this.artist) {
return this.artist return this.artist
} else { } else {
return this.track.album.artist return this.track.album.artist
} }
} },
} }
} }
</script> </script>
......
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