Bugfixes (#1004)
* Refactored the code for choosing the tab to select when updates occur or first load. Specials will no longer be auto-selected if present. We will always try to select Storyline. * Fixed a bug where marking a chapter as unread was actually making it read * When loading a book, put a spinner in the action bar * Fixed an issue with last page not getting marked as read with epubs due to a bugfix from last release * Removed some debug code
This commit is contained in:
parent
6fadbb5231
commit
868eb70506
5 changed files with 96 additions and 50 deletions
|
|
@ -63,7 +63,7 @@
|
|||
<div>
|
||||
<app-bulk-operations [actionCallback]="bulkActionCallback"></app-bulk-operations>
|
||||
<ul ngbNav #nav="ngbNav" [(activeId)]="activeTabId" class="nav-tabs nav-pills" [destroyOnHide]="false" (navChange)="onNavChange($event)">
|
||||
<li [ngbNavItem]="1" *ngIf="hasSpecials">
|
||||
<li [ngbNavItem]="TabID.Specials" *ngIf="hasSpecials">
|
||||
<a ngbNavLink>Specials</a>
|
||||
<ng-template ngbNavContent>
|
||||
<div class="row no-gutters">
|
||||
|
|
@ -75,7 +75,7 @@
|
|||
</div>
|
||||
</ng-template>
|
||||
</li>
|
||||
<li [ngbNavItem]="2" *ngIf="libraryType !== LibraryType.Book && (hasNonSpecialVolumeChapters || hasNonSpecialNonVolumeChapters)">
|
||||
<li [ngbNavItem]="TabID.Storyline" *ngIf="libraryType !== LibraryType.Book && (hasNonSpecialVolumeChapters || hasNonSpecialNonVolumeChapters)">
|
||||
<a ngbNavLink>Storyline</a>
|
||||
<ng-template ngbNavContent>
|
||||
<div class="row no-gutters">
|
||||
|
|
@ -92,7 +92,7 @@
|
|||
</div>
|
||||
</ng-template>
|
||||
</li>
|
||||
<li [ngbNavItem]="3" *ngIf="hasNonSpecialVolumeChapters">
|
||||
<li [ngbNavItem]="TabID.Volumes" *ngIf="hasNonSpecialVolumeChapters">
|
||||
<a ngbNavLink>Volumes</a>
|
||||
<ng-template ngbNavContent>
|
||||
<div class="row no-gutters">
|
||||
|
|
@ -104,7 +104,7 @@
|
|||
</div>
|
||||
</ng-template>
|
||||
</li>
|
||||
<li [ngbNavItem]="4" *ngIf="hasNonSpecialNonVolumeChapters">
|
||||
<li [ngbNavItem]="TabID.Chapters" *ngIf="hasNonSpecialNonVolumeChapters">
|
||||
<a ngbNavLink>{{utilityService.formatChapterName(libraryType) + 's'}}</a>
|
||||
<ng-template ngbNavContent>
|
||||
<div class="row no-gutters">
|
||||
|
|
|
|||
|
|
@ -33,6 +33,13 @@ import { ReaderService } from '../_services/reader.service';
|
|||
import { SeriesService } from '../_services/series.service';
|
||||
|
||||
|
||||
enum TabID {
|
||||
Specials = 1,
|
||||
Storyline = 2,
|
||||
Volumes = 3,
|
||||
Chapters = 4
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'app-series-detail',
|
||||
templateUrl: './series-detail.component.html',
|
||||
|
|
@ -61,7 +68,7 @@ export class SeriesDetailComponent implements OnInit, OnDestroy {
|
|||
|
||||
hasSpecials = false;
|
||||
specials: Array<Chapter> = [];
|
||||
activeTabId = 2;
|
||||
activeTabId = TabID.Storyline;
|
||||
hasNonSpecialVolumeChapters = false;
|
||||
hasNonSpecialNonVolumeChapters = false;
|
||||
|
||||
|
|
@ -148,6 +155,10 @@ export class SeriesDetailComponent implements OnInit, OnDestroy {
|
|||
return TagBadgeCursor;
|
||||
}
|
||||
|
||||
get TabID(): typeof TabID {
|
||||
return TabID;
|
||||
}
|
||||
|
||||
constructor(private route: ActivatedRoute, private seriesService: SeriesService,
|
||||
private router: Router, public bulkSelectionService: BulkSelectionService,
|
||||
private modalService: NgbModal, public readerService: ReaderService,
|
||||
|
|
@ -383,31 +394,7 @@ export class SeriesDetailComponent implements OnInit, OnDestroy {
|
|||
});
|
||||
}
|
||||
|
||||
// This shows Chapters/Issues tab
|
||||
// If this has chapters that are not specials
|
||||
if (this.chapters.filter(c => !c.isSpecial).length > 0) {
|
||||
if (this.utilityService.formatChapterName(this.libraryType) == 'Book') {
|
||||
this.activeTabId = 4;
|
||||
}
|
||||
this.hasNonSpecialNonVolumeChapters = true;
|
||||
}
|
||||
|
||||
// This shows Volumes tab
|
||||
if (this.volumes.filter(v => v.number !== 0).length !== 0) {
|
||||
if (this.utilityService.formatChapterName(this.libraryType) == 'Book') {
|
||||
this.activeTabId = 3;
|
||||
}
|
||||
this.hasNonSpecialVolumeChapters = true;
|
||||
}
|
||||
|
||||
// If an update occured and we were on specials, re-activate Volumes/Chapters
|
||||
if (!this.hasSpecials && !this.hasNonSpecialVolumeChapters && this.activeTabId != 2) {
|
||||
this.activeTabId = 3;
|
||||
}
|
||||
|
||||
if (this.hasSpecials) {
|
||||
this.activeTabId = 1;
|
||||
}
|
||||
this.updateSelectedTab();
|
||||
|
||||
this.isLoading = false;
|
||||
});
|
||||
|
|
@ -416,6 +403,36 @@ export class SeriesDetailComponent implements OnInit, OnDestroy {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* This will update the selected tab
|
||||
*
|
||||
* This assumes loadPage() has already primed all the calculations and state variables. Do not call directly.
|
||||
*/
|
||||
updateSelectedTab() {
|
||||
// This shows Chapters/Issues tab
|
||||
|
||||
// If this has chapters that are not specials
|
||||
if (this.chapters.filter(c => !c.isSpecial).length > 0) {
|
||||
this.hasNonSpecialNonVolumeChapters = true;
|
||||
}
|
||||
|
||||
// This shows Volumes tab
|
||||
if (this.volumes.filter(v => v.number !== 0).length !== 0) {
|
||||
this.hasNonSpecialVolumeChapters = true;
|
||||
}
|
||||
|
||||
// If an update occured and we were on specials, re-activate Volumes/Chapters
|
||||
if (!this.hasSpecials && !this.hasNonSpecialVolumeChapters && this.activeTabId != TabID.Storyline) {
|
||||
this.activeTabId = TabID.Storyline;
|
||||
}
|
||||
|
||||
if (this.hasNonSpecialVolumeChapters || this.hasNonSpecialNonVolumeChapters) {
|
||||
this.activeTabId = TabID.Storyline;
|
||||
} else {
|
||||
this.activeTabId = TabID.Specials;
|
||||
}
|
||||
}
|
||||
|
||||
createHTML() {
|
||||
this.userReview = (this.series.userReview === null ? '' : this.series.userReview).replace(/\n/g, '<br>');
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue