From 6087e5fb0a8a6c51af3d60079bcaf1a23f8fc9b1 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Wed, 26 Oct 2022 22:25:04 -0700 Subject: [PATCH] Port album picker --- src/components/SelectionManager.vue | 16 ++ src/components/modal/AddToAlbumModal.vue | 63 ++++++++ src/components/modal/AlbumPicker.vue | 180 +++++++++++++++++++++++ 3 files changed, 259 insertions(+) create mode 100644 src/components/modal/AddToAlbumModal.vue create mode 100644 src/components/modal/AlbumPicker.vue diff --git a/src/components/SelectionManager.vue b/src/components/SelectionManager.vue index 72d1ae9a..87f5bb27 100644 --- a/src/components/SelectionManager.vue +++ b/src/components/SelectionManager.vue @@ -27,6 +27,7 @@ + @@ -45,6 +46,7 @@ import { getCurrentUser } from '@nextcloud/auth'; import * as dav from "../services/DavRequests"; import EditDate from "./modal/EditDate.vue" import FaceMoveModal from "./modal/FaceMoveModal.vue" +import AddToAlbumModal from "./modal/AddToAlbumModal.vue" import StarIcon from 'vue-material-design-icons/Star.vue'; import DownloadIcon from 'vue-material-design-icons/Download.vue'; @@ -55,6 +57,7 @@ import UnarchiveIcon from 'vue-material-design-icons/PackageUp.vue'; import OpenInNewIcon from 'vue-material-design-icons/OpenInNew.vue'; import CloseIcon from 'vue-material-design-icons/Close.vue'; import MoveIcon from 'vue-material-design-icons/ImageMove.vue'; +import AlbumsIcon from 'vue-material-design-icons/ImageAlbum.vue'; type Selection = Map; @@ -64,6 +67,7 @@ type Selection = Map; NcActionButton, EditDate, FaceMoveModal, + AddToAlbumModal, CloseIcon, }, @@ -126,6 +130,11 @@ export default class SelectionHandler extends Mixins(GlobalMixin, UserConfig) { callback: this.viewInFolder.bind(this), if: () => this.selection.size === 1, }, + { + name: t('memories', 'Add to album'), + icon: AlbumsIcon, + callback: this.addToAlbum.bind(this), + }, { name: t('memories', 'Move to another person'), icon: MoveIcon, @@ -335,6 +344,13 @@ export default class SelectionHandler extends Mixins(GlobalMixin, UserConfig) { return this.$route.name === 'archive'; } + /** + * Move selected photos to album + */ + private async addToAlbum(selection: Selection) { + (this.$refs.addToAlbumModal).open(Array.from(selection.values())); + } + /** * Move selected photos to another person */ diff --git a/src/components/modal/AddToAlbumModal.vue b/src/components/modal/AddToAlbumModal.vue new file mode 100644 index 00000000..bdcf12fa --- /dev/null +++ b/src/components/modal/AddToAlbumModal.vue @@ -0,0 +1,63 @@ + + + + + \ No newline at end of file diff --git a/src/components/modal/AlbumPicker.vue b/src/components/modal/AlbumPicker.vue new file mode 100644 index 00000000..0aee3127 --- /dev/null +++ b/src/components/modal/AlbumPicker.vue @@ -0,0 +1,180 @@ + + + + + + \ No newline at end of file