mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-27 15:45:56 -05:00
2 lines
4.2 KiB
JavaScript
2 lines
4.2 KiB
JavaScript
import{_ as T,r as i,o as m,c as f,d as a,w as o,s as _,x as F,y as I,a as n,t as d,F as b,f as k,g as v,m as N,h as C,b as S}from"./index.js";import{C as R}from"./ContentWithHeading.js";import{C as B}from"./CoverArtwork.js";import{L as D}from"./ListItemAlbumSpotify.js";import{L as $}from"./ListItemPlaylistSpotify.js";import{M as O}from"./ModalDialogAlbumSpotify.js";import{M as V}from"./ModalDialogPlaylistSpotify.js";import{S as W}from"./spotify-web-api.js";import{T as Y}from"./TabsMusic.js";const u={load(t){if(_.state.spotify_new_releases.length>0&&_.state.spotify_featured_playlists.length>0)return Promise.resolve();const e=new W;return e.setAccessToken(_.state.spotify.webapi_token),Promise.all([e.getNewReleases({country:_.state.spotify.webapi_country,limit:50}),e.getFeaturedPlaylists({country:_.state.spotify.webapi_country,limit:50})])},set(t,e){e&&(_.commit(F,e[0].albums.items),_.commit(I,e[1].playlists.items))}},z={name:"PageMusicSpotify",components:{ContentWithHeading:R,CoverArtwork:B,ListItemAlbumSpotify:D,ListItemPlaylistSpotify:$,ModalDialogAlbumSpotify:O,ModalDialogPlaylistSpotify:V,TabsMusic:Y},beforeRouteEnter(t,e,c){u.load(t).then(p=>{c(l=>u.set(l,p))})},beforeRouteUpdate(t,e,c){const p=this;u.load(t).then(l=>{u.set(p,l),c()})},data(){return{show_album_details_modal:!1,selected_album:{},show_playlist_details_modal:!1,selected_playlist:{}}},computed:{new_releases(){return this.$store.state.spotify_new_releases.slice(0,3)},featured_playlists(){return this.$store.state.spotify_featured_playlists.slice(0,3)},is_visible_artwork(){return this.$store.getters.settings_option("webinterface","show_cover_artwork_in_album_lists").value}},methods:{open_album(t){this.$router.push({name:"music-spotify-album",params:{id:t.id}})},open_album_dialog(t){this.selected_album=t,this.show_album_details_modal=!0},open_playlist_dialog(t){this.selected_playlist=t,this.show_playlist_details_modal=!0},artwork_url(t){return t.images&&t.images.length>0?t.images[0].url:""}}},U={class:"fd-page-with-tabs"},j=["textContent"],H=["onClick"],q={class:"level"},G={class:"level-item"},J=["textContent"],K=["onClick"],Q={class:"level"},X={class:"level-item"};function Z(t,e,c,p,l,r){const x=i("tabs-music"),P=i("cover-artwork"),y=i("mdicon"),A=i("list-item-album-spotify"),E=i("modal-dialog-album-spotify"),h=i("router-link"),w=i("content-with-heading"),L=i("list-item-playlist-spotify"),M=i("modal-dialog-playlist-spotify");return m(),f("div",U,[a(x),a(w,null,{"heading-left":o(()=>[n("p",{class:"title is-4",textContent:d(t.$t("page.spotify.music.new-releases"))},null,8,j)]),content:o(()=>[(m(!0),f(b,null,k(r.new_releases,s=>(m(),v(A,{key:s.id,album:s,onClick:g=>r.open_album(s)},N({actions:o(()=>[n("a",{onClick:C(g=>r.open_album_dialog(s),["prevent","stop"])},[a(y,{class:"icon has-text-dark",name:"dots-vertical",size:"16"})],8,H)]),_:2},[r.is_visible_artwork?{name:"artwork",fn:o(()=>[a(P,{artwork_url:r.artwork_url(s),artist:s.artist,album:s.name,class:"is-clickable fd-has-shadow fd-cover fd-cover-small-image",maxwidth:64,maxheight:64},null,8,["artwork_url","artist","album"])]),key:"0"}:void 0]),1032,["album","onClick"]))),128)),a(E,{show:l.show_album_details_modal,album:l.selected_album,onClose:e[0]||(e[0]=s=>l.show_album_details_modal=!1)},null,8,["show","album"])]),footer:o(()=>[n("nav",q,[n("p",G,[a(h,{to:{name:"music-spotify-new-releases"},class:"button is-light is-small is-rounded"},{default:o(()=>[S(d(t.$t("page.spotify.music.show-more")),1)]),_:1})])])]),_:1}),a(w,null,{"heading-left":o(()=>[n("p",{class:"title is-4",textContent:d(t.$t("page.spotify.music.featured-playlists"))},null,8,J)]),content:o(()=>[(m(!0),f(b,null,k(r.featured_playlists,s=>(m(),v(L,{key:s.id,playlist:s},{actions:o(()=>[n("a",{onClick:C(g=>r.open_playlist_dialog(s),["prevent","stop"])},[a(y,{class:"icon has-text-dark",name:"dots-vertical",size:"16"})],8,K)]),_:2},1032,["playlist"]))),128)),a(M,{show:l.show_playlist_details_modal,playlist:l.selected_playlist,onClose:e[1]||(e[1]=s=>l.show_playlist_details_modal=!1)},null,8,["show","playlist"])]),footer:o(()=>[n("nav",Q,[n("p",X,[a(h,{to:{name:"music-spotify-featured-playlists"},class:"button is-light is-small is-rounded"},{default:o(()=>[S(d(t.$t("page.spotify.music.show-more")),1)]),_:1})])])]),_:1})])}const _t=T(z,[["render",Z]]);export{_t as default};
|