feat(webui): sort books within a series by last modified date or read date

This commit is contained in:
Gauthier Roebroeck 2025-02-19 15:49:10 +08:00
parent ef01550367
commit 1f852dbce9
2 changed files with 10 additions and 0 deletions

View file

@ -133,6 +133,12 @@ export class BookItem extends Item<BookDto> {
} else {
text = i18n.t('book_card.unread')
}
} else if (context.includes(ItemContext.DATE_UPDATED)) {
text = new Intl.DateTimeFormat(i18n.locale, {dateStyle: 'medium'} as Intl.DateTimeFormatOptions).format(this.item.lastModified)
title = new Intl.DateTimeFormat(i18n.locale, {
dateStyle: 'long',
timeStyle: 'medium',
} as Intl.DateTimeFormatOptions).format(this.item.lastModified)
} else if (context.includes(ItemContext.FILE_SIZE))
text = getFileSize(this.item.sizeBytes)
else

View file

@ -639,6 +639,8 @@ export default Vue.extend({
itemContext(): ItemContext[] {
if (this.sortActive.key === 'metadata.releaseDate') return [ItemContext.RELEASE_DATE]
if (this.sortActive.key === 'createdDate') return [ItemContext.DATE_ADDED]
if (this.sortActive.key === 'lastModifiedDate') return [ItemContext.DATE_UPDATED]
if (this.sortActive.key === 'readProgress.readDate') return [ItemContext.READ_DATE]
if (this.sortActive.key === 'fileSize') return [ItemContext.FILE_SIZE]
return []
},
@ -646,7 +648,9 @@ export default Vue.extend({
return [
{name: this.$t('sort.number').toString(), key: 'metadata.numberSort'},
{name: this.$t('sort.date_added').toString(), key: 'createdDate'},
{name: this.$t('sort.date_updated').toString(), key: 'lastModifiedDate'},
{name: this.$t('sort.release_date').toString(), key: 'metadata.releaseDate'},
{name: this.$t('sort.date_read').toString(), key: 'readProgress.readDate'},
{name: this.$t('sort.file_size').toString(), key: 'fileSize'},
{name: this.$t('sort.file_name').toString(), key: 'name'},
{name: this.$t('sort.page_count').toString(), key: 'media.pagesCount'},