From c328f684a09c37de63c0e4e6b782de658ae13319 Mon Sep 17 00:00:00 2001 From: tjarls Date: Sun, 14 Aug 2022 14:40:46 +0100 Subject: [PATCH] Volume relative numbering (#1421) * Order issues by volume first is series detail * Display volume along with chapter in chapters tab * Move volume title to tooltip in card-item * Consolidate card-item tooltip into one variable. * Version as per comments --- API/Services/SeriesService.cs | 6 ++--- .../cards/card-item/card-item.component.ts | 27 ++++++++++--------- .../series-detail/series-detail.component.ts | 2 +- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/API/Services/SeriesService.cs b/API/Services/SeriesService.cs index 6abb8b581..f869ea12a 100644 --- a/API/Services/SeriesService.cs +++ b/API/Services/SeriesService.cs @@ -485,8 +485,7 @@ public class SeriesService : ISeriesService if (v.Number == 0) return c; c.VolumeTitle = v.Name; return c; - })).ToList(); - + }).OrderBy(c => float.Parse(c.Number), new ChapterSortComparer())); foreach (var chapter in chapters) { @@ -505,8 +504,7 @@ public class SeriesService : ISeriesService } else { retChapters = chapters - .Where(ShouldIncludeChapter) - .OrderBy(c => float.Parse(c.Number), new ChapterSortComparer()); + .Where(ShouldIncludeChapter); } var storylineChapters = volumes diff --git a/UI/Web/src/app/cards/card-item/card-item.component.ts b/UI/Web/src/app/cards/card-item/card-item.component.ts index 3da1df0d0..af731717a 100644 --- a/UI/Web/src/app/cards/card-item/card-item.component.ts +++ b/UI/Web/src/app/cards/card-item/card-item.component.ts @@ -75,8 +75,8 @@ export class CardItemComponent implements OnInit, OnDestroy { */ @Input() suppressArchiveWarning: boolean = false; /** - * The number of updates/items within the card. If less than 2, will not be shown. - */ + * The number of updates/items within the card. If less than 2, will not be shown. + */ @Input() count: number = 0; /** * Additional information to show on the overlay area. Will always render. @@ -99,10 +99,10 @@ export class CardItemComponent implements OnInit, OnDestroy { * Format of the entity (only applies to Series) */ format: MangaFormat = MangaFormat.UNKNOWN; - chapterTitle: string = ''; + tooltipTitle: string = this.title; /** - * This is the download we get from download service. + * This is the download we get from download service. */ download$: Observable | null = null; @@ -118,12 +118,6 @@ export class CardItemComponent implements OnInit, OnDestroy { private user: User | undefined; - get tooltipTitle() { - if (this.chapterTitle === '' || this.chapterTitle === null) return this.title; - return this.chapterTitle; - } - - get MangaFormat(): typeof MangaFormat { return MangaFormat; } @@ -158,14 +152,21 @@ export class CardItemComponent implements OnInit, OnDestroy { this.format = (this.entity as Series).format; if (this.utilityService.isChapter(this.entity)) { - this.chapterTitle = this.utilityService.asChapter(this.entity).titleName; + const chapterTitle = this.utilityService.asChapter(this.entity).titleName; + if (chapterTitle === '' || chapterTitle === null) { + this.tooltipTitle = (this.utilityService.asChapter(this.entity).volumeTitle + ' ' + this.title).trim(); + } else { + this.tooltipTitle = chapterTitle; + } } else if (this.utilityService.isVolume(this.entity)) { const vol = this.utilityService.asVolume(this.entity); if (vol.chapters !== undefined && vol.chapters.length > 0) { - this.chapterTitle = vol.chapters[0].titleName; + this.tooltipTitle = vol.chapters[0].titleName; + } + if (this.tooltipTitle === '') { + this.tooltipTitle = vol.name; } } - this.accountService.currentUser$.pipe(takeUntil(this.onDestroy)).subscribe(user => { this.user = user; }); diff --git a/UI/Web/src/app/series-detail/series-detail.component.ts b/UI/Web/src/app/series-detail/series-detail.component.ts index d2084308e..8967929d3 100644 --- a/UI/Web/src/app/series-detail/series-detail.component.ts +++ b/UI/Web/src/app/series-detail/series-detail.component.ts @@ -125,7 +125,7 @@ export class SeriesDetailComponent implements OnInit, OnDestroy, AfterContentChe /** * Track by function for Chapter to tell when to refresh card data */ - trackByChapterIdentity = (index: number, item: Chapter) => `${item.title}_${item.number}_${item.pagesRead}`; + trackByChapterIdentity = (index: number, item: Chapter) => `${item.title}_${item.number}_${item.volumeId}_${item.pagesRead}`; trackByRelatedSeriesIdentiy = (index: number, item: RelatedSeris) => `${item.series.name}_${item.series.libraryId}_${item.series.pagesRead}_${item.relation}`; trackByStoryLineIdentity = (index: number, item: StoryLineItem) => { if (item.isChapter) {