refactor(cards): SSR series and tag pages through the builder
Both BrowseDetail surfaces hand-rolled bare 4-field literals (badges
dropped) and patched the nil-slice with []BookInfo{} seeds after.
BookCardsFromMediaItems feeds GetSeriesBooks/GetBooksByTag rows —
cards gain format_group + badge on the series and tag pages, and the
two seed blocks die with the adapter's non-nil empties. Conflict
stamping at these sites was already adjacent and is preserved.
This commit is contained in:
1 parent
0971e7debb
commit
8c56c9da55
1 file changed
+2
-28
@@ -241,20 +241,7 @@ func registerFrontendRoutes(cfg *Config) {
|
|||||||
log.Printf("GetSeriesBooks failed: %v", err)
|
log.Printf("GetSeriesBooks failed: %v", err)
|
||||||
errorMsg = "Error loading series books"
|
errorMsg = "Error loading series books"
|
||||||
} else {
|
} else {
|
||||||
bookInfoList = make([]handlers.BookInfo, 0, len(books))
|
bookInfoList = handlers.BookCardsFromMediaItems(books, handlers.LibraryTypeMap(c.Request().Context(), cfg.Queries))
|
||||||
for _, item := range books {
|
|
||||||
itemUUID, _ := uuid.FromBytes(item.ID.Bytes[0:16])
|
|
||||||
bookInfoList = append(bookInfoList, handlers.BookInfo{
|
|
||||||
MediaItemID: itemUUID.String(),
|
|
||||||
Title: item.Title,
|
|
||||||
Author: textToString(item.Author),
|
|
||||||
CoverImagePath: utils.ResolveMediaURL(item.LibraryID, item.CoverImagePath),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if bookInfoList == nil {
|
|
||||||
bookInfoList = []handlers.BookInfo{}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
seriesUserUUID, _ := uuid.Parse(user.ID)
|
seriesUserUUID, _ := uuid.Parse(user.ID)
|
||||||
@@ -295,22 +282,9 @@ func registerFrontendRoutes(cfg *Config) {
|
|||||||
log.Printf("GetBooksByTag failed: %v", err)
|
log.Printf("GetBooksByTag failed: %v", err)
|
||||||
errorMsg = "Error loading tag books"
|
errorMsg = "Error loading tag books"
|
||||||
} else {
|
} else {
|
||||||
bookInfoList = make([]handlers.BookInfo, 0, len(books))
|
bookInfoList = handlers.BookCardsFromMediaItems(books, handlers.LibraryTypeMap(c.Request().Context(), cfg.Queries))
|
||||||
for _, item := range books {
|
|
||||||
itemUUID, _ := uuid.FromBytes(item.ID.Bytes[0:16])
|
|
||||||
bookInfoList = append(bookInfoList, handlers.BookInfo{
|
|
||||||
MediaItemID: itemUUID.String(),
|
|
||||||
Title: item.Title,
|
|
||||||
Author: textToString(item.Author),
|
|
||||||
CoverImagePath: utils.ResolveMediaURL(item.LibraryID, item.CoverImagePath),
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if bookInfoList == nil {
|
|
||||||
bookInfoList = []handlers.BookInfo{}
|
|
||||||
}
|
|
||||||
|
|
||||||
tagUserUUID, _ := uuid.Parse(user.ID)
|
tagUserUUID, _ := uuid.Parse(user.ID)
|
||||||
bookInfoList = handlers.MarkActiveConflicts(c.Request().Context(), cfg.Queries, pgtype.UUID{Bytes: tagUserUUID, Valid: true}, bookInfoList)
|
bookInfoList = handlers.MarkActiveConflicts(c.Request().Context(), cfg.Queries, pgtype.UUID{Bytes: tagUserUUID, Valid: true}, bookInfoList)
|
||||||
|
|||||||
Reference in new issue
Block a user