fix(ui): round progress percentage to 2 decimals on progress page

The large percentage badge displayed the raw float value unformatted
(e.g. 1.523456789%). Now uses %.2f for a clean display (e.g. 1.52%).
This commit is contained in:
2026-08-06 13:25:54 -04:00
parent 4716790564
commit 0a0caa9533
2 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -60,7 +60,7 @@ templ Progress(user User, progressData []handlers.ProgressWithMedia, errorMessag
<p class="text-sm mt-0.5" style="color: var(--text-secondary)">by { item.Author }</p>
}
</div>
<span class="text-2xl font-bold shrink-0" style="color: var(--accent)">{ item.ProgressPercentage }%</span>
<span class="text-2xl font-bold shrink-0" style="color: var(--accent)">{ fmt.Sprintf("%.2f", item.ProgressPercentage) }%</span>
</div>
<div class="mb-4">
<div class="w-full rounded-full h-2.5" style="background-color: color-mix(in srgb, var(--text-primary) 12%, transparent);">
@@ -75,7 +75,7 @@ templ Progress(user User, progressData []handlers.ProgressWithMedia, errorMessag
if item.EstimatedPages > 0 {
{ fmt.Sprintf("Page %d of %d (est.)", item.CurrentPage, item.EstimatedPages) }
} else {
{ fmt.Sprintf("%.1f%%", item.ProgressPercentage) }
{ fmt.Sprintf("%.2f%%", item.ProgressPercentage) }
}
} else {
{ fmt.Sprintf("%d / %d", item.CurrentPage, item.TotalPages) }
+3 -3
View File
@@ -134,9 +134,9 @@ func Progress(user User, progressData []handlers.ProgressWithMedia, errorMessage
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var6 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(item.ProgressPercentage)
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%.2f", item.ProgressPercentage))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/progress.templ`, Line: 63, Col: 106}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/progress.templ`, Line: 63, Col: 127}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
if templ_7745c5c3_Err != nil {
@@ -172,7 +172,7 @@ func Progress(user User, progressData []handlers.ProgressWithMedia, errorMessage
}
} else {
var templ_7745c5c3_Var9 string
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%.1f%%", item.ProgressPercentage))
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%.2f%%", item.ProgressPercentage))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/progress.templ`, Line: 78, Col: 62}
}