From 6905257928c42c36813931edb4d35fc44be58951 Mon Sep 17 00:00:00 2001 From: mkelvers Date: Mon, 4 May 2026 19:57:12 +0200 Subject: [PATCH] style: refine anime details ui and formatting --- integrations/jikan/types.go | 16 +++++++++++++ templates/anime.gohtml | 48 ++++++++++++++++++------------------- 2 files changed, 39 insertions(+), 25 deletions(-) diff --git a/integrations/jikan/types.go b/integrations/jikan/types.go index f363163..9dc1226 100644 --- a/integrations/jikan/types.go +++ b/integrations/jikan/types.go @@ -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 } diff --git a/templates/anime.gohtml b/templates/anime.gohtml index 4181ca2..7ec2f7a 100644 --- a/templates/anime.gohtml +++ b/templates/anime.gohtml @@ -29,8 +29,8 @@
{{if $anime.Score}} -
- +
+ {{$anime.Score}}
{{end}} @@ -38,15 +38,15 @@ {{if $anime.Episodes}}{{$anime.Episodes}} episodes{{end}} {{if $anime.Status}}{{$anime.Status}}{{end}} {{if $anime.Season}}{{$anime.Premiered}}{{end}} - {{if $anime.ShortRating}}{{$anime.ShortRating}}{{end}} + {{if $anime.ShortRating}}{{$anime.ShortRating}}{{end}}
{{template "watchlist_actions" dict "Anime" $anime "User" .User "Status" .Status}} -
+
-

Synopsis

+

Synopsis

{{if $anime.Synopsis}}{{$anime.Synopsis}}{{else}}No synopsis available.{{end}}

@@ -70,16 +70,16 @@ {{if $anime.Genres}}
{{range $anime.Genres}} - {{.Name}} + {{.Name}} {{end}}
{{end}}
-