chore(ui): drop book and author animations (#270)

* chore(ui): drop book and author animations

* chore(ui): remove stale import
This commit is contained in:
Alex
2026-04-22 17:26:56 -04:00
committed by Zach Yale
parent 1799493ed7
commit 09c36dfa0b
9 changed files with 11 additions and 80 deletions
@@ -196,6 +196,7 @@
<virtual-scroller <virtual-scroller
#scroll #scroll
[items]="authorList" [items]="authorList"
[bufferAmount]="16"
class="virtual-scroller"> class="virtual-scroller">
<div class="author-grid" <div class="author-grid"
#container #container
@@ -1,14 +1,12 @@
<div class="author-card" [class.selected]="isSelected" role="button" tabindex="0" (click)="onCardClick($event)" (keydown.enter)="onCardClick($event)"> <div class="author-card" [class.selected]="isSelected" role="button" tabindex="0" (click)="onCardClick($event)" (keydown.enter)="onCardClick($event)">
<div class="cover-container" [ngClass]="{'loaded': isImageLoaded}"> <div class="cover-container">
@if (hasPhoto) { @if (hasPhoto) {
<img <img
[src]="thumbnailUrl" [src]="thumbnailUrl"
class="author-photo" class="author-photo"
[class.loaded]="isImageLoaded"
[alt]="author.name" [alt]="author.name"
loading="lazy" loading="lazy"
decoding="async" decoding="async"
(load)="onImageLoad()"
(error)="onPhotoError()"/> (error)="onPhotoError()"/>
} @else { } @else {
<div class="author-photo-placeholder"> <div class="author-photo-placeholder">
@@ -20,16 +20,6 @@
} }
} }
@keyframes shimmer {
0% {
background-position: -200% 0;
}
100% {
background-position: 200% 0;
}
}
.cover-container { .cover-container {
position: relative; position: relative;
width: 100%; width: 100%;
@@ -42,31 +32,15 @@
justify-content: center; 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 { .author-photo {
width: 100%; width: 100%;
height: 100%; height: 100%;
object-fit: cover; object-fit: cover;
border-radius: 8px; border-radius: 8px;
opacity: 0; transition: transform 0.35s ease;
transition: opacity 0.2s ease-in, transform 0.35s ease;
} }
.author-photo.loaded { .author-card:hover .author-photo {
opacity: 1;
}
.author-card:hover .author-photo.loaded {
transform: scale(1.04); transform: scale(1.04);
} }
@@ -1,5 +1,4 @@
import {ChangeDetectorRef, Component, EventEmitter, inject, Input, OnChanges, Output, SimpleChanges} from '@angular/core'; import {ChangeDetectorRef, Component, EventEmitter, inject, Input, OnChanges, Output, SimpleChanges} from '@angular/core';
import {NgClass} from '@angular/common';
import {TranslocoPipe, TranslocoService} from '@jsverse/transloco'; import {TranslocoPipe, TranslocoService} from '@jsverse/transloco';
import {Tooltip} from 'primeng/tooltip'; import {Tooltip} from 'primeng/tooltip';
import {CheckboxChangeEvent, CheckboxModule} from 'primeng/checkbox'; import {CheckboxChangeEvent, CheckboxModule} from 'primeng/checkbox';
@@ -15,7 +14,7 @@ import {AuthorService} from '../../service/author.service';
standalone: true, standalone: true,
templateUrl: './author-card.component.html', templateUrl: './author-card.component.html',
styleUrls: ['./author-card.component.scss'], 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 { export class AuthorCardComponent implements OnChanges {
@@ -41,7 +40,6 @@ export class AuthorCardComponent implements OnChanges {
private lastShiftKey = false; private lastShiftKey = false;
hasPhoto = false; hasPhoto = false;
isImageLoaded = false;
quickMatching = false; quickMatching = false;
items: MenuItem[] = []; items: MenuItem[] = [];
@@ -53,12 +51,10 @@ export class AuthorCardComponent implements OnChanges {
const curr = changes['author'].currentValue as AuthorSummary; const curr = changes['author'].currentValue as AuthorSummary;
if (!prev || prev.id !== curr.id || prev.hasPhoto !== curr.hasPhoto || prev.asin !== curr.asin) { if (!prev || prev.id !== curr.id || prev.hasPhoto !== curr.hasPhoto || prev.asin !== curr.asin) {
this.hasPhoto = curr.hasPhoto; this.hasPhoto = curr.hasPhoto;
this.isImageLoaded = false;
} }
} }
if (changes['cacheBuster'] && !changes['cacheBuster'].firstChange) { if (changes['cacheBuster'] && !changes['cacheBuster'].firstChange) {
this.hasPhoto = true; this.hasPhoto = true;
this.isImageLoaded = false;
} }
} }
@@ -86,9 +82,6 @@ export class AuthorCardComponent implements OnChanges {
this.cardClick.emit(this.author); this.cardClick.emit(this.author);
} }
onImageLoad(): void {
this.isImageLoaded = true;
}
onPhotoError(): void { onPhotoError(): void {
this.hasPhoto = false; this.hasPhoto = false;
@@ -163,7 +156,6 @@ export class AuthorCardComponent implements OnChanges {
this.quickMatching = false; this.quickMatching = false;
this.author = {...this.author, asin: updated.asin, hasPhoto: true}; this.author = {...this.author, asin: updated.asin, hasPhoto: true};
this.hasPhoto = true; this.hasPhoto = true;
this.isImageLoaded = false;
this.menuInitialized = false; this.menuInitialized = false;
this.quickMatched.emit(this.author); this.quickMatched.emit(this.author);
this.messageService.add({ this.messageService.add({
@@ -104,7 +104,7 @@
<p>{{ t('noBooksFound') }}</p> <p>{{ t('noBooksFound') }}</p>
</div> </div>
} @else { } @else {
<virtual-scroller #scroll [items]="books" class="books-virtual-scroller"> <virtual-scroller #scroll [items]="books" [bufferAmount]="16" class="books-virtual-scroller">
<div class="books-grid" #container <div class="books-grid" #container
[ngStyle]="{'grid-template-columns': 'repeat(auto-fill, minmax(' + gridColumnMinWidth + ', 1fr))'}"> [ngStyle]="{'grid-template-columns': 'repeat(auto-fill, minmax(' + gridColumnMinWidth + ', 1fr))'}">
@for (book of scroll.viewPortItems; track book.id; let i = $index) { @for (book of scroll.viewPortItems; track book.id; let i = $index) {
@@ -295,7 +295,7 @@
></app-book-table> ></app-book-table>
} }
@if (currentViewMode === 'grid') { @if (currentViewMode === 'grid') {
<virtual-scroller class="virtual-scroller" #scroll [items]="books"> <virtual-scroller class="virtual-scroller" #scroll [items]="books" [bufferAmount]="16">
<div <div
class="grid" class="grid"
#container #container
@@ -5,16 +5,14 @@
(click)="onCardClick($event)" (click)="onCardClick($event)"
(keydown.enter)="onCardClick($event)"> (keydown.enter)="onCardClick($event)">
<div class="cover-container" [ngClass]="{ 'center-info-btn': _isSeriesViewActive || !hasDigitalFile(), 'loaded': isImageLoaded, 'audiobook-cover': _isAudiobook, 'square-library-cover': useSquareCovers }"> <div class="cover-container" [ngClass]="{ 'center-info-btn': _isSeriesViewActive || !hasDigitalFile(), 'audiobook-cover': _isAudiobook, 'square-library-cover': useSquareCovers }">
<img <img
[src]="coverImageUrl" [src]="coverImageUrl"
class="book-cover" class="book-cover"
[class.loaded]="isImageLoaded"
[class.square-cover]="_isAudiobook || useSquareCovers" [class.square-cover]="_isAudiobook || useSquareCovers"
[alt]="('book.card.alt.cover' | transloco: { title: displayTitle })" [alt]="('book.card.alt.cover' | transloco: { title: displayTitle })"
loading="lazy" loading="lazy"
decoding="async" decoding="async"/>
(load)="onImageLoad()"/>
<div class="top-left-overlay-stack"> <div class="top-left-overlay-stack">
@if ((overlayPreferenceService?.showBookTypePill() ?? true) && getDisplayFormat(); as displayFormat) { @if ((overlayPreferenceService?.showBookTypePill() ?? true) && getDisplayFormat(); as displayFormat) {
@@ -19,16 +19,6 @@
} }
} }
@keyframes shimmer {
0% {
background-position: -200% 0;
}
100% {
background-position: 200% 0;
}
}
.cover-container { .cover-container {
position: relative; position: relative;
width: 100%; width: 100%;
@@ -41,17 +31,6 @@
justify-content: center; 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 { .cover-container.audiobook-cover {
aspect-ratio: 5/7; aspect-ratio: 5/7;
background-color: var(--surface-ground); background-color: var(--surface-ground);
@@ -66,15 +45,10 @@
width: 100%; width: 100%;
height: 100%; height: 100%;
border-radius: 8px 8px 0 0; border-radius: 8px 8px 0 0;
opacity: 0; transition: transform 0.35s ease;
transition: opacity 0.2s ease-in, transform 0.35s ease;
} }
.book-cover.loaded { .book-card:hover .book-cover {
opacity: 1;
}
.book-card:hover .book-cover.loaded {
transform: scale(1.04); transform: scale(1.04);
} }
@@ -55,10 +55,8 @@ export class BookCardComponent implements OnInit, OnChanges {
@Input() useSquareCovers: boolean = false; @Input() useSquareCovers: boolean = false;
@ViewChild('checkboxElem') checkboxElem!: ElementRef<HTMLInputElement>; @ViewChild('checkboxElem') checkboxElem!: ElementRef<HTMLInputElement>;
items: MenuItem[] | undefined; items: MenuItem[] | undefined;
readStatusMenuItems: MenuItem[] = []; readStatusMenuItems: MenuItem[] = [];
isImageLoaded: boolean = false;
isSubMenuLoading = false; isSubMenuLoading = false;
private additionalFilesLoaded = false; private additionalFilesLoaded = false;
@@ -254,10 +252,6 @@ export class BookCardComponent implements OnInit, OnChanges {
menu.toggle(event); menu.toggle(event);
} }
onImageLoad(): void {
this.isImageLoaded = true;
this.cdr.markForCheck();
}
readBook(book: Book): void { readBook(book: Book): void {
if (this.forceEbookMode && book.primaryFile?.bookType === 'AUDIOBOOK') { if (this.forceEbookMode && book.primaryFile?.bookType === 'AUDIOBOOK') {