From 09c36dfa0b4f888b82c4a637db49a14fedbc0d71 Mon Sep 17 00:00:00 2001 From: Alex <25013571+alexhb1@users.noreply.github.com> Date: Sun, 29 Mar 2026 20:01:50 +0100 Subject: [PATCH] chore(ui): drop book and author animations (#270) * chore(ui): drop book and author animations * chore(ui): remove stale import --- .../author-browser.component.html | 1 + .../author-card/author-card.component.html | 4 +-- .../author-card/author-card.component.scss | 30 ++----------------- .../author-card/author-card.component.ts | 10 +------ .../author-detail.component.html | 2 +- .../book-browser/book-browser.component.html | 2 +- .../book-card/book-card.component.html | 6 ++-- .../book-card/book-card.component.scss | 30 ++----------------- .../book-card/book-card.component.ts | 6 ---- 9 files changed, 11 insertions(+), 80 deletions(-) diff --git a/frontend/src/app/features/author-browser/components/author-browser/author-browser.component.html b/frontend/src/app/features/author-browser/components/author-browser/author-browser.component.html index 0d23d17b1..7030231f7 100644 --- a/frontend/src/app/features/author-browser/components/author-browser/author-browser.component.html +++ b/frontend/src/app/features/author-browser/components/author-browser/author-browser.component.html @@ -196,6 +196,7 @@
-
+
@if (hasPhoto) { } @else {
diff --git a/frontend/src/app/features/author-browser/components/author-card/author-card.component.scss b/frontend/src/app/features/author-browser/components/author-card/author-card.component.scss index 518e1069f..9d3123830 100644 --- a/frontend/src/app/features/author-browser/components/author-card/author-card.component.scss +++ b/frontend/src/app/features/author-browser/components/author-card/author-card.component.scss @@ -20,16 +20,6 @@ } } -@keyframes shimmer { - 0% { - background-position: -200% 0; - } - - 100% { - background-position: 200% 0; - } -} - .cover-container { position: relative; width: 100%; @@ -42,31 +32,15 @@ justify-content: center; } -.cover-container:not(.loaded) { - background: linear-gradient( - 90deg, - var(--surface-ground) 25%, - var(--surface-hover, rgb(255 255 255 / 8%)) 50%, - var(--surface-ground) 75% - ); - background-size: 200% 100%; - animation: shimmer 1.5s ease-in-out infinite; -} - .author-photo { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; - opacity: 0; - transition: opacity 0.2s ease-in, transform 0.35s ease; + transition: transform 0.35s ease; } -.author-photo.loaded { - opacity: 1; -} - -.author-card:hover .author-photo.loaded { +.author-card:hover .author-photo { transform: scale(1.04); } diff --git a/frontend/src/app/features/author-browser/components/author-card/author-card.component.ts b/frontend/src/app/features/author-browser/components/author-card/author-card.component.ts index 057921da8..88850f809 100644 --- a/frontend/src/app/features/author-browser/components/author-card/author-card.component.ts +++ b/frontend/src/app/features/author-browser/components/author-card/author-card.component.ts @@ -1,5 +1,4 @@ import {ChangeDetectorRef, Component, EventEmitter, inject, Input, OnChanges, Output, SimpleChanges} from '@angular/core'; -import {NgClass} from '@angular/common'; import {TranslocoPipe, TranslocoService} from '@jsverse/transloco'; import {Tooltip} from 'primeng/tooltip'; import {CheckboxChangeEvent, CheckboxModule} from 'primeng/checkbox'; @@ -15,7 +14,7 @@ import {AuthorService} from '../../service/author.service'; standalone: true, templateUrl: './author-card.component.html', styleUrls: ['./author-card.component.scss'], - imports: [NgClass, TranslocoPipe, Tooltip, CheckboxModule, FormsModule, TieredMenu, Button] + imports: [TranslocoPipe, Tooltip, CheckboxModule, FormsModule, TieredMenu, Button] }) export class AuthorCardComponent implements OnChanges { @@ -41,7 +40,6 @@ export class AuthorCardComponent implements OnChanges { private lastShiftKey = false; hasPhoto = false; - isImageLoaded = false; quickMatching = false; items: MenuItem[] = []; @@ -53,12 +51,10 @@ export class AuthorCardComponent implements OnChanges { const curr = changes['author'].currentValue as AuthorSummary; if (!prev || prev.id !== curr.id || prev.hasPhoto !== curr.hasPhoto || prev.asin !== curr.asin) { this.hasPhoto = curr.hasPhoto; - this.isImageLoaded = false; } } if (changes['cacheBuster'] && !changes['cacheBuster'].firstChange) { this.hasPhoto = true; - this.isImageLoaded = false; } } @@ -86,9 +82,6 @@ export class AuthorCardComponent implements OnChanges { this.cardClick.emit(this.author); } - onImageLoad(): void { - this.isImageLoaded = true; - } onPhotoError(): void { this.hasPhoto = false; @@ -163,7 +156,6 @@ export class AuthorCardComponent implements OnChanges { this.quickMatching = false; this.author = {...this.author, asin: updated.asin, hasPhoto: true}; this.hasPhoto = true; - this.isImageLoaded = false; this.menuInitialized = false; this.quickMatched.emit(this.author); this.messageService.add({ diff --git a/frontend/src/app/features/author-browser/components/author-detail/author-detail.component.html b/frontend/src/app/features/author-browser/components/author-detail/author-detail.component.html index 7abecf751..2b06fc306 100644 --- a/frontend/src/app/features/author-browser/components/author-detail/author-detail.component.html +++ b/frontend/src/app/features/author-browser/components/author-detail/author-detail.component.html @@ -104,7 +104,7 @@

{{ t('noBooksFound') }}

} @else { - +
@for (book of scroll.viewPortItems; track book.id; let i = $index) { diff --git a/frontend/src/app/features/book/components/book-browser/book-browser.component.html b/frontend/src/app/features/book/components/book-browser/book-browser.component.html index d5de4c3f2..c2b1e37dd 100644 --- a/frontend/src/app/features/book/components/book-browser/book-browser.component.html +++ b/frontend/src/app/features/book/components/book-browser/book-browser.component.html @@ -295,7 +295,7 @@ > } @if (currentViewMode === 'grid') { - +
-
+
+ decoding="async"/>
@if ((overlayPreferenceService?.showBookTypePill() ?? true) && getDisplayFormat(); as displayFormat) { diff --git a/frontend/src/app/features/book/components/book-browser/book-card/book-card.component.scss b/frontend/src/app/features/book/components/book-browser/book-card/book-card.component.scss index fe7c0e27c..7d08e1e5e 100644 --- a/frontend/src/app/features/book/components/book-browser/book-card/book-card.component.scss +++ b/frontend/src/app/features/book/components/book-browser/book-card/book-card.component.scss @@ -19,16 +19,6 @@ } } -@keyframes shimmer { - 0% { - background-position: -200% 0; - } - - 100% { - background-position: 200% 0; - } -} - .cover-container { position: relative; width: 100%; @@ -41,17 +31,6 @@ justify-content: center; } -.cover-container:not(.loaded) { - background: linear-gradient( - 90deg, - var(--surface-ground) 25%, - var(--surface-hover, rgb(255 255 255 / 8%)) 50%, - var(--surface-ground) 75% - ); - background-size: 200% 100%; - animation: shimmer 1.5s ease-in-out infinite; -} - .cover-container.audiobook-cover { aspect-ratio: 5/7; background-color: var(--surface-ground); @@ -66,15 +45,10 @@ width: 100%; height: 100%; border-radius: 8px 8px 0 0; - opacity: 0; - transition: opacity 0.2s ease-in, transform 0.35s ease; + transition: transform 0.35s ease; } -.book-cover.loaded { - opacity: 1; -} - -.book-card:hover .book-cover.loaded { +.book-card:hover .book-cover { transform: scale(1.04); } diff --git a/frontend/src/app/features/book/components/book-browser/book-card/book-card.component.ts b/frontend/src/app/features/book/components/book-browser/book-card/book-card.component.ts index 89b90e693..11c66eee8 100644 --- a/frontend/src/app/features/book/components/book-browser/book-card/book-card.component.ts +++ b/frontend/src/app/features/book/components/book-browser/book-card/book-card.component.ts @@ -55,10 +55,8 @@ export class BookCardComponent implements OnInit, OnChanges { @Input() useSquareCovers: boolean = false; @ViewChild('checkboxElem') checkboxElem!: ElementRef; - items: MenuItem[] | undefined; readStatusMenuItems: MenuItem[] = []; - isImageLoaded: boolean = false; isSubMenuLoading = false; private additionalFilesLoaded = false; @@ -254,10 +252,6 @@ export class BookCardComponent implements OnInit, OnChanges { menu.toggle(event); } - onImageLoad(): void { - this.isImageLoaded = true; - this.cdr.markForCheck(); - } readBook(book: Book): void { if (this.forceEbookMode && book.primaryFile?.bookType === 'AUDIOBOOK') {