import{d as s,h as r,t as a,k as n}from"./preload-helper-BKveOr2o.chunk.mjs";import{k as i,v as l,w as m,x as u,y as p}from"./index-B1ja0bGP.chunk.mjs";import{N as c}from"./NcEmptyContent-Bix1E0zN.chunk.mjs";import{I as b,P as f,n as h}from"./icons-DBfG8RnV.chunk.mjs";import{A as d}from"./AlbumForm-DADJ7ZLP.chunk.mjs";import{C as y,a as _}from"./CollectionsList-DxlASzGz.chunk.mjs";import{H as C}from"./HeaderNavigation-BesIDwoI.chunk.mjs";import{F as v}from"./FetchCollectionsMixin-DGV1-NlJ.chunk.mjs";import"./index-BT3E1rl9.chunk.mjs";import"./createElementId-DhjFt1I9-B2HCdIOx.chunk.mjs";import"./NcTextField-Czr9S6YO-CrA5GVjq.chunk.mjs";import"./useModelMigration-EhAWvqDD-DsYb9Ccp.chunk.mjs";import"./PhotosFiltersInput-Dy4sLswh.chunk.mjs";import"./NcSelect-CHc1QupB-CZUA9tYj.chunk.mjs";import"./NcAvatar-DkAX4nqq-DnOpfy69.chunk.mjs";import"./NcActionButton-K4jUGMlW-C4vrfkig.chunk.mjs";import"./NcDateTimePicker-B8JaPsQk.chunk.mjs";import"./useFormatDateTime-DLp_UqyQ.chunk.mjs";import"./NcDateTime-enXYuwj8-CRtEmco8.chunk.mjs";import"./collectionFetcher-B8-V3AGI.chunk.mjs";import"./video-CODLAaTx.chunk.mjs";import"./index-x9vhq81Z.chunk.mjs";import"./NcSelectUsers-B4w9UC_d-DMxPBuI2.chunk.mjs";import"./FetchCollectionContentMixin-RzqIVCIv.chunk.mjs";import"./AbortControllerMixin-NVr2Cd4D.chunk.mjs";const A=s({name:"AlbumsView",components:{Plus:f,ImageMultipleOutline:b,NcModal:l,NcButton:i,NcEmptyContent:c,CollectionsList:_,CollectionCover:y,HeaderNavigation:C,AlbumForm:d},filters:{coverUrl(t){return t===-1?"":n(`/apps/photos/api/v1/preview/${t}?x=512&y=512`)}},mixins:[v],setup(){return{isMobile:p()}},data(){return{showAlbumCreationForm:!1}},computed:{albums(){return this.$store.getters.albums}},async beforeMount(){this.fetchAlbums()},methods:{fetchAlbums(){this.fetchCollections(m,u)},handleAlbumCreated({album:t}){this.showAlbumCreationForm=!1,this.$router.push(`/albums/${t.basename}`)},t:a,n:r}});var N=function(){var t=this,o=t._self._c;return t._self._setupProxy,o("div",[o("CollectionsList",{staticClass:"albums-list",attrs:{collections:t.albums,loading:t.loadingCollections,error:t.errorFetchingCollections},scopedSlots:t._u([{key:"header",fn:function(){return[o("HeaderNavigation",{key:"navigation",attrs:{loading:t.loadingCollections,title:t.t("photos","Albums"),"root-title":t.t("photos","Albums")},on:{refresh:t.fetchAlbums}},[o("NcButton",{attrs:{"aria-label":t.isMobile?t.t("photos","New album"):void 0},on:{click:function(e){t.showAlbumCreationForm=!0}},scopedSlots:t._u([{key:"icon",fn:function(){return[o("Plus",{attrs:{size:20}})]},proxy:!0},t.isMobile?null:{key:"default",fn:function(){return[t._v(" "+t._s(t.t("photos","New album"))+" ")]},proxy:!0}],null,!0)})],1)]},proxy:!0},{key:"default",fn:function({collection:e}){return[o("CollectionCover",{key:e.basename,attrs:{"parent-route":"/albums","collection-name":e.basename,"alt-img":t.t("photos","Cover photo for album {albumName}",{albumName:e.basename}),"cover-url":t._f("coverUrl")(e.attributes["last-photo"])},scopedSlots:t._u([{key:"default",fn:function(){return[o("span",{staticClass:"album__name"},[t._v(" "+t._s(e.basename)+" ")])]},proxy:!0},{key:"subtitle",fn:function(){return[o("div",{staticClass:"album__details"},[t._v(" "+t._s(e.attributes.date)+" ⸱ "+t._s(t.n("photos","%n item","%n photos and videos",e.attributes.nbItems))+" ")])]},proxy:!0}],null,!0)})]}},{key:"empty-collections-list",fn:function(){return[o("NcEmptyContent",{attrs:{name:t.t("photos","There is no album yet!")},scopedSlots:t._u([{key:"icon",fn:function(){return[o("ImageMultipleOutline")]},proxy:!0}])})]},proxy:!0}])}),t.showAlbumCreationForm?o("NcModal",{attrs:{"label-id":"new-album-form"},on:{close:function(e){t.showAlbumCreationForm=!1}}},[o("h2",{staticClass:"album-creation__heading"},[t._v(" "+t._s(t.t("photos","New album"))+" ")]),o("AlbumForm",{on:{done:t.handleAlbumCreated}})],1):t._e()],1)},g=[],k=h(A,N,g,!1,null,"5f230c1c");const W=k.exports;export{W as default};
//# sourceMappingURL=AlbumsView-DrBzVw7J.chunk.mjs.map
