Skip to content

Commit

Permalink
Order collections files by taken date
Browse files Browse the repository at this point in the history
Signed-off-by: Louis Chemineau <[email protected]>
  • Loading branch information
artonge committed Jan 2, 2024
1 parent dd266f2 commit 0390e5b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/components/Collection/CollectionContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@
:reset-selection="resetSelection" />

<!-- No content -->
<slot v-if="collectionFileIds.length === 0 && !loading" name="empty-content" />
<slot v-if="sortedCollectionFileIds.length === 0 && !loading" name="empty-content" />

<!-- Media list -->
<FilesListViewer v-if="collection !== undefined"
:container-element="appContent"
class="collection__media"
:file-ids="collectionFileIds"
:file-ids="sortedCollectionFileIds"
:base-height="isMobile ? 120 : 200"
:loading="loading">
<File slot-scope="{file, distance}"
Expand Down Expand Up @@ -125,14 +125,18 @@ export default {
files() {
return this.$store.getters.files
},
sortedCollectionFileIds() {
return this.collectionFileIds.toSorted((fileId1, fileId2) => this.files[fileId1].timestamp < this.files[fileId2].timestamp ? -1 : 1)
},
},
methods: {
openViewer(fileId) {
const file = this.files[fileId]
OCA.Viewer.open({
fileInfo: file,
list: this.collectionFileIds.map(fileId => this.files[fileId]).filter(file => !file.sectionHeader),
list: this.sortedCollectionFileIds.map(fileId => this.files[fileId]).filter(file => !file.sectionHeader),
loadMore: file.loadMore ? async () => await file.loadMore(true) : () => [],
canLoop: file.canLoop,
})
Expand Down

0 comments on commit 0390e5b

Please sign in to comment.