From f34b18f2b87f7575c96b5e08d019b142774f6c32 Mon Sep 17 00:00:00 2001 From: ACX <8075870+acx10@users.noreply.github.com> Date: Thu, 5 Feb 2026 21:22:04 -0700 Subject: [PATCH] fix(book-browser): resolve footer menu not hiding after navigation back (#2626) --- .../book-browser/book-browser.component.html | 8 +++----- .../book-browser/book-browser.component.scss | 9 +++++++++ .../book-browser/book-browser.component.ts | 19 ++++++++++++++++++- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/booklore-ui/src/app/features/book/components/book-browser/book-browser.component.html b/booklore-ui/src/app/features/book/components/book-browser/book-browser.component.html index b279c4ef8..460f39d60 100644 --- a/booklore-ui/src/app/features/book/components/book-browser/book-browser.component.html +++ b/booklore-ui/src/app/features/book/components/book-browser/book-browser.component.html @@ -317,14 +317,13 @@ } } - @if (selectedBooks.size > 0) { - @if (userService.userState$ | async; as userState) { -
} diff --git a/booklore-ui/src/app/features/book/components/book-browser/book-browser.component.scss b/booklore-ui/src/app/features/book/components/book-browser/book-browser.component.scss index a0e30e8c3..8c46a96d1 100644 --- a/booklore-ui/src/app/features/book/components/book-browser/book-browser.component.scss +++ b/booklore-ui/src/app/features/book/components/book-browser/book-browser.component.scss @@ -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%; diff --git a/booklore-ui/src/app/features/book/components/book-browser/book-browser.component.ts b/booklore-ui/src/app/features/book/components/book-browser/book-browser.component.ts index 8b7a81a3b..37c839662 100644 --- a/booklore-ui/src/app/features/book/components/book-browser/book-browser.component.ts +++ b/booklore-ui/src/app/features/book/components/book-browser/book-browser.component.ts @@ -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