import{a as s,h as r,t as a,k as n}from"./preload-helper-B5suVMXI.chunk.mjs";import{i,v as l,w as m,x as u,y as p}from"./index-jVniDJU4.chunk.mjs";import{N as c}from"./NcEmptyContent-N81-grsO.chunk.mjs";import{I as b,P as f,n as h}from"./icons-Du8Q1knx.chunk.mjs";import{A as d}from"./AlbumForm-Cvq8hXlY.chunk.mjs";import{C as y,a as _}from"./CollectionsList-Cc0lkFTT.chunk.mjs";import{H as C}from"./HeaderNavigation-BZeSRu1V.chunk.mjs";import{F as v}from"./FetchCollectionsMixin-C6oyGASH.chunk.mjs";import"./index-0B43P1b2.chunk.mjs";import"./createElementId-DhjFt1I9-B2HCdIOx.chunk.mjs";import"./NcTextField-BPhf3E7g-oHc4Eym1.chunk.mjs";import"./useModelMigration-EhAWvqDD-DV9p8w3D.chunk.mjs";import"./PhotosFiltersInput-dSKFsbqj.chunk.mjs";import"./NcSelect-DrKzKPZL-DG1sBZoM.chunk.mjs";import"./NcAvatar-BBqomFJ3-DHA3JRit.chunk.mjs";import"./NcActionButton-D7uypboC-BCr3_K5C.chunk.mjs";import"./NcDateTimePicker-jPrLjO0X.chunk.mjs";import"./useFormatDateTime-CcJ-Psjy.chunk.mjs";import"./NcDateTime-enXYuwj8-Det_wstB.chunk.mjs";import"./collectionFetcher-CGGNOyCQ.chunk.mjs";import"./video-DkVd1BrK.chunk.mjs";import"./index-x9vhq81Z.chunk.mjs";import"./NcSelectUsers-z2bZafO2-D17UArSl.chunk.mjs";import"./FetchCollectionContentMixin-DS79dxMs.chunk.mjs";import"./AbortControllerMixin-Bq66YDIl.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=[],x=h(A,N,g,!1,null,"5f230c1c");const W=x.exports;export{W as default};
//# sourceMappingURL=AlbumsView-B4emudNu.chunk.mjs.map
