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

2 lines
5.3 KiB
JavaScript

import{C as b}from"./CoverArtwork.js";import{_ as k,e as u,r as c,o,c as d,d as r,w as C,a as t,t as a,k as m,T as p}from"./index.js";const x={name:"ModalDialogAlbum",components:{CoverArtwork:b},props:["show","album","media_kind","new_tracks"],emits:["close","remove-podcast","play-count-changed"],data(){return{artwork_visible:!1}},computed:{artwork_url(){return u.artwork_url_append_size_params(this.album.artwork_url)},media_kind_resolved(){return this.media_kind?this.media_kind:this.album.media_kind}},methods:{play(){this.$emit("close"),u.player_play_uri(this.album.uri,!1)},queue_add(){this.$emit("close"),u.queue_add(this.album.uri)},queue_add_next(){this.$emit("close"),u.queue_add_next(this.album.uri)},open_album(){this.$emit("close"),this.media_kind_resolved==="podcast"?this.$router.push({name:"podcast",params:{id:this.album.id}}):this.media_kind_resolved==="audiobook"?this.$router.push({name:"audiobooks-album",params:{id:this.album.id}}):this.$router.push({name:"music-album",params:{id:this.album.id}})},open_artist(){this.$emit("close"),this.media_kind_resolved==="audiobook"?this.$router.push({name:"audiobooks-artist",params:{id:this.album.artist_id}}):this.$router.push({name:"music-artist",params:{id:this.album.artist_id}})},mark_played(){u.library_album_track_update(this.album.id,{play_count:"played"}).then(({data:e})=>{this.$emit("play-count-changed"),this.$emit("close")})},artwork_loaded(){this.artwork_visible=!0},artwork_error(){this.artwork_visible=!1}}},y={key:0,class:"modal is-active"},v={class:"modal-content fd-modal-card"},g={class:"card"},f={class:"card-content"},w={class:"title is-4"},$=["textContent"],q={key:0,class:"buttons"},z=["textContent"],A=["textContent"],B={class:"content is-small"},D={key:0},M=["textContent"],N=["textContent"],V={key:1},T=["textContent"],j=["textContent"],E={key:2},H=["textContent"],I=["textContent"],S=["textContent"],F=["textContent"],G=["textContent"],J=["textContent"],K=["textContent"],L=["textContent"],O=["textContent"],P=["textContent"],Q={class:"card-footer"},R=["textContent"],U=["textContent"],W=["textContent"];function X(e,s,n,Y,Z,i){const h=c("cover-artwork"),_=c("mdicon");return o(),d("div",null,[r(p,{name:"fade"},{default:C(()=>[n.show?(o(),d("div",y,[t("div",{class:"modal-background",onClick:s[0]||(s[0]=l=>e.$emit("close"))}),t("div",v,[t("div",g,[t("div",f,[r(h,{artwork_url:n.album.artwork_url,artist:n.album.artist,album:n.album.name,class:"fd-has-shadow fd-cover fd-cover-normal-image mb-5"},null,8,["artwork_url","artist","album"]),t("p",w,[t("a",{class:"has-text-link",onClick:s[1]||(s[1]=(...l)=>i.open_album&&i.open_album(...l)),textContent:a(n.album.name)},null,8,$)]),i.media_kind_resolved==="podcast"?(o(),d("div",q,[t("a",{class:"button is-small",onClick:s[2]||(s[2]=(...l)=>i.mark_played&&i.mark_played(...l)),textContent:a(e.$t("dialog.album.mark-as-played"))},null,8,z),n.album.data_kind==="url"?(o(),d("a",{key:0,class:"button is-small",onClick:s[3]||(s[3]=l=>e.$emit("remove-podcast")),textContent:a(e.$t("dialog.album.remove-podcast"))},null,8,A)):m("",!0)])):m("",!0),t("div",B,[n.album.artist?(o(),d("p",D,[t("span",{class:"heading",textContent:a(e.$t("dialog.album.artist"))},null,8,M),t("a",{class:"title is-6 has-text-link",onClick:s[4]||(s[4]=(...l)=>i.open_artist&&i.open_artist(...l)),textContent:a(n.album.artist)},null,8,N)])):m("",!0),n.album.date_released?(o(),d("p",V,[t("span",{class:"heading",textContent:a(e.$t("dialog.album.release-date"))},null,8,T),t("span",{class:"title is-6",textContent:a(e.$filters.date(n.album.date_released))},null,8,j)])):n.album.year>0?(o(),d("p",E,[t("span",{class:"heading",textContent:a(e.$t("dialog.album.year"))},null,8,H),t("span",{class:"title is-6",textContent:a(n.album.year)},null,8,I)])):m("",!0),t("p",null,[t("span",{class:"heading",textContent:a(e.$t("dialog.album.tracks"))},null,8,S),t("span",{class:"title is-6",textContent:a(n.album.track_count)},null,8,F)]),t("p",null,[t("span",{class:"heading",textContent:a(e.$t("dialog.album.duration"))},null,8,G),t("span",{class:"title is-6",textContent:a(e.$filters.durationInHours(n.album.length_ms))},null,8,J)]),t("p",null,[t("span",{class:"heading",textContent:a(e.$t("dialog.album.type"))},null,8,K),t("span",{class:"title is-6",textContent:a([e.$t("media.kind."+n.album.media_kind),e.$t("data.kind."+n.album.data_kind)].join(" - "))},null,8,L)]),t("p",null,[t("span",{class:"heading",textContent:a(e.$t("dialog.album.added-on"))},null,8,O),t("span",{class:"title is-6",textContent:a(e.$filters.datetime(n.album.time_added))},null,8,P)])])]),t("footer",Q,[t("a",{class:"card-footer-item has-text-dark",onClick:s[5]||(s[5]=(...l)=>i.queue_add&&i.queue_add(...l))},[r(_,{class:"icon",name:"playlist-plus",size:"16"}),t("span",{class:"is-size-7",textContent:a(e.$t("dialog.album.add"))},null,8,R)]),t("a",{class:"card-footer-item has-text-dark",onClick:s[6]||(s[6]=(...l)=>i.queue_add_next&&i.queue_add_next(...l))},[r(_,{class:"icon",name:"playlist-play",size:"16"}),t("span",{class:"is-size-7",textContent:a(e.$t("dialog.album.add-next"))},null,8,U)]),t("a",{class:"card-footer-item has-text-dark",onClick:s[7]||(s[7]=(...l)=>i.play&&i.play(...l))},[r(_,{class:"icon",name:"play",size:"16"}),t("span",{class:"is-size-7",textContent:a(e.$t("dialog.album.play"))},null,8,W)])])])]),t("button",{class:"modal-close is-large","aria-label":"close",onClick:s[8]||(s[8]=l=>e.$emit("close"))})])):m("",!0)]),_:1})])}const at=k(x,[["render",X]]);export{at as M};