mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-27 23:55:57 -05:00
2 lines
6.5 KiB
JavaScript
2 lines
6.5 KiB
JavaScript
import{C as z}from"./ContentWithHeading.js";import{G as m}from"./GroupByList.js";import{_ as $,e as y,r as c,o as u,c as p,d as r,w as g,a as s,t as _,k as w,T as L,z as D,F as C,f as B,h as F,g as O,B as P}from"./index.js";import{L as T}from"./ListPlaylists.js";import{L as I}from"./ListTracks.js";import"./ModalDialogPlaylist.js";import"./spotify-web-api.js";const M={name:"ModalDialogDirectory",props:["show","directory"],emits:["close"],methods:{play(){this.$emit("close"),y.player_play_expression(`path starts with "${this.directory}" order by path asc`,!1)},queue_add(){this.$emit("close"),y.queue_expression_add(`path starts with "${this.directory}" order by path asc`)},queue_add_next(){this.$emit("close"),y.queue_expression_add_next(`path starts with "${this.directory}" order by path asc`)}}},N={key:0,class:"modal is-active"},V={class:"modal-content fd-modal-card"},E={class:"card"},G={class:"card-content"},R=["textContent"],S={class:"card-footer"},j=["textContent"],H=["textContent"],U=["textContent"];function W(t,e,n,h,o,i){const l=c("mdicon");return u(),p("div",null,[r(L,{name:"fade"},{default:g(()=>[n.show?(u(),p("div",N,[s("div",{class:"modal-background",onClick:e[0]||(e[0]=a=>t.$emit("close"))}),s("div",V,[s("div",E,[s("div",G,[s("p",{class:"title is-4",textContent:_(n.directory)},null,8,R)]),s("footer",S,[s("a",{class:"card-footer-item has-text-dark",onClick:e[1]||(e[1]=(...a)=>i.queue_add&&i.queue_add(...a))},[r(l,{class:"icon",name:"playlist-plus",size:"16"}),s("span",{class:"is-size-7",textContent:_(t.$t("dialog.directory.add"))},null,8,j)]),s("a",{class:"card-footer-item has-text-dark",onClick:e[2]||(e[2]=(...a)=>i.queue_add_next&&i.queue_add_next(...a))},[r(l,{class:"icon",name:"playlist-play",size:"16"}),s("span",{class:"is-size-7",textContent:_(t.$t("dialog.directory.add-next"))},null,8,H)]),s("a",{class:"card-footer-item has-text-dark",onClick:e[3]||(e[3]=(...a)=>i.play&&i.play(...a))},[r(l,{class:"icon",name:"play",size:"16"}),s("span",{class:"is-size-7",textContent:_(t.$t("dialog.directory.play"))},null,8,U)])])])]),s("button",{class:"modal-close is-large","aria-label":"close",onClick:e[4]||(e[4]=a=>t.$emit("close"))})])):w("",!0)]),_:1})])}const b=$(M,[["render",W]]),A={name:"ListDirectories",components:{ModalDialogDirectory:b},props:["directories"],data(){return{show_details_modal:!1,selected_directory:""}},computed:{current_directory(){return this.$route.query&&this.$route.query.directory?this.$route.query.directory:"/"}},methods:{open_parent_directory(){this.current_directory.slice(0,this.current_directory.lastIndexOf("/"))===""||this.$store.state.config.directories.includes(this.current_directory)?this.$router.push({name:"files"}):this.$router.push({name:"files",query:{directory:this.current_directory.slice(0,this.current_directory.lastIndexOf("/"))}})},open_directory(t){this.$router.push({name:"files",query:{directory:t.path}})},open_dialog(t){this.selected_directory=t.path,this.show_details_modal=!0}}},J={class:"media-left is-clickable"},K=s("div",{class:"media-content is-clickable is-clipped"},[s("h1",{class:"title is-6"},"..")],-1),Q={class:"media-right"},X=["onClick"],Y={class:"media-left is-clickable"},Z={class:"media-content is-clickable is-clipped"},tt=["textContent"],et=["textContent"],st={class:"media-right"},it=["onClick"];function ot(t,e,n,h,o,i){const l=c("mdicon"),a=c("modal-dialog-directory");return u(),p(C,null,[t.$route.query.directory?(u(),p("div",{key:0,class:"media is-align-items-center",onClick:e[0]||(e[0]=d=>i.open_parent_directory())},[s("figure",J,[r(l,{class:"icon",name:"subdirectory-arrow-left",size:"16"})]),K,s("div",Q,[D(t.$slots,"actions")])])):w("",!0),(u(!0),p(C,null,B(n.directories,d=>(u(),p("div",{key:d.path,class:"media is-align-items-center",onClick:k=>i.open_directory(d)},[s("figure",Y,[r(l,{class:"icon",name:"folder",size:"16"})]),s("div",Z,[s("h1",{class:"title is-6",textContent:_(d.path.substring(d.path.lastIndexOf("/")+1))},null,8,tt),s("h2",{class:"subtitle is-7 has-text-grey-light",textContent:_(d.path)},null,8,et)]),s("div",st,[s("a",{onClick:F(k=>i.open_dialog(d),["prevent","stop"])},[r(l,{class:"icon has-text-dark",name:"dots-vertical",size:"16"})],8,it)])],8,X))),128)),(u(),O(P,{to:"#app"},[r(a,{show:o.show_details_modal,directory:o.selected_directory,onClose:e[1]||(e[1]=d=>o.show_details_modal=!1)},null,8,["show","directory"])]))],64)}const rt=$(A,[["render",ot]]),f={load(t){return t.query.directory?y.library_files(t.query.directory):Promise.resolve()},set(t,e){e?(t.dirs=e.data.directories,t.playlists=new m(e.data.playlists),t.tracks=new m(e.data.tracks)):(t.dirs=t.$store.state.config.directories.map(n=>({path:n})),t.playlists=new m,t.tracks=new m)}},nt={name:"PageFiles",components:{ContentWithHeading:z,ListDirectories:rt,ListPlaylists:T,ListTracks:I,ModalDialogDirectory:b},beforeRouteEnter(t,e,n){f.load(t).then(h=>{n(o=>f.set(o,h))})},beforeRouteUpdate(t,e,n){const h=this;f.load(t).then(o=>{f.set(h,o),n()})},data(){return{dirs:[],playlists:new m,tracks:new m,show_details_modal:!1}},computed:{current_directory(){return this.$route.query&&this.$route.query.directory?this.$route.query.directory:"/"},play_expression(){return`path starts with "${this.current_directory}" order by path asc`}},methods:{play(){y.player_play_expression(this.play_expression,!1)}}},at=["textContent"],lt=["textContent"],dt={class:"buttons is-centered"},ct=["textContent"];function _t(t,e,n,h,o,i){const l=c("mdicon"),a=c("list-directories"),d=c("list-playlists"),k=c("list-tracks"),v=c("modal-dialog-directory"),q=c("content-with-heading");return u(),p("div",null,[r(q,null,{"heading-left":g(()=>[s("p",{class:"title is-4",textContent:_(t.$t("page.files.title"))},null,8,at),s("p",{class:"title is-7 has-text-grey",textContent:_(i.current_directory)},null,8,lt)]),"heading-right":g(()=>[s("div",dt,[s("a",{class:"button is-small is-light is-rounded",onClick:e[0]||(e[0]=x=>o.show_details_modal=!0)},[r(l,{class:"icon",name:"dots-horizontal",size:"16"})]),s("a",{class:"button is-small is-dark is-rounded",onClick:e[1]||(e[1]=(...x)=>i.play&&i.play(...x))},[r(l,{class:"icon",name:"play",size:"16"}),s("span",{textContent:_(t.$t("page.files.play"))},null,8,ct)])])]),content:g(()=>[r(a,{directories:o.dirs},null,8,["directories"]),r(d,{playlists:o.playlists},null,8,["playlists"]),r(k,{tracks:o.tracks,expression:i.play_expression,show_icon:!0},null,8,["tracks","expression"]),r(v,{show:o.show_details_modal,directory:i.current_directory,onClose:e[2]||(e[2]=x=>o.show_details_modal=!1)},null,8,["show","directory"])]),_:1})])}const kt=$(nt,[["render",_t]]);export{kt as default};
|