diff --git a/internal/router/search.go b/internal/router/search.go
index e40d3ad5..1fcaac0c 100644
--- a/internal/router/search.go
+++ b/internal/router/search.go
@@ -4,7 +4,6 @@ import (
"bookhoard/internal/database"
"bookhoard/internal/handlers"
"bookhoard/internal/services"
- "bookhoard/internal/utils"
"bookhoard/templates"
"bytes"
"log"
@@ -101,19 +100,7 @@ func handleSearchHTML(c *echo.Context, cfg *Config) error {
return c.HTML(http.StatusInternalServerError, `
Search error
`)
}
// Convert to BookInfo
- bookInfoList := make([]handlers.BookInfo, len(results))
- for i, book := range results {
- bookUUID, _ := uuid.FromBytes(book.ID.Bytes[0:16])
- bookLibUUID, _ := uuid.FromBytes(book.LibraryID.Bytes[0:16])
- bookInfoList[i] = handlers.BookInfo{
- MediaItemID: bookUUID.String(),
- Title: book.Title,
- Author: textToString(book.Author),
- CoverImagePath: utils.ResolveMediaURL(pgtype.UUID{Bytes: bookLibUUID, Valid: true}, book.CoverImagePath),
- FormatGroup: book.FormatGroup,
- Badge: handlers.MediaBadgeKind(book.FormatGroup, book.LibraryTypeName),
- }
- }
+ bookInfoList := handlers.BookCardsFromUnified(results)
// Stamp active conflict flags so cards route the play action correctly
bookInfoList = handlers.MarkActiveConflicts(c.Request().Context(), cfg.Queries, user.ID, bookInfoList)
// Render using BooksGrid template (or BookPickerGrid for collection picker)