From 14afd86b8e77bc0c2d16c3d58f6d323d964a6894 Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Fri, 27 Nov 2026 03:06:36 -0500 Subject: [PATCH] refactor(web): the play bar and Now Playing share one set of transport rules (DRY W1) PlayerBar and the Now Playing page each carried their own copy of when Previous and Next are enabled, the repeat label, the volume icon and the range-input handlers, and the 3-second "restart rather than go back" threshold was written in both and again in store.skipPrev. lib/player/controls.ts now holds them once (canSkipPrev, canSkipNext, repeatLabel, volumeIcon, inputNumber, RESTART_THRESHOLD_SEC), and the store reads its threshold from there. Behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 --- web/src/lib/components/PlayerBar.svelte | 34 +++++++----------------- web/src/lib/player/controls.test.ts | 24 +++++++++++++++++ web/src/lib/player/controls.ts | 35 +++++++++++++++++++++++++ web/src/lib/player/store.svelte.ts | 3 ++- web/src/routes/now-playing/+page.svelte | 32 ++++++---------------- 5 files changed, 78 insertions(+), 50 deletions(-) create mode 100644 web/src/lib/player/controls.test.ts create mode 100644 web/src/lib/player/controls.ts diff --git a/web/src/lib/components/PlayerBar.svelte b/web/src/lib/components/PlayerBar.svelte index 5e560470..f6ce995b 100644 --- a/web/src/lib/components/PlayerBar.svelte +++ b/web/src/lib/components/PlayerBar.svelte @@ -1,8 +1,8 @@