diff --git a/booklore-ui/src/app/features/book/components/book-browser/book-browser.component.html b/booklore-ui/src/app/features/book/components/book-browser/book-browser.component.html index 889cf997f..669dc6cdf 100644 --- a/booklore-ui/src/app/features/book/components/book-browser/book-browser.component.html +++ b/booklore-ui/src/app/features/book/components/book-browser/book-browser.component.html @@ -312,6 +312,7 @@ [isSeriesCollapsed]="seriesCollapseFilter.isSeriesCollapsed" (checkboxClick)="onCheckboxClicked($event)" [isSelected]="selectedBooks.has(book.id)" + [useSquareCovers]="isAudiobookOnlyLibrary" [overlayPreferenceService]="bookCardOverlayPreferenceService"> diff --git a/booklore-ui/src/app/features/book/components/book-browser/book-browser.component.ts b/booklore-ui/src/app/features/book/components/book-browser/book-browser.component.ts index defe0ced8..61df836ee 100644 --- a/booklore-ui/src/app/features/book/components/book-browser/book-browser.component.ts +++ b/booklore-ui/src/app/features/book/components/book-browser/book-browser.component.ts @@ -196,7 +196,7 @@ export class BookBrowserComponent implements OnInit, AfterViewInit, OnDestroy { const totalGaps = (columns - 1) * this.MOBILE_GAP; const availableWidth = this.screenWidth - totalGaps - this.MOBILE_PADDING; const cardWidth = Math.floor(availableWidth / columns); - const coverHeight = Math.floor(cardWidth * this.CARD_ASPECT_RATIO); + const coverHeight = this.isAudiobookOnlyLibrary ? cardWidth : Math.floor(cardWidth * this.CARD_ASPECT_RATIO); const cardHeight = coverHeight + this.MOBILE_TITLE_BAR_HEIGHT; return {width: cardWidth, height: cardHeight}; } @@ -209,23 +209,31 @@ export class BookBrowserComponent implements OnInit, AfterViewInit, OnDestroy { if (this.isMobile) { return this.mobileCardSize; } - return this.coverScalePreferenceService.currentCardSize; + const base = this.coverScalePreferenceService.currentCardSize; + if (this.isAudiobookOnlyLibrary) { + const squareSide = Math.round(base.width * 1.1); + return { width: squareSide, height: squareSide + 31 }; + } + return base; } get gridColumnMinWidth(): string { if (this.isMobile) { return `${this.mobileCardSize.width}px`; } + if (this.isAudiobookOnlyLibrary) { + return `${this.currentCardSize.width}px`; + } return this.coverScalePreferenceService.gridColumnMinWidth; } getCardHeight(_book: Book): number { - // Use uniform height for all book types to ensure smooth virtual scrolling. - // Mixed heights cause choppy/jumpy scrolling because the virtual scroller - // cannot accurately estimate positions when item heights vary. if (this.isMobile) { return this.mobileCardSize.height; } + if (this.isAudiobookOnlyLibrary) { + return this.currentCardSize.height; + } return this.coverScalePreferenceService.getCardHeight(_book); } @@ -267,6 +275,12 @@ export class BookBrowserComponent implements OnInit, AfterViewInit, OnDestroy { : filterSummary; } + get isAudiobookOnlyLibrary(): boolean { + if (!this.entity || this.entityType !== EntityType.LIBRARY) return false; + const library = this.entity as Library; + return !!library.allowedFormats && library.allowedFormats.length === 1 && library.allowedFormats[0] === 'AUDIOBOOK'; + } + get seriesViewEnabled(): boolean { return Boolean(this.userService.getCurrentUser()?.userSettings?.enableSeriesView); } diff --git a/booklore-ui/src/app/features/book/components/book-browser/book-card/book-card.component.html b/booklore-ui/src/app/features/book/components/book-browser/book-card/book-card.component.html index 7df34472d..e74f42775 100644 --- a/booklore-ui/src/app/features/book/components/book-browser/book-card/book-card.component.html +++ b/booklore-ui/src/app/features/book/components/book-browser/book-card/book-card.component.html @@ -2,12 +2,12 @@ [class.selected]="isSelected" (click)="onCardClick($event)"> -
+
; @@ -138,7 +139,7 @@ export class BookCardComponent implements OnInit, OnChanges, OnDestroy { } ngOnChanges(changes: SimpleChanges): void { - if (changes['book'] || changes['forceEbookMode']) { + if (changes['book'] || changes['forceEbookMode'] || changes['useSquareCovers']) { this.computeAllMemoizedValues(); if (changes['book'] && !changes['book'].firstChange && this.menuInitialized) { this.additionalFilesLoaded = false;