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.

Focus mode: set dots shrink before they wrap, so four sets stay on one row at 320px (#655)

Duarte Santos41f3b5cdc3ad
diff --git a/frontend/src/views/FocusView.css b/frontend/src/views/FocusView.css
index 56fed9135..e4824fe6b 100644
--- a/frontend/src/views/FocusView.css
+++ b/frontend/src/views/FocusView.css
@@ -42,9 +42,12 @@
.focus-pager{display:grid;grid-template-columns:44px minmax(0,1fr) 44px;align-items:center;gap:8px}
.focus-pager>button{display:grid;place-items:center;width:44px;height:44px;border:1px solid var(--sep);border-radius:50%;color:var(--label)}
.focus-pager>button:disabled{opacity:.3}
-/* Many sets (a superset with warm-ups is easily nine) squeeze the dots, then wrap. */
+/* Many sets (a superset with warm-ups is easily nine) squeeze the dots, then wrap. A wrapping
+ row breaks at each item's basis before anything shrinks, so the basis is the 24px floor and
+ the dots grow back to 44px where there is room: with a 44px basis four sets already took two
+ rows on a 320px phone, and nine took three. */
.focus-dots{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:4px}
-.focus-dots button{position:relative;flex:0 1 44px;min-width:24px;height:44px}
+.focus-dots button{position:relative;flex:1 1 24px;min-width:24px;max-width:44px;height:44px}
.focus-dots button::after{content:'';position:absolute;left:50%;top:50%;width:6px;height:6px;border-radius:50%;background:var(--label-3);transform:translate(-50%,-50%)}
.focus-dots button.active::after{width:9px;height:9px;background:var(--acc)}
.focus-dots button.done::after{box-shadow:0 0 0 2px var(--acc-line)}
diff --git a/frontend/src/views/FocusView.layout.test.js b/frontend/src/views/FocusView.layout.test.js
index 14475cb26..fe6ffd1ee 100644
--- a/frontend/src/views/FocusView.layout.test.js
+++ b/frontend/src/views/FocusView.layout.test.js
@@ -18,7 +18,10 @@ describe('Focus mode stays on the screen (#655)', () => {
it('squeezes and then wraps the set dots', () => {
expect(rule('.focus-dots')).toMatch(/flex-wrap:wrap/)
const dot = rule('.focus-dots button')
- expect(dot).toMatch(/flex:0 1 44px/)
+ // a wrapping row breaks at the basis, before anything shrinks: the basis is the floor, and the
+ // dots grow back to 44px (in Chrome at 320px a 44px basis put four sets on two rows)
+ expect(dot).toMatch(/flex:1 1 24px/)
+ expect(dot).toMatch(/max-width:44px/)
expect(dot).not.toMatch(/(^|;)width:44px/)
})