mirror of
https://github.com/owntone/owntone-server.git
synced 2025-02-10 05:08:11 -05:00
[web] Refactor the Spotify album item page
This commit is contained in:
parent
2b57f1124c
commit
fc192c5dfc
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="media is-align-items-center" @click="open_album">
|
<div class="media is-align-items-center" @click="open">
|
||||||
<div v-if="show_artwork" class="media-left is-clickable">
|
<div v-if="show_artwork" class="media-left is-clickable">
|
||||||
<cover-artwork
|
<cover-artwork
|
||||||
:artwork_url="artwork_url"
|
:artwork_url="artwork_url"
|
||||||
@ -20,19 +20,35 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="media-right">
|
<div class="media-right">
|
||||||
<slot name="actions" />
|
<a @click.prevent.stop="show_details_modal = true">
|
||||||
|
<mdicon class="icon has-text-dark" name="dots-vertical" size="16" />
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<teleport to="#app">
|
||||||
|
<modal-dialog-album-spotify
|
||||||
|
:show="show_details_modal"
|
||||||
|
:album="item"
|
||||||
|
@close="show_details_modal = false"
|
||||||
|
/>
|
||||||
|
</teleport>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import CoverArtwork from '@/components/CoverArtwork.vue'
|
import CoverArtwork from '@/components/CoverArtwork.vue'
|
||||||
|
import ModalDialogAlbumSpotify from '@/components/ModalDialogAlbumSpotify.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ListItemAlbumSpotify',
|
name: 'ListItemAlbumSpotify',
|
||||||
components: { CoverArtwork },
|
components: { CoverArtwork, ModalDialogAlbumSpotify },
|
||||||
props: { item: { required: true, type: Object } },
|
props: { item: { required: true, type: Object } },
|
||||||
|
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
show_details_modal: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
artwork_url() {
|
artwork_url() {
|
||||||
return this.item.images?.[0]?.url ?? ''
|
return this.item.images?.[0]?.url ?? ''
|
||||||
@ -46,7 +62,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
open_album() {
|
open() {
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
name: 'music-spotify-album',
|
name: 'music-spotify-album',
|
||||||
params: { id: this.item.id }
|
params: { id: this.item.id }
|
||||||
|
@ -130,24 +130,21 @@ export default {
|
|||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
artwork_url(album) {
|
artwork_url(album) {
|
||||||
return album.images?.[0]?.url || ''
|
return album.images?.[0]?.url ?? ''
|
||||||
},
|
},
|
||||||
|
|
||||||
open_artist() {
|
open_artist() {
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
name: 'music-spotify-artist',
|
name: 'music-spotify-artist',
|
||||||
params: { id: this.album.artists[0].id }
|
params: { id: this.album.artists[0].id }
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
play() {
|
|
||||||
this.show_details_modal = false
|
|
||||||
webapi.player_play_uri(this.album.uri, true)
|
|
||||||
},
|
|
||||||
|
|
||||||
open_track_dialog(track) {
|
open_track_dialog(track) {
|
||||||
this.selected_track = track
|
this.selected_track = track
|
||||||
this.show_track_details_modal = true
|
this.show_track_details_modal = true
|
||||||
|
},
|
||||||
|
play() {
|
||||||
|
this.show_details_modal = false
|
||||||
|
webapi.player_play_uri(this.album.uri, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,15 +28,6 @@
|
|||||||
:key="album.id"
|
:key="album.id"
|
||||||
:item="album"
|
:item="album"
|
||||||
>
|
>
|
||||||
<template #actions>
|
|
||||||
<a @click.prevent.stop="open_dialog(album)">
|
|
||||||
<mdicon
|
|
||||||
class="icon has-text-dark"
|
|
||||||
name="dots-vertical"
|
|
||||||
size="16"
|
|
||||||
/>
|
|
||||||
</a>
|
|
||||||
</template>
|
|
||||||
</list-item-album-spotify>
|
</list-item-album-spotify>
|
||||||
<VueEternalLoading v-if="offset < total" :load="load_next">
|
<VueEternalLoading v-if="offset < total" :load="load_next">
|
||||||
<template #loading>
|
<template #loading>
|
||||||
@ -53,11 +44,6 @@
|
|||||||
:artist="artist"
|
:artist="artist"
|
||||||
@close="show_details_modal = false"
|
@close="show_details_modal = false"
|
||||||
/>
|
/>
|
||||||
<modal-dialog-album-spotify
|
|
||||||
:show="show_album_details_modal"
|
|
||||||
:album="selected_album"
|
|
||||||
@close="show_album_details_modal = false"
|
|
||||||
/>
|
|
||||||
</template>
|
</template>
|
||||||
</content-with-heading>
|
</content-with-heading>
|
||||||
</div>
|
</div>
|
||||||
@ -66,7 +52,6 @@
|
|||||||
<script>
|
<script>
|
||||||
import ContentWithHeading from '@/templates/ContentWithHeading.vue'
|
import ContentWithHeading from '@/templates/ContentWithHeading.vue'
|
||||||
import ListItemAlbumSpotify from '@/components/ListItemAlbumSpotify.vue'
|
import ListItemAlbumSpotify from '@/components/ListItemAlbumSpotify.vue'
|
||||||
import ModalDialogAlbumSpotify from '@/components/ModalDialogAlbumSpotify.vue'
|
|
||||||
import ModalDialogArtistSpotify from '@/components/ModalDialogArtistSpotify.vue'
|
import ModalDialogArtistSpotify from '@/components/ModalDialogArtistSpotify.vue'
|
||||||
import SpotifyWebApi from 'spotify-web-api-js'
|
import SpotifyWebApi from 'spotify-web-api-js'
|
||||||
import { VueEternalLoading } from '@ts-pro/vue-eternal-loading'
|
import { VueEternalLoading } from '@ts-pro/vue-eternal-loading'
|
||||||
@ -92,7 +77,6 @@ const dataObject = {
|
|||||||
|
|
||||||
set(vm, response) {
|
set(vm, response) {
|
||||||
vm.artist = response[0]
|
vm.artist = response[0]
|
||||||
|
|
||||||
vm.albums = []
|
vm.albums = []
|
||||||
vm.total = 0
|
vm.total = 0
|
||||||
vm.offset = 0
|
vm.offset = 0
|
||||||
@ -105,7 +89,6 @@ export default {
|
|||||||
components: {
|
components: {
|
||||||
ContentWithHeading,
|
ContentWithHeading,
|
||||||
ListItemAlbumSpotify,
|
ListItemAlbumSpotify,
|
||||||
ModalDialogAlbumSpotify,
|
|
||||||
ModalDialogArtistSpotify,
|
ModalDialogArtistSpotify,
|
||||||
VueEternalLoading
|
VueEternalLoading
|
||||||
},
|
},
|
||||||
@ -128,8 +111,6 @@ export default {
|
|||||||
albums: [],
|
albums: [],
|
||||||
artist: {},
|
artist: {},
|
||||||
offset: 0,
|
offset: 0,
|
||||||
selected_album: {},
|
|
||||||
show_album_details_modal: false,
|
|
||||||
show_details_modal: false,
|
show_details_modal: false,
|
||||||
total: 0
|
total: 0
|
||||||
}
|
}
|
||||||
@ -155,10 +136,6 @@ export default {
|
|||||||
loaded(data.items.length, PAGE_SIZE)
|
loaded(data.items.length, PAGE_SIZE)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
open_dialog(album) {
|
|
||||||
this.selected_album = album
|
|
||||||
this.show_album_details_modal = true
|
|
||||||
},
|
|
||||||
play() {
|
play() {
|
||||||
this.show_album_details_modal = false
|
this.show_album_details_modal = false
|
||||||
webapi.player_play_uri(this.artist.uri, true)
|
webapi.player_play_uri(this.artist.uri, true)
|
||||||
|
@ -12,21 +12,7 @@
|
|||||||
:key="album.id"
|
:key="album.id"
|
||||||
:item="album"
|
:item="album"
|
||||||
>
|
>
|
||||||
<template #actions>
|
|
||||||
<a @click.prevent.stop="open_album_dialog(album)">
|
|
||||||
<mdicon
|
|
||||||
class="icon has-text-dark"
|
|
||||||
name="dots-vertical"
|
|
||||||
size="16"
|
|
||||||
/>
|
|
||||||
</a>
|
|
||||||
</template>
|
|
||||||
</list-item-album-spotify>
|
</list-item-album-spotify>
|
||||||
<modal-dialog-album-spotify
|
|
||||||
:show="show_album_details_modal"
|
|
||||||
:album="selected_album"
|
|
||||||
@close="show_album_details_modal = false"
|
|
||||||
/>
|
|
||||||
</template>
|
</template>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<nav class="level">
|
<nav class="level">
|
||||||
@ -136,7 +122,6 @@ export default {
|
|||||||
ContentWithHeading,
|
ContentWithHeading,
|
||||||
ListItemAlbumSpotify,
|
ListItemAlbumSpotify,
|
||||||
ListItemPlaylistSpotify,
|
ListItemPlaylistSpotify,
|
||||||
ModalDialogAlbumSpotify,
|
|
||||||
ModalDialogPlaylistSpotify,
|
ModalDialogPlaylistSpotify,
|
||||||
TabsMusic
|
TabsMusic
|
||||||
},
|
},
|
||||||
@ -156,9 +141,7 @@ export default {
|
|||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
selected_album: {},
|
|
||||||
selected_playlist: {},
|
selected_playlist: {},
|
||||||
show_album_details_modal: false,
|
|
||||||
show_playlist_details_modal: false
|
show_playlist_details_modal: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -173,10 +156,6 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
open_album_dialog(album) {
|
|
||||||
this.selected_album = album
|
|
||||||
this.show_album_details_modal = true
|
|
||||||
},
|
|
||||||
open_playlist_dialog(playlist) {
|
open_playlist_dialog(playlist) {
|
||||||
this.selected_playlist = playlist
|
this.selected_playlist = playlist
|
||||||
this.show_playlist_details_modal = true
|
this.show_playlist_details_modal = true
|
||||||
|
@ -21,11 +21,6 @@
|
|||||||
</a>
|
</a>
|
||||||
</template>
|
</template>
|
||||||
</list-item-album-spotify>
|
</list-item-album-spotify>
|
||||||
<modal-dialog-album-spotify
|
|
||||||
:show="show_details_modal"
|
|
||||||
:album="selected_album"
|
|
||||||
@close="show_details_modal = false"
|
|
||||||
/>
|
|
||||||
</template>
|
</template>
|
||||||
</content-with-heading>
|
</content-with-heading>
|
||||||
</div>
|
</div>
|
||||||
@ -35,7 +30,6 @@
|
|||||||
import * as types from '@/store/mutation_types'
|
import * as types from '@/store/mutation_types'
|
||||||
import ContentWithHeading from '@/templates/ContentWithHeading.vue'
|
import ContentWithHeading from '@/templates/ContentWithHeading.vue'
|
||||||
import ListItemAlbumSpotify from '@/components/ListItemAlbumSpotify.vue'
|
import ListItemAlbumSpotify from '@/components/ListItemAlbumSpotify.vue'
|
||||||
import ModalDialogAlbumSpotify from '@/components/ModalDialogAlbumSpotify.vue'
|
|
||||||
import SpotifyWebApi from 'spotify-web-api-js'
|
import SpotifyWebApi from 'spotify-web-api-js'
|
||||||
import TabsMusic from '@/components/TabsMusic.vue'
|
import TabsMusic from '@/components/TabsMusic.vue'
|
||||||
import store from '@/store'
|
import store from '@/store'
|
||||||
@ -66,7 +60,6 @@ export default {
|
|||||||
components: {
|
components: {
|
||||||
ContentWithHeading,
|
ContentWithHeading,
|
||||||
ListItemAlbumSpotify,
|
ListItemAlbumSpotify,
|
||||||
ModalDialogAlbumSpotify,
|
|
||||||
TabsMusic
|
TabsMusic
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -83,24 +76,10 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
selected_album: {},
|
|
||||||
show_details_modal: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
new_releases() {
|
new_releases() {
|
||||||
return this.$store.state.spotify_new_releases
|
return this.$store.state.spotify_new_releases
|
||||||
}
|
}
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
open_album_dialog(album) {
|
|
||||||
this.selected_album = album
|
|
||||||
this.show_details_modal = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -170,15 +170,6 @@
|
|||||||
:key="album.id"
|
:key="album.id"
|
||||||
:item="album"
|
:item="album"
|
||||||
>
|
>
|
||||||
<template #actions>
|
|
||||||
<a @click.prevent.stop="open_album_dialog(album)">
|
|
||||||
<mdicon
|
|
||||||
class="icon has-text-dark"
|
|
||||||
name="dots-vertical"
|
|
||||||
size="16"
|
|
||||||
/>
|
|
||||||
</a>
|
|
||||||
</template>
|
|
||||||
</list-item-album-spotify>
|
</list-item-album-spotify>
|
||||||
<VueEternalLoading
|
<VueEternalLoading
|
||||||
v-if="query.type === 'album'"
|
v-if="query.type === 'album'"
|
||||||
@ -193,11 +184,6 @@
|
|||||||
</template>
|
</template>
|
||||||
<template #no-more> </template>
|
<template #no-more> </template>
|
||||||
</VueEternalLoading>
|
</VueEternalLoading>
|
||||||
<modal-dialog-album-spotify
|
|
||||||
:show="show_album_details_modal"
|
|
||||||
:album="selected_album"
|
|
||||||
@close="show_album_details_modal = false"
|
|
||||||
/>
|
|
||||||
</template>
|
</template>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<nav v-if="show_all_button(albums)" class="level">
|
<nav v-if="show_all_button(albums)" class="level">
|
||||||
@ -291,7 +277,6 @@ import ListItemAlbumSpotify from '@/components/ListItemAlbumSpotify.vue'
|
|||||||
import ListItemArtistSpotify from '@/components/ListItemArtistSpotify.vue'
|
import ListItemArtistSpotify from '@/components/ListItemArtistSpotify.vue'
|
||||||
import ListItemPlaylistSpotify from '@/components/ListItemPlaylistSpotify.vue'
|
import ListItemPlaylistSpotify from '@/components/ListItemPlaylistSpotify.vue'
|
||||||
import ListItemTrackSpotify from '@/components/ListItemTrackSpotify.vue'
|
import ListItemTrackSpotify from '@/components/ListItemTrackSpotify.vue'
|
||||||
import ModalDialogAlbumSpotify from '@/components/ModalDialogAlbumSpotify.vue'
|
|
||||||
import ModalDialogArtistSpotify from '@/components/ModalDialogArtistSpotify.vue'
|
import ModalDialogArtistSpotify from '@/components/ModalDialogArtistSpotify.vue'
|
||||||
import ModalDialogPlaylistSpotify from '@/components/ModalDialogPlaylistSpotify.vue'
|
import ModalDialogPlaylistSpotify from '@/components/ModalDialogPlaylistSpotify.vue'
|
||||||
import ModalDialogTrackSpotify from '@/components/ModalDialogTrackSpotify.vue'
|
import ModalDialogTrackSpotify from '@/components/ModalDialogTrackSpotify.vue'
|
||||||
@ -311,7 +296,6 @@ export default {
|
|||||||
ListItemArtistSpotify,
|
ListItemArtistSpotify,
|
||||||
ListItemPlaylistSpotify,
|
ListItemPlaylistSpotify,
|
||||||
ListItemTrackSpotify,
|
ListItemTrackSpotify,
|
||||||
ModalDialogAlbumSpotify,
|
|
||||||
ModalDialogArtistSpotify,
|
ModalDialogArtistSpotify,
|
||||||
ModalDialogPlaylistSpotify,
|
ModalDialogPlaylistSpotify,
|
||||||
ModalDialogTrackSpotify,
|
ModalDialogTrackSpotify,
|
||||||
@ -327,11 +311,9 @@ export default {
|
|||||||
query: {},
|
query: {},
|
||||||
search_param: {},
|
search_param: {},
|
||||||
search_query: '',
|
search_query: '',
|
||||||
selected_album: {},
|
|
||||||
selected_artist: {},
|
selected_artist: {},
|
||||||
selected_playlist: {},
|
selected_playlist: {},
|
||||||
selected_track: {},
|
selected_track: {},
|
||||||
show_album_details_modal: false,
|
|
||||||
show_artist_details_modal: false,
|
show_artist_details_modal: false,
|
||||||
show_playlist_details_modal: false,
|
show_playlist_details_modal: false,
|
||||||
show_track_details_modal: false,
|
show_track_details_modal: false,
|
||||||
@ -376,10 +358,6 @@ export default {
|
|||||||
})
|
})
|
||||||
this.$refs.search_field.blur()
|
this.$refs.search_field.blur()
|
||||||
},
|
},
|
||||||
open_album_dialog(album) {
|
|
||||||
this.selected_album = album
|
|
||||||
this.show_album_details_modal = true
|
|
||||||
},
|
|
||||||
open_artist_dialog(artist) {
|
open_artist_dialog(artist) {
|
||||||
this.selected_artist = artist
|
this.selected_artist = artist
|
||||||
this.show_artist_details_modal = true
|
this.show_artist_details_modal = true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user