import{d as s,f as r,t as a,k as l}from"./preload-helper-DadE4qT2.chunk.mjs";import{j as n,q as i,u as m,v as u,w as p}from"./index-4VW8tlR1.chunk.mjs";import{N as c}from"./NcEmptyContent-BKX-oWV6.chunk.mjs";import{C as b,I as f,P as h,n as d}from"./icons-CFZwNZD8.chunk.mjs";import{A as C}from"./AlbumForm-B0Cf67ai.chunk.mjs";import{C as _,a as y}from"./CollectionsList-CagAlq4C.chunk.mjs";import{H as v}from"./HeaderNavigation-BR4YvKwj.chunk.mjs";import{F as g}from"./FetchCollectionsMixin-CXW2_C-g.chunk.mjs";import"./index-BCevi9E9.chunk.mjs";import"./createElementId-DhjFt1I9-B2HCdIOx.chunk.mjs";import"./NcTextField-CfZknuqx-Bry01vdd.chunk.mjs";import"./useModelMigration-EhAWvqDD-Zhby4giX.chunk.mjs";import"./PhotosFiltersInput-D1DJdaLy.chunk.mjs";import"./NcSelect-DTniMiUS-BlM1kmZS.chunk.mjs";import"./NcAvatar-D5nljVEA-1kdZeGyJ.chunk.mjs";import"./NcActionButton-DykQxmXJ-CF2v2H6n.chunk.mjs";import"./NcDateTimePicker-B478ZW0o.chunk.mjs";import"./useFormatDateTime-CBXL1vfM.chunk.mjs";import"./NcDateTime-enXYuwj8-fJ1V3Ixk.chunk.mjs";import"./collectionFetcher-B0xfjDIB.chunk.mjs";import"./video-d0YXt7Dm.chunk.mjs";import"./index-x9vhq81Z.chunk.mjs";import"./NcSelectUsers-RyUVUaWQ-i6ykqGF1.chunk.mjs";import"./FetchCollectionContentMixin-D6jev9DQ.chunk.mjs";import"./AbortControllerMixin-Bb5X6Yae.chunk.mjs";const A=s({name:"AlbumsView",components:{Plus:h,ImageMultipleOutline:f,NcModal:i,NcButton:n,NcEmptyContent:c,CollectionsList:y,CollectionCover:_,HeaderNavigation:v,AlbumForm:C,CogOutline:b},filters:{coverUrl(t){return t===-1?"":l(`/apps/photos/api/v1/preview/${t}?x=512&y=512`)}},mixins:[g],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)+" ")]),Object.keys(e.attributes.filters).length!==0?o("CogOutline",{attrs:{"fill-color":"var(--color-text-lighter)"}}):t._e()]},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)},k=[],x=d(A,N,k,!1,null,"aaa5b5ca");const X=x.exports;export{X as default};
//# sourceMappingURL=AlbumsView-Rn4OqqtA.chunk.mjs.map
