package templates import "mal/internal/jikan" import "fmt" import "strings" templ AnimeDetails(anime jikan.Anime, currentStatus string) { @Layout("mal - " + anime.DisplayTitle()) {
if anime.ImageURL() != "" { { } else {
no image
}

{ anime.DisplayTitle() }

if anime.TitleJapanese != "" {

{ anime.TitleJapanese }

}
if anime.ShortRating() != "" { { anime.ShortRating() } } if anime.Type != "" { { anime.Type } } if anime.Episodes > 0 { { fmt.Sprintf("%d ep", anime.Episodes) } } if anime.ShortDuration() != "" { { anime.ShortDuration() } }
@WatchlistDropdown(anime.MalID, anime.Title, anime.TitleEnglish, anime.TitleJapanese, anime.ImageURL(), currentStatus, anime.Airing)

synopsis

if anime.Synopsis != "" {

{ anime.Synopsis }

} else {

no synopsis available.

}
loading relations
loading recommendations
} } func joinNames(entities []jikan.NamedEntity) string { names := make([]string, len(entities)) for i, e := range entities { names[i] = e.Name } return strings.Join(names, ", ") } templ WatchlistDropdown(animeID int, animeTitle string, animeTitleEnglish string, animeTitleJapanese string, animeImage string, currentStatus string, airing bool) { } templ dropdownStatusOption(animeID int, animeTitle string, animeTitleEnglish string, animeTitleJapanese string, animeImage string, status string, currentStatus string, airing bool) { } templ statusOption(anime jikan.Anime, status string, currentStatus string) { } func formatStatus(status string) string { switch status { case "watching": return "watching" case "completed": return "completed" case "on_hold": return "on hold" case "dropped": return "dropped" case "plan_to_watch": return "plan to watch" default: return status } } templ AnimeRelationsList(relations []jikan.RelationEntry) { if len(relations) > 1 {

related

for _, rel := range relations { if rel.IsCurrent {
if rel.Anime.ImageURL() != "" { { } else {
no image
}
{ rel.Anime.DisplayTitle() }
} else { if rel.Anime.ImageURL() != "" { { } else {
no image
}
{ rel.Anime.DisplayTitle() }
} }
} } templ AnimeRecommendations(recs []jikan.Anime) { if len(recs) > 0 {

recommendations

for _, anime := range recs { if anime.ImageURL() != "" { { } else {
no image
}
{ anime.DisplayTitle() }
}
} }