Skip to content

Commit

Permalink
navigate through shared media with Viewer pagination
Browse files Browse the repository at this point in the history
Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>
  • Loading branch information
Antreesy committed Sep 20, 2023
1 parent 4da92c2 commit 2b2d8ba
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ import Tooltip from '@nextcloud/vue/dist/Directives/Tooltip.js'
import AudioPlayer from './AudioPlayer.vue'

import { useViewer } from '../../../../../composables/useViewer.js'
import { SHARED_ITEM } from '../../../../../constants.js'

const PREVIEW_TYPE = {
TEMPORARY: 0,
Expand Down Expand Up @@ -233,6 +234,11 @@ export default {
type: Boolean,
default: false,
},

sharedItemsType: {
type: String,
default: '',
},
},

emits: ['remove-file'],
Expand Down Expand Up @@ -473,7 +479,18 @@ export default {
event.preventDefault()

const fileInfo = this.generateViewerObject(this)
this.openViewer(this.internalAbsolutePath, [fileInfo], fileInfo)

if (this.isSharedItemsTab && this.sharedItemsType === SHARED_ITEM.TYPES.MEDIA) {
// Get available media files from store and put them to the list to navigate through slides
const mediaFiles = this.$store.getters.sharedItems(this.$store.getters.getToken())?.media
const list = Object.values(mediaFiles).reverse()
.map(item => this.generateViewerObject(item.messageParameters.file))

this.openViewer(this.internalAbsolutePath, list, fileInfo)
} else {
this.openViewer(this.internalAbsolutePath, [fileInfo], fileInfo)

}
},
},
}
Expand Down
1 change: 1 addition & 0 deletions src/components/RightSidebar/SharedItems/SharedItems.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
:key="item.id"
:small-preview="isList"
:row-layout="isList"
:shared-items-type="type"
:is-shared-items-tab="true"
v-bind="item.messageParameters.file" />
</template>
Expand Down

0 comments on commit 2b2d8ba

Please sign in to comment.