feat(audio-player): Resume Rewind select in the settings popover
Release / build-and-push (push) Successful in 4m43s

The player window could only change Skip and Speed; resume rewind
lived exclusively on the profile page. The user-facing settings now
match Speed's precedent — changeable from the player, saved to the
account, applied immediately.

The select mirrors the default-speed row (CSP-safe @change bound to
one Alpine method; templ emits the option list from the shared
ResumeRewindOptions allow-list and the :selected expression against
the live resumeRewind field). Applying updates the running player's
value first — the next open/unpause uses it with no reload — then
PUTs audio_resume_rewind_seconds to the profile endpoint as the
string wire shape the server binds. normalizeResumeRewind gates the
select's value through 0/5/10 before both steps.
This commit is contained in:
John O'Keefe committed 2026-11-01 21:29:19 -05:00
1 parent ef827a3a05
commit fbdd4ab9f9
4 files changed
+142 -40

No files matched your search

+13
View File
@@ -1,6 +1,7 @@
package templates
import (
"fmt"
"time"
"github.com/a-h/templ"
@@ -35,6 +36,18 @@ type User struct {
// server-side mirror of the web player's SPEEDS list (plan §5/§8).
var SpeedOptions = []float64{0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 2.5, 3}
// ResumeRewindOptions mirrors the server's strict allow-list for
// audio_resume_rewind_seconds (0 = exact resume). Shared by the
// profile form and the audio player's settings popover.
var ResumeRewindOptions = []int{0, 5, 10}
func ResumeRewindLabel(seconds int) string {
if seconds == 0 {
return "Off"
}
return fmt.Sprintf("%d s before", seconds)
}
type PageData struct {
User User
CurrentPage string