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
#scroll
[items]="authorList"
[bufferAmount]="16"
class="virtual-scroller">
<div class="author-grid"
#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="cover-container" [ngClass]="{'loaded': isImageLoaded}">
<div class="cover-container">
@if (hasPhoto) {
<img
[src]="thumbnailUrl"
class="author-photo"
[class.loaded]="isImageLoaded"
[alt]="author.name"
loading="lazy"
decoding="async"
(load)="onImageLoad()"
(error)="onPhotoError()"/>
} @else {
<div class="author-photo-placeholder">
@@ -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);
}
@@ -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({
@@ -104,7 +104,7 @@
<p>{{ t('noBooksFound') }}</p>
</div>
} @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
[ngStyle]="{'grid-template-columns': 'repeat(auto-fill, minmax(' + gridColumnMinWidth + ', 1fr))'}">
@for (book of scroll.viewPortItems; track book.id; let i = $index) {
@@ -295,7 +295,7 @@
></app-book-table>
}
@if (currentViewMode === 'grid') {
<virtual-scroller class="virtual-scroller" #scroll [items]="books">
<virtual-scroller class="virtual-scroller" #scroll [items]="books" [bufferAmount]="16">
<div
class="grid"
#container
@@ -5,16 +5,14 @@
(click)="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
[src]="coverImageUrl"
class="book-cover"
[class.loaded]="isImageLoaded"
[class.square-cover]="_isAudiobook || useSquareCovers"
[alt]="('book.card.alt.cover' | transloco: { title: displayTitle })"
loading="lazy"
decoding="async"
(load)="onImageLoad()"/>
decoding="async"/>
<div class="top-left-overlay-stack">
@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 {
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);
}
@@ -55,10 +55,8 @@ export class BookCardComponent implements OnInit, OnChanges {
@Input() useSquareCovers: boolean = false;
@ViewChild('checkboxElem') checkboxElem!: ElementRef<HTMLInputElement>;
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') {