diff --git a/web/components/anime_card.templ b/web/components/anime_card.templ index 786e930..14e12c2 100644 --- a/web/components/anime_card.templ +++ b/web/components/anime_card.templ @@ -13,28 +13,34 @@ type AnimeCardProps struct { TitleClass string // override default title class HideTitle bool // if true, do not render the default title block CurrentNode bool // if true, renders a div instead of an anchor tag (useful for graph nodes) + Synopsis string // optional synopsis for hover detail + Score int // optional score for hover detail + PlayHref string // optional play button href (anchored to poster) } templ AnimeCard(props AnimeCardProps) { if props.CurrentNode { -
- @animeCardPoster(props.ImageURL, props.Title, props.ImgClass) -
- { props.Title } -
- { children... } -
- } else { - - @animeCardPoster(props.ImageURL, props.Title, props.ImgClass) - +
+ @animeCardPoster(props) if !props.HideTitle {
{ props.Title }
} { children... } -
+
+ } else { +
+ @animeCardPoster(props) + + if !props.HideTitle { +
+ { props.Title } +
+ } + { children... } +
+
} } @@ -46,12 +52,43 @@ func cardHref(props AnimeCardProps) string { return fmt.Sprintf("/anime/%d", props.ID) } -templ animeCardPoster(imageURL, title, imgClass string) { -
- if imageURL != "" { - { - } else { -
No image
+templ animeCardPoster(props AnimeCardProps) { +
+ + if props.ImageURL != "" { + { + } else { +
No image
+ } +
+
+ if props.Synopsis != "" || props.Score > 0 { +
+
+ if props.Score > 0 { +
+ + + + { fmt.Sprintf("%d", props.Score) } +
+ } + if props.Synopsis != "" { +

{ props.Synopsis }

+ } +
+
+ } + if props.PlayHref != "" { + + + + + }
} diff --git a/web/components/anime_list.templ b/web/components/anime_list.templ index d3448c6..ee29581 100644 --- a/web/components/anime_list.templ +++ b/web/components/anime_list.templ @@ -34,5 +34,8 @@ templ CatalogItem(anime jikan.Anime) { ID: anime.MalID, Title: anime.DisplayTitle(), ImageURL: anime.ImageURL(), + Synopsis: anime.Synopsis, + Score: int(anime.Score * 10), + PlayHref: fmt.Sprintf("/watch/%d/1", anime.MalID), }) }