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 749ecc922..e7fd54092 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
@@ -111,20 +111,43 @@
-
-
-
-
-
- {{ coverScalePreferenceService.scaleFactor.toFixed(2) }}x
+ @if (isMobile) {
+
+
+
+
+
+
+
-
+ } @else {
+
+
+
+
+
+ {{ coverScalePreferenceService.scaleFactor.toFixed(2) }}x
+
+
+ }
| undefined;
@@ -136,6 +138,14 @@ export class BookBrowserComponent implements OnInit, AfterViewInit {
currentViewMode: string | undefined;
lastAppliedSort: SortOption | null = null;
showFilter = false;
+ screenWidth = typeof window !== 'undefined' ? window.innerWidth : 1024;
+ mobileColumnCount = 3;
+
+ private readonly MOBILE_BREAKPOINT = 768;
+ private readonly CARD_ASPECT_RATIO = 7 / 5; // height / width (from aspect-ratio: 5/7)
+ private readonly MOBILE_GAP = 16; // 1rem in px
+ private readonly MOBILE_PADDING = 16; // 0.5rem * 2 sides
+ private readonly MOBILE_COLUMNS_STORAGE_KEY = 'mobileColumnsPreference';
private settingFiltersFromUrl = false;
protected metadataMenuItems: MenuItem[] | undefined;
@@ -152,15 +162,40 @@ export class BookBrowserComponent implements OnInit, AfterViewInit {
@ViewChild(BookFilterComponent, {static: false})
bookFilterComponent!: BookFilterComponent;
+ @HostListener('window:resize')
+ onResize(): void {
+ this.screenWidth = window.innerWidth;
+ }
+
+ get isMobile(): boolean {
+ return this.screenWidth < this.MOBILE_BREAKPOINT;
+ }
+
+ get mobileCardSize(): { width: number; height: number } {
+ const columns = this.mobileColumnCount;
+ const totalGaps = (columns - 1) * this.MOBILE_GAP;
+ const totalPadding = this.MOBILE_PADDING * 2;
+ const availableWidth = this.screenWidth - totalGaps - totalPadding;
+ const cardWidth = Math.floor(availableWidth / columns);
+ const cardHeight = Math.floor(cardWidth * this.CARD_ASPECT_RATIO);
+ return { width: cardWidth, height: cardHeight };
+ }
+
get selectedBooks(): Set {
return this.bookSelectionService.selectedBooks;
}
get currentCardSize() {
+ if (this.isMobile) {
+ return this.mobileCardSize;
+ }
return this.coverScalePreferenceService.currentCardSize;
}
get gridColumnMinWidth(): string {
+ if (this.isMobile) {
+ return `${this.mobileCardSize.width}px`;
+ }
return this.coverScalePreferenceService.gridColumnMinWidth;
}
@@ -217,6 +252,7 @@ export class BookBrowserComponent implements OnInit, AfterViewInit {
ngOnInit(): void {
this.pageTitle.setPageTitle('');
this.coverScalePreferenceService.scaleChange$.pipe(debounceTime(1000)).subscribe();
+ this.loadMobileColumnsPreference();
this.initializeEntityRouting();
this.setupRouteChangeHandlers();
@@ -704,4 +740,16 @@ export class BookBrowserComponent implements OnInit, AfterViewInit {
this.bookSorter.selectedSort!
);
}
+
+ setMobileColumns(columns: number): void {
+ this.mobileColumnCount = columns;
+ this.localStorageService.set(this.MOBILE_COLUMNS_STORAGE_KEY, columns);
+ }
+
+ private loadMobileColumnsPreference(): void {
+ const saved = this.localStorageService.get(this.MOBILE_COLUMNS_STORAGE_KEY);
+ if (saved !== null && [2, 3, 4].includes(saved)) {
+ this.mobileColumnCount = saved;
+ }
+ }
}
diff --git a/booklore-ui/src/app/features/book/components/book-browser/book-card/book-card.component.scss b/booklore-ui/src/app/features/book/components/book-browser/book-card/book-card.component.scss
index 595e06039..7a4c01036 100644
--- a/booklore-ui/src/app/features/book/components/book-browser/book-card/book-card.component.scss
+++ b/booklore-ui/src/app/features/book/components/book-browser/book-card/book-card.component.scss
@@ -67,6 +67,11 @@
text-align: center;
margin: 0;
padding-left: 0.5rem;
+
+ @media (max-width: 767px) {
+ font-size: 0.75rem;
+ padding-left: 0.25rem;
+ }
}
.info-btn,
@@ -79,6 +84,31 @@
transition: opacity 0.15s ease, visibility 0.15s ease;
z-index: 2;
will-change: opacity, visibility;
+
+ ::ng-deep .p-button {
+ box-shadow:
+ 0 2px 8px rgba(0, 0, 0, 0.4),
+ inset 0 1px 0 rgba(255, 255, 255, 0.15);
+ border: 1px solid rgba(255, 255, 255, 0.1);
+ transition: transform 0.15s ease, box-shadow 0.15s ease;
+
+ &:hover {
+ transform: scale(1.08);
+ box-shadow:
+ 0 4px 12px rgba(0, 0, 0, 0.5),
+ inset 0 1px 0 rgba(255, 255, 255, 0.2);
+ }
+
+ @media (max-width: 767px) {
+ width: clamp(1.5rem, 8vw, 2.5rem);
+ height: clamp(1.5rem, 8vw, 2.5rem);
+ padding: 0;
+
+ .pi {
+ font-size: clamp(0.65rem, 3.5vw, 1rem);
+ }
+ }
+ }
}
.info-btn {
@@ -109,6 +139,11 @@
transition: opacity 0.15s ease, visibility 0.15s ease;
z-index: 2;
will-change: opacity, visibility;
+
+ @media (max-width: 767px) {
+ top: 4px;
+ right: 4px;
+ }
}
.select-checkbox .p-checkbox {
@@ -203,6 +238,12 @@
align-items: flex-start;
gap: 4px;
z-index: 4;
+
+ @media (max-width: 767px) {
+ top: 4px;
+ left: 4px;
+ gap: 2px;
+ }
}
.book-type-pill-overlay,
@@ -210,6 +251,11 @@
.series-items-count-overlay {
position: static;
margin: 0;
+
+ @media (max-width: 767px) {
+ font-size: 0.6rem;
+ padding: 1px 4px;
+ }
}
.book-type-epub {