From 9c883b5584493e4e34a0b8e1067da8793d97b89f Mon Sep 17 00:00:00 2001 From: Alexander Saltykov Date: Mon, 31 Jul 2023 18:04:27 +0300 Subject: [PATCH] Moves AlbumsList component to metadata tab, changes album picker behaviour (click to add, click checkmark icon to select) Signed-off-by: Alexander Saltykov --- src/App.vue | 24 ---------------- src/components/AlbumsList.vue | 41 +++++++++++++++++++--------- src/components/Metadata.vue | 6 ++++ src/components/modal/AlbumPicker.vue | 31 ++++++++++++++++++--- 4 files changed, 61 insertions(+), 41 deletions(-) diff --git a/src/App.vue b/src/App.vue index 2785667f..c2e61124 100644 --- a/src/App.vue +++ b/src/App.vue @@ -79,7 +79,6 @@ import Settings from './components/Settings.vue'; import FirstStart from './components/FirstStart.vue'; import Viewer from './components/viewer/Viewer.vue'; import Metadata from './components/Metadata.vue'; -import AlbumsList from './components/AlbumsList.vue'; import Sidebar from './components/Sidebar.vue'; import EditMetadataModal from './components/modal/EditMetadataModal.vue'; import NodeShareModal from './components/modal/NodeShareModal.vue'; @@ -145,7 +144,6 @@ export default defineComponent({ data: () => ({ navItems: [] as NavItem[], metadataComponent: null as any, - albumsListComponent: null as any, settingsOpen: false, }), @@ -275,28 +273,6 @@ export default defineComponent({ }, }) ); - // Register sidebar albums tab - globalThis.OCA?.Files?.Sidebar?.registerTab( - new globalThis.OCA.Files.Sidebar.Tab({ - id: 'memories-albums', - name: this.t('memories', 'Albums'), - icon: 'icon-details', - - mount(el, fileInfo, context) { - this.albumsListComponent?.$destroy?.(); - this.albumsListComponent = new Vue(AlbumsList as any); - this.albumsListComponent.$mount(el); - this.albumsListComponent.update(fileInfo); - }, - update(fileInfo) { - this.albumsListComponent.update(fileInfo); - }, - destroy() { - this.albumsListComponent?.$destroy?.(); - this.albumsListComponent = null; - }, - }) - ); // Check for native interface if (this.native) { diff --git a/src/components/AlbumsList.vue b/src/components/AlbumsList.vue index be8b3c34..8352f1f7 100644 --- a/src/components/AlbumsList.vue +++ b/src/components/AlbumsList.vue @@ -3,6 +3,17 @@
+ + + {{ t('memories', 'Add to album') }} + {{ t('memories', 'No albums') }} - - - {{ t('memories', 'Add to album') }} - @@ -61,9 +61,19 @@ Plus, AddToAlbumModal, }, + + props: { + fileid: { + type: Number, + required: true, + }, + filename: { + type: String, + required: true, + }, + }, data: () => ({ - fileid: -1, photo: {} as { id: number, name: string }, albums: [] as IAlbum[], loadingAlbums: false, @@ -71,12 +81,13 @@ mounted() { subscribe('files:file:updated', this.handleFileUpdated); + this.update({ id: this.$props.fileid, name: this.$props.filename }); }, beforeDestroy() { unsubscribe('files:file:updated', this.handleFileUpdated); }, - + methods: { update(photo: { id: number, name: string }){ this.photo = photo; @@ -184,6 +195,10 @@ justify-content: center; display: flex; } + + .new-album-button { + margin: auto; + } \ No newline at end of file diff --git a/src/components/Metadata.vue b/src/components/Metadata.vue index e24efdca..1453b9e8 100644 --- a/src/components/Metadata.vue +++ b/src/components/Metadata.vue @@ -38,6 +38,8 @@