style: refine anime details ui and formatting

This commit is contained in:
2026-05-04 19:57:12 +02:00
parent ad171ed7c4
commit 6905257928
2 changed files with 39 additions and 25 deletions

View File

@@ -84,6 +84,22 @@ type Anime struct {
} `json:"external"`
}
func (a Anime) ScoredByFormatted() string {
if a.ScoredBy == 0 {
return ""
}
s := fmt.Sprintf("%d", a.ScoredBy)
var res []string
for i := len(s); i > 0; i -= 3 {
start := i - 3
if start < 0 {
start = 0
}
res = append([]string{s[start:i]}, res...)
}
return strings.Join(res, " ")
}
func (a Anime) ImageURL() string {
return a.Images.Webp.LargeImageURL
}