Yōten: A social tracker for your language learning journey built on the atproto.

feat(views/stats): update duration numbers to be more human readable

Signed-off-by: brookjeynes <me@brookjeynes.dev>

authored by brookjeynes.dev and committed by

Tangled 2de6115f ca55bfc4

+8 -9
+8 -9
internal/server/views/partials/horizonal-bar-chart.templ
··· 11 11 <div class="flex flex-col gap-3 px-6"> 12 12 for _, item := range params.Data { 13 13 {{ 14 - widthPercentage := 0.0 15 - if item.MaxValue > 0 { 16 - widthPercentage = (item.Value.Seconds() / item.MaxValue.Seconds()) * 100 17 - } 14 + widthPercentage := 0.0 15 + if item.MaxValue > 0 { 16 + widthPercentage = (item.Value.Seconds() / item.MaxValue.Seconds()) * 100 17 + } 18 18 }} 19 19 <div class="flex items-center gap-2 text-sm"> 20 20 <span title={ item.Label } class="w-28 truncate text-right">{ item.Label }</span> 21 21 <div class="flex-grow bg-gray-light rounded-md h-6"> 22 - <div 23 - class="bg-primary h-6 rounded-md" 24 - style={ fmt.Sprintf("width: %.2f%%", widthPercentage) } 25 - ></div> 22 + <div class="bg-primary h-6 rounded-md" style={ fmt.Sprintf("width: %.2f%%", widthPercentage) }></div> 26 23 </div> 27 - <span class="w-12 font-medium text-text-muted">{ item.Value }</span> 24 + <span title={ item.Value } class="w-12 font-medium text-text-muted text-nowrap"> 25 + { FormatDuration(item.Value) } 26 + </span> 28 27 </div> 29 28 } 30 29 </div>