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

2 lines
3.7 KiB
JavaScript

import{_ as v,n as S,H as k,i as $,r as d,o as h,c as u,d as l,w as c,e as H,a as e,t as o,j as m,v as g,k as I}from"./index.js";import{G as f,a as B,c as E}from"./GroupByList.js";import{C as L}from"./ContentWithHeading.js";import{C as T}from"./ControlDropdown.js";import{I as D}from"./IndexButtonList.js";import{L as N}from"./ListArtists.js";import{T as V}from"./TabsMusic.js";import"./ModalDialogArtist.js";const p={load(t){return H.library_artists("music")},set(t,s){t.artists_list=new f(s.data)}},A={name:"PageArtists",components:{ContentWithHeading:L,ControlDropdown:T,IndexButtonList:D,ListArtists:N,TabsMusic:V},beforeRouteEnter(t,s,n){p.load(t).then(_=>{n(a=>p.set(a,_))})},beforeRouteUpdate(t,s,n){if(!this.artists_list.isEmpty()){n();return}const _=this;p.load(t).then(a=>{p.set(_,a),n()})},data(){return{artists_list:new f,groupby_options:[{id:1,name:this.$t("page.artists.sort-by.name"),options:B("name_sort",!0)},{id:2,name:this.$t("page.artists.sort-by.recently-added"),options:E("time_added",{direction:"desc"})}]}},computed:{artists(){if(!this.artists_list)return[];const t=this.groupby_options.find(s=>s.id===this.selected_groupby_option_id);return this.artists_list.group(t.options,[s=>!this.hide_singles||s.track_count>s.album_count*2,s=>!this.hide_spotify||s.data_kind!=="spotify"]),this.artists_list},selected_groupby_option_id:{get(){return this.$store.state.artists_sort},set(t){this.$store.commit(S,t)}},spotify_enabled(){return this.$store.state.spotify.webapi_token_valid},hide_singles:{get(){return this.$store.state.hide_singles},set(t){this.$store.commit(k,t)}},hide_spotify:{get(){return this.$store.state.hide_spotify},set(t){this.$store.commit($,t)}}}},R={class:"fd-page-with-tabs"},U={class:"columns"},G={class:"column"},O=["textContent"],P={class:"field"},j={class:"control"},M=["textContent"],Y=["textContent"],F={key:0,class:"field"},W={class:"control"},q=["textContent"],z=["textContent"],J={class:"column"},K=["textContent"],Q=["textContent"],X=["textContent"];function Z(t,s,n,_,a,i){const b=d("tabs-music"),y=d("index-button-list"),C=d("control-dropdown"),x=d("list-artists"),w=d("content-with-heading");return h(),u("div",R,[l(b),l(w,null,{options:c(()=>[l(y,{index:i.artists.indexList},null,8,["index"]),e("div",U,[e("div",G,[e("p",{class:"heading mb-5",textContent:o(t.$t("page.artists.filter"))},null,8,O),e("div",P,[e("div",j,[m(e("input",{id:"switchHideSingles","onUpdate:modelValue":s[0]||(s[0]=r=>i.hide_singles=r),type:"checkbox",class:"switch is-rounded"},null,512),[[g,i.hide_singles]]),e("label",{for:"switchHideSingles",textContent:o(t.$t("page.artists.hide-singles"))},null,8,M)]),e("p",{class:"help",textContent:o(t.$t("page.artists.hide-singles-help"))},null,8,Y)]),i.spotify_enabled?(h(),u("div",F,[e("div",W,[m(e("input",{id:"switchHideSpotify","onUpdate:modelValue":s[1]||(s[1]=r=>i.hide_spotify=r),type:"checkbox",class:"switch is-rounded"},null,512),[[g,i.hide_spotify]]),e("label",{for:"switchHideSpotify",textContent:o(t.$t("page.artists.hide-spotify"))},null,8,q)]),e("p",{class:"help",textContent:o(t.$t("page.artists.hide-spotify-help"))},null,8,z)])):I("",!0)]),e("div",J,[e("p",{class:"heading mb-5",textContent:o(t.$t("page.artists.sort-by.title"))},null,8,K),l(C,{value:i.selected_groupby_option_id,"onUpdate:value":s[2]||(s[2]=r=>i.selected_groupby_option_id=r),options:a.groupby_options},null,8,["value","options"])])])]),"heading-left":c(()=>[e("p",{class:"title is-4",textContent:o(t.$t("page.artists.title"))},null,8,Q),e("p",{class:"heading",textContent:o(t.$t("page.artists.count",{count:i.artists.count}))},null,8,X)]),"heading-right":c(()=>[]),content:c(()=>[l(x,{artists:i.artists},null,8,["artists"])]),_:1})])}const dt=v(A,[["render",Z]]);export{dt as default};