fix(book-browser): resolve footer menu not hiding after navigation back (#2626)
This commit is contained in:
+3
-5
@@ -317,14 +317,13 @@
|
||||
</virtual-scroller>
|
||||
}
|
||||
}
|
||||
@if (selectedBooks.size > 0) {
|
||||
@if (userService.userState$ | async; as userState) {
|
||||
<div class="book-browser-footer" [@slideInOut]>
|
||||
@if (userService.userState$ | async; as userState) {
|
||||
<div class="book-browser-footer" [class.footer-hidden]="selectedCount === 0">
|
||||
<div class="footer-content">
|
||||
<div class="footer-left">
|
||||
<div class="selected-count-badge">
|
||||
<i class="pi pi-check-circle"></i>
|
||||
<span class="selected-count">{{ selectedBooks.size }}</span>
|
||||
<span class="selected-count">{{ selectedCount }}</span>
|
||||
<span class="selected-label">selected</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -441,7 +440,6 @@
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -232,6 +232,15 @@
|
||||
border: 1px solid rgba(255, 255, 255, 0.5);
|
||||
border-width: 1px 1px 0 1px;
|
||||
background-color: var(--card-background);
|
||||
transition: transform 0.15s ease-out, opacity 0.15s ease-out;
|
||||
transform: translateY(0);
|
||||
opacity: 1;
|
||||
|
||||
&.footer-hidden {
|
||||
transform: translateY(100%);
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
> .footer-content {
|
||||
width: 100%;
|
||||
|
||||
+18
-1
@@ -1,4 +1,4 @@
|
||||
import {AfterViewInit, Component, HostListener, inject, OnDestroy, OnInit, ViewChild} from '@angular/core';
|
||||
import {AfterViewInit, ApplicationRef, ChangeDetectorRef, Component, HostListener, inject, NgZone, OnDestroy, OnInit, ViewChild} from '@angular/core';
|
||||
import {ActivatedRoute, NavigationStart, Router} from '@angular/router';
|
||||
import {ConfirmationService, MenuItem, MessageService, PrimeTemplate} from 'primeng/api';
|
||||
import {PageTitleService} from '../../../../shared/service/page-title.service';
|
||||
@@ -100,6 +100,9 @@ export class BookBrowserComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
protected bookSelectionService = inject(BookSelectionService);
|
||||
protected appSettingsService = inject(AppSettingsService);
|
||||
|
||||
private cdr = inject(ChangeDetectorRef);
|
||||
private ngZone = inject(NgZone);
|
||||
private appRef = inject(ApplicationRef);
|
||||
private activatedRoute = inject(ActivatedRoute);
|
||||
private router = inject(Router);
|
||||
private messageService = inject(MessageService);
|
||||
@@ -142,6 +145,7 @@ export class BookBrowserComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
showFilter = false;
|
||||
screenWidth = typeof window !== 'undefined' ? window.innerWidth : 1024;
|
||||
mobileColumnCount = 3;
|
||||
selectedCount = 0;
|
||||
|
||||
private readonly MOBILE_BREAKPOINT = 768;
|
||||
private readonly CARD_ASPECT_RATIO = 7 / 5;
|
||||
@@ -278,6 +282,7 @@ export class BookBrowserComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
this.setupQueryParamSubscription();
|
||||
this.setupSearchTermSubscription();
|
||||
this.setupScrollPositionTracking();
|
||||
this.setupSelectionSubscription();
|
||||
}
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
@@ -465,6 +470,18 @@ export class BookBrowserComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
});
|
||||
}
|
||||
|
||||
private setupSelectionSubscription(): void {
|
||||
this.bookSelectionService.selectedBooks$
|
||||
.pipe(takeUntil(this.destroy$))
|
||||
.subscribe(selectedBooks => {
|
||||
this.ngZone.run(() => {
|
||||
this.selectedCount = selectedBooks.size;
|
||||
this.cdr.detectChanges();
|
||||
this.appRef.tick();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
onFilterSelected(filters: Record<string, any> | null): void {
|
||||
if (this.settingFiltersFromUrl) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user