mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-27 23:55:57 -05:00
2 lines
2.5 KiB
JavaScript
2 lines
2.5 KiB
JavaScript
import{_ as v,r as a,o as d,c as u,d as r,w as m,s as _,x as C,a as p,t as S,F as x,f as A,g as E,m as M,h as N}from"./index.js";import{C as R}from"./ContentWithHeading.js";import{C as B}from"./CoverArtwork.js";import{L}from"./ListItemAlbumSpotify.js";import{M as P}from"./ModalDialogAlbumSpotify.js";import{S as T}from"./spotify-web-api.js";import{T as F}from"./TabsMusic.js";const c={load(e){if(_.state.spotify_new_releases.length>0)return Promise.resolve();const t=new T;return t.setAccessToken(_.state.spotify.webapi_token),t.getNewReleases({country:_.state.spotify.webapi_country,limit:50})},set(e,t){t&&_.commit(C,t.albums.items)}},W={name:"PageMusicSpotifyNewReleases",components:{ContentWithHeading:R,CoverArtwork:B,ListItemAlbumSpotify:L,ModalDialogAlbumSpotify:P,TabsMusic:F},beforeRouteEnter(e,t,n){c.load(e).then(l=>{n(o=>c.set(o,l))})},beforeRouteUpdate(e,t,n){const l=this;c.load(e).then(o=>{c.set(l,o),n()})},data(){return{show_details_modal:!1,selected_album:{}}},computed:{new_releases(){return this.$store.state.spotify_new_releases},is_visible_artwork(){return this.$store.getters.settings_option("webinterface","show_cover_artwork_in_album_lists").value}},methods:{open_album(e){this.$router.push({name:"music-spotify-album",params:{id:e.id}})},open_album_dialog(e){this.selected_album=e,this.show_details_modal=!0},artwork_url(e){return e.images&&e.images.length>0?e.images[0].url:""}}},$={class:"fd-page-with-tabs"},D=["textContent"],I=["onClick"];function O(e,t,n,l,o,i){const f=a("tabs-music"),w=a("cover-artwork"),h=a("mdicon"),b=a("list-item-album-spotify"),g=a("modal-dialog-album-spotify"),k=a("content-with-heading");return d(),u("div",$,[r(f),r(k,null,{"heading-left":m(()=>[p("p",{class:"title is-4",textContent:S(e.$t("page.spotify.music.new-releases"))},null,8,D)]),content:m(()=>[(d(!0),u(x,null,A(i.new_releases,s=>(d(),E(b,{key:s.id,album:s,onClick:y=>i.open_album(s)},M({actions:m(()=>[p("a",{onClick:N(y=>i.open_album_dialog(s),["prevent","stop"])},[r(h,{class:"icon has-text-dark",name:"dots-vertical",size:"16"})],8,I)]),_:2},[i.is_visible_artwork?{name:"artwork",fn:m(()=>[r(w,{artwork_url:i.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)),r(g,{show:o.show_details_modal,album:o.selected_album,onClose:t[0]||(t[0]=s=>o.show_details_modal=!1)},null,8,["show","album"])]),_:1})])}const G=v(W,[["render",O]]);export{G as default};
|