photos/js/photos-src_views_SharedAlbu...

1 line
16 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{"version":3,"file":"photos-src_views_SharedAlbums_vue.js?v=8b65f903f9c58e85dad1","mappings":";0LA6BA,SACCA,KAAM,yBAENC,KAAIA,KACI,CACNC,oBAAqB,KACrBC,eAAe,IAIjBC,OAAQ,CACPC,EAAAA,GAGDC,oBACCC,KAAKC,aACN,EAEAC,SAAU,KACNC,EAAAA,EAAAA,IAAW,CACb,kBAIFC,QAAS,KACLC,EAAAA,EAAAA,IAAW,CACb,oBAGDN,oBACC,IAAIC,KAAKJ,cAIT,IAAI,IAAAU,EACHN,KAAKJ,eAAgB,EACrBI,KAAKL,oBAAsB,KAE3B,MAAMY,QAAeN,EAAAA,EAAAA,IAAY,WAADO,OAA4B,QAA5BF,GAAYG,EAAAA,EAAAA,aAAgB,IAAAH,OAAA,EAAhBA,EAAkBI,IAAG,iBAAiBV,KAAKW,gBAAgBC,QAEvGZ,KAAKa,gBAAgB,CAAEN,UACxB,CAAE,MAAOO,GAAO,IAAAC,EACgB,OAAb,QAAdA,EAAAD,EAAME,gBAAQ,IAAAD,OAAA,EAAdA,EAAgBE,QACnBjB,KAAKL,oBAAsB,IAE3BK,KAAKL,oBAAsBmB,CAE7B,CAAE,QACDd,KAAKJ,eAAgB,CACtB,CACD,yEC5EEsB,QAA0B,GAA4B,KAE1DA,EAAwBC,KAAK,CAACC,EAAOC,GAAI,4LAA6L,GAAG,CAAC,QAAU,EAAE,QAAU,CAAC,0CAA0C,MAAQ,GAAG,SAAW,8EAA8E,eAAiB,CAAC,2uBAA2zB,WAAa,MAEzuC,yDCPA,0FCoEA,MCpE4K,EDoE5K,CACA5B,KAAA,eACA6B,WAAA,CACAC,oBAAA,IACAC,eAAA,KACAC,gBAAA,IACAC,gBAAA,IACAC,iBAAA,IACAC,aAA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AAChB,EAAIc,GAAG,WAAWd,EAAIe,GAAGJ,EAAWM,MAAM,MAAMjB,EAAIe,GAAGf,EAAIR,EAAE,SAAU,UAAW,uBAAwBmB,EAAWO,UAAW,YAAYjB,EAAG,MAAMD,EAAIc,GAAG,WAAWd,EAAIe,GAAGf,EAAIV,EAAE,SAAU,cAAc,KAAKW,EAAG,eAAe,CAACG,MAAM,CAAC,eAAeO,EAAWvB,cAAc,GAAG+B,MAAM,KAAOR,EAAWvB,cAAc,GAAGjB,OAAO,IAAI,MAAM,CAAC8B,EAAG,mBAAmB,CAACO,IAAI,aAAaJ,MAAM,CAAC,KAAO,SAAS,QAAUJ,EAAItD,cAAc,MAAQsD,EAAIV,EAAE,SAAU,iBAAiB,aAAaU,EAAIV,EAAE,SAAU,kBAAkB8B,GAAG,CAAC,QAAUpB,EAAIjD,aAAaiE,KAAK,WAAWhB,EAAIc,GAAG,KAAKd,EAAIc,GAAG,KAAKb,EAAG,iBAAiB,CAACG,MAAM,CAAC,KAAO,yBAAyB,MAAQJ,EAAIV,EAAE,SAAU,2BAA2B0B,KAAK,0BAA0B,CAACf,EAAG,sBAAsB,CAACG,MAAM,CAAC,KAAO,QAAQY,KAAK,UAAU,IAAI,EAC/iD,GACsB,IIUpB,EACA,KACA,WACA,MAI8B","sources":["webpack:///photos/src/mixins/FetchSharedAlbumsMixin.js","webpack:///photos/src/views/SharedAlbums.vue?vue&type=style&index=0&id=10a1f9c9&prod&lang=scss&scoped=true","webpack://photos/./src/views/SharedAlbums.vue?af50","webpack:///photos/src/views/SharedAlbums.vue","webpack:///photos/src/views/SharedAlbums.vue?vue&type=script&lang=js","webpack://photos/./src/views/SharedAlbums.vue?9e8c","webpack://photos/./src/views/SharedAlbums.vue?dd2f"],"sourcesContent":["/**\n * @copyright Copyright (c) 2022 Louis Chemineau <louis@chmn.me>\n *\n * @author Louis Chemineau <louis@chmn.me>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nimport { mapGetters, mapActions } from 'vuex'\n\nimport { getCurrentUser } from '@nextcloud/auth'\n\nimport AbortControllerMixin from './AbortControllerMixin.js'\nimport { fetchAlbums } from '../services/Albums.js'\n\nexport default {\n\tname: 'FetchSharedAlbumsMixin',\n\n\tdata() {\n\t\treturn {\n\t\t\terrorFetchingAlbums: null,\n\t\t\tloadingAlbums: false,\n\t\t}\n\t},\n\n\tmixins: [\n\t\tAbortControllerMixin,\n\t],\n\n\tasync beforeMount() {\n\t\tthis.fetchAlbums()\n\t},\n\n\tcomputed: {\n\t\t...mapGetters([\n\t\t\t'sharedAlbums',\n\t\t]),\n\t},\n\n\tmethods: {\n\t\t...mapActions([\n\t\t\t'addSharedAlbums',\n\t\t]),\n\n\t\tasync fetchAlbums() {\n\t\t\tif (this.loadingAlbums) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tthis.loadingAlbums = true\n\t\t\t\tthis.errorFetchingAlbums = null\n\n\t\t\t\tconst albums = await fetchAlbums(`/photos/${getCurrentUser()?.uid}/sharedalbums`, this.abortController.signal)\n\n\t\t\t\tthis.addSharedAlbums({ albums })\n\t\t\t} catch (error) {\n\t\t\t\tif (error.response?.status === 404) {\n\t\t\t\t\tthis.errorFetchingAlbums = 404\n\t\t\t\t} else {\n\t\t\t\t\tthis.errorFetchingAlbums = error\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\tthis.loadingAlbums = false\n\t\t\t}\n\t\t},\n\t},\n}\n","// Imports\nimport ___CSS_LOADER_API_SOURCEMAP_IMPORT___ from \"../../node_modules/css-loader/dist/runtime/sourceMaps.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \".albums-list[data-v-10a1f9c9]{display:flex;flex-direction:column}.albums-list .album__name[data-v-10a1f9c9]{font-weight:normal;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}\", \"\",{\"version\":3,\"sources\":[\"webpack://./src/views/SharedAlbums.vue\"],\"names\":[],\"mappings\":\"AAEA,8BACC,YAAA,CACA,qBAAA,CAEA,2CACC,kBAAA,CACA,eAAA,CACA,kBAAA,CACA,sBAAA\",\"sourcesContent\":[\"$sizes: (\\\"400\\\": (\\\"count\\\": 3, \\\"marginTop\\\": 66, \\\"marginW\\\": 8), \\\"700\\\": (\\\"count\\\": 4, \\\"marginTop\\\": 66, \\\"marginW\\\": 8), \\\"1024\\\": (\\\"count\\\": 5, \\\"marginTop\\\": 66, \\\"marginW\\\": 44), \\\"1280\\\": (\\\"count\\\": 4, \\\"marginTop\\\": 66, \\\"marginW\\\": 44), \\\"1440\\\": (\\\"count\\\": 5, \\\"marginTop\\\": 88, \\\"marginW\\\": 66), \\\"1600\\\": (\\\"count\\\": 6, \\\"marginTop\\\": 88, \\\"marginW\\\": 66), \\\"2048\\\": (\\\"count\\\": 7, \\\"marginTop\\\": 88, \\\"marginW\\\": 66), \\\"2560\\\": (\\\"count\\\": 8, \\\"marginTop\\\": 88, \\\"marginW\\\": 88), \\\"3440\\\": (\\\"count\\\": 9, \\\"marginTop\\\": 88, \\\"marginW\\\": 88), \\\"max\\\": (\\\"count\\\": 10, \\\"marginTop\\\": 88, \\\"marginW\\\": 88));\\n\\n.albums-list {\\n\\tdisplay: flex;\\n\\tflex-direction: column;\\n\\n\\t.album__name {\\n\\t\\tfont-weight: normal;\\n\\t\\toverflow: hidden;\\n\\t\\twhite-space: nowrap;\\n\\t\\ttext-overflow: ellipsis;\\n\\t}\\n}\\n\"],\"sourceRoot\":\"\"}]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___;\n","var render = function render(){var _vm=this,_c=_vm._self._c;return _c('CollectionsList',{staticClass:\"albums-list\",attrs:{\"collections\":_vm.sharedAlbums,\"loading\":_vm.loadingAlbums,\"error\":_vm.errorFetchingAlbums},scopedSlots:_vm._u([{key:\"default\",fn:function({collection}){return _c('CollectionCover',{key:collection.basename,attrs:{\"link\":`/sharedalbums/${collection.basename}`,\"alt-img\":_vm.t('photos', 'Cover photo for shared album {albumName}.', { albumName: collection.basename }),\"data-test\":collection.basename,\"cover-url\":_vm._f(\"coverUrl\")(collection.lastPhoto)}},[_c('h2',{staticClass:\"album__name\"},[_vm._v(\"\\n\\t\\t\\t\"+_vm._s(_vm._f(\"albumOriginalName\")(collection))+\"\\n\\t\\t\")]),_vm._v(\" \"),_c('div',{staticClass:\"album__details\",attrs:{\"slot\":\"subtitle\"},slot:\"subtitle\"},[_vm._v(\"\\n\\t\\t\\t\"+_vm._s(collection.date)+\" ⸱ \"+_vm._s(_vm.n('photos', '%n item', '%n photos and videos', collection.nbItems,))+\"\\n\\t\\t\\t\"),_c('br'),_vm._v(\"\\n\\t\\t\\t\"+_vm._s(_vm.t('photos', 'Shared by'))+\" \"),_c('NcUserBubble',{attrs:{\"display-name\":collection.collaborators[0].label,\"user\":collection.collaborators[0].id}})],1)])}}])},[_c('HeaderNavigation',{key:\"navigation\",attrs:{\"slot\":\"header\",\"loading\":_vm.loadingAlbums,\"title\":_vm.t('photos', 'Shared albums'),\"root-title\":_vm.t('photos', 'Shared albums')},on:{\"refresh\":_vm.fetchAlbums},slot:\"header\"}),_vm._v(\" \"),_vm._v(\" \"),_c('NcEmptyContent',{attrs:{\"slot\":\"empty-collections-list\",\"title\":_vm.t('photos', 'There is no album yet!')},slot:\"empty-collections-list\"},[_c('FolderMultipleImage',{attrs:{\"slot\":\"icon\"},slot:\"icon\"})],1)],1)\n}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","<!--\n - @copyright Copyright (c) 2022 Louis Chemineau <louis@chmn.me>\n -\n - @author Louis Chemineau <louis@chmn.me>\n -\n - @license AGPL-3.0-or-later\n -\n - This program is free software: you can redistribute it and/or modify\n - it under the terms of the GNU Affero General Public License as\n - published by the Free Software Foundation, either version 3 of the\n - License, or (at your option) any later version.\n -\n - This program is distributed in the hope that it will be useful,\n - but WITHOUT ANY WARRANTY; without even the implied warranty of\n - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n - GNU Affero General Public License for more details.\n -\n - You should have received a copy of the GNU Affero General Public License\n - along with this program. If not, see <http://www.gnu.org/licenses/>.\n -\n -->\n<template>\n\t<CollectionsList :collections=\"sharedAlbums\"\n\t\t:loading=\"loadingAlbums\"\n\t\t:error=\"errorFetchingAlbums\"\n\t\tclass=\"albums-list\">\n\t\t<HeaderNavigation key=\"navigation\"\n\t\t\tslot=\"header\"\n\t\t\t:loading=\"loadingAlbums\"\n\t\t\t:title=\"t('photos', 'Shared albums')\"\n\t\t\t:root-title=\"t('photos', 'Shared albums')\"\n\t\t\t@refresh=\"fetchAlbums\" />\n\n\t\t<CollectionCover :key=\"collection.basename\"\n\t\t\tslot-scope=\"{collection}\"\n\t\t\t:link=\"`/sharedalbums/${collection.basename}`\"\n\t\t\t:alt-img=\"t('photos', 'Cover photo for shared album {albumName}.', { albumName: collection.basename })\"\n\t\t\t:data-test=\"collection.basename\"\n\t\t\t:cover-url=\"collection.lastPhoto | coverUrl\">\n\t\t\t<h2 class=\"album__name\">\n\t\t\t\t{{ collection | albumOriginalName }}\n\t\t\t</h2>\n\n\t\t\t<div slot=\"subtitle\" class=\"album__details\">\n\t\t\t\t{{ collection.date }} ⸱ {{ n('photos', '%n item', '%n photos and videos', collection.nbItems,) }}\n\t\t\t\t<br>\n\t\t\t\t{{ t('photos', 'Shared by') }}&nbsp;<NcUserBubble :display-name=\"collection.collaborators[0].label\" :user=\"collection.collaborators[0].id\" />\n\t\t\t</div>\n\t\t</CollectionCover>\n\n\t\t<NcEmptyContent slot=\"empty-collections-list\" :title=\"t('photos', 'There is no album yet!')\">\n\t\t\t<FolderMultipleImage slot=\"icon\" />\n\t\t</NcEmptyContent>\n\t</CollectionsList>\n</template>\n\n<script>\nimport FolderMultipleImage from 'vue-material-design-icons/FolderMultipleImage.vue'\n\nimport { generateUrl } from '@nextcloud/router'\nimport { NcEmptyContent, NcUserBubble } from '@nextcloud/vue'\n\nimport FetchSharedAlbumsMixin from '../mixins/FetchSharedAlbumsMixin.js'\nimport CollectionsList from '../components/Collection/CollectionsList.vue'\nimport CollectionCover from '../components/Collection/CollectionCover.vue'\nimport HeaderNavigation from '../components/HeaderNavigation.vue'\nimport { translate, translatePlural } from '@nextcloud/l10n'\n\nexport default {\n\tname: 'SharedAlbums',\n\tcomponents: {\n\t\tFolderMultipleImage,\n\t\tNcEmptyContent,\n\t\tCollectionsList,\n\t\tCollectionCover,\n\t\tHeaderNavigation,\n\t\tNcUserBubble,\n\t},\n\n\tfilters: {\n\t\t/**\n\t\t * @param {string} lastPhoto The album's last photos.\n\t\t * @return {string}\n\t\t */\n\t\tcoverUrl(lastPhoto) {\n\t\t\tif (lastPhoto === -1) {\n\t\t\t\treturn ''\n\t\t\t}\n\n\t\t\treturn generateUrl(`/apps/photos/api/v1/preview/${lastPhoto}?x=${512}&y=${512}`)\n\t\t},\n\n\t\t/**\n\t\t * @param {import('../services/Albums.js').Album} album The album's full name, including the userid.\n\t\t * @return {string} The album name without the userId between parentheses.\n\t\t */\n\t\talbumOriginalName(album) {\n\t\t\treturn album.basename.replace(new RegExp(`\\\\(${album.collaborators[0].id}\\\\)$`), '')\n\t\t},\n\t},\n\n\tmixins: [\n\t\tFetchSharedAlbumsMixin,\n\t],\n\n\tmethods: {\n\t\tt: translate,\n\t\tn: translatePlural,\n\t},\n}\n</script>\n<style lang=\"scss\" scoped>\n.albums-list {\n\tdisplay: flex;\n\tflex-direction: column;\n\n\t.album__name {\n\t\tfont-weight: normal;\n\t\toverflow: hidden;\n\t\twhite-space: nowrap;\n\t\ttext-overflow: ellipsis;\n\t}\n}\n</style>\n","import mod from \"-!../../node_modules/babel-loader/lib/index.js!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./SharedAlbums.vue?vue&type=script&lang=js\"; export default mod; export * from \"-!../../node_modules/babel-loader/lib/index.js!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./SharedAlbums.vue?vue&type=script&lang=js\"","\n import API from \"!../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\";\n import domAPI from \"!../../node_modules/style-loader/dist/runtime/styleDomAPI.js\";\n import insertFn from \"!../../node_modules/style-loader/dist/runtime/insertBySelector.js\";\n import setAttributes from \"!../../node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js\";\n import insertStyleElement from \"!../../node_modules/style-loader/dist/runtime/insertStyleElement.js\";\n import styleTagTransformFn from \"!../../node_modules/style-loader/dist/runtime/styleTagTransform.js\";\n import content, * as namedExport from \"!!../../node_modules/css-loader/dist/cjs.js!../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../node_modules/postcss-loader/dist/cjs.js!../../node_modules/sass-loader/dist/cjs.js??clonedRuleSet-2.use[3]!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./SharedAlbums.vue?vue&type=style&index=0&id=10a1f9c9&prod&lang=scss&scoped=true\";\n \n \n\nvar options = {};\n\noptions.styleTagTransform = styleTagTransformFn;\noptions.setAttributes = setAttributes;\n\n options.insert = insertFn.bind(null, \"head\");\n \noptions.domAPI = domAPI;\noptions.insertStyleElement = insertStyleElement;\n\nvar update = API(content, options);\n\n\n\nexport * from \"!!../../node_modules/css-loader/dist/cjs.js!../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../node_modules/postcss-loader/dist/cjs.js!../../node_modules/sass-loader/dist/cjs.js??clonedRuleSet-2.use[3]!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./SharedAlbums.vue?vue&type=style&index=0&id=10a1f9c9&prod&lang=scss&scoped=true\";\n export default content && content.locals ? content.locals : undefined;\n","import { render, staticRenderFns } from \"./SharedAlbums.vue?vue&type=template&id=10a1f9c9&scoped=true\"\nimport script from \"./SharedAlbums.vue?vue&type=script&lang=js\"\nexport * from \"./SharedAlbums.vue?vue&type=script&lang=js\"\nimport style0 from \"./SharedAlbums.vue?vue&type=style&index=0&id=10a1f9c9&prod&lang=scss&scoped=true\"\n\n\n/* normalize component */\nimport normalizer from \"!../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n \"10a1f9c9\",\n null\n \n)\n\nexport default component.exports"],"names":["name","data","errorFetchingAlbums","loadingAlbums","mixins","AbortControllerMixin","async","this","fetchAlbums","computed","mapGetters","methods","mapActions","_getCurrentUser","albums","concat","getCurrentUser","uid","abortController","signal","addSharedAlbums","error","_error$response","response","status","___CSS_LOADER_EXPORT___","push","module","id","components","FolderMultipleImage","NcEmptyContent","CollectionsList","CollectionCover","HeaderNavigation","NcUserBubble","filters","coverUrl","lastPhoto","generateUrl","albumOriginalName","album","basename","replace","RegExp","collaborators","FetchSharedAlbumsMixin","t","translate","n","translatePlural","options","styleTagTransform","setAttributes","insert","domAPI","insertStyleElement","_vm","_c","_self","staticClass","attrs","sharedAlbums","scopedSlots","_u","key","fn","_ref","collection","albumName","_f","_v","_s","slot","date","nbItems","label","on"],"sourceRoot":""}