owntone-server/htdocs/assets/PageArtistTracks.js
2023-12-14 20:00:28 +00:00

2 lines
3.3 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{_ as C,p as x,e as u,r,o as w,c as v,d as a,w as c,a as e,t as l}from"./index.js";import{a as T,d as B,G as h}from"./GroupByList.js";import{C as R}from"./ContentWithHeading.js";import{C as A}from"./ControlDropdown.js";import{I as L}from"./IndexButtonList.js";import{L as S}from"./ListTracks.js";import{M as j}from"./ModalDialogArtist.js";import"./spotify-web-api.js";const p={load(t){return Promise.all([u.library_artist(t.params.id),u.library_artist_tracks(t.params.id)])},set(t,s){t.artist=s[0].data,t.tracks_list=new h(s[1].data.tracks)}},z={name:"PageArtistTracks",components:{ContentWithHeading:R,ControlDropdown:A,IndexButtonList:L,ListTracks:S,ModalDialogArtist:j},beforeRouteEnter(t,s,d){p.load(t).then(_=>{d(o=>p.set(o,_))})},beforeRouteUpdate(t,s,d){const _=this;p.load(t).then(o=>{p.set(_,o),d()})},data(){return{artist:{},groupby_options:[{id:1,name:this.$t("page.artist.sort-by.name"),options:T("title_sort")},{id:2,name:this.$t("page.artist.sort-by.rating"),options:B("rating",{direction:"desc"})}],show_details_modal:!1,tracks_list:new h}},computed:{selected_groupby_option_id:{get(){return this.$store.state.artist_tracks_sort},set(t){this.$store.commit(x,t)}},tracks(){const t=this.groupby_options.find(s=>s.id===this.selected_groupby_option_id);return this.tracks_list.group(t.options),this.tracks_list},track_uris(){return this.tracks_list.items.map(t=>t.uri).join(",")}},methods:{open_artist(){this.show_details_modal=!1,this.$router.push({name:"music-artist",params:{id:this.artist.id}})},play(){u.player_play_uri(this.tracks_list.items.map(t=>t.uri).join(","),!0)}}},D={class:"columns"},I={class:"column"},N=["textContent"],P=["textContent"],E={class:"buttons is-centered"},G=["textContent"],M={class:"heading has-text-centered-mobile"},O=["textContent"],U=e("span",null," | ",-1),V=["textContent"];function H(t,s,d,_,o,n){const g=r("index-button-list"),k=r("control-dropdown"),m=r("mdicon"),b=r("list-tracks"),f=r("modal-dialog-artist"),y=r("content-with-heading");return w(),v("div",null,[a(y,null,{options:c(()=>[a(g,{index:n.tracks.indexList},null,8,["index"]),e("div",D,[e("div",I,[e("p",{class:"heading mb-5",textContent:l(t.$t("page.artist.sort-by.title"))},null,8,N),a(k,{value:n.selected_groupby_option_id,"onUpdate:value":s[0]||(s[0]=i=>n.selected_groupby_option_id=i),options:o.groupby_options},null,8,["value","options"])])])]),"heading-left":c(()=>[e("p",{class:"title is-4",textContent:l(o.artist.name)},null,8,P)]),"heading-right":c(()=>[e("div",E,[e("a",{class:"button is-small is-light is-rounded",onClick:s[1]||(s[1]=i=>o.show_details_modal=!0)},[a(m,{class:"icon",name:"dots-horizontal",size:"16"})]),e("a",{class:"button is-small is-dark is-rounded",onClick:s[2]||(s[2]=(...i)=>n.play&&n.play(...i))},[a(m,{class:"icon",name:"shuffle",size:"16"}),e("span",{textContent:l(t.$t("page.artist.shuffle"))},null,8,G)])])]),content:c(()=>[e("p",M,[e("a",{class:"has-text-link",onClick:s[3]||(s[3]=(...i)=>n.open_artist&&n.open_artist(...i)),textContent:l(t.$t("page.artist.album-count",{count:o.artist.album_count}))},null,8,O),U,e("span",{textContent:l(t.$t("page.artist.track-count",{count:o.artist.track_count}))},null,8,V)]),a(b,{tracks:n.tracks,uris:n.track_uris},null,8,["tracks","uris"]),a(f,{show:o.show_details_modal,artist:o.artist,onClose:s[4]||(s[4]=i=>o.show_details_modal=!1)},null,8,["show","artist"])]),_:1})])}const Z=C(z,[["render",H]]);export{Z as default};