fitness: add exercise reorder buttons in template editor and active workout

This commit is contained in:
2026-03-21 16:46:25 +01:00
parent 7534b8151f
commit 6f3512d7cf
3 changed files with 88 additions and 12 deletions
+9
View File
@@ -276,6 +276,14 @@ export function createWorkout() {
_persist();
}
function moveExercise(index: number, direction: number) {
const newIndex = index + direction;
if (newIndex < 0 || newIndex >= exercises.length) return;
const [item] = exercises.splice(index, 1);
exercises.splice(newIndex, 0, item);
_persist();
}
function addSet(exerciseIndex: number) {
const ex = exercises[exerciseIndex];
if (ex) {
@@ -487,6 +495,7 @@ export function createWorkout() {
resumeTimer,
addExercise,
removeExercise,
moveExercise,
addSet,
removeSet,
updateSet,