fix: calculate actual progress percentage for continue watching
This commit is contained in:
@@ -21,10 +21,9 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{if .CurrentTimeSeconds}}
|
||||
<!-- Progress calculation would go here if total duration was available -->
|
||||
{{if and .CurrentTimeSeconds .AnimeDurationSeconds.Valid}}
|
||||
<div class="bg-foreground-muted/60 absolute bottom-0 left-0 h-1.5 w-full z-20">
|
||||
<div class="shadow-background/20 bg-accent h-full shadow-[0_-2px_5px_0]" style="width: 50%"></div>
|
||||
<div class="shadow-background/20 bg-accent h-full shadow-[0_-2px_5px_0]" style="width: {{percent .CurrentTimeSeconds .AnimeDurationSeconds.Float64}}%"></div>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
@@ -62,6 +62,21 @@ func GetRenderer() *Renderer {
|
||||
"sub": func(a, b int) int {
|
||||
return a - b
|
||||
},
|
||||
"mul": func(a, b float64) float64 {
|
||||
return a * b
|
||||
},
|
||||
"div": func(a, b float64) float64 {
|
||||
if b == 0 {
|
||||
return 0
|
||||
}
|
||||
return a / b
|
||||
},
|
||||
"percent": func(current, total float64) float64 {
|
||||
if total == 0 {
|
||||
return 0
|
||||
}
|
||||
return (current / total) * 100
|
||||
},
|
||||
}
|
||||
|
||||
pages, err := filepath.Glob(filepath.Join(".", "templates", "*.gohtml"))
|
||||
|
||||
Reference in New Issue
Block a user