fix(collapse-series): fix series collapsing (#541)
This commit is contained in:
@@ -439,6 +439,17 @@ describe('BookBrowserComponent', () => {
|
||||
expect(component.showTableLoadingPlaceholder()).toBe(false);
|
||||
});
|
||||
|
||||
it('calls SeriesCollapseFilter.collapseBooks when computing pipelineInputs', () => {
|
||||
createHarness();
|
||||
const filter = TestBed.inject(SeriesCollapseFilter);
|
||||
const collapseBooksSpy = vi.spyOn(filter, 'collapseBooks');
|
||||
|
||||
vi.runOnlyPendingTimers();
|
||||
TestBed.flushEffects();
|
||||
|
||||
expect(collapseBooksSpy).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('triggers next page fetch when scrolled near the bottom of rendered content', async () => {
|
||||
const {component} = createHarness();
|
||||
const appBooksApi = TestBed.inject(AppBooksApiService);
|
||||
|
||||
@@ -264,7 +264,10 @@ export class BookBrowserComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
return Number.isNaN(entityId) ? entityType : `${entityType}:${entityId}`;
|
||||
});
|
||||
|
||||
private readonly pipelineInputs = computed(() => this.appBooksApi.books());
|
||||
private readonly pipelineInputs = computed(() => {
|
||||
const books = this.appBooksApi.books();
|
||||
return this.seriesCollapseFilter.collapseBooks(books, this.forceExpandSeries());
|
||||
});
|
||||
|
||||
private readonly renderBooksEffect = effect((onCleanup) => {
|
||||
const contextKey = this.booksContextKey();
|
||||
|
||||
+1
-1
@@ -149,7 +149,7 @@
|
||||
{{ t('emptyState') }}
|
||||
</div>
|
||||
} @else {
|
||||
@for (file of bookdropFileUis; track file) {
|
||||
@for (file of bookdropFileUis; track file.file.id) {
|
||||
|
||||
<div class="file-item">
|
||||
<div class="file-row" [ngClass]="file.showDetails ? ' expanded' : ''">
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@
|
||||
|
||||
<div class="results-list">
|
||||
<ul class="file-list">
|
||||
@for (r of result.results; track r) {
|
||||
@for (r of result.results; track r.fileName + ':' + $index) {
|
||||
<li
|
||||
class="file-item"
|
||||
[ngClass]="{
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@
|
||||
<div class="tab-content">
|
||||
@if (bookInSeries.length > 1) {
|
||||
<div class="dashboard-scroller-infinite" infiniteScroll [infiniteScrollDistance]="2" [infiniteScrollThrottle]="50" [horizontal]="true">
|
||||
@for (bookInSeriesItem of bookInSeries; track bookInSeriesItem) {
|
||||
@for (bookInSeriesItem of bookInSeries; track bookInSeriesItem.id) {
|
||||
@if (bookInSeriesItem.id !== book.id) {
|
||||
<div class="dashboard-scroller-card">
|
||||
<app-book-card-lite-component [book]="bookInSeriesItem" [showSeriesNumber]="true" [isActive]="bookInSeriesItem.id === book.id"></app-book-card-lite-component>
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@
|
||||
@if (showBookList) {
|
||||
<div class="book-list-panel">
|
||||
<ul class="book-list">
|
||||
@for (book of books; track book) {
|
||||
@for (book of books; track book.id) {
|
||||
<li>{{ book.metadata?.title || 'Untitled Book' }}</li>
|
||||
}
|
||||
</ul>
|
||||
|
||||
@@ -154,9 +154,9 @@
|
||||
class="overall-progress-bar"/>
|
||||
</div>
|
||||
}
|
||||
<div class="files-list">
|
||||
@for (uploadFile of this.files; track uploadFile; let i = $index) {
|
||||
<div class="file-item">
|
||||
<div class="file-list-items">
|
||||
@for (uploadFile of this.files; track uploadFile.file.name; let i = $index) {
|
||||
<div class="file-item-card">
|
||||
<div class="file-info">
|
||||
<p-badge
|
||||
[value]="getFileStatusLabel(uploadFile)"
|
||||
|
||||
@@ -258,7 +258,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
.files-list {
|
||||
.file-list-items {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
@@ -288,7 +288,7 @@
|
||||
scrollbar-width: thin;
|
||||
scrollbar-color: var(--border-color) var(--overlay-background);
|
||||
|
||||
.file-item {
|
||||
.file-item-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
Reference in New Issue
Block a user