curated2: review fixes — touch drag (!45), deload seeds (!28), rep-range typing (!69), rebuilt rows on config change (!54), swap keeps history (!43), Hevy retry/dedup/aliases (!30), HTTPS doc (!67), locale gaps

This commit is contained in:
Duarte Santos committed 2026-08-30 14:18:09 +02:00
1 parent 148ef9fbbb
commit cc878dd353
26 files changed
+230 -64

No files matched your search

+8
View File
@@ -251,7 +251,14 @@ function useRoutineReorder(routineIdentity, exercises, onDrop) {
const onContextMenu = event => { if (gestureRef.current?.active && event.target.closest?.('[data-routine-row]')) event.preventDefault() }
const onDragStart = event => { if (event.target.closest?.('[data-routine-row]')) event.preventDefault() }
// Touch: the rows keep `touch-action: pan-y` so the list still scrolls with a finger, but once
// a long-press has lifted a row the browser must not claim the vertical drag as a pan — it
// would fire pointercancel and scroll instead. preventDefault on a pointer event cannot stop
// that; only a non-passive touchmove listener can, and only while a drag is actually active.
const onTouchMove = event => { if (gestureRef.current?.active) event.preventDefault() }
document.addEventListener('pointerdown', onPointerDown)
document.addEventListener('touchmove', onTouchMove, { passive: false })
document.addEventListener('pointermove', onPointerMove, { passive: false })
document.addEventListener('pointerup', onPointerUp, { passive: false })
document.addEventListener('pointercancel', onPointerCancel)
@@ -266,6 +273,7 @@ function useRoutineReorder(routineIdentity, exercises, onDrop) {
clearTimer(gesture); clearFrame(); gestureRef.current = null
releaseCapture(gesture)
document.removeEventListener('pointerdown', onPointerDown)
document.removeEventListener('touchmove', onTouchMove)
document.removeEventListener('pointermove', onPointerMove)
document.removeEventListener('pointerup', onPointerUp)
document.removeEventListener('pointercancel', onPointerCancel)
+12 -1
View File
@@ -444,10 +444,21 @@ function ActiveWorkout() {
if (!activeEntry) return
const full = { ...cfg, id: activeEntry.id }
const activeRoutine = s.routines.find(r => r.id === s.active.routineId)
const step = defaultIncrement(activeEntry.id, s.unit)
// A config without a set count keeps the rows the session already has.
if (!(full.sets > 0)) full.sets = activeEntry.sets.filter(x => !isWarmupRow(x)).length || 1
const plan = nextPrescription(s, full, activeRoutine)
// The sheet edits sets, reps, weight and warm-ups as well as the rule — so the rows are
// rebuilt from the new config the way the session was, and only what you already logged
// is kept in place (done warm-ups first, then done work sets, then the fresh remainder).
const fresh = applyIntensifierPlan(applyPrescription(buildSets(s, full, { step }), plan, step), full)
const doneWarm = activeEntry.sets.filter(x => x.done && isWarmupRow(x))
const doneWork = activeEntry.sets.filter(x => x.done && !isWarmupRow(x))
const freshWarm = fresh.filter(isWarmupRow)
const freshWork = fresh.filter(x => !isWarmupRow(x))
activeEntry.target = { ...cfg }
activeEntry.plan = plan
activeEntry.sets = applyPrescription(activeEntry.sets, plan, defaultIncrement(activeEntry.id, s.unit))
activeEntry.sets = [...doneWarm, ...freshWarm.slice(doneWarm.length), ...doneWork, ...freshWork.slice(doneWork.length)]
}), null, routine)
}