From 4bc7a842b5f6cb8dfa90b349b1147a12203373c8 Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Sun, 1 Feb 2026 00:52:45 -0500 Subject: [PATCH] feat(collections): add collection-specific search/filter (Limitation #3) Add search and filter within a collection: Frontend Implementation: - Search input box in collection detail toolbar - filterCollectionBooks() JavaScript function - Real-time filtering of books by title and author - Case-insensitive search - Hides non-matching book cards - Shows all books when search is cleared How It Works: - AllBooks array contains book data from server render - On keyup, filters books by title and author - Toggles display property on book cards - Empty state has ID and is not hidden - Pure client-side filtering (no server round-trips) User Experience: - Instant search results as user types - No page reload required - Works with existing multi-select for bulk operations - Search box always visible in toolbar Resolves Limitation #3: Collection-Specific Search --- templates/collections.templ | 42 +++++++++++++++++++++++++++++++++- templates/collections_templ.go | 10 ++++---- 2 files changed, 46 insertions(+), 6 deletions(-) diff --git a/templates/collections.templ b/templates/collections.templ index b464f61..a17d48c 100644 --- a/templates/collections.templ +++ b/templates/collections.templ @@ -247,6 +247,12 @@ templ CollectionDetail(user User, collection CollectionDetailData, books []BookD
+
+ +

Books in this Collection

0 selected
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "

Books in this Collection

0 selected
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if len(books) == 0 { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "
No books in this collection yet.
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "
No books in this collection yet.
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -199,7 +199,7 @@ func CollectionDetail(user User, collection CollectionDetailData, books []BookDa var templ_7745c5c3_Var10 string templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(book.Title) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/collections.templ`, Line: 278, Col: 131} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/collections.templ`, Line: 284, Col: 131} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10)) if templ_7745c5c3_Err != nil { @@ -217,7 +217,7 @@ func CollectionDetail(user User, collection CollectionDetailData, books []BookDa var templ_7745c5c3_Var11 string templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(book.Author) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/collections.templ`, Line: 280, Col: 108} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/collections.templ`, Line: 286, Col: 108} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11)) if templ_7745c5c3_Err != nil { @@ -233,7 +233,7 @@ func CollectionDetail(user User, collection CollectionDetailData, books []BookDa return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "

Add Books to Collection

Search and select books to add to this collection.

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "

Add Books to Collection

Search and select books to add to this collection.

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err }