package templates import ( "fmt" "bookhoard/internal/handlers" ) // pluralizeBooks renders "book"/"books" for count displays. func pluralizeBooks(n int) string { if n == 1 { return "book" } return "books" } templ Collection(user User, collections []CollectionData, errorMessage string) { Collections - Bookhoard @Header(user, "/collections")
@Icon("folder", "h-5 w-5")

My Collections

Organize your books into custom collections

if len(collections) == 0 {
@Icon("folder", "h-7 w-7")

No Collections Yet

Create collections to organize your books

} for _, col := range collections {
{ col.Icon }
if col.IsSmart { ⚡ Smart }

{ col.Name }

{ col.Description }

{ fmt.Sprintf("%d %s", col.BookCount, pluralizeBooks(col.BookCount)) } if col.IsSmart { · rules-matched live }

}
@ErrorToast(errorMessage) } templ CollectionDetail(user User, collection CollectionData, books []handlers.BookInfo, libraryID string, libData []LibraryData) { { collection.Name } - Bookhoard @Header(user, "/collections") @LibrarySwitcher(libData, libraryID, "")
@Icon("arrow-left", "h-4 w-4") Back to Collections
{ collection.Icon }

{ collection.Name } if collection.IsSmart { ⚡ Smart }

{ collection.Description }

if collection.IsSmart {

Membership is rules-matched live — always current, nothing to refresh.

}

Books in this Collection

if !collection.IsSystem { @Icon("filter", "h-4 w-4") Edit Rules if !collection.IsSmart { } }
if len(books) == 0 {
No books in this collection yet.
} for _, book := range books {
if !collection.IsSystem && !collection.IsSmart {
}

{ book.Title }

if book.Author != "" {

by { book.Author }

}
if !collection.IsSystem && !collection.IsSmart {
}
}
if !collection.IsSystem && !collection.IsSmart { } } templ BookPickerGrid(books []handlers.BookInfo) { for _, book := range books {
if book.CoverImagePath != "" { { } else { { }
✓

{ book.Title }

} }