diff --git a/internal/handlers/dashboard.go b/internal/handlers/dashboard.go index 81610b2f..6a6e578d 100644 --- a/internal/handlers/dashboard.go +++ b/internal/handlers/dashboard.go @@ -3,7 +3,6 @@ package handlers import ( "bookhoard/internal/database" "bookhoard/internal/services" - "bookhoard/internal/utils" "context" "log" "net/http" @@ -200,18 +199,7 @@ func BuildSections(sections []services.DashboardSection, currentLibraryID, libra } } - bookCards := make([]BookInfo, len(ds.Items)) - for i, item := range ds.Items { - itemUUID, _ := uuid.FromBytes(item.ID.Bytes[0:16]) - bookCards[i] = BookInfo{ - MediaItemID: itemUUID.String(), - Title: item.Title, - Author: textToString(item.Author), - CoverImagePath: utils.ResolveMediaURL(item.LibraryID, item.CoverImagePath), - FormatGroup: item.FormatGroup, - Badge: MediaBadgeKind(item.FormatGroup, libTypes[uuid.UUID(item.LibraryID.Bytes).String()]), - } - } + bookCards := BookCardsFromMediaItems(ds.Items, libTypes) result = append(result, SectionData{ ID: ds.CollectionName,