package templates import ( "bookhoard/internal/handlers" "fmt" "github.com/microcosm-cc/bluemonday" "strings" ) templ BookDetail(user User, book handlers.MediaDetail, errorMessage string) { { book.Title } - Bookhoard @Header(user, "/media/{ uuidToString(book.ID) }")
if book.CoverImagePath.Valid && book.CoverImagePath.String != "" { { } else { { book.Title } }

{ book.Title }

if book.Author.Valid && book.Author.String != "" {

by { book.Author.String }

}
if book.ActiveConflict != nil || book.ReadingProgress != nil { }
@templ.Raw(renderStars(getBookRating(book.Rating))) ({ fmt.Sprintf("%.1f", float64(getBookRating(book.Rating))/2.0) } / 5)
if book.CommunityRating.Valid && book.CommunityRating.Float64 > 0 {
Community Rating: @templ.Raw(renderStars(int32(book.CommunityRating.Float64))) { fmt.Sprintf("%.1f / 10", book.CommunityRating.Float64) }
} if book.Series.Valid && book.Series.String != "" {
{ book.Series.String } if book.SeriesNumber.Valid && book.SeriesNumber.Int32 > 0 { #{ book.SeriesNumber.Int32 } }
} if book.ReadingDirection.Valid && book.ReadingDirection.String != "" && book.ReadingDirection.String != "auto" {
📖 { strings.ToUpper(book.ReadingDirection.String) }
}
if book.AgeRating.Valid && book.AgeRating.String != "" { { book.AgeRating.String } } if book.IsBlackAndWhite.Valid && book.IsBlackAndWhite.Bool { B&W } if book.StoryArc.Valid && book.StoryArc.String != "" { 📚 { book.StoryArc.String } }
if book.Description.Valid && book.Description.String != "" {

Synopsis

@UnsafeHTML( bluemonday.UGCPolicy().Sanitize(book.Description.String), ).ToComponent()
}
if book.Summary.Valid && book.Summary.String != "" && book.Summary.String != book.Description.String {

Comic Summary

@UnsafeHTML( bluemonday.UGCPolicy().Sanitize(book.Summary.String), ).ToComponent()
} if book.MetadataNotes.Valid && book.MetadataNotes.String != "" {

Metadata Notes

{ book.MetadataNotes.String }
} if book.ReadingProgress != nil {

Reading Progress

if book.ActiveConflict != nil {

⚠️ Progress conflict detected - Click "Sync Progress" to review and resolve

}

Progress

{ fmt.Sprintf("%.1f", book.ReadingProgress.Percentage.Float64 * 100) }%

if book.ReadingProgress.CurrentPage.Valid && book.ReadingProgress.TotalPages.Valid {

Page

{ book.ReadingProgress.CurrentPage.Int32 } / { book.ReadingProgress.TotalPages.Int32 }

} if book.ReadingProgress.LastReadAt.Valid {

Last Read

{ templates.FormatTimestamptzInTimezone(book.ReadingProgress.LastReadAt, user.Timezone) }

} if book.ReadingProgress.LastSyncSource.Valid {

Source

{ book.ReadingProgress.LastSyncSource.String }

}
}

Metadata

if book.Publisher.Valid && book.Publisher.String != "" {

Publisher

{ book.Publisher.String }

} if book.DatePublished.Valid {

Published

{ book.DatePublished.Time.Format("01-02-2006") }

} if book.Isbn.Valid && book.Isbn.String != "" {

Isbn

{ book.Isbn.String }

} if book.Language.Valid && book.Language.String != "" {

Language

{ book.Language.String }

} if book.Edition.Valid && book.Edition.String != "" {

Edition

{ book.Edition.String }

} if book.PageCount.Valid && book.PageCount.Int32 > 0 {

Pages

{ book.PageCount.Int32 }

} if book.Genre.Valid && book.Genre.String != "" {

Genre

{ book.Genre.String }

} if book.SeriesCount.Valid && book.SeriesCount.Int32 > 0 {

Series Count

{ book.SeriesCount.Int32 } items

} if book.Volume.Valid && book.Volume.Int32 > 0 {

Volume

Vol. { book.Volume.Int32 }

} if book.Imprint.Valid && book.Imprint.String != "" {

Imprint

{ book.Imprint.String }

} if book.CopyrightYear.Valid && book.CopyrightYear.Int32 > 0 {

Copyright Year

{ book.CopyrightYear.Int32 }

} if book.MangaType.Valid && book.MangaType.String != "" && book.MangaType.String != "unknown" {

Manga Type

{ strings.ReplaceAll(book.MangaType.String, "_", " ") }

} if book.ScanInformation.Valid && book.ScanInformation.String != "" {

Scan Info

{ book.ScanInformation.String }

} if len(book.AlternateInfo) > 0 {

Alternate Series

{ string(book.AlternateInfo) }

} if altSeries := getAlternateSeries(book.AlternateInfo); altSeries != "" {

Alternate Series

{ altSeries }

}

Format

{ book.MimeType.String }

if book.FileSize.Valid && book.FileSize.Int64 > 0 {

File Size

{ formatFileSize(book.FileSize.Int64) }

}
if book.GoodreadsID.Valid || book.OpenlibraryID.Valid || book.GoogleBooksID.Valid || book.Asin.Valid || book.Isbn.Valid || book.WebUrl.Valid {

External Links

if book.GoodreadsID.Valid && book.GoodreadsID.String != "" { 📚 Goodreads } else { 📚 Goodreads } if book.OpenlibraryID.Valid && book.OpenlibraryID.String != "" { 📖 Open Library } else { 📖 Open Library } if book.GoogleBooksID.Valid && book.GoogleBooksID.String != "" { 🔍 Google Books } else { 🔍 Google Books } if book.Asin.Valid && book.Asin.String != "" { 🛒 Amazon } else if book.Isbn.Valid && book.Isbn.String != "" { 🛒 Amazon } if book.WebUrl.Valid && book.WebUrl.String != "" { 🔗 { getDomainName(book.WebUrl.String) } }
}
if len(book.Collections) > 0 {

Collections

for _, col := range book.Collections { { col.Icon.String } { col.Name } }
}
@ProgressSyncModal(book) @NotesHighlightsModal(book) @ErrorToast(errorMessage) }