diff --git a/web/components/anime_card.templ b/web/components/anime_card.templ index eaffc0a..734ef06 100644 --- a/web/components/anime_card.templ +++ b/web/components/anime_card.templ @@ -20,58 +20,28 @@ type AnimeCardProps struct { Synopsis string // optional synopsis for hover detail PlayHref string // optional play button href (anchored to poster) // Watchlist integration - TitleEnglish string - TitleJapanese string - Airing bool - WatchlistStatus string // empty if not in watchlist - DisableWatchlist bool // if true, don't render the watchlist button + TitleEnglish string + TitleJapanese string + Airing bool + WatchlistStatus string // empty if not in watchlist + DisableWatchlist bool // if true, don't render the watchlist button } templ AnimeCard(props AnimeCardProps) { -
- if props.CurrentNode { - @animeCardPoster(props) - if !props.HideTitle { +
+ @animeCardPoster(props) + if !props.HideTitle { + if props.CurrentNode {
{ props.Title }
- } - } else { - - @animeCardPoster(props) - if !props.HideTitle { + } else { +
{ props.Title }
- } -
- } - if props.PlayHref != "" || !props.CurrentNode && !props.DisableWatchlist { -
- if props.PlayHref != "" { - - - Play - - - - } - if !props.CurrentNode && !props.DisableWatchlist { - @watchlist.CardButton( - props.ID, - props.Title, - props.TitleEnglish, - props.TitleJapanese, - props.ImageURL, - props.Airing, - props.WatchlistStatus != "", - ) - } -
+ + } } { children... }
@@ -81,31 +51,73 @@ func cardHref(props AnimeCardProps) string { if props.Href != "" { return props.Href } - return fmt.Sprintf("/anime/%d", props.ID) } templ animeCardPoster(props AnimeCardProps) { -
-
- if props.ImageURL != "" { - { - } else { -
No image
- } -
-
+
+ + if !props.CurrentNode { + + @animeCardImage(props) + + } else { +
+ @animeCardImage(props) +
+ } + +
+ if props.Synopsis != "" { -
+
{ props.Title }

{ props.Synopsis }

} + + if props.PlayHref != "" || !props.CurrentNode && !props.DisableWatchlist { +
+
+ if props.PlayHref != "" { + + + Play + + + + } + if !props.CurrentNode && !props.DisableWatchlist { + @watchlist.CardButton( + props.ID, + props.Title, + props.TitleEnglish, + props.TitleJapanese, + props.ImageURL, + props.Airing, + props.WatchlistStatus != "", + ) + } +
+
+ }
} +templ animeCardImage(props AnimeCardProps) { + if props.ImageURL != "" { + { + } else { +
No image
+ } +} + func defaultString(val, fallback string) string { if val == "" { return fallback