From 22b781aa9f8a4074e768a07e02838007c036f46b Mon Sep 17 00:00:00 2001 From: "aditya.chandel" <> Date: Sat, 25 Jan 2025 17:24:32 -0700 Subject: [PATCH] Derive filter type from filterStreams --- .../book-browser/book-filter/book-filter.component.html | 2 +- .../book-browser/book-filter/book-filter.component.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/booklore-ui/src/app/book/components/book-browser/book-filter/book-filter.component.html b/booklore-ui/src/app/book/components/book-browser/book-filter/book-filter.component.html index 67628613e..8b8788a16 100644 --- a/booklore-ui/src/app/book/components/book-browser/book-filter/book-filter.component.html +++ b/booklore-ui/src/app/book/components/book-browser/book-filter/book-filter.component.html @@ -1,7 +1,7 @@

Filters:

- + {{ filterType | titlecase }}
diff --git a/booklore-ui/src/app/book/components/book-browser/book-filter/book-filter.component.ts b/booklore-ui/src/app/book/components/book-browser/book-filter/book-filter.component.ts index df6771d43..2be29ec1d 100644 --- a/booklore-ui/src/app/book/components/book-browser/book-filter/book-filter.component.ts +++ b/booklore-ui/src/app/book/components/book-browser/book-filter/book-filter.component.ts @@ -39,6 +39,7 @@ export class BookFilterComponent implements OnInit { activeFilter: { type: string; value: any | null } = {type: '', value: null}; filterStreams: Record[]>> = {}; + filterTypes: string[] = []; bookService = inject(BookService); @@ -52,6 +53,7 @@ export class BookFilterComponent implements OnInit { award: this.getFilterStream((book) => book.metadata?.awards?.filter((award) => award.designation === 'WINNER'), 'name', 'name'), publisher: this.getFilterStream((book) => (book.metadata?.publisher ? [{id: book.metadata.publisher, name: book.metadata.publisher}] : []), 'id', 'name'), }; + this.filterTypes = Object.keys(this.filterStreams); } }