Add a user-facing option to enable or disable series view (#1748)

This commit is contained in:
Aditya Chandel
2025-12-03 21:17:06 -07:00
committed by GitHub
parent 9b6079a3b5
commit f22f9bd1e0
15 changed files with 106 additions and 28 deletions
@@ -262,7 +262,7 @@
[index]="books.indexOf(book)"
[book]="book"
[isCheckboxEnabled]="true"
[readButtonHidden]="!!book.seriesCount"
[seriesViewEnabled]="seriesViewEnabled"
[onBookSelect]="handleBookSelect.bind(this)"
[isSeriesCollapsed]="seriesCollapseFilter.isSeriesCollapsed"
(checkboxClick)="onCheckboxClicked($event)"
@@ -841,4 +841,8 @@ export class BookBrowserComponent implements OnInit, AfterViewInit {
})
);
}
get seriesViewEnabled(): boolean {
return Boolean(this.userService.getCurrentUser()?.userSettings?.enableSeriesView);
}
}
@@ -4,11 +4,11 @@
(mouseout)="isHovered = false"
(click)="onCardClick($event)">
<div class="cover-container" [ngClass]="{ 'shimmer': !isImageLoaded, 'center-info-btn': readButtonHidden }">
<div class="cover-container" [ngClass]="{ 'shimmer': !isImageLoaded, 'center-info-btn': isSeriesViewActive() }">
<div
class="cover-container"
[ngClass]="{
'center-info-btn': readButtonHidden,
'center-info-btn': isSeriesViewActive(),
'loaded': isImageLoaded
}">
<img
@@ -32,13 +32,13 @@
</div>
}
@if (book.seriesCount && book.seriesCount! >= 1) {
@if (isSeriesViewActive()) {
<p-button [rounded]="true" icon="pi pi-info" class="info-btn" (click)="openSeriesInfo()"></p-button>
} @else {
<p-button [rounded]="true" icon="pi pi-info" class="info-btn" (click)="openBookInfo(book)"></p-button>
}
<p-button [hidden]="readButtonHidden" [rounded]="true" icon="pi pi-book" class="read-btn" (click)="readBook(book)"></p-button>
<p-button [hidden]="isSeriesViewActive()" [rounded]="true" icon="pi pi-book" class="read-btn" (click)="readBook(book)"></p-button>
@if (isCheckboxEnabled) {
<p-checkbox
@@ -45,7 +45,7 @@ export class BookCardComponent implements OnInit, OnChanges, OnDestroy {
@Input() onBookSelect?: (bookId: number, selected: boolean) => void;
@Input() isSelected: boolean = false;
@Input() bottomBarHidden: boolean = false;
@Input() readButtonHidden: boolean = false;
@Input() seriesViewEnabled: boolean = false;
@Input() isSeriesCollapsed: boolean = false;
@ViewChild('checkboxElem') checkboxElem!: ElementRef<HTMLInputElement>;
@@ -768,4 +768,8 @@ export class BookCardComponent implements OnInit, OnChanges, OnDestroy {
shouldShowStatusIcon(): boolean {
return this.readStatusHelper.shouldShowStatusIcon(this.book.readStatus);
}
isSeriesViewActive(): boolean {
return this.seriesViewEnabled && !!this.book.seriesCount && this.book.seriesCount! >= 1;
}
}