Skip to content

Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.

Routine editor: the exercise list stays one column on a computer, so a dragged exercise lands where it is dropped (#277)

Duarte Santosd685e3992919
diff --git a/frontend/src/index.css b/frontend/src/index.css
index 297f550bc..9fdd2ebe3 100644
--- a/frontend/src/index.css
+++ b/frontend/src/index.css
@@ -455,6 +455,12 @@ h4.sec{
}
.item:active{background:var(--surface-2)}
.routine-list{position:relative}
+/* One column at every width (#277). The desktop layout puts every #app list in two columns, and
+ the `.narrow .list` rule meant to undo that on the narrow pages loses to it on specificity. So
+ on a computer this list sat in a grid, while the reorder measures its rows top to bottom and
+ draws the drop line across the whole list: an exercise dragged just below the next one in its
+ column landed at the end. Supersets ("the exercise above") read as a column too. */
+#app .list.routine-list{display:flex;flex-direction:column}
.routine-drag-row{touch-action:pan-y;-webkit-touch-callout:none;position:relative;transition:transform var(--fast) var(--ease)}
.routine-list.is-reordering{user-select:none;-webkit-user-select:none}
.routine-list.is-reordering .routine-drag-row{transition:none}
diff --git a/frontend/src/views/RoutineEdit.grip.test.jsx b/frontend/src/views/RoutineEdit.grip.test.jsx
index 77b0c3c05..9c21a1fdd 100644
--- a/frontend/src/views/RoutineEdit.grip.test.jsx
+++ b/frontend/src/views/RoutineEdit.grip.test.jsx
@@ -100,6 +100,12 @@ describe('routine drag handle', () => {
expect(cssSource).toMatch(/\.routine-list\.is-reordering,\.routine-list\.is-reordering \*\{cursor:grabbing\}/)
})
+ it('keeps the list one column on a computer, where #app lists otherwise go two-up', () => {
+ // The reorder reads rows top to bottom; in two columns a drop landed in the wrong place.
+ expect(cssSource).toMatch(/@media \(min-width:1000px\)\{[\s\S]*#app \.list\{display:grid/)
+ expect(cssSource).toMatch(/#app \.list\.routine-list\{display:flex;flex-direction:column\}/)
+ })
+
it('picks the row up at once under a mouse and drops it where it is let go', () => {
const layout = mount([configured('a'), configured('b'), configured('c'), configured('d')])
const down = pointer(grip(0), 'pointerdown', { kind: 'mouse', y: layout.centers[0] })