feat(ui): persist user settings and audio position across sessions

- Replace double inline player controls with compact 'now playing' indicator when mini-bar is active
- Add user_settings PocketBase collection (auto_next, voice, speed) and audio_time field on progress
- Add getSettings/saveSettings/setAudioTime/getAudioTime server functions
- Add GET/PUT /api/settings and GET/PATCH /api/progress/audio-time API routes
- Load settings server-side in layout and apply to audioStore on mount
- Debounced 800ms effect persists settings changes to DB
- Save audio currentTime on pause/end; restore position when replaying a chapter
This commit is contained in:
Admin
2026-03-04 16:21:17 +05:00
parent b87e758303
commit 82186cfd6d
7 changed files with 363 additions and 57 deletions

View File

@@ -181,9 +181,24 @@ create_collection "app_users" '{
]
}'
create_collection "user_settings" '{
"name": "user_settings",
"type": "base",
"fields": [
{"name": "session_id", "type": "text", "required": true},
{"name": "user_id", "type": "text"},
{"name": "auto_next", "type": "bool"},
{"name": "voice", "type": "text"},
{"name": "speed", "type": "number"},
{"name": "updated", "type": "date"}
]
}'
# ─── 5. Schema migrations (idempotent field additions) ───────────────────────
# Ensures fields added after initial deploy are present in existing instances.
ensure_field "progress" "user_id" "text"
ensure_field "progress" "audio_time" "number"
ensure_field "user_settings" "user_id" "text"
log "all collections ready"